Worked examples — Score-based generative models
This page lives under Score-Based Generative Models. Read that first for the definitions — here we do. We will take the score , the denoising target , and the Langevin update, and run them through every case a problem can throw at you: positive/negative gradients, the zero (peak) input, the degenerate limit, the giant- limit, a multi-dimensional case, a word problem, and an exam twist.

The scenario matrix
Before any example, here is the full space of cases this topic contains. Each worked example is tagged with the cell it covers.
| Cell | What varies | Question it answers |
|---|---|---|
| A. Sign right | is to the right of the mode | Which way does the score point? |
| B. Sign left | is to the left of the mode | Does the arrow flip? |
| C. At the peak | = the mode exactly | What is the score when is maximal? |
| D. Small- limit | Why do scores blow up near clean data? | |
| E. Large- limit | huge | Why does everything look like one big Gaussian? |
| F. Multi-dimensional | vector | Score as a vector, not a number |
| G. Denoising target | given | Compute and check it equals the Gaussian score |
| H. Word problem | Langevin steps by hand | Does an actual dust speck move toward the mode? |
| I. Exam twist | mixture of two Gaussians | Where is the score zero and where does it point between modes? |
Our worked-through model distribution for most cells is the humble 1-D Gaussian
Where does that formula come from? ; differentiating with respect to gives . The constant (which hides the intractable ) vanishes — exactly the magic from the parent note.
Cell A + B — the sign of the score (right vs left of the mode)
- Write the score.
- Why this step? We plug into the one formula. No integrals, no — the log-gradient already killed the normalizer.
- Evaluate right side.
- Why? A negative score means "decrease " — the arrow points left, back toward .
- Evaluate left side.
- Why? A positive score means "increase " — the arrow points right, again toward . The sign flips exactly as the side flips.

