πŸ“–Glossary

CFG Scale Explained: Mastering AI Image Generation Control

Understand CFG Scale (Classifier-Free Guidance) - the crucial parameter that controls how closely AI follows your prompts. Learn optimal values for different scenarios.

The Most Important Setting You Might Be Ignoring

You've crafted the perfect prompt. The words are precise, the style is defined, you hit generate... and the result is either a blurry mess or a crispy, oversaturated nightmare. What went wrong?

Often, the culprit is CFG Scale – one of the most important yet misunderstood parameters in AI image generation. Understanding this single setting can dramatically improve your results.

What Is CFG Scale?

CFG stands for Classifier-Free Guidance. It's a parameter that controls how strongly the AI follows your text prompt versus generating more "free-form" creative output.

Think of it as a dial between two extremes:

  • Low CFG (1-5): The AI has more creative freedom. Results may drift from your prompt but often look more natural and organic
  • High CFG (15-30): The AI strictly adheres to your prompt. Results match your description closely but may look artificial or oversaturated

A Simple Analogy

Imagine giving instructions to an artist:

  • Low CFG: "Paint me a landscape. Feel free to interpret that however you want."
  • Medium CFG: "Paint me a sunset landscape with mountains. Make sure those elements are there, but you can add your own touches."
  • High CFG: "Paint me exactly this: a sunset landscape with snow-capped mountains, three pine trees on the left, a lake reflecting the orange sky. Every element must be exactly as I describe."

How CFG Scale Works (Technical Explanation)

For those who want to understand the mechanics:

The Denoising Process

AI image generation works by starting with random noise and gradually "denoising" it into an image. At each step, the model makes predictions about what the final image should look like.

Conditional vs. Unconditional

The model actually makes two predictions at each step:

  1. Unconditional prediction: "What would a generic image look like?"
  2. Conditional prediction: "What would an image matching this specific prompt look like?"

The CFG Formula

CFG Scale determines how to blend these predictions:

Final = Unconditional + CFG Γ— (Conditional βˆ’ Unconditional)

  • CFG = 1: Only uses the conditional prediction (prompt-guided but weak)
  • CFG = 7: Strongly pushes toward prompt-matching content
  • CFG = 20: Aggressively enforces prompt adherence (often too much)

Higher CFG means the difference between "what you asked for" and "generic image" is amplified more strongly.

Finding the Sweet Spot

The Common Range: 5-15

Most AI image generators work best in this range. The exact sweet spot depends on:

  • The specific model you're using
  • The complexity of your prompt
  • The style you're targeting
  • Personal preference

Model-Specific Recommendations

Stable Diffusion (SD 1.5, SDXL):

  • General use: 7-8
  • Photorealistic: 5-7
  • Artistic/stylized: 8-12
  • Maximum prompt adherence: 12-15

Flux Models:

  • Flux Schnell: 1-4 (designed for low CFG)
  • Flux Dev: 3-5
  • Flux Pro: 2-4

Midjourney:

  • Uses "stylize" parameter instead (similar concept)
  • Lower = more literal, higher = more artistic

DALL-E:

  • CFG is handled internally, not user-adjustable

Effects of Different CFG Values

Very Low (1-3)

Characteristics:

  • Soft, dreamy quality
  • Colors are muted and natural
  • Prompt adherence is loose
  • May ignore specific details
  • Can feel unfocused or random

When to use:

  • Abstract or surreal art
  • When you want AI creativity
  • Soft, atmospheric images
  • With Flux models (designed for low CFG)

Low-Medium (4-6)

Characteristics:

  • Natural-looking images
  • Good balance of prompt following and creativity
  • Soft lighting, realistic colors
  • Minor details may vary from prompt

When to use:

  • Photorealistic images
  • Portraits and people
  • Natural scenes
  • When realism matters more than precision

Medium (7-9)

Characteristics:

  • Strong prompt adherence
  • Balanced saturation and contrast
  • Clear subject definition
  • Good detail reproduction

When to use:

  • General-purpose generation
  • When you need reliable results
  • Commercial and product images
  • Most Stable Diffusion workflows

Medium-High (10-14)

Characteristics:

  • Very strong prompt adherence
  • Increased saturation
  • Higher contrast
  • Details become more pronounced
  • Starting to look "AI-generated"

When to use:

  • When prompt precision is critical
  • Stylized or graphic art
  • When specific elements must appear
  • Text rendering attempts

High (15-20+)

