Autoencoders Needs review

Variational Autoencoder

VAE

Year of appearance
2013
Researchers
Diederik P. Kingma, Max Welling
Organisation
Universiteit van Amsterdam
Architecture type
Probabilistic encoder–decoder (latent variable model)
Learning mechanism
unsupervised
Tasks
Image generation, Representation learning, Dimensionality reduction

A probabilistic generative model that learns an encoder approximating the posterior q(z|x) and a decoder p(x|z), trained by maximising an evidence lower bound (ELBO) with the reparameterisation trick.

Architecture diagram

Displayed configuration: VAE on MNIST: hidden layer 500 and latent space J = 20 — An MLP encoder and decoder with one hidden layer each, as in the paper’s experiments.

Layer table (11 nodes)
LayerTypeInputOutputRepetitionParametersFormulaMACs
Flattened MNIST imageinput78410—
Encoder: FC 500 + tanhfc7845001392,500784·500 + 500392,000
μ: FC 20fc50020110,020500·20 + 2010,000
log σ²: FC 20fc50020110,020500·20 + 2010,000
ε ∼ N(0, I)noise2010—
z = μ + σ ⊙ εsampling20, 202010—
Decoder: FC 500 + tanhfc20500110,50020·500 + 50010,000
FC 784 + sigmoid (Bernoulli)fc5007841392,784500·784 + 784392,000
Reconstruction x̂output78478410—
Reconstruction term −log p(x|z)lossx, x̂L_rec10—
KL termlossμ, log σ²L_KL10—

Configuration figures: VAE on MNIST: hidden layer 500 and latent space J = 20

Parameters (computed from the layers)815,824 (≈815.82K)
Parameters (published in the source)Unspecified
MACs814,000 (≈814K)
FLOPs ≈ 2 × MACs1,628,000 (≈1.63M)
Input shape
784
Output shape
784 (+ z ∈ ℝ²⁰)
Depth
One hidden layer per network
Complexity
O(D·H + H·J).
MACs note
Per image and for a single sample L = 1 of z.
Calculation assumptions: The paper used 500 hidden units for MNIST and tried several latent dimensions; J = 20 is one of them. The activation is tanh and the decoder is Bernoulli.

MAC = a multiplication followed by an addition. The figures are for one forward pass of one sample with the stated dimensions; they are an analytical calculation, not a measurement of run time.

Scientific explanation

Historical background

Appeared on arXiv in December 2013 and was published at ICLR 2014 under the title “Auto-Encoding Variational Bayes”; the work of Rezende and colleagues appeared at the same time.

The problem it addresses

Variational inference in continuous latent-variable models with intractable posteriors, on large data.

Core idea

A network encoder that predicts μ and σ of a normal distribution, and sampling z = μ + σ⊙ε allows backpropagation through the sample.

Architecture description

An MLP encoder that outputs (μ, log σ²), a sampling layer, and an MLP decoder that outputs the parameters of p(x|z) (Bernoulli or Gaussian).

Data flow

x → encoder → (μ, log σ²) → z = μ + σε → decoder → x̂. For generation: z ∼ N(0, I) → decoder.

Inputs

Continuous or binary data (an image).

Outputs

A reconstruction, a latent distribution, and new samples.

Training procedure

SGVB/AEVB with batches of 100 and Adagrad, with a single sample L = 1 per data point.

Loss functions

Negative ELBO: reconstruction error + KL(q(z|x) ‖ N(0, I)).

Computational complexity

O(D·H + H·J) per sample.

Computational requirements

Low.

Advantages

  • A regular latent space that supports interpolation and generation
  • Stable training
  • A clear probabilistic framework

Limitations

  • Blurry samples compared with GAN and diffusion
  • Posterior collapse with powerful decoders
  • A lower bound, not the actual likelihood

Equations

Evidence lower bound Evidence lower bound (ELBO)

\mathcal{L}(\theta, \phi; \mathbf{x}) = \mathbb{E}_{q_\phi(\mathbf{z}\mid\mathbf{x})}\left[\log p_\theta(\mathbf{x} \mid \mathbf{z})\right] - D_{KL}\big(q_\phi(\mathbf{z}\mid\mathbf{x}) \,\Vert\, p(\mathbf{z})\big)

The reconstruction term minus the regularisation term; it is maximised during training.

Symbols: q_φ: encoder, p_θ: decoder

Reparameterisation trick Reparameterization trick

\mathbf{z} = \boldsymbol\mu + \boldsymbol\sigma \odot \boldsymbol\epsilon,\quad \boldsymbol\epsilon \sim \mathcal{N}(0, I)

Makes sampling differentiable with respect to μ and σ.

Symbols: ε: standard noise

KL divergence of two normal distributions KL divergence (Gaussian)

D_{KL}\big(\mathcal{N}(\boldsymbol\mu, \boldsymbol\sigma^2) \,\Vert\, \mathcal{N}(0, I)\big) = -\frac{1}{2} \sum_{j=1}^{J} \left(1 + \log \sigma_j^2 - \mu_j^2 - \sigma_j^2\right)

A closed form computed without sampling (Appendix B of the VAE paper).

Symbols: J: latent-space dimension

Applications

Related models

References

  1. Original paper Diederik P. Kingma, Max Welling. (2014). Auto-encoding variational Bayes. ICLR 2014. arXiv:1312.6114 Verified
Scientific review note: A first scientific draft based on the original paper and reference implementations; it needs review by a specialist before final approval.

Version 1 — last updated 2026-11-15.