Concepts

Variational autoencoders

4 min readadvancedUpdated 28 Sept 2026
1 · In one line

A variational autoencoder pairs a deep latent-variable model with a corresponding approximate inference model.

1 · What it is

A variational autoencoder pairs a deep latent-variable model with a corresponding approximate inference model. An approximate inference model is also called a recognition model. The posterior is approximate.

The approximate posterior has a mean and standard deviation. Compute z as mu plus sigma times epsilon. Reparameterization of the variational lower bound yields a lower-bound estimator.

Evaluate the decoding term. Combine reconstruction loss with KL loss. The standard example assumes Gaussian prior and approximate-posterior distributions.

2 · Why it exists

VAE training combines reconstruction loss with KL loss.

Uncertain codesAn approximate inference model is also called a recognition model.
Trainable samplesReparameterization computes z as mu plus sigma times epsilon.
Organized spaceA KL-divergence term encourages the approximate posterior to stay close to the prior.
3 · How it works

Follow one input through the VAE training path.

The reparameterized lower bound yields a lower-bound estimator.
  1. 1 · encodeProduce the mean and standard deviation of the approximate posterior.
  2. 2 · sampleCompute z as mu plus sigma times epsilon.
  3. 3 · decodeEvaluate the decoding term.
  4. 4 · scoreCombine reconstruction loss with KL loss.
  5. 5 · updateUse the resulting gradients with stochastic optimization methods.

The reparameterized sample computes z as mu plus sigma times epsilon.

4 · Where it's used
WhoWhat they askWhat it works with
Generative-modelling team“Can we sample new examples from a learned latent model?”Samples from a chosen latent prior
Imaging researcher“How does the decoded output change across a two-dimensional latent space?”A grid of latent coordinates
Missing-data team“Can a latent-variable model impute unobserved values?”Partially observed records
5 · What it solves, and what it doesn't
solves
  • A VAE trains an approximate inference model together with a generative model.
  • Reparameterization of the variational lower bound yields a lower-bound estimator.
  • A low-dimensional latent space can project high-dimensional data for visualization.
doesn't solve
  • The true posterior can remain intractable.
  • The posterior is approximate.
  • The standard example assumes Gaussian prior and approximate-posterior distributions.
6 · Go deeper

Sources used

This explainer is written in original language. The links below support its factual claims.

  1. paperAuto-Encoding Variational Bayes, Kingma and Welling · read 28 Sept 2026
  2. paperStochastic Backpropagation and Approximate Inference in Deep Generative Models, Rezende, Mohamed and Wierstra · read 28 Sept 2026
  3. docsVariational AutoEncoder, Keras · read 28 Sept 2026
  4. docsPyTorch Examples, PyTorch · read 28 Sept 2026
  5. paperAn Introduction to Variational Autoencoders, Kingma and Welling · read 28 Sept 2026