Classifier-Free Guidance
To make a conditional diffusion model follow its prompt more strongly, classifier-free guidance trains one network to predict both conditioned and unconditioned noise, then extrapolates away from the unconditioned prediction at generation time instead of needing a separate classifier at all.
Prerequisites: Denoising Diffusion Probabilistic Models
A diffusion model conditioned on a prompt — "a photo of a cat," or in a finance setting, "a stressed-regime return path" — will follow only loosely by default, because the training objective rewards matching the conditional data distribution , and that distribution still has plenty of room for outputs that only weakly resemble . Earlier approaches used a separate trained classifier to push samples toward more forcefully, but that meant training and maintaining a second model, on noisy intermediate images the classifier had never seen clean. Classifier-free guidance gets the same forceful push using only the diffusion model itself, trained once.
The analogy: exaggerating the difference between two directions
Suppose you're giving driving directions and you know both "the route to the mall" and "the route to nowhere in particular" from the current junction. If someone follows "the mall route" only loosely, you can make the instruction more insistent not by hiring a separate guide, but by comparing the two routes and telling the driver to lean further in the direction the mall route diverges from the aimless one — exaggerating the difference between "going somewhere specific" and "going nowhere in particular" pushes them more decisively toward the mall.
The mechanics: train both, extrapolate at sampling time
During training, the same network predicts noise conditioned on some fraction of the time, and conditioned on nothing (a null label, ) the rest of the time — one network, two modes, achieved just by randomly dropping the conditioning during training. At sampling time, both predictions are computed for the same noisy point, and combined with a guidance scale :
In words: start from the unconditional prediction, take the difference the conditioning makes, and add back more than 100% of that difference (since ). This exaggerates whatever the label was already nudging the prediction toward, at the cost of some diversity — the sample is pushed harder toward the specific mode implies, and correspondingly further from the variety of outputs the unconditional model would otherwise consider plausible.
Worked example 1: computing a guided prediction
Suppose at some diffusion step, the unconditional noise prediction is and the conditional one is (a single scalar for simplicity). With guidance scale (no guidance, plain conditional sampling): — just the conditional prediction. With : — nearly double the conditional prediction's deviation from the unconditional one, pushing the denoising step much more aggressively toward whatever favors.
Worked example 2: the diversity trade-off, in numbers
Generate 100 samples at : suppose 40 land in each of two plausible sub-styles consistent with , and 20 are more generic/off-prompt. At , the extrapolation collapses much of that spread: perhaps 85 land in the single dominant sub-style, 10 in the other, and only 5 generic — prompt-following goes up sharply (fewer off-prompt samples), but the model has effectively narrowed which of the two valid sub-styles it explores, which is the classic guidance trade-off: fidelity to rises, diversity within "things consistent with " falls.
Picture the guidance scale as this curve's steepness parameter: small gives a gentle nudge toward the prompt, while large sharpens the response into an aggressive, low-diversity extrapolation — the same shape of trade-off between responsiveness and stability that shows up whenever you scale up a control signal.
Classifier-free guidance trains one diffusion model to predict noise both with and without conditioning, and at sampling time extrapolates past the conditional prediction, away from the unconditional one, by a guidance scale — sharpening prompt-following without any separate classifier, at the cost of reduced sample diversity.
What this means in practice
Every modern text-to-image and text-to-audio diffusion system uses some form of classifier-free guidance, and the same mechanism applies to a finance-conditioned generator — e.g. pushing synthetic scenario generation harder toward a specific stress label at the cost of exploring fewer distinct ways that stress could manifest. The guidance scale is a genuine dial practitioners tune per use case, not a fixed constant.
Cranking up is not a free way to get "more correct" samples — past a moderate value, guided samples start to look oversaturated, artifact-ridden, or mode-collapsed onto a narrow slice of what's actually consistent with , because the linear extrapolation eventually pushes the prediction outside the region the network was ever trained to produce sensible outputs in. Guidance scale trades fidelity for diversity; it does not trade for free.
Related concepts
Practice in interviews
Further reading
- Ho & Salimans, Classifier-Free Diffusion Guidance (2021)