VAE: Reparameterized variational inference for generative modeling
VAEs jointly train an approximate posterior encoder and generative decoder with the ELBO. Reparameterization z=mu+sigma*epsilon makes sampling differentiable and underpins continuous-latent generative modeling.
On this page
Variational autoencoders address intractable posteriors in directed latent-variable models by amortizing inference with a neural network and optimizing stochastic-gradient variational Bayes.
How it works
The encoder emits mean and variance, z=mu+sigma*epsilon is sampled, and the decoder scores reconstruction. KL from the approximate posterior to the prior regularizes the latent space; independent noise preserves gradients to mu and sigma.
What the evidence shows
MNIST and Frey Face experiments demonstrate scalable learning and generation. Reconstruction/KL balance affects sample sharpness, and the ELBO is a lower bound rather than exact likelihood.
A reproducible check
This snippet checks a public formula or configuration; it does not reproduce full training.
import math
mu, logvar = 0.4, math.log(0.25)
sigma = math.exp(0.5*logvar)
kl = 0.5*(math.exp(logvar)+mu**2-1-logvar)
print("sigma =", sigma)
print("standard normal KL =", kl)
print("sample with epsilon=2 =", mu+sigma*2)
sigma = 0.5
standard normal KL = 0.3981471805599453
sample with epsilon=2 = 1.4
The arithmetic is reproducible, but model quality still depends on the full experiments in the paper.
Limitations and common misreadings
Gaussian and decoder assumptions limit expressivity, and posterior collapse is a practical issue. Encoder outputs are approximate posteriors, while reconstruction alone does not measure generative coverage.
The key takeaway
VAEs connect variational inference, autoencoding and backpropagation in one scalable objective, with reparameterization as the crucial link.
Further reading
FAQ
- What does reparameterization solve?
- It expresses z as deterministic parameters plus independent noise, allowing gradients to reach the encoder.
- Which two terms form the ELBO?
- Expected reconstruction log-likelihood minus KL from approximate posterior to prior.
- Is the ELBO the exact log-likelihood?
- No. It is a lower bound whose gap involves posterior approximation error.