SDXL Classifier-Free Guidance (CFG)
Comprehensive Calibration Guide, Syntax & Recommended Values
Controls how aggressively the U-Net latent diffusion denoising steps follow the positive text prompt versus unconditioned generation.
How SDXL Classifier-Free Guidance (CFG) Operates Internally
Classifier-Free Guidance (CFG) in SDXL measures how far the diffusion generation is pushed toward the positive conditioning vector away from the unconditioned (negative) vector at each inference step. A CFG of 5.5 to 7.0 is universally recognized as the sweet spot for photorealism. Values below 4 lead to washed-out dreamscapes; values above 10 result in fried, oversaturated neon artifacts.
Recommended Value Calibration Matrix
| Setting / Syntax | Target Scenario | Visual Result & Impact |
|---|---|---|
| CFG: 5.0 - 6.0 | Realistic Human Skin & Soft Light | Subtle gradients, gentle skin tones, zero digital edge clipping. |
| CFG: 7.0 | Balanced Default | Strong prompt adherence, crisp edges, balanced contrast. |
| CFG: 10.0+ | Stylized Graphic Art / 3D Render | Deep punchy shadows and saturated highlights (avoid for human portraits). |
Common Mistakes & Syntax Errors
- •Setting CFG too high (>9) to 'force' a missing prompt detail—instead, increase inference steps or rephrase the prompt.
- •Using high CFG with DPM++ 2M SDE Karras samplers, which naturally increase contrast.
Production Prompt Examples
Ready to experiment with CFG Scale?
Launch the Visual Prompt Compiler to test real-world camera optics, lighting, and parameters in real time.
SDXL Classifier-Free Guidance (CFG) Frequently Asked Questions
How does inference step count affect CFG in SDXL?
Higher CFG scales require slightly more inference steps (35–45) to resolve fine details. Low CFG (5.0) converges smoothly in as few as 25–30 steps.