Flow matching
& diffusion.
How does a cloud of noise become a distribution of data? Build the intuition, follow the mathematics, and discover the answer through experiments.
Before you begin: prerequisites, notation, and how to use this course
The first lessons need basic algebra and derivatives. Later proofs use conditional expectation, multivariable calculus, and introductory stochastic calculus. Open each proof when ready; the examples remain useful without every technical detail.
Two clocks, deliberately named differently: flow time $t$ runs from noise at $0$ to data at $1$. Diffusion time $\tau$ runs from data at $0$ to noise at $T$. Reversing a clock changes drift signs.
| Symbol | Meaning |
|---|---|
| $X, Z$ | A clean data sample and standard Gaussian noise. Independent unless a coupling is explicitly specified. |
| $p_t, s_t$ | A time-dependent density and its score $s_t(x)=\nabla_x\log p_t(x)$. |
| $v_t(x)$ | A velocity field in an ODE. It is distinct from the particular “v-prediction” target used in some diffusion models. |
| $a_t,b_t$ | Data and noise coefficients in the flow path $X_t=a_tX+b_tZ$. |
| $\beta_k,\alpha_k,\bar\alpha_k$ | A DDPM noise variance, $1-\beta_k$, and $\prod_{j=1}^k\alpha_j$. |
| $\mathcal N(m,\Sigma), I$ | A Gaussian with mean $m$ and covariance $\Sigma$; the identity matrix. |
Every lesson has the same four parts: problem, intuition, theory with an experiment, and a knowledge check. The experiments use analytically solvable toy distributions; lesson 13 also contains a runnable PyTorch example. Quiz progress counts correct answers, not mastery, and is saved in this browser when local storage is available.
Primary papers and further study
- Ho et al. (2020), Denoising Diffusion Probabilistic Models — lessons 3–5.
- Song et al. (2021), Score-Based Generative Modeling through Stochastic Differential Equations — lessons 4 and 6.
- Song et al. (2021), Denoising Diffusion Implicit Models — lesson 10.
- Lipman et al. (2023), Flow Matching for Generative Modeling — lessons 7–8.
- Liu et al. (2023), Flow Straight and Fast: Learning to Generate and Transfer Data with Rectified Flow — lesson 9.
- Grathwohl et al. (2019), FFJORD — lesson 11.
- Ho & Salimans (2022), Classifier-Free Diffusion Guidance — lesson 12.
- Albergo, Boffi & Vanden-Eijnden (2023), Stochastic Interpolants: A Unifying Framework for Flows and Diffusions — lesson 14.
- Lipman et al. (2024), Flow Matching Guide and Code — broader derivations and implementations.