Exercises — Score-based generative models
Before we start, two shared pieces of notation used all over this page.
Keep this figure in mind — it is the true score field .

The arrows all point toward the peak, they shrink to zero at the peak (nowhere left to climb), and they never care how tall the mountain is — only its slope. That last fact is why the normalizer vanishes.
Level 1 — Recognition
These check that you can read the definitions without computing anything heavy.
Exercise 1.1
State the score function of the 1-D standard Gaussian , and say what its sign means at and .
Recall Solution
Take the log first — that is the whole trick of a "score": The second term is a constant (no ), so its derivative is . Differentiate: WHY the log: logging turns the product/exponential into a sum, and the annoying constant becomes an additive constant that dies under the derivative. That is the " disappears" magic in miniature.
At : — the arrow points left, back toward the mean (higher density). At : — points right, again toward . The score always aims at the peak. ✅
Exercise 1.2
True or false: to compute for , you must first evaluate . Justify in one line.
Recall Solution
False. , and is a constant in , so . Hence . You never touch . ✅
Level 2 — Application
Now you plug numbers into the machinery.
Exercise 2.1
You add noise with , . For a clean point you draw . What is (a) the noisy point , and (b) the true conditional score at that point?
Recall Solution
(a) .
(b) From the parent note, for the Gaussian , Plug in: . Check via the other form: . ✅ Both agree — the two formulas are the same thing since , so .
What it means: the score points back down the noise you added, toward the clean . That is exactly "denoising."
Exercise 2.2
Your denoising network — the learned score from the definition box above — is trained to match the target . With and the noisy input from above, what target should it produce? If instead the network outputs , what is the squared error ?
Recall Solution
Recall is the network's output; we want it to approximate the true score. The training target is (same value as the true conditional score in 2.1b — the network learns exactly that score).
The denoising loss is . With and target : ✅
Level 3 — Analysis
Here you reason about why a design choice behaves as it does.
Exercise 3.1
Show that with the weighting , each per-noise-level term of the objective becomes independent of the scale of the score's magnitude — i.e. it reduces to predicting the unit noise .
Recall Solution
One term of the objective is (Recall is the learned score — the network's output.) Substitute and pull the scalar inside the norm. Why is that legal? For any vector and scalar , — because . So the constant outside a squared norm is the same as one factor multiplying the vector inside it. Applying this with : WHY this matters: define the reparameterised network output . Then the term is — a plain "predict the unit-variance noise " loss. The typical magnitude of is at every noise level, so gradients across scales have comparable size. Without the weight, the raw target blows up as and the smallest-noise level would dominate training. ✅
Exercise 3.2
The Langevin update is . At the mode of a standard Gaussian (, so ), compute the expected displacement and the variance of one step. What stops the chain from collapsing onto the mode?
Recall Solution
At : the drift . So the expected displacement is But the noise term with has variance What stops collapse: exactly this injected noise. If we used only the drift, the chain would settle at the mode and stay — giving one point, not a distribution. The term keeps kicking off the peak; the drift then pulls it back. The tug-of-war between "pull uphill" and "random kick" is what makes the stationary spread of the chain match the true distribution's spread (its detailed-balance property). ✅
Level 4 — Synthesis
Combine several pieces into one argument.
Exercise 4.1
In diffusion, . Prove that the score of equals , and hence that a network predicting can be converted to a score with a single scalar. Then verify numerically for .
Recall Solution
Distribution: conditioned on , is Gaussian with mean and variance : Score: using with : Substitute : Conversion: if the net outputs , then the score estimate is — one division by the (known) scalar . ✅
Numeric check: . Score . Cross-check . ✅ Match.
Exercise 4.2
Design a 3-level noise schedule that is geometric with ratio starting at . Give the values, and give the corresponding step sizes if with .
Recall Solution
Geometric means each level is the previous times : So . Step sizes :
Reading it: big ⇒ big steps (coarse exploration of all of space); small ⇒ tiny steps (careful refinement near the data). Exactly the annealing intent. ✅
The figure below plots this very schedule: the teal curve (left axis, log scale) is marching down , and the orange curve (right axis, log scale) is the step size dropping . Notice they fall together — that is the annealing design made visual: coarse-and-bold at high noise, fine-and-cautious at low noise.

Level 5 — Mastery
Full end-to-end reasoning, mixing derivation, numeric, and design.
Exercise 5.1
A 1-D two-mode target is . (a) Write the exact score . (b) Evaluate and interpret it. (c) Explain, using , why single-scale Langevin from struggles, and how annealing with a large fixes it.
Recall Solution
Notation note: we are in one dimension, so the gradient is just the ordinary derivative. Below we write as shorthand for — it is the same used everywhere else on this page, only spelled with a prime to keep the fraction readable.
(a) Let . Then . By the chain rule, , so the score of a mixture is a weighted average of component scores, weighted by posterior responsibility: Since ,
(b) At : by symmetry , so they cancel in the numerator's structure. Numerator . Hence Interpretation: is a local minimum (a valley) of — the low-density point between the two modes. In one dimension there are no saddles, so this is a genuine minimum: the slope vanishes there, and on either side rises toward a mode. The score gives no directional guidance at the very bottom of the valley (equal pull from both sides).
(c) Single-scale Langevin from : the drift is , so only the small noise moves you. To cross from the valley to either peak at you must random-walk across a low-density gap — exponentially unlikely per step, so the chain gets stuck near one mode (poor mode coverage).
Fix via annealing: at a large , the target is convolved with wide Gaussian noise, which fills in the valley — the two blurred modes merge into one broad hump whose score smoothly points toward the middle mass. Sampling there mixes freely across the whole region. As we anneal down, the single hump splits back into two, and by then the chain is already distributed across both basins. This is precisely why multi-scale score matching exists. ✅
The figure makes the fix concrete. The teal curve is the raw target with its two sharp peaks and the deep valley at (dotted plum line) where the score is and the chain stalls. The orange curve is the same target after convolving with a large- Gaussian: the valley is gone, so a walker at now feels a well-defined score and mixes across both basins.

Exercise 5.2
(Mastery numeric.) For the mixture in 5.1, evaluate the score at to 4 decimal places, and state whether the arrow points toward the right mode.
Recall Solution
Compute the two responsibilities' unnormalised weights at :
- .
- .
Numerator of : . Denominator: . Numerically , : Rounding to 4 decimal places: the fifth decimal is , so rounds up at the fourth place, giving Positive ⇒ the arrow points right, toward the mode at . Makes sense: at you're on the inner slope of the right mode, so uphill is rightward (toward ), and the far-left mode contributes almost nothing (its weight is negligible). ✅
Recall Self-test cloze
The normalizer vanishes from the score because ::: (it is constant in ). The denoising target given noise at level is ::: . The Langevin noise term coefficient is ::: . The loss weighting reduces the objective to predicting ::: the unit noise . A mixture's score is a ::: responsibility-weighted average of component scores.