Figure caption (s02): The blue curve is , an upside-down parabola peaking at the dashed yellow line . The red dot sits at with a red arrow pointing left (that's , "go downhill in , uphill in "). The green dot sits at with a green arrow pointing right (). Look how both arrows aim at the peak — that is the entire message of cells A and B.
Verify: Both arrows point toward the mode Langevin will pull particles inward, which is what "follow the gradient uphill in " must do. Magnitudes are equal () because the points are equidistant from . ✓ (Cells A and B done.)
Cell C — the score at the peak
- Plug in .
- Why this step? At the top of a smooth hill the slope is flat in every direction, so the gradient is the zero vector.
- Interpret. A zero score is a fixed point of Langevin (ignoring the noise term). The deterministic push is zero; only the random kick (with , defined at the top) moves you.
- Why it matters: This is why samples cluster at modes but never freeze there — the noise term keeps them alive.
Verify: The maximum of has zero derivative — first-derivative test confirms it. ✓ (Cell C.)
Cell D + E — the two limits of noise level
The denoising score at a noised point is . Watch what does to it.
- Score formula for the noised Gaussian.
- Why this step? , so its score is displacement/variance, negated.
- Small .
- Why? With tiny noise, being away from clean data is enormously improbable, so the log-density plummets steeply — a huge arrow yanks you back. This is cell D: scores explode near the data manifold. That is precisely why we need multiple noise levels.
- Large .
- Why? With huge noise the distribution is a wide, flat blanket; off is nothing, so the arrow is nearly zero. This is cell E: at large the landscape is smooth and easy to explore.

Figure caption (s03): Vertical axis is on a log scale; horizontal axis is the noise level . The blue curve rockets up on the left (small , red dot — the huge arrow of cell D) and flattens toward the right (large , green dot — the whisper of cell E).
Verify: Ratio of magnitudes . Score magnitude scales as — exactly why the weighting in the parent note rescues balanced gradients. ✓ (Cells D and E.)
Cell F — the score is a vector in high dimensions
- Vector form of the formula. applied componentwise (because is diagonal — dimensions don't interact).
- Why this step? For an isotropic Gaussian the log-density splits into a sum over coordinates, so the gradient splits too.
- Displacement vector.
- Divide by variance, negate.
- Why? First component negative ⇒ push left (we're right of ). Second component negative ⇒ push down toward , since .
Verify: Both components point back toward : from the mean is down-left, and the score points down-left. Magnitude . ✓ (Cell F.)
Cell G — denoising target equals the Gaussian score
- Denoising target.
- Why this step? This is what the network is trained to output given .
- Gaussian score of .
- Why? This is the true score at the noised point. They agree because , hence .
Verify: . The identity holds algebraically for any inputs, so denoising ≡ score learning. ✓ (Cell G — this is the whole justification of the DSM objective.)
Cell H — a word problem: run Langevin by hand
- Step 1 drift. With the update is
- Why this step? The score says "go left"; scaled by it moves the speck toward the mode. The term is because we chose .
- Step 2 drift. With :
- Why? Same rule with the new position. Each drift step multiplies the distance by , so it's a geometric crawl inward.
- General pattern. After zero-kick steps .
- Why it matters: Converges to (the mode) as — exactly the "follow the score uphill" behaviour. In real sampling the kicks are nonzero and let the speck wander, so it samples the full Gaussian instead of collapsing onto .
Verify: ✓, ✓. Both between the start and the mode, monotonically decreasing. ✓ (Cell H.)
Cell I — exam twist: the score of a mixture
A quick tool we need first, because it appears everywhere in mixtures.
- Symmetry argument. is even about (swapping swaps the two bumps but leaves the sum unchanged), so is even, so its derivative — the score — is odd: . An odd function passing through the origin must satisfy
- Why this step? Symmetry hands us the fixed point with no calculus at all.
- Set up the score honestly. Write the two unnormalized bumps , so . The score is the log-derivative:
- Why this step? differentiates to ; the constant prefactor (our old friend ) drops out.
- Differentiate each bump. (chain rule on the exponent). Substituting,
- Why this step? Each bump's own score is ; the denominator is the density (up to the constant), so this is a weighted average of the two individual scores, weighted by how responsible each bump is for the point .
- Collapse the exponentials into . Divide top and bottom by and factor. The mean-of-two-scores rearranges to
Now note (cancel the common factor from both bumps, leaving exactly the ratio). Taking the common case this simplifies to the clean closed form
- Why introduce here? Because "difference of two exponentials over their sum" is the definition of (see the definition box). It is the natural language for "which of two competing bumps wins", so it compresses the messy fraction into one interpretable S-curve.
- Plug numbers (). At the centre : — the predicted fixed point. Just right of centre at : — the score points right, toward the near mode .
- Why? A positive score at means the fixed point at is an unstable ridge, not a valley: the tiniest nudge sends the speck rolling to one mode. This is the reason single-scale Langevin gets stranded between modes, and why annealing from large (where the two bumps merge into one broad hill) is essential.

Figure caption (s04): Blue is the two-humped density (scaled up so you can see it); red is the score . The red curve crosses zero at the dashed yellow line (the unstable ridge, yellow dot), is positive just to its right (green dot at — pushes toward ) and negative just to its left. Watch how the red curve dives back down near each hump: those downward crossings at are the stable fixed points at the modes.
Verify: ✓ (fixed point). ✓ (repelled toward the near mode). By oddness . ✓ (Cell I.)
Recall checkpoints
Recall Sign of the score right of the mode
Right of (so ), the Gaussian score is... ::: negative — it points left, back toward the mode.
Recall Score at the peak
The score exactly at the mode equals... ::: zero (flat top of the log-density hill).
Recall Why scores blow up at small sigma
As the score magnitude scales like... ::: , so it explodes near clean data — motivating multiple noise scales.
Recall Denoising ↔ score identity
equals the true score because... ::: , so .
Recall Mixture-of-two score
For with , the score is... ::: , zero at (an unstable ridge).
See also: Diffusion Models, Langevin Dynamics, Stochastic Differential Equations, Energy-Based Models, and the generative cousins VAE and GAN.