Characteristics:

  • Maximum prompt adherence
  • Oversaturated colors
  • Harsh, artificial look
  • Artifacts and distortions common
  • "Crispy" or "fried" appearance

When to use:

  • Rarely – usually indicates the prompt needs work instead
  • Specific artistic effects
  • Testing prompt effectiveness
  • Some abstract or glitch art styles

Common Problems and Solutions

Problem: Images Look Blurry or Unfocused

Likely cause: CFG too low

Solution: Increase CFG by 2-3 points. If using Flux, try going from 2 to 4.

Problem: Images Look Oversaturated or Artificial

Likely cause: CFG too high

Solution: Lower CFG by 2-3 points. Most cases do well between 6-8.

Problem: AI Ignores Parts of the Prompt

Likely cause: CFG may be too low, but often the prompt itself needs work

Solution: Try increasing CFG slightly. If that doesn't help, restructure your prompt to emphasize important elements.

Problem: Strange Artifacts or "Deep Fried" Look

Likely cause: CFG significantly too high

Solution: Lower CFG to 7-10 range. The crispy artifacts are a classic sign of excessive guidance.

Problem: Faces Look Distorted

Likely cause: CFG interacting poorly with face generation

Solution: For portraits, lower CFG to 5-7 range. Faces are sensitive to high CFG values.

CFG Scale Strategies

Strategy 1: The Bracketing Approach

When unsure, generate the same prompt at multiple CFG values:

  1. Generate at CFG 5, 7, 9, 11
  2. Compare results
  3. Fine-tune around your favorite

This quickly shows you the optimal range for your specific prompt.

Strategy 2: Match CFG to Content

  • Realistic photos: Lower CFG (5-7)
  • Illustrations: Medium CFG (7-10)
  • Graphic art: Higher CFG (9-12)
  • Abstract: Variable (experiment!)

Strategy 3: Adjust for Prompt Complexity

  • Simple prompts: Can handle lower CFG
  • Complex prompts: May need higher CFG to include all elements
  • Very specific prompts: Higher CFG but watch for artifacts

CFG and Other Parameters

CFG vs. Steps

These interact significantly:

  • Higher CFG often benefits from more steps to resolve details
  • Lower CFG can often use fewer steps without quality loss
  • If increasing CFG, consider increasing steps slightly too

CFG vs. Sampler

Different samplers have different CFG sensitivities:

  • Euler: Standard CFG response
  • DPM++ 2M: Works well with moderate CFG
  • DDIM: Can handle higher CFG with less artifacting

CFG vs. Model

Each model has its own optimal CFG range:

  • Read model documentation for recommendations
  • Custom fine-tuned models may have specific CFG needs
  • When switching models, don't assume your usual CFG will work

Advanced: Dynamic CFG

Some advanced workflows use varying CFG throughout generation:

  • High CFG early: Establishes composition and key elements
  • Lower CFG later: Allows natural detail development

This can produce images that are both prompt-accurate and natural-looking. Tools like ComfyUI support this through custom nodes.

Practical Examples

Portrait Photography

Prompt: "Professional headshot of a business woman, studio lighting, neutral background"

  • CFG 5: Soft, natural lighting, slight prompt variation
  • CFG 7: Clear studio lighting, accurate to prompt
  • CFG 12: Harsh lighting, possibly unnatural skin tones
  • Best choice: 5-7

Fantasy Illustration

Prompt: "Epic dragon perched on a crystal mountain, sunset, fantasy art style"

  • CFG 5: Atmospheric but details may be vague
  • CFG 8: Clear dragon and mountain, good balance
  • CFG 12: Very defined elements, heightened colors
  • Best choice: 7-10

Product Shot

Prompt: "White sneaker on white background, product photography, clean lighting"

  • CFG 5: May not achieve the clean product look
  • CFG 8: Clean, professional appearance
  • CFG 12: Risk of over-sharpening and artifacts
  • Best choice: 7-9

Conclusion

CFG Scale is your most powerful lever for controlling AI image generation quality. Too low and your images drift from your vision; too high and they become artificial and harsh.

The key insights:

  • 7-8 is a safe starting point for most models and prompts
  • Adjust based on content type – realistic = lower, stylized = higher
  • Watch for telltale signs – blurry means too low, crispy means too high
  • Different models have different sweet spots – always check documentation
  • When in doubt, bracket – test multiple values and compare

Master CFG Scale, and you'll have much more control over your AI-generated images. It's the difference between fighting the AI and collaborating with it.

TAGS

Related Articles

← Back to Knowledge Base