Image & Generative Models
VAE (Variational Autoencoder)
Encode to a latent space, sample, then decode.

A VAE (Variational Autoencoder) is a generative model that learns a compressed representation of data and can generate new, similar data by sampling from that space. An encoder maps input into a probability distribution, and a decoder reconstructs data from samples of it.
In simple terms
Encode data into a simple latent space, then decode — and create new data by sampling that space.
How it works
- 1Input: data is provided to the model.
- 2Encoder: maps the input to a latent distribution.
- 3Latent space: the distribution is described by a mean (μ) and variance (σ²); you sample a point from it.
- 4Decoder: reconstructs data from the sampled latent point.
- 5Output: reconstructed or brand-new data.
Key points
- The latent space is a probability distribution, which makes sampling smooth.
- Training minimises reconstruction loss plus a regularisation loss.
- Used for image generation, denoising, anomaly detection and data compression.
- Latent space exploration lets you interpolate smoothly between samples.
Why it matters
VAEs gave a principled way to both compress data and generate new samples, and their latent-space idea underpins many later models — including the latent space used inside modern diffusion models.
Frequently asked questions
- How is a VAE different from a plain autoencoder?
- A VAE encodes to a probability distribution (not a single point), so you can sample it to generate new, varied data.
- What is the latent space?
- A compact numeric space where each point represents a version of the data; nearby points produce similar outputs.