Multimodal Models·Question 14 of 67Intermediate

Explain classifier-free guidance. What actually happens when you turn the scale up?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Classifier-free guidance (CFG) is the trick that makes conditional diffusion actually obey the prompt. During training, the text condition is randomly dropped (replaced with a null/empty embedding) ~10-20% of the time, so a single network learns both conditional denoising ("what does this noisy image look like given this caption") and unconditional denoising ("what does a generic image look like"). At sampling time you run both predictions and extrapolate:

pred = eps_uncond + s * (eps_cond - eps_uncond)   # s = guidance scale
Full worked answer with diagram

Classifier-free guidance (CFG) is the trick that makes conditional diffusion actually obey the prompt. During training, the text condition is randomly dropped (replaced with a null/empty embedding) ~10-20% of the time, so a single network learns both conditional denoising ("what does this noisy image look like given this caption") and unconditional denoising ("what does a generic image look like"). At sampling time you run both predictions and extrapolate:

pred = eps_uncond + s * (eps_cond - eps_uncond)   # s = guidance scale

The vector (eps_cond - eps_uncond) isolates the direction in which the prompt changes the prediction; multiplying by s > 1 exaggerates exactly that component. It replaced classifier guidance, which needed a separate noise-robust classifier and its gradients - CFG gets the same effect from the generative model itself, which is why it's "classifier-free."

Effects of the scale: s = 1 is pure conditional sampling - prompt adherence is mediocre because the condition only weakly shifts the prediction. Typical operating range for SD-1.5-era models was ~5-9, and newer flow-matching models tend to run lower. As you push higher: prompt adherence and apparent sharpness improve, but diversity collapses (samples converge toward a prompt-archetype), colours oversaturate, contrast blows out, and anatomical/geometric artifacts appear - you're extrapolating outside the distribution the model was trained to denoise. Practical costs and consequences worth naming: CFG doubles compute per sampling step (two forward passes, usually batched); negative prompts are just replacing the unconditional branch's null embedding with an "away-from-this" condition, so the extrapolation points away from the negative; and distilled few-step models often bake guidance in during distillation, which is why turbo-style models expose no meaningful CFG knob.

Worth sketching. Two branches per step is the detail people miss, and it explains both the doubled cost and how negative prompts slot in.

flowchart LR
    A["Noisy latent at step t"] --> B["Pass 1: with the prompt"]
    A --> C["Pass 2: null or negative prompt"]
    B --> D["eps_cond"]
    C --> E["eps_uncond"]
    D --> F["eps_uncond + s x difference,<br/>two forward passes per step"]
    E --> F

What a good answer covers

  • Classifier-free guidance (CFG) is the trick that makes conditional diffusion actually obey the prompt
  • During training, the text condition is randomly dropped (replaced with a null/empty embedding) ~10-20%…
  • The vector (eps_cond - eps_uncond) isolates the direction in which the prompt changes the prediction;…
  • It replaced classifier guidance, which needed a separate noise-robust classifier and its gradients - CFG…
  • Effects of the scale: s = 1 is pure conditional sampling - prompt adherence is mediocre because the…

Key terms: conditional · unconditional · diversity collapses · doubles compute per sampling step · negative prompts

Interviewer follow-ups to expect

  1. Why does high guidance hurt diversity specifically?

  2. How do negative prompts work mechanically?

  3. Why do guidance-distilled models generate at CFG ≈ 1?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep