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 w 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:
Definition The one formula, in words
ϵ θ ( x t , t , c ) = the noise the model predicts when it can read your prompt c . Call it ϵ cond .
ϵ θ ( x t , t , ∅ ) = the noise the model predicts when the prompt is blanked out (the null token ∅ , "empty string"). Call it ϵ uncond .
w = the guidance scale , a single dial you turn.
ϵ ~ θ = ( 1 − w ) ϵ uncond + w ϵ cond
Read it as: "Start at the no-prompt guess, then walk a distance w along the arrow from no-prompt to with-prompt." That arrow is Δ ϵ = ϵ cond − ϵ uncond , the conditioning direction .
Intuition Why these are just points on a line
Both predictions are vectors living in the same space (one number per pixel/channel). Δ ϵ is the arrow from the unconditional point to the conditional point. The guided answer ϵ ~ is what you get by standing at ϵ uncond and stepping w arrow-lengths. So w is literally "how many arrow-lengths?" — and that single picture explains every case below.
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
w = 0 (degenerate)
prompt ignored entirely
Ex 1
B
w = 1 (identity)
guidance does nothing
Ex 2
C
0 < w < 1 (interpolation)
answer sits between the two guesses
Ex 3
D
w > 1 (extrapolation)
unconditional weight goes negative
Ex 4
E
Degenerate arrow Δ ϵ = 0
prompt made no difference
Ex 5
F
Sign flip / over-shoot
large w flips a component's sign
Ex 6
G
Real-world word problem
Stable-Diffusion prompt with w = 7.5
Ex 7
H
Negative prompting twist
subtracting an unwanted prompt
Ex 8
I
Limiting behaviour w → ∞
where does ϵ ~ head?
Ex 9
To keep arithmetic honest, most examples use tiny 2-number noise vectors [ a , b ] . Real models use millions of numbers, but every number obeys the same line rule independently, so 2 is enough to see everything.
Worked example Example 1 — Cell A:
w = 0 , the prompt is ignored
Statement. ϵ cond = [ 0.8 , − 0.4 ] , ϵ uncond = [ 0.2 , 0.1 ] , w = 0 . Find ϵ ~ .
Forecast: guess before computing — should the prompt matter at all here?
Write the formula: ϵ ~ = ( 1 − w ) ϵ uncond + w ϵ cond .
Why this step? Always start from the single master equation; every case is just a value of w .
Substitute w = 0 : ϵ ~ = ( 1 − 0 ) ϵ uncond + 0 ⋅ ϵ cond = ϵ uncond = [ 0.2 , 0.1 ] .
Why this step? The conditional term is multiplied by 0 , so it drops out completely.
Answer: ϵ ~ = [ 0.2 , 0.1 ] .
Verify: In the line picture, w = 0 means "take zero arrow-lengths" — you stay exactly at the unconditional point. Matches the intuition that with w = 0 the model produces a generic, prompt-free image.
Worked example Example 2 — Cell B:
w = 1 , guidance is a no-op
Statement. Same vectors, w = 1 . Find ϵ ~ .
Forecast: does turning the dial to 1 change anything vs. just using the conditional model?
Substitute w = 1 : ϵ ~ = ( 1 − 1 ) ϵ uncond + 1 ⋅ ϵ cond = 0 ⋅ ϵ uncond + ϵ cond .
Why this step? ( 1 − w ) becomes 0 , killing the unconditional term.
So ϵ ~ = ϵ cond = [ 0.8 , − 0.4 ] .
Answer: ϵ ~ = [ 0.8 , − 0.4 ] .
Verify: w = 1 = "walk exactly one arrow-length" = land on the conditional point. This is plain Conditional generation with no amplification — the theoretically "correct" posterior sample.
Worked example Example 3 — Cell C:
0 < w < 1 , an in-between blend
Statement. Same vectors, w = 0.5 . Find ϵ ~ .
Forecast: where on the line — closer to prompt, or to no-prompt, or exactly halfway?
ϵ ~ = ( 1 − 0.5 ) ϵ uncond + 0.5 ϵ cond = 0.5 [ 0.2 , 0.1 ] + 0.5 [ 0.8 , − 0.4 ] .
Why this step? Both weights are positive and sum to 1 , so this is an honest average.
Component-wise: [ 0.5 ( 0.2 ) + 0.5 ( 0.8 ) , 0.5 ( 0.1 ) + 0.5 ( − 0.4 )] = [ 0.5 , − 0.15 ] .
Answer: ϵ ~ = [ 0.5 , − 0.15 ] .
Verify: Halfway between [ 0.2 , 0.1 ] and [ 0.8 , − 0.4 ] is exactly the midpoint — sanity check: [( 0.2 + 0.8 ) /2 , ( 0.1 − 0.4 ) /2 ] = [ 0.5 , − 0.15 ] . ✓ For w ∈ ( 0 , 1 ) the answer always lands strictly between the two points (a soft prompt).
Worked example Example 4 — Cell D:
w > 1 , the negative-weight extrapolation
Statement. Same vectors, w = 3.0 . Find ϵ ~ and note the sign of each coefficient.
Forecast: with w = 3 , does the answer stay between the points or shoot past the conditional one?
Coefficients: ( 1 − w ) = 1 − 3 = − 2 on the unconditional term, + 3 on the conditional.
Why this step? This is the famous negative coefficient : for w > 1 we push away from the generic distribution.
ϵ ~ = − 2 [ 0.2 , 0.1 ] + 3 [ 0.8 , − 0.4 ] = [ − 0.4 , − 0.2 ] + [ 2.4 , − 1.2 ] .
Sum: [ 2.0 , − 1.4 ] .
Answer: ϵ ~ = [ 2.0 , − 1.4 ] .
Verify (extrapolation check): The additive form must agree: ϵ uncond + w Δ ϵ with Δ ϵ = [ 0.8 , − 0.4 ] − [ 0.2 , 0.1 ] = [ 0.6 , − 0.5 ] gives [ 0.2 , 0.1 ] + 3 [ 0.6 , − 0.5 ] = [ 0.2 + 1.8 , 0.1 − 1.5 ] = [ 2.0 , − 1.4 ] . ✓ Notice the point is now beyond the conditional — that is what "stronger prompt adherence" means geometrically.
Worked example Example 5 — Cell E: degenerate arrow, prompt makes no difference
Statement. ϵ cond = [ 0.3 , 0.7 ] , ϵ uncond = [ 0.3 , 0.7 ] (identical!), w = 9.0 . Find ϵ ~ .
Forecast: we cranked w to 9 — will the huge dial still do anything?
Arrow: Δ ϵ = ϵ cond − ϵ uncond = [ 0 , 0 ] .
Why this step? If the model predicts the same noise with and without the prompt, the conditioning direction is the zero arrow .
ϵ ~ = ϵ uncond + w ⋅ 0 = [ 0.3 , 0.7 ] for any w .
Answer: ϵ ~ = [ 0.3 , 0.7 ] , independent of w .
Verify: Line picture: a zero-length arrow means you never leave the start point, no matter how many "lengths" you walk. Practically this happens when a prompt token is out-of-distribution and the model treats it as meaningless — guidance is helpless, a genuine failure mode.
Worked example Example 6 — Cell F: a sign flip from over-shooting
Statement. One channel only: ϵ cond = 0.2 , ϵ uncond = 0.5 , w = 5.0 . What happens to the sign?
Forecast: the conditional (0.2) is below the unconditional (0.5). After guidance, positive or negative?
Δ ϵ = 0.2 − 0.5 = − 0.3 (a downward arrow).
Why this step? Direction matters: here the prompt pushes this channel down .
ϵ ~ = 0.5 + 5.0 ( − 0.3 ) = 0.5 − 1.5 = − 1.0 .
Why this step? Walking 5 downward-arrow-lengths overshoots past zero into negative territory.
Answer: ϵ ~ = − 1.0 (sign flipped from + to − ).
Verify: ( 1 − 5 ) ( 0.5 ) + 5 ( 0.2 ) = − 4 ( 0.5 ) + 1.0 = − 2.0 + 1.0 = − 1.0 . ✓ Both forms agree. This is why very high w produces over-saturated, unnatural images — components blow past their sensible range.
Worked example Example 7 — Cell G: real Stable-Diffusion word problem
Statement. Prompt c = "a cat wearing a wizard hat", w = 7.5 , at timestep t = 500 . Model outputs (simplified 3-vectors): ϵ cond = [ 0.2 , − 0.5 , 0.3 ] , ϵ uncond = [ 0.1 , − 0.3 , 0.1 ] . Find ϵ ~ to feed into the next DDPM sampling step.
Forecast: each component gets pushed in the direction the prompt already leans . Guess whether the first component ends above or below 0.2.
Arrow: Δ ϵ = [ 0.2 − 0.1 , − 0.5 + 0.3 , 0.3 − 0.1 ] = [ 0.1 , − 0.2 , 0.2 ] .
Why this step? This vector is exactly "what the words cat wizard add."
Scale: 7.5 Δ ϵ = [ 0.75 , − 1.5 , 1.5 ] .
Why this step? w = 7.5 is Stable Diffusion's typical dial — strong adherence.
Add to baseline: ϵ ~ = [ 0.1 , − 0.3 , 0.1 ] + [ 0.75 , − 1.5 , 1.5 ] = [ 0.85 , − 1.8 , 1.6 ] .
Answer: ϵ ~ = [ 0.85 , − 1.8 , 1.6 ] .
Verify (line form): ( 1 − 7.5 ) ϵ uncond + 7.5 ϵ cond = − 6.5 [ 0.1 , − 0.3 , 0.1 ] + 7.5 [ 0.2 , − 0.5 , 0.3 ] = [ − 0.65 , 1.95 , − 0.65 ] + [ 1.5 , − 3.75 , 2.25 ] = [ 0.85 , − 1.8 , 1.6 ] . ✓ First component rose from 0.2 to 0.85 — pushed further along its own direction, as forecast.
Worked example Example 8 — Cell H: the negative-prompting twist
Statement. We want "a photo of a dog" but not blurry . Negative prompting replaces the unconditional branch with a negative prompt c neg = "blurry". So ϵ ~ = ϵ neg + w ( ϵ cond − ϵ neg ) . With ϵ cond = [ 0.6 , 0.2 ] (dog), ϵ neg = [ 0.4 , 0.5 ] (blurry), w = 6.0 , find ϵ ~ .
Forecast: the arrow now points from blurry to dog — so the answer should flee the "blurry" point.
Arrow: Δ ϵ = [ 0.6 − 0.4 , 0.2 − 0.5 ] = [ 0.2 , − 0.3 ] .
Why this step? Same machinery as CFG, but the "baseline" is now the thing we want to move away from.
Guided: ϵ ~ = [ 0.4 , 0.5 ] + 6.0 [ 0.2 , − 0.3 ] = [ 0.4 , 0.5 ] + [ 1.2 , − 1.8 ] = [ 1.6 , − 1.3 ] .
Why this step? Walking 6 arrow-lengths from blurry toward dog strongly suppresses blur features.
Answer: ϵ ~ = [ 1.6 , − 1.3 ] .
Verify: Line form with ϵ neg as baseline: ( 1 − 6 ) [ 0.4 , 0.5 ] + 6 [ 0.6 , 0.2 ] = − 5 [ 0.4 , 0.5 ] + [ 3.6 , 1.2 ] = [ − 2 , − 2.5 ] + [ 3.6 , 1.2 ] = [ 1.6 , − 1.3 ] . ✓ Identical algebra to plain CFG — negative prompting is just CFG with ∅ swapped for an unwanted prompt.
Worked example Example 9 — Cell I: limiting behaviour
w → ∞
Statement. Using Example 4's vectors (ϵ cond = [ 0.8 , − 0.4 ] , ϵ uncond = [ 0.2 , 0.1 ] ), describe the direction ϵ ~ heads as w → ∞ , and compute w = 100 .
Forecast: as the dial goes to infinity, does ϵ ~ settle down or run off — and in which direction?
Factor the formula: ϵ ~ = ϵ uncond + w Δ ϵ with Δ ϵ = [ 0.6 , − 0.5 ] .
Why this step? Only the w Δ ϵ term grows; the constant ϵ uncond becomes negligible.
As w → ∞ , ϵ ~ ≈ w Δ ϵ , i.e. it runs off to infinity along the arrow direction [ 0.6 , − 0.5 ] (up to positive scaling).
At w = 100 : ϵ ~ = [ 0.2 , 0.1 ] + 100 [ 0.6 , − 0.5 ] = [ 0.2 + 60 , 0.1 − 50 ] = [ 60.2 , − 49.9 ] .
Answer: direction → [ 0.6 , − 0.5 ] ; at w = 100 , ϵ ~ = [ 60.2 , − 49.9 ] .
Verify: Line form: ( 1 − 100 ) [ 0.2 , 0.1 ] + 100 [ 0.8 , − 0.4 ] = − 99 [ 0.2 , 0.1 ] + [ 80 , − 40 ] = [ − 19.8 , − 9.9 ] + [ 80 , − 40 ] = [ 60.2 , − 49.9 ] . ✓ The magnitude explodes — this is exactly why unbounded w destroys images: the noise prediction leaves any sensible range. This connects to the score-scaling view in Score-based diffusion models and the classifier-gradient origin in Classifier guidance .
Common mistake The three killers
Forgetting the ( 1 − w ) can go negative. For w > 1 the unconditional weight is negative — that's a feature, not a bug (Ex 4).
Assuming bigger w is always better. Ex 6 & 9 show over-shoot flips signs and blows up magnitudes → mode collapse.
Thinking a zero arrow can be rescued by huge w . Ex 5: w ⋅ 0 = 0 forever.
Recall Quick self-test
With w = 0 , which prediction do you get? ::: The unconditional one, ϵ uncond (prompt ignored).
With w = 1 , which prediction do you get? ::: Exactly the conditional one, ϵ cond .
What is the sign of the unconditional coefficient when w = 7.5 ? ::: Negative (1 − 7.5 = − 6.5 ).
If ϵ cond = ϵ uncond , what does guidance do? ::: Nothing — the arrow is zero for any w .
As w → ∞ , which direction does ϵ ~ run off along? ::: The conditioning arrow Δ ϵ = ϵ cond − ϵ uncond .
Mnemonic One line to remember them all
"Stand at no-prompt, walk w arrows toward prompt." Every cell A–I is just choosing w .