CFG Scale (Classifier-Free Guidance)

CFG scale, short for classifier-free guidance scale, is the parameter in diffusion image generation that controls how strongly the output is pushed toward matching your text prompt rather than toward the model's unconditional, prompt-free generation distribution. Mechanically it works by extrapolating between two noise predictions at every denoising step — one made with the prompt, one made without it — and the scale value sets how far past the conditional prediction the model extrapolates. That is why it behaves like a prompt-adherence dial rather than a quality dial. Turn it up and the image follows your description more literally; turn it down and the image looks more natural but drifts from what you asked for. The trap is assuming higher is simply better prompt-following with no cost. It is not: very high CFG values commonly produce oversaturated colour, harsh contrast, visible artifacts, and the characteristic 'overcooked' look, along with reduced realism, while very low values quietly drop elements of the prompt entirely. The usable range is also model-specific rather than universal — SDXL-family models are commonly run somewhere in the mid-single digits, while distilled turbo-class variants are designed to operate at a guidance value near 1 and behave poorly if you feed them settings that suit a conventional model. Newer architectures complicate this further: some distilled and flow-matching models effectively bake guidance into the model and neither expose nor need a traditional CFG slider at all, so a preset copied from one generation of models to another is a common source of unexplained quality regressions. CFG has no direct effect on generation cost — you are billed per image regardless — so the only thing at stake is output character. For SaaS builders exposing image generation, the sound approach is to fix a sensible value per model behind the scenes and expose it, if at all, as a small set of named presets rather than a raw number, since the correct range moves whenever you change the underlying model. A useful way to reason about the parameter is that it is doing extrapolation, not selection. The model is not choosing between two candidate images and weighting them; it is pushing past the prompt-conditioned prediction in the direction away from the unconditional one, and pushing past a prediction is exactly the kind of operation that stays well-behaved for a while and then stops. That is why quality does not degrade gracefully as you raise the value — output looks progressively more committed to the prompt, then crosses a threshold and looks broken, with the transition happening over a fairly narrow range. The same mechanism explains why negative prompts interact with it: a negative prompt replaces the unconditional prediction with one conditioned on what you want to avoid, so raising CFG amplifies the push away from those terms too, and a high scale combined with a heavy negative prompt can distort an image as readily as a high scale alone. When you tune, hold the seed, prompt, and step count fixed and move only the guidance value.

Related terms

More Output & Media terms