4.5.14 · D3Generative Models

Worked examples — Classifier-free guidance

2,015 words9 min readBack to topic

This is the "roll up your sleeves" companion to Classifier-free guidance. The parent note built the formula; here we hit every case the guidance scale can produce — including the weird ones nobody warns you about. Prefer to read this in Hinglish? Try 4.5.14 Classifier-free guidance (Hinglish).

Everything below rests on one single equation. Let us re-state it in plain words so no symbol is a stranger:


The scenario matrix

Every question this topic can throw at you is one of these cells. We will hit all of them.

Cell Case class What makes it tricky Example
A (degenerate) prompt ignored entirely Ex 1
B (identity) guidance does nothing Ex 2
C (interpolation) answer sits between the two guesses Ex 3
D (extrapolation) unconditional weight goes negative Ex 4
E Degenerate arrow prompt made no difference Ex 5
F Sign flip / over-shoot large flips a component's sign Ex 6
G Real-world word problem Stable-Diffusion prompt with Ex 7
H Negative prompting twist subtracting an unwanted prompt Ex 8
I Limiting behaviour where does head? Ex 9

To keep arithmetic honest, most examples use tiny 2-number noise vectors . Real models use millions of numbers, but every number obeys the same line rule independently, so 2 is enough to see everything.


Worked examples


Recall Quick self-test

With , which prediction do you get? ::: The unconditional one, (prompt ignored). With , which prediction do you get? ::: Exactly the conditional one, . What is the sign of the unconditional coefficient when ? ::: Negative (). If , what does guidance do? ::: Nothing — the arrow is zero for any . As , which direction does run off along? ::: The conditioning arrow .