Last chapter's flow needed an invertible function, engineered by hand or by careful architecture choices, before it could define a density at all. What if a model didn't need to invert anything — just needed to know, at any point, which direction makes the data more likely?
Click "Take a Langevin step" a few times. The point starts at — nowhere near the data — and drifts steadily toward , the single peak of this chapter's target distribution, one gradient step at a time.
The score of a distribution is — a vector field pointing toward higher density. For a Gaussian , it has a clean closed form:
- — the score function: the gradient of the log-density, a vector field pointing toward higher-probability regions.
- — the probability density of the target distribution.
- — the mean of the Gaussian target distribution.
- — the variance of the Gaussian target distribution.
- Climbing the score reaches the mode
Follow it uphill, repeatedly — — and climbs toward .
- Langevin dynamics samples the whole distribution
Real score-based models add noise to this update (Langevin dynamics) so the process samples the whole distribution instead of always collapsing onto the single peak.
- Learned directly, no invertibility required
A neural network is trained to estimate directly from data, without ever needing an invertible architecture or a tractable normalizing constant.
Every bar here comes from a closed-form formula, not a simulation — the distance to the mode shrinks by exactly the same factor, , every single step, no matter how far the trajectory started. That factor is : it's baked into the step size and the target's own spread, not something that has to be measured empirically.
Starting at , target , step size :
- Step 1
. .
- Step 2
. .
- The distance to the mode obeys a clean pattern
Each one is exactly the last (, ). That's not a coincidence of these particular numbers; it falls straight out of the fact that is linear in for a Gaussian.
Find the smallest step count, among the candidates, where the trajectory lands within 0.5 of the mode.
This chapter's target was a single Gaussian precisely because its score has a closed form simple enough to hand-verify. Real score-based models estimate with a neural network trained via score matching on complicated, multi-modal, high-dimensional data — where no closed form exists at all — and they run the noisy version of this update (not the deterministic climb shown here) so different starting points can land on different modes of the data, not just the nearest peak. The next chapter asks what happens if, instead of learning the score and simulating a path toward the data, a model is trained to predict the straight-line path itself.