# 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.

- URL: https://dmxsf.com/en/blog/auto-encoding-variational-bayes/
- [DMXSF](https://dmxsf.com/en/about/)
- Published: 2013-12-30
- Updated: 2026-11-13
- Paper notes
- Paper: [Auto-Encoding Variational Bayes](https://arxiv.org/abs/1312.6114) (Diederik P Kingma, Max Welling · ICLR 2014, 2013)

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.

```python
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)
```

```text
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

- [Auto-Encoding Variational Bayes](https://arxiv.org/abs/1312.6114)
- [GAN](https://dmxsf.com/en/blog/generative-adversarial-nets/)
- [DDPM](https://dmxsf.com/en/blog/ddpm-denoising-diffusion-probabilistic-models/)

## 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.
