CFG

last edited

Classifier-free guidance (CFG) controls how strongly an image follows the prompt. In standard sampling, the model makes two predictions at each denoising step. One is conditioned on the prompt. The other is unconditioned, or conditioned on the negative prompt. The sampler extrapolates past the conditioned prediction by the guidance scale. Guidance-distilled checkpoints skip the unconditional pass.

Guidance ranges

Low values (2-5) stay close to what the model produces on its own. Results are looser and more organic, but follow the prompt less closely. High values (10+) are literal and forceful. Over-amplification shows up as fried colors, waxy skin and burned contrast.

The diffusers guider interface lists a typical range of 1.0 to 20.0. It also exposes a guidance_rescale option, which counters the color distortion that high values cause. Higher values may need more sampler steps to resolve cleanly.

Model differences

The diffusers default for latent diffusion pipelines is 7.5, the usual starting point for SD 1.5. Guidance-distilled checkpoints work differently. FLUX.1 [dev] receives the guidance value as a network input, so it skips the unconditional pass. Diffusers notes that such models only approximate true CFG when the scale is above 1. Its example uses 3.5.

Timestep-distilled models need a scale of 0 in diffusers. FLUX.1 [schnell] is guidance-free. The undistilled variants of FLUX.2 [klein] were trained without guidance distillation and run genuine CFG. The distilled variants run in four steps and do not use it.

Testing and research

A paper posted in August re-evaluated eight training-free CFG-derived methods. They ran on two open rectified-flow transformers. None consistently beat plain CFG on compositional alignment.

A classic diagnostic is a fixed-seed grid sweeping the scale from 1 to 15. It shows an image moving from dreamy to literal to burnt. This is a fast way to learn a new checkpoint's behavior. See core techniques.

Sources

Primary references cover the guidance method, its underlying framework and the library documentation: