Classifier-free guidance (CFG)
Classifier-free guidance, usually called CFG, is a setting in diffusion models that controls how strictly the result follows your prompt, at the price of extra computation.
At each step the model predicts the result both with and without your prompt, and the guidance scale decides how far to push toward the prompted version. A higher scale follows the prompt more closely but can make results look overdone, and every step needs two model passes instead of one.
Distilled models often bake guidance in, which is part of why they are faster. Z-Image Turbo needs no classifier-free guidance, Anima's Turbo version runs at a scale of 1 while the regular version suggests 4 to 5, and the MiniMax H3 checkpoints are CFG-distilled. MOSS-Image defaults to a scale of 3 and skips one layer in the negative branch to save compute. Start from the values on the model card, because a setting that suits one model can spoil another.
Related terms
- Diffusion model A diffusion model generates images or video by starting from random noise and removing the noise step by step until a picture emerges.
- Sampling steps Sampling steps are the number of passes a diffusion model makes to turn noise into an image or video. Fewer steps mean faster results, usually with some loss of detail or variety.
- Distillation Distillation trains a smaller student model to imitate a larger teacher model, keeping much of its ability at a fraction of the size.