Concepts

Classifier-free guidance

Quick explainer2 min readAdvanced

Classifier-free guidance is a trick in image generators that makes pictures follow the prompt more closely, at the cost of some variety.

In plain words

A diffusion model builds an image by removing noise step by step. With classifier-free guidance, the same model is trained both with and without the prompt. At each step it makes both predictions and pushes the result further towards the prompted one. A setting often called the guidance scale controls how hard it pushes: higher values stick closer to the prompt, but too high can add visual glitches.

A quick example

In the Hugging Face diffusers library you pass guidance_scale when generating an image. A low value lets the image drift loosely from the prompt; a higher value keeps it closer to what you asked for.

Where you'll meet it

  • Text-to-image models such as Stable Diffusion.
  • The guidance or CFG scale setting in image tools.

Related

Sources

  1. PaperClassifier-Free Diffusion Guidance, Ho and Salimans (arXiv) · read 29 Sept 2026
  2. DocsText-to-image: guidance scale, Hugging Face Diffusers docs · read 29 Sept 2026

Checked by WhatIsAI against the sources above · 29 Sept 2026. Spotted an error? Report it.