Variational Autoencoder (VAE)
The variational autoencoder (VAE) is a generative model proposed by Diederik Kingma and Max Welling in 2013; it constrains the latent space of an autoencoder to be a probability distribution, so that it can both compress representations and generate new samples from random sampling. It is one of the foundational works of deep generative models and, together with generative adversarial networks, one of the two main lines of modern generative modeling.
Core Principles
The VAE assumes that data are produced by a generative process from some low-dimensional latent variable z, and the goal is to maximize the marginal likelihood of the data, p(x) = integral p(x|z)p(z) dz. This integral is intractable in high dimensions, so the VAE introduces variational inference: it uses an encoder q(z|x) to approximate the true posterior and takes the evidence lower bound (ELBO) as the optimization objective. The ELBO decomposes into two terms: the reconstruction term, namely how well the decoder restores x given a sampled z; and the KL divergence term, which penalizes the approximate posterior for deviating from the prior p(z) (usually a standard normal distribution).
The KL term is the watershed between the VAE and an ordinary autoencoder: it makes the latent space continuous and regular, so that nearby latent vectors decode to nearby samples, and therefore random sampling from the prior also yields reasonable outputs, which is the source of the "generative" capability. It is also the root of the VAE's somewhat blurry outputs: excessive pursuit of a regular latent space necessarily sacrifices reconstruction detail.
The latent prior is usually taken as a standard normal, so a sample is encoded not as a point but as a mean and a variance, and sampling from it gives a continuous neighborhood around that sample. The key difficulty in training is that sampling is not differentiable. Kingma and Welling used the reparameterization trick: writing z = mu + sigma * epsilon as a deterministic function, where epsilon is sampled from a standard normal, moves the randomness onto a noise term independent of the parameters, so that gradients can pass through the sampling operation back to mu and sigma, allowing backpropagation to proceed. This trick was later widely borrowed by diffusion models and by continuous action policies in reinforcement learning.
Key Points
Trade-off with GANs: the VAE trains stably, has an explicit likelihood objective and an interpretable latent space, but its samples are somewhat blurry; the GAN generates sharp samples but is prone to mode collapse and unstable training. In practice hybrid schemes combining a VAE structure with adversarial loss are common.
beta-VAE: in 2017 Higgins and others proposed weighting the KL term with beta; increasing beta strengthens the disentanglement of the latent space so that a single dimension corresponds to a single semantic factor, but reconstruction quality drops, forming a clear trade-off curve.
VQ-VAE: in 2017 van den Oord and others replaced the continuous latent variable with a discrete codebook, avoiding posterior collapse and making the latent space suitable for autoregressive modeling; it became an important component of later image and audio generation (such as early versions of DALL-E and the latent-space encoder of Stable Diffusion).
Posterior collapse: when the decoder is too strong the network ignores z, the KL term quickly approaches zero, and the model degenerates into an ordinary autoencoder. Countermeasures include KL annealing, free bits and stronger constraints on the decoder.
Common Misconceptions
Misconception one: thinking the VAE can compute p(x) exactly. The ELBO is only a lower bound, the true likelihood remains unavailable, and the model optimizes the bound rather than the true value, so a gap exists between them. Misconception two: attributing the blurriness of VAE outputs solely to the loss function, whereas blurriness actually stems from both the Gaussian likelihood assumption and the KL regularization. Misconception three: thinking the VAE's latent variables are necessarily interpretable, whereas disentanglement requires additional regularization or architectural design.
Application Scenarios
Image and audio generation, drug and molecule design, single-cell gene expression analysis, collaborative filtering in recommendation systems, anomaly detection, data imputation and denoising, latent-space compression for diffusion models, timbre modeling for voice conversion, and representation learning and semi-supervised classification.