Before you move a control in the demo, say what you expect to change.
Foundation reference
Diffusion, Score-Based Models & Flow Matching
A diffusion model learns to reverse a process that gradually adds noise to data. Stable Diffusion is a latent diffusion model: a DDPM-style denoiser trained in the latent space of a pretrained autoencoder (Rombach et al., 2022).
Study guide
Where to start
Why is learning to denoise the same as learning the score ∇ₓ log pₜ(x), and in what sense does reverse-time sampling climb toward higher log-density while the injected noise keeps samples spread out?
How to study this pagePredict · Check · Generalize · Continue
Compare what the demo shows with the key equation and with the papers cited below.
Identify the part of the idea that survives a change of notation or model, so you can recognize it in another paper or system.
The newer notebook covers the same concept and has an interactive demo.
Why It Matters for Modern Models
- A diffusion model learns to reverse a process that gradually adds noise to data. Stable Diffusion is a latent diffusion model: a DDPM-style denoiser trained in the latent space of a pretrained autoencoder (Rombach et al., 2022).
- OpenAI describes its Sora video model as a diffusion transformer over spacetime patches of compressed video (Brooks et al., 2024).
- Straighter sampling paths, as in rectified flow, allow generation in a few steps, and in one step after further distillation (Liu et al., 2023).
Questions to Think About
- How do different probability paths, such as the diffusion path and the straight conditional path of flow matching, change the trajectories a sampler follows?
Interactive Demos
Core Math
If you prefer intuition first, try the demos above, then come back for the math.
Forward diffusion adds noise:
The model learns to predict the added noise with a mean-squared error, where :
Ho et al. (2020) obtained this loss by dropping the weights of the variational bound on log-likelihood, so it is a reweighted form of that bound.
Score-based SDE view: the forward process is an SDE . Sampling runs the reverse-time SDE, which needs the score ; the noise predictor gives it as .
Flow matching: regress a vector field onto the velocity of a chosen conditional path, often the straight line from a noise sample to a data sample (Lipman et al. call this the conditional optimal-transport path). The learned field averages these conditional velocities; it is not in general the optimal-transport map between noise and data.