Skip to main content
Parameter ReferenceCFG ScaleStable Diffusion XL

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.

Parameter Flag
CFG Scale
Default Setting
7.0
Allowed Range
1.0 to 20.0 (Optimal: 5.0 to 8.0)
Target Architecture
Stable Diffusion XL
Standard Command Syntax
CFG: <1.0 - 20.0>

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 / SyntaxTarget ScenarioVisual Result & Impact
CFG: 5.0 - 6.0Realistic Human Skin & Soft LightSubtle gradients, gentle skin tones, zero digital edge clipping.
CFG: 7.0Balanced DefaultStrong prompt adherence, crisp edges, balanced contrast.
CFG: 10.0+Stylized Graphic Art / 3D RenderDeep 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

Positive: RAW photo of an elderly craftsman, natural window lighting, 8k, masterpiece. Negative: blurry, bad anatomy. Parameters: CFG: 6.0, Steps: 30, Sampler: DPM++ 2M Karras

Ready to experiment with CFG Scale?

Launch the Visual Prompt Compiler to test real-world camera optics, lighting, and parameters in real time.

Test in Compiler Studio

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.