Interactive Explainer
Guidance Bends the Trajectory
A diffusion model generates by starting from pure noise and running a learned reverse process that walks each sample back toward the data. Left alone it is unconditional — samples scatter across every mode. Add a guidance term pointing at a chosen class and the trajectories bend toward it. Turn the knob up and they bend harder… and collapse onto the class's centre. Fidelity up, diversity down. Watch it happen below.
Sampling is following a score
The reverse process moves a sample $x$ in the direction of the score $\nabla_x \log p(x)$ — uphill in probability — while slowly removing noise. That unconditional score pulls each sample toward whichever data mode is nearest, so a batch ends up spread over all the modes.
To condition on a class $c$ we want the score of $p(x \mid c)$. Bayes' rule splits it into the unconditional score plus the gradient of a classifier, and guidance simply over-weights that second term by a scale $w$:
At $w = 0$ the class term vanishes and you sample unconditionally. As $w$ grows the pull toward class $c$ dominates — the mechanism behind classifier and classifier-free guidance alike.
Turn the knob, watch the pull
Three class blobs sit in the plane (the data distribution). Press Run and a batch of noisy samples runs the reverse process, leaving faint trails. With guidance $w = 0$ they settle across all three blobs. Raise the guidance scale and pick a target class: the trajectories bend toward that blob. Push $w$ high and they pile onto its centre — sharp, on-class, and nearly identical.
Fidelity and diversity pull against each other
Guidance re-weights the sampling distribution toward roughly $p(x)\,p(c\mid x)^{w}$. A larger exponent sharpens the class posterior: probability mass concentrates where the classifier is most confident — the centre of the target blob. That is exactly what you want for fidelity (samples unmistakably belong to the class) and exactly what destroys diversity (the tails and neighbouring modes get starved).
- $w = 0$: pure unconditional sampling — every mode represented, maximal variety, no control.
- Moderate $w$: the sweet spot — clearly on-class while still varied. Real systems use small single-digit scales.
- Large $w$: mode collapse — oversaturated, near-identical samples clustered at the class centre.