FoundationsChecking saved investigationReading browser-local route memory before showing a continuation.

Foundation Lab

Variational Autoencoders & Variational Inference

Stable Diffusion is a latent diffusion model: an autoencoder maps images ↔ compressed latent space where diffusion operates

Concept 7 of 100Generative ModelsPhase 4
#7VAEsGenerative Models
key equation\log p_\theta(x) \ge \mathbb E_{q_\phi}[\log p_\theta(x\mid z)] - \mathrm{KL}(q_\phi\,\|\,p(z))

Selected Foundation Object

Keep the equation fixed; move through the evidence.

Concept 7 of 100VAEsGenerative Models / Phase 4: Generative modeling families
Current question

Intuitive grasp of why ELBO works as both reconstruction + regularization

\log p_\theta(x) \ge \mathbb E_{q_\phi}[\log p_\theta(x\mid z)] - \mathrm{KL}(q_\phi\,\|\,p(z))
PredictionCommit before the demo.

Ask what should change when the equation is manipulated, then let the visualization test that expectation.

EvidenceCompare local witness and source.

Use the runnable panel, the key equation, and canonical papers as separate forms of evidence for the same object.

InvariantName what survives notation changes.

The useful learning product is the reusable mechanism you can carry into another model, paper, or engineering tradeoff.

Next moveContinue in the newer notebook.

This atlas page keeps the working demo; the domain notebook carries the fuller Intuition -> Math -> Code -> Demo sequence.

Why It Matters for Modern Models

  • Stable Diffusion is a latent diffusion model: an autoencoder maps images ↔ compressed latent space where diffusion operates
  • VAEs underpin many multimodal encoders (audio, video latents) used as building blocks

What Tutorials Skip

What is still poorly explained in textbooks and papers:

  • Intuitive grasp of why ELBO works as both reconstruction + regularization
  • Visualizations of how the prior p(z) and posterior families affect sample quality/diversity

Interactive Visualization

Core Math (Optional Deep Dive)

If you want intuition first, start with the key equation and the visualization. Come back here for the full walkthrough.

Key Equation
logpθ(x)Eqϕ[logpθ(xz)]KL(qϕp(z))\log p_\theta(x) \ge \mathbb E_{q_\phi}[\log p_\theta(x\mid z)] - \mathrm{KL}(q_\phi\,\|\,p(z))

Latent variable model pθ(x,z)=p(z)pθ(xz)p_\theta(x,z) = p(z)p_\theta(x\mid z) with intractable posterior. Introduce variational encoder qϕ(zx)q_\phi(z\mid x) and maximize ELBO:

logpθ(x)Eqϕ(zx)[logpθ(xz)]KL(qϕ(zx)p(z))\log p_\theta(x) \ge \mathbb E_{q_\phi(z\mid x)}[\log p_\theta(x\mid z)] - \mathrm{KL}(q_\phi(z\mid x)\,\|\,p(z))

Reparameterization trick for Gaussian encoder:

z=μϕ(x)+σϕ(x)ϵ,ϵN(0,I)z = \mu_\phi(x) + \sigma_\phi(x)\odot\epsilon,\quad \epsilon\sim\mathcal N(0,I)

Canonical Papers

Auto-Encoding Variational Bayes

Kingma & Welling2013ICLR
Read paper →

Connections

Next Moves

Choose the next question to carry this object forward.