A retailer's Stable Diffusion 1.5 pipeline uses classifier-free guidance, ε̂ = ε_uncond + w·(ε_cond − ε_uncond), with w = 7.5. For one latent element at one step, the model predicts ε_uncond = 0.20 and ε_cond = 0.35. What is ε̂, and which statement about how CFG is trained and used is correct?
Show the answer and explanation
Correct answer: B, ε̂ = 0.20 + 7.5 × (0.35 − 0.20) = 1.325; one network learns both branches because the prompt is replaced by a null prompt about 10% of the time in training, and a negative prompt replaces the unconditional branch.
Explanation Diffusion Models
Classifier-free guidance (Ho and Salimans, 2022) runs the same denoiser twice per step, with and without the prompt, and extrapolates from the unconditional prediction toward the conditional one:
ε̂ = ε_uncond + w·(ε_cond − ε_uncond) = 0.20 + 7.5 × 0.15 = 1.325
With w = 1 you get the plain conditional prediction; w > 1 pushes further in the direction the prompt adds, improving prompt adherence at the cost of diversity (and oversaturated images at very high w).
Training. No second model is needed: the caption is replaced by a null condition with a small probability (10% for Stable Diffusion 1.5; other models use other rates), so one network learns both the conditional and the unconditional prediction. In SD 1.5 the unconditional branch uses the frozen text encoder's output for the empty prompt, which is not a vector of zeros; the U-Net learns to handle it like any other prompt.
Negative prompts. At sampling, the unconditional branch is simply computed with the negative prompt instead of the empty one: ε̂ = ε_neg + w·(ε_cond − ε_neg). The update moves away from the negative concept and toward the prompt at no extra cost, still with two passes per step.
| Mistake | Result |
|---|---|
| dropping the difference: 0.20 + 7.5 × 0.35 | 2.825 |
| dividing by w instead of multiplying | 0.22 |
Dividing by the scale would make a larger w weaker, the opposite of how CFG behaves.
Interview tip: some papers write the same rule as (1 + w)·ε_cond − w·ε_uncond, so "w" differs by 1 between conventions; always check which one a library uses.