AI Glossary / Probabilistic machine learning / Advanced
Discrete variational autoencoder
Definition
A discrete variational autoencoder is a variational generative model that uses discrete latent variables, such as categorical choices or binary states, to help represent observations. An encoder approximates which latent states explain an input, and a decoder models observations from those states. Training requires methods appropriate to discrete choices rather than ordinary differentiation through a hard sample.
What it means
A continuous latent variable can vary smoothly, while a discrete one selects among separated alternatives. This can be useful when a representation should contain codes or structural choices. However, a learned code does not automatically correspond to a named class or a meaningful business category.
The term has both a broad descriptive use and a specific research history. Rolfe's Discrete Variational Autoencoders combines an undirected binary component with a hierarchy of continuous variables and a specialized smoothing construction. Other discrete-latent models use different methods. VQ-VAE is a related named architecture, not an interchangeable name for every discrete VAE.
How it works
The generative model specifies a prior over latent states and a conditional distribution for observations. Given an input, the inference network supplies an approximate posterior. In a basic variational formulation, the evidence lower bound balances expected reconstruction log-likelihood against a divergence between the approximate posterior and prior.
The training difficulty is that a categorical sample or hard code selection changes discontinuously. For small state spaces, expectations can sometimes be summed exactly. Other approaches use gradient estimators, continuous relaxations such as Gumbel-Softmax, or architecture-specific constructions. Their objectives and gradient properties must be checked separately.
After training, sampling from a suitable prior and decoding can generate observations. Reconstructing a supplied input instead uses information from the encoder. Good reconstructions alone do not establish that samples from the prior will be useful or diverse.
Three practical examples
1. An image-modeling experiment can explore whether discrete codes capture recurring visual structures. Researchers must inspect code use rather than assume codes correspond to objects or classes.
2. An audio researcher can study discrete representations as an intermediate layer in a larger generative system. The usefulness of the codes depends on the architecture and downstream evaluation.
3. A modeling team can compare discrete and continuous latent structures for data believed to contain distinct modes. The comparison should test reconstruction, generation, and stability rather than presuppose that a discrete structure is superior.
Think of it this way
Think of describing an item by choosing among several catalog patterns and then using the selected pattern to reconstruct a description. The choices can organize recurring structure. The analogy is limited because latent states are learned mathematical variables, may combine with continuous variation, and need not correspond to recognizable human categories.
Worked example
Consider an original one-observation toy model with a binary latent state z. The prior assigns 0.5 to each state. For a particular discrete observation x, the decoder assigns P(x given z=0)=0.9 and P(x given z=1)=0.1. The exact evidence is therefore 0.5 times 0.9 plus 0.5 times 0.1=0.5.
Suppose the encoder's approximate posterior is q(z=0 given x)=0.8 and q(z=1 given x)=0.2. Using natural logarithms, expected reconstruction log-likelihood is 0.8 log(0.9)+0.2 log(0.1), approximately -0.5448. The divergence from the prior is 0.8 log(0.8/0.5)+0.2 log(0.2/0.5), approximately 0.1927.
Subtracting gives an ELBO of approximately -0.7376. The exact log evidence is log(0.5), approximately -0.6931, so the bound is lower as expected. The gap is about 0.0444.
This tiny example can enumerate both states exactly and demonstrates the basic discrete variational objective. It does not implement Rolfe's hierarchy, a continuous relaxation, or vector quantization. Its numbers are invented and are not a trained encoder's class-confidence estimates. A larger model with many binary variables may make exact enumeration impractical.
Illustrative case study
Illustrative fictional case: Patternlake Research trains an experimental discrete-latent model for simple product silhouettes. Several codes become rarely used, and the team initially assumes that unused codes indicate missing product categories.
Review shows that code usage is a property of the learned representation and objective, not a labeled taxonomy. The team checks reconstruction, prior samples, and stability across runs before assigning any interpretation. This fictional case illustrates evaluation questions without reporting a real model or performance gain.
Common misconceptions and mistakes
Discrete latent variables do not mean the input or output must be discrete. A model can combine discrete and continuous variables in different layers.
A categorical posterior contains probabilities, while a sampled code is one selected state. These are different objects and should not be confused.
Backpropagation through a continuous relaxation is not automatically the exact gradient of the original hard-sampling objective. Estimator bias, variance, and temperature choices can matter.
Finally, discrete codes are not guaranteed to be interpretable or evenly used. Some models may ignore latent information or use a restricted portion of the available representation.
Business use
Businesses evaluating such models should begin with the purpose of the representation: generation, compression, clustering support, or another downstream task. Identify the exact architecture and training objective rather than relying on the generic label.
Check how codes are learned, how generation samples are obtained, and how unused or unstable codes are handled. Compare with a simpler continuous model when appropriate. Evaluate reconstruction and generation separately, and inspect whether any claimed categories correspond to external evidence. A compact code vocabulary is useful only if it preserves information relevant to the intended task and can be maintained consistently as data changes.
People also ask
Is a discrete VAE a classifier?
Not necessarily. It may learn latent states without class labels. Those states do not automatically match a supervised classification scheme.
Is Gumbel-Softmax mandatory?
No. It is one approach to differentiable relaxation of categorical sampling. Other estimators and architectures use different methods.
Is it identical to VQ-VAE?
No. VQ-VAE is a specific vector-quantized architecture. The broader phrase includes other models with discrete latent variables and different training constructions.
Check your understanding
Our toy model has log evidence -0.6931 and ELBO -0.7376. Does the more negative ELBO violate the lower-bound property?
Answer: No. -0.7376 is below -0.6931. The approximately 0.0444 gap reflects the approximate posterior in this constructed model.
Related terms
- Variational autoencoder
- Vector quantization
- Latent variable
- categorical distribution
- evidence lower bound
- Gumbel-Softmax
- posterior collapse
Learn next
Enumerate a two-state latent model and calculate its exact posterior and evidence. Compare the ELBO under two approximate posteriors. Then identify why the same enumeration becomes expensive when many binary latent variables are combined.
More in Probabilistic machine learning
- Differentiable cross-entropy method - The differentiable cross-entropy method, or DCEM, is a differentiable variant of a sampling-based optimization method.
- Dirichlet-multinomial model - A Dirichlet-multinomial model combines a Dirichlet distribution over category probabilities with a multinomial distribution over counts.
- Discrete denoising diffusion probabilistic model - A discrete denoising diffusion probabilistic model, often abbreviated D3PM, generates discrete data by learning to reverse a gradual categorical corruption...
- Distributionally robust optimization - Distributionally robust optimization (DRO) chooses a model or decision by minimizing its worst expected loss across a specified set of possible probability...
- Domain generalization - Domain generalization is the task of learning from available environments so that a model works well in a new environment whose data were not used to train...
- Double machine learning - Double machine learning (DML), also called double/debiased machine learning, is a framework for estimating a target statistical or causal parameter while...
Sources
Rolfe, Discrete Variational Autoencoders: https://arxiv.org/html/1609.02200
Jang, Gu, and Poole, Categorical Reparameterization with Gumbel-Softmax: https://arxiv.org/abs/1611.01144
Van den Oord, Vinyals, and Kavukcuoglu, Neural Discrete Representation Learning: https://arxiv.org/abs/1711.00937
Independent review checked Rolfe sections 1–2 and both related primary abstracts. Source-book release retrieval failed; broad scope and architecture distinctions are explicit. The binary calculation is original, not a reproduction of a named architecture.
Previous: Discrete variable Next: Discrete wavelet transform