Classifier-Free Diffusion Guidance (CFG)

Prior to this, see Diffusion Models Beat GANs on Image Synthesis where they used classifier guidance to condition diffusion models on text.

Combine conditional and unconditional estimates.

  • — model’s prediction of the clean sample (or noise) conditioned on
    (the conditioning signal, e.g., action, text, or latent control input)
  • — model’s unconditional prediction (no conditioning)
  • — guidance weight or scale (often denoted in Ho & Salimans 2021)
  • — the current latent (noisy sample) at noise level

The core of this technique

Classifier-Free Guidance increases controllability by amplifying the difference between the model’s conditional and unconditional predictions during denoising.

https://getimg.ai/guides/interactive-guide-to-stable-diffusion-guidance-scale-parameter “CFG Scale parameter”

But like, why not just always do conditioning?

If my model already takes the condition , why do I need this classifier-free guidance trick at all? Why not just trust the network’s conditional output?

Like the issue is that might entirely ignore . The loss we minimize is .

But with CFG, what we do is first detect how much it actually changes the prediction:

Then we rescale that difference:

If , this artificially amplifies the conditional influence.

It’s a post-hoc correction that compensates for the model’s tendency to ignore the condition under the plain MSE training objective.

💡 Intuition

The equation blends the conditional and unconditional predictions:

  • → unconditional generation (no conditioning influence)
  • → normal conditional generation
  • → stronger conditioning effect (e.g., tighter action or prompt adherence)