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

Foundation Lab

Diffusion, Score-Based Models & Flow Matching

Stable Diffusion: latent diffusion — DDPM in a VAE latent space

Concept 9 of 100Generative ModelsPhase 4
#9DiffusionGenerative Models
key equation\mathcal L = \mathbb E_{x_0,t,\epsilon} \big\|\epsilon - \epsilon_\theta(x_t,t)\big\|^2

Selected Foundation Object

Keep the equation fixed; move through the evidence.

Concept 9 of 100DiffusionGenerative Models / Phase 4: Generative modeling families
Current question

Intuitive explanation that denoising is learning ∇ₓ log pₜ(x) (scores), and how reverse-time SDE sampling corresponds to "walking uphill in log-density space"

\mathcal L = \mathbb E_{x_0,t,\epsilon} \big\|\epsilon - \epsilon_\theta(x_t,t)\big\|^2
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: latent diffusion — DDPM in a VAE latent space
  • Sora: diffusion transformer over 3D spacetime patches
  • Flow-matching and rectified flows enable one-step or few-step generation

What Tutorials Skip

What is still poorly explained in textbooks and papers:

  • Intuitive explanation that denoising is learning ∇ₓ log pₜ(x) (scores), and how reverse-time SDE sampling corresponds to "walking uphill in log-density space"
  • Visual/interactive demonstrations of different probability paths (diffusion vs optimal transport)

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
L=Ex0,t,ϵϵϵθ(xt,t)2\mathcal L = \mathbb E_{x_0,t,\epsilon} \big\|\epsilon - \epsilon_\theta(x_t,t)\big\|^2

Forward diffusion adds noise:

q(xtx0)=N(αˉtx0,(1αˉt)I)q(x_t \mid x_0) = \mathcal N(\sqrt{\bar\alpha_t}\,x_0, (1-\bar\alpha_t)I)

Model learns to predict noise ϵ\epsilon via MSE:

L=Ex0,t,ϵϵϵθ(xt,t)2\mathcal L = \mathbb E_{x_0,t,\epsilon} \big\|\epsilon - \epsilon_\theta(x_t,t)\big\|^2

Score-based SDE view: forward SDE dxt=f(xt,t)dt+g(t)dWtdx_t = f(x_t,t)\,dt + g(t)\,dW_t. Reverse-time SDE uses score xlogpt(x)\nabla_x \log p_t(x).

Flow matching: train vector field vθ(x,t)v_\theta(x,t) to match the "true" conditional field (often optimal transport / straight lines).

Canonical Papers

Deep Unsupervised Learning using Nonequilibrium Thermodynamics

Sohl-Dickstein et al.2015ICML
Read paper →

Denoising Diffusion Probabilistic Models

Ho et al.2020NeurIPS
Read paper →

Score-Based Generative Modeling through SDEs

Song et al.2021ICLR
Read paper →

Flow Matching for Generative Modeling

Lipman et al.2023ICLR
Read paper →

Connections