AI GLOSSARY · AI CONCEPTS
Classifier-free guidance (CFG)
Definition
Classifier-free guidance is a diffusion-model technique that combines a conditional and an unconditional prediction, so one setting can trade how closely an image follows its prompt against sample diversity, without a separate classifier.
Also called: CFG, CFG scale, guidance scale, CFG Stable Diffusion, classifier-free diffusion guidance.
In plain language
Image generators turn a text prompt into a picture, and most expose a dial often called guidance scale or CFG scale. Turn it down and the model wanders more loosely from your wording. Turn it up and it sticks closer to the prompt, though the Hugging Face guide warns that a value that is too high can show artifacts in the image. The idea comes from a 2022 paper that showed this steering works without a separate classifier. The limit is that no single value is right for every prompt or model, so you have to try settings, and each try generates a new image.
Technical definition
The paper (arXiv 2207.12598) starts from classifier guidance, which combines a diffusion model's score estimate with the gradient of a separately trained image classifier to trade off mode coverage against sample fidelity after training. Classifier-free guidance removes that classifier: a conditional and an unconditional diffusion model are trained jointly, and their score estimates are combined at sampling time to trade sample quality against diversity. Image-generation libraries expose a setting for this kind of control. The Hugging Face Diffusers documentation describes its guidance_scale parameter as affecting how much the prompt influences generation: lower values give more creative, looser images, and higher values follow the prompt more closely.
Worked examples in this catalogue
Catalogue examples point at a skill, guide or coding tool listed on this site, with what to run and what you see. An example marked illustrative describes the item from its own documentation; it was not executed for this page. Platform Scores are our assessment under a published method, not a safety guarantee.
Skill by Skill Almanac · Illustrative, not executed
image-prompt-direction 61/100 · grade CScored · Method v0.2 · How we score
- What you see
- The skill writes image prompts like an art director and lints them for gaps, contradictions and rights problems.
- Why it exercises the concept
- Guidance scale decides how strongly a generator follows the prompt, so a prompt with gaps or contradictions gives the setting less to work with. The skill improves the prompt. It does not set or measure guidance.
Skill by OpenAI · Illustrative, not executed
imagegen 29/100 · Provisional, not yet measuredScored · Method v0.2 · How we score
- What you see
- The skill generates or edits raster images such as mockups, textures and illustrations.
- Why it exercises the concept
- An adjacent example. Whether a given image service exposes a guidance setting depends on that service, and the skill description does not say it does. Check the service's own documentation for the parameter names.
Skill by Skill Almanac · Illustrative, not executed
room-redesign-brief 43/100 · Provisional, not yet measuredScored · Method v0.2 · How we score
- What you see
- The skill writes a room redesign brief, three image-tool prompts and a measure-before-you-buy checklist from measured dimensions and fixed items.
- Why it exercises the concept
- It produces prompts you would feed to an image tool. Running the same prompt at different guidance settings is a way to see the effect described above. The skill does not run a generator.
How it shows up when you use agents
Classifier-free guidance is a setting you meet when you generate images, not when you code. In a hosted image tool it may appear as a slider labelled guidance or CFG. In code, a coding agent writing a script with the Hugging Face Diffusers library would pass a guidance_scale value to the pipeline, which the documentation says affects how much the prompt influences the image. The model behind it is a diffusion model, used for text-to-image generation.
What goes wrong when it is misunderstood: people turn the value up expecting "better" images and get artifacts, which the Hugging Face page warns about for high values. Others change the prompt and the setting at the same time, then cannot tell which one made the difference. A negative prompt is a separate control: the Diffusers page describes it as steering the model away from things you do not want.
Next action: if you ask an agent to generate images, ask it to keep the seed and prompt fixed, vary only the guidance value across a few runs, and save each output next to its settings. That gives you a comparison you can judge by eye. Check that an image service exposes the setting before you plan around it.
Common confusions
- Guidance scale versus the method. Search queries use "guidance scale" and "CFG scale" for the setting. The paper is the source of the method's name, and the Hugging Face page documents the guidance_scale parameter. This entry does not claim every tool implements the setting the same way.
- Classifier guidance versus classifier-free guidance. The paper says classifier guidance needs a separately trained image classifier. The classifier-free version trains a conditional and an unconditional diffusion model jointly instead.
- Guidance scale versus negative prompt. One sets how strongly the prompt influences the image. The other names things to steer away from. They are two parameters in the Diffusers documentation.
- Prompt adherence versus quality. The paper describes a trade-off between quality and diversity. Following the prompt more closely is not the same as a better picture, and this entry makes no quality claim.
- Myth. Higher is better. The Hugging Face page says too high a value can show artifacts.
Related terms
Terms that mention Classifier-free guidance (CFG)
4 terms mention this one
More in AI concepts
Sources
- Classifier-Free Diffusion Guidance, arXiv (accessed 2026-11-24)
- Text-to-image, Hugging Face (Diffusers documentation) (accessed 2026-11-24)
Definitions are written by Skill Almanac from these sources and were checked against them on 2026-11-25. Wikipedia is never the only source.
Review record
Last verified
Drafted by claude-sonnet-5-5; sources and example targets checked by Independent automated source review (OpenAI Codex); not human peer review on 2026-11-25. Last verified .
Change log (4)
- : Independent automated factual/example review completed. Cached US query estimate aligned to receipt; no traffic promise. Final technical gate recorded separately; publication disabled.
- : First version.
- : Verifier pass: applied verifier corrections to wording and claims.
- : Automated review completed; approved for the staged public release. Search indexing is controlled by the release configuration.