CFG is the one KSampler setting that can wreck an image on its own. Set it too low and the picture ignores your prompt. Set it too high and you get burnt colors, crunchy edges and plastic skin.
And with Flux, Z-Image or any turbo model, the “right” CFG is 1.0, which surprises almost everyone the first time.
This guide explains what CFG actually does in ComfyUI (straight from the sampler code), why CFG 1 makes the negative prompt disappear, how FluxGuidance differs from CFG, the best starting values for each popular model, and the extra guidance nodes (CFGGuider, DualCFGGuider, RescaleCFG, APG, CFG-Zero*, NAG) that fix the side effects of high CFG.
- CFG = how hard the sampler pushes toward your prompt and away from the negative. ComfyUI computes
uncond + (cond - uncond) × cfgon every step. - SD 1.5 / SDXL: 5-8 (the KSampler default is 8.0). SD3.5: about 4-5.5. Qwen-Image: 2.5, edit models 4. Wan 2.2 14B: 3.5.
- Flux dev, Flux schnell, Z-Image Turbo, Lightning/turbo LoRAs: CFG 1.0. Control Flux strength with FluxGuidance (3.5 default) instead.
- At CFG 1.0 ComfyUI skips the negative prompt completely and runs about twice as fast. Want negatives on a distilled model? Use the NAGuidance node.
- Burnt or oversaturated images? Lower CFG first, then try RescaleCFG (0.7), APG or CFG-Zero*.
New to ComfyUI? Start with my ComfyUI guide for the basics of nodes and workflows.
What CFG Does in ComfyUI
CFG stands for Classifier-Free Guidance. On every sampling step, the model makes two predictions:
- cond: what the image should look like with your positive prompt.
- uncond: what it would look like with the negative prompt (or an empty prompt).
ComfyUI then combines them in comfy/samplers.py with one line:
cfg_result = uncond_pred + (cond_pred - uncond_pred) * cond_scale
cond_scale is the CFG number on your KSampler. The difference between the two predictions is the “direction” of your prompt. CFG multiplies that direction:
- CFG 1: the result is just the positive prediction. No extra push.
- CFG 7: the prompt direction is amplified 7 times, so the image follows the prompt strongly and moves away from the negative.
- CFG 0: the result is just the negative prediction, which is almost never what you want.
The KSampler’s cfg widget runs from 0.0 to 100.0 in steps of 0.1, with a default of 8.0. ComfyUI’s own tooltip sums it up: higher values match the prompt more closely, but values that are too high hurt quality.
Because each step needs two model passes (positive and negative), a CFG above 1 roughly doubles the work per step compared with CFG 1. That matters a lot for big models like Flux, Qwen-Image or Wan.
Best CFG Values per Model
These starting values come from ComfyUI’s official example workflows (I read the settings straight out of the workflow metadata in the example images) plus each model’s own recommendations. Treat them as a starting point and adjust in small steps.
| Model | KSampler CFG | Other guidance | Notes |
|---|---|---|---|
| SD 1.5 / SDXL | 5-8 (examples use 8.0) | – | Lower (4-6) for photoreal fine-tunes; many anime models like 5-7 |
| SDXL Turbo / SD Turbo / LCM | 1.0-2.0 | – | LCM needs low CFG plus the lcm sampler |
| SD3 / SD3.5 Large | 4.0-5.5 | – | Examples use 4.0-5.45; SD3.5 Large Turbo uses 1.2 at 4 steps |
| Flux.1 dev | 1.0 | FluxGuidance 3.5 | Kontext dev uses guidance 2.5 |
| Flux.1 Fill / Canny | 1.0 | FluxGuidance 30 | Depth LoRA example uses 10 |
| Flux.1 schnell | 1.0 | – | 4 steps, no guidance node needed |
| Flux.2 dev | 1.0 | FluxGuidance 4.0 | From the official Flux.2 example |
| Qwen-Image | 2.5 | ModelSamplingAuraFlow shift 3.1 | Qwen-Image-Edit examples use 4.0 |
| Z-Image Turbo | 1.0 | – | 9 steps in the example |
| Wan 2.2 14B (T2V/I2V) | 3.5 | ModelSamplingSD3 shift 8 | Both high-noise and low-noise passes use 3.5 |
| Wan 2.2 5B | 5.0 | shift 8 | 30 steps, uni_pc sampler |
| Any Lightning / Hyper / turbo LoRA | 1.0 | – | These LoRAs are trained for CFG 1; higher burns the image |
For Flux setup details see how to use Flux in ComfyUI, and for SDXL settings see my ComfyUI SDXL guide.
CFG 1.0: Why the Negative Prompt Stops Working
This is the most common “bug” report about CFG, and it is intentional. In sampling_function, ComfyUI checks whether CFG is 1.0:
if math.isclose(cond_scale, 1.0) and model_options.get("disable_cfg1_optimization", False) == False:
uncond_ = None
When CFG is 1, the formula above gives exactly the positive prediction, so the negative pass would be wasted work. ComfyUI drops it. Two things follow:
- Your negative prompt is ignored. You can type anything into it, and it changes nothing.
- Each step is roughly twice as fast, because only one model pass runs.
That is why distilled models (Flux dev and schnell, Z-Image Turbo, Lightning LoRAs) run at CFG 1: the guidance was “baked in” during training, so they don’t need the second pass.
How to get a negative prompt on a CFG 1 model
- NAGuidance node (Normalized Attention Guidance, built into ComfyUI). Its description says it applies NAG “enabling negative prompts on distilled/schnell models”. Defaults:
nag_scale5.0,nag_alpha0.5,nag_tau1.5. It works inside attention, so you keep CFG at 1. - Raise CFG slightly (for example 1.5-2 on Flux dev). This brings back the negative pass, doubles the time per step, and can shift the style. Some people like it; many don’t.
- Some patch nodes switch the optimization off. Nodes that hook into the CFG step can set
disable_cfg1_optimization, which forces the negative pass even at CFG 1. You’ll notice it as slower steps.
CFG vs FluxGuidance
Flux dev was “guidance distilled”. Instead of running two passes, the model takes a guidance number as an input and imitates what CFG would have done. In ComfyUI that number is set by the FluxGuidance node:
- It sits on the conditioning line (between CLIP Text Encode and the sampler), not on the model.
- Default
guidanceis 3.5, range 0-100. - It costs nothing extra: still one pass per step.
| KSampler CFG | FluxGuidance | |
|---|---|---|
| Works on | All models | Flux dev family, Flux.2 and models trained the same way |
| Cost | 2 passes per step when above 1 | 1 pass per step |
| Uses negative prompt | Yes (when above 1) | No |
| Typical value | 1.0 for Flux | 2.5-4 normal, 30 for Fill/Canny |
Practical tips for Flux:
- Lower guidance (2-3) gives more natural, less “AI glossy” photos and more variety.
- Higher guidance (4-5) follows long prompts and text more strictly but looks more saturated.
- Fill and Canny models expect 30. Using 3.5 there gives weak, washed-out results.
- Schnell ignores guidance, so you can leave the node out.
Too High vs Too Low: What to Look For
| Symptom | Likely cause | Fix |
|---|---|---|
| Burnt, oversaturated colors, harsh contrast | CFG too high | Drop CFG by 1-2; add RescaleCFG |
| Crunchy edges, extra detail noise, “deep fried” look | CFG too high or turbo LoRA at CFG > 1 | Set CFG 1 for turbo/Lightning; lower otherwise |
| Plastic skin, same face every time | CFG high on SDXL/Flux guidance high | SDXL: 4-6; Flux: guidance 2-3 |
| Image ignores half the prompt | CFG too low | Raise CFG by 1; check prompt weighting |
| Muddy, grey, low contrast | CFG too low (or wrong VAE) | Raise CFG; see the VAE guide |
| Negative prompt does nothing | CFG is 1.0 | Expected; use NAGuidance |
| Steps suddenly twice as slow | CFG moved from 1 to above 1 | Expected: second model pass |
CFG and steps interact: a very high CFG with few steps is the fastest way to get burnt images. Samplers react differently too, so retest CFG when you switch sampler. See samplers and schedulers explained for pairings.
Guidance Nodes That Fix High-CFG Problems
All of these are built into ComfyUI (no custom nodes). They patch the model, so you place them between your model loader and the KSampler. Double-click the canvas and search the node name.
| Node | Defaults | What it does | When to use |
|---|---|---|---|
| RescaleCFG | multiplier 0.7 | Rescales the CFG result to tame overexposure | v-prediction models and any model that burns at normal CFG |
| Adaptive Projected Guidance (APG) | eta 1.0, norm_threshold 5.0, momentum 0.0 | Splits guidance into parts and limits the part that causes oversaturation | You want high prompt adherence without burnt colors |
| CFGZeroStar | no settings | CFG-Zero* scaling from the CFG-Zero-star paper | Flow models (Wan, Qwen-Image, SD3.5) with artifacts at normal CFG |
| CFGNorm (experimental) | strength 1.0, pre_cfg off | Keeps the combined result from getting “louder” than the positive prediction | Models that recommend norm-scaled CFG |
| Mahiro | – | Scales more on the positive prompt’s direction than the positive-negative difference | Experiments when negatives push the image too far |
| NAGuidance | scale 5.0, alpha 0.5, tau 1.5 | Negative prompts through attention | Distilled models at CFG 1 |
| PerturbedAttentionGuidance | scale 3.0 | Adds structure guidance on top of CFG | Better structure at lower CFG (SD 1.5/SDXL) |
| SelfAttentionGuidance | scale 0.5, blur_sigma 2.0 | Sharper details via self-attention | SD 1.5/SDXL detail boost |
Note on APG: the tooltip says an eta of 1 gives default CFG behavior, and norm_threshold 0 disables the normalization. Start with the defaults and raise CFG higher than you normally would.
CFGGuider, DualCFGGuider and PerpNegGuider
If you use the advanced sampler setup (SamplerCustomAdvanced), CFG lives in a “guider” node instead of the KSampler:
- BasicGuider: positive conditioning only, no CFG. Same as CFG 1. This is what Flux workflows often use.
- CFGGuider: positive + negative +
cfg(default 8.0). Same math as the KSampler. - DualCFGGuider: three conditionings (positive, a middle one, negative) with two scales,
cfg_condsandcfg_cond2_negative, plus astyleof regular or nested. You normally only need it when a model’s official workflow uses it. - PerpNegGuider: uses an extra empty conditioning so a negative prompt removes a concept without dragging the whole image away from the positive prompt. Settings:
cfg(8.0) andneg_scale(1.0).
My KSampler Advanced guide covers when to switch to the custom sampler nodes.
How to Find the Best CFG for Your Model
- Fix the seed. Set
control_after_generateto fixed so only CFG changes. (Details in my seed guide.) - Start at the table value for your model.
- Run 3-4 values around it, for example 4, 5.5, 7 and 8.5 on SDXL, or guidance 2.5, 3.5 and 4.5 on Flux.
- Compare side by side. Pick the lowest CFG that still follows the prompt. Lower CFG usually looks more natural.
- Check the model page. Fine-tunes and LoRAs often list their own CFG. A LoRA trained for CFG 1 will look wrong at 7.
To test many values in one queue, a custom node pack with an XY plot helps, or simply duplicate the KSampler a few times with the same seed.
If you want speed, CFG 1 on a distilled model is one of the biggest wins. See how to speed up ComfyUI for more.
FAQ
What is a good CFG in ComfyUI?
For SD 1.5 and SDXL, 5-8. For SD3.5, about 4-5.5. For Qwen-Image, 2.5. For Wan 2.2 14B, 3.5. For Flux, Z-Image Turbo and any turbo or Lightning model, 1.0.
Why is my negative prompt not working in ComfyUI?
Your CFG is 1.0. ComfyUI skips the negative pass at CFG 1 because it would have no effect on the math. Raise CFG above 1 or use the NAGuidance node on distilled models.
What CFG should I use for Flux?
Keep the KSampler CFG at 1.0 and use the FluxGuidance node instead: 3.5 for Flux dev, 2.5 for Kontext dev, 30 for Fill and Canny. Schnell needs no guidance.
Is FluxGuidance the same as CFG?
No. CFG runs two model passes and mixes them. FluxGuidance feeds a number into the model, which was trained to imitate CFG, so it costs only one pass and doesn’t use a negative prompt.
Why are my images burnt or oversaturated?
CFG is too high for that model, or you are using a turbo or Lightning LoRA above CFG 1. Lower CFG first. If you still want strong prompt adherence, add RescaleCFG, APG or CFGZeroStar.
Does CFG change generation speed?
Yes. Any CFG above 1 needs two model passes per step, so it is roughly twice as slow as CFG 1. The exact value above 1 (2 or 8) doesn’t change speed.
What does CFG 0 do?
It returns only the negative (unconditional) prediction, so your positive prompt is ignored. It is not useful for normal generation.
Can I use a different CFG for each step?
Yes. Split sampling across two KSampler Advanced nodes with different CFG values (high CFG early for composition, low CFG later for detail), the same way Wan 2.2 splits high-noise and low-noise passes.
Sources
- ComfyUI source: comfy/samplers.py (cfg_function formula, CFG 1 optimization)
- ComfyUI source: nodes.py (KSampler cfg range, default and tooltip)
- ComfyUI source: nodes_flux.py (FluxGuidance default 3.5)
- ComfyUI source: nodes_cfg.py (CFGZeroStar, CFGNorm), nodes_apg.py, nodes_nag.py, nodes_custom_sampler.py (guiders)
- ComfyUI_examples (CFG and guidance values read from the Flux, Flux.2, SD3, SDXL, Qwen-Image, Z-Image and Wan 2.2 example workflows)
- CFG-Zero* paper code




