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 noise prediction applied at this denoising step
- unconditional prediction with the prompt replaced by an empty placeholder
- conditional prediction shaped by the prompt or control signal
- guidance scale that sets how far the update moves along the prompt direction
- noisy latent or pixel state at denoising step t
- 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.Noisy state x_tUnconditional predictionGuidance directionGuided predictionConditional predictionNoisy state x_t to Unconditional predictionNoisy state x_t to Conditional predictionUnconditional prediction to Guidance directionConditional prediction to Guidance directionGuidance direction to Guided prediction