Classifier-Free Guidance

A diffusion inference technique that steers denoising by comparing prompt-conditioned and prompt-free predictions, then blending them with a guidance scale.

Classifier-free guidance steers diffusion denoising by comparing what the model predicts when a prompt is present against what it predicts when the prompt is dropped, then nudging each step along that difference.

What It Is

At each denoising step the model can emit two predictions over the same noisy state: a conditional prediction shaped by the prompt embedding or other control signal, and an unconditional prediction produced when that signal is replaced by a learned null or empty placeholder. Classifier-free guidance takes the gap between those two outputs—the direction the prompt pulls the update—and mixes it back with the unconditional baseline using a guidance scale. A scale of one returns only the conditional path; higher values push further along the prompt direction.

Why It Matters

Prompt-driven diffusion models already learn to denoise with conditioning, but the conditional and unconditional paths can stay close during sampling. Classifier-free guidance amplifies how much each step follows the prompt without training a separate classifier network at inference time. That makes text prompts visibly steer image or latent updates in systems where users expect the output to track what they typed.

Simple Example

A latent diffusion image model encodes the text prompt "a red bicycle" into a CLIP-style embedding for the conditional pass. For the unconditional pass it feeds a learned empty-prompt token instead. At step twenty of fifty, the denoiser outputs both noise predictions on the same latent grid. Classifier-free guidance blends the unconditional prediction with the conditional-minus-unconditional gap scaled by the user guidance setting, then applies that guided update before the next denoising step.

Where It Appears

Classifier-free guidance is a standard knob in prompt-driven diffusion systems, including latent diffusion text-to-image pipelines where denoising runs in a compressed latent space before a decoder returns pixels. Conditioning pages describe how prompts attach to each step; denoising generation and diffusion model pages describe the iterative loop that consumes these guided updates.

Guidance Scale

The guidance scale sets how far each denoising step moves along the prompt direction. At low values near one, the guided update stays close to the conditional path, so prompt steering is weak and outputs may drift from what was typed. Moderate values—often in the single digits to low teens in common image settings—usually strengthen prompt adherence without pushing every step to an extreme. High values amplify the conditional-minus-unconditional gap, which can make layouts and objects track the prompt more tightly but also increases the risk that the sampler overcommits to prompt features. The blend below names the symbols used at each step.
Guided prediction blend
ϵ^θ=ϵθ(xt,∅)+w⋅(ϵθ(xt,c)−ϵθ(xt,∅))\hat{\epsilon}_\theta = \epsilon_\theta(x_t, \varnothing) + w \cdot \left(\epsilon_\theta(x_t, c) - \epsilon_\theta(x_t, \varnothing)\right)
ϵ^θ\hat{\epsilon}_\theta
guided noise prediction applied at this denoising step
ϵθ(xt,∅)\epsilon_\theta(x_t, \varnothing)
unconditional prediction with the prompt replaced by an empty placeholder
ϵθ(xt,c)\epsilon_\theta(x_t, c)
conditional prediction shaped by the prompt or control signal
ww
guidance scale that sets how far the update moves along the prompt direction
xtx_t
noisy latent or pixel state at denoising step t
cc
prompt conditioning such as a text embedding

Tradeoffs

Guidance scale is a steering control, not a quality dial. Turning it up can make repeated samples look more alike because each step is pulled harder toward the same prompt features, which reduces visible diversity across runs. Very high settings can also produce oversaturated colors, harsh contrast, or unnatural textures when the model is forced past the range it saw during training. Moderate guidance often improves prompt adherence on the first try, but the best value depends on the model, scheduler, and how much variety you want. The diagram below shows how unconditional and conditional predictions combine into one guided update.
Classifier-free guidance compares prompt-free and prompt-conditioned predictions, forms a guidance direction from their difference, and blends it with the unconditional baseline using the guidance scale.

Common Confusions

Classifier-free guidance is not the older classifier guidance method that required a separate image classifier to score each denoising step. The name reflects dropping that extra classifier while still steering generation. It is also not fine-tuning: weights stay fixed and the guidance scale is a runtime control. Turning guidance up can strengthen prompt adherence, but it is not a guarantee of higher image quality on every sample.

Tags

References

  1. Ho, Jonathan, and Tim Salimans. "Classifier-Free Diffusion Guidance." arXiv, 2022, https://arxiv.org/abs/2207.12598.