ComfyUI Node Runs on cloud

Automatic CFG

The anti-burn sampler patch that rescales CFG on every step

By Extraltodeus·Created 3 years ago·Updated 24 days ago· 428
Automatic CFG
  • model
  • MODEL
hard_modetrue
boosttrue

It's the 2024 SDXL problem in one node: you crank CFG up for prompt adherence and the image comes out deep-fried - blown-out colors, crushed contrast, faces turning to wax. The classic fix is to babysit the CFG slider and reroll. Automatic CFG instead rewrites what the slider means, rescaling the effective guidance at every single denoising step so the output lands at a target intensity instead of whatever runaway value your fixed CFG produced. Set your sampler's CFG to 8 and let the node handle the rest.

Worth knowing before you get attached: this is a 2024-era SD 1.5/SDXL tool, and the author has since moved on - the README opens with "Abandon this boat and jump on this one!" pointing at his newer Skimmed_CFG. It still works fine, but don't expect active development here.

How it works

Normal CFG computes uncond + (cond - uncond) * scale with one fixed scale for the whole render. That's the burn problem: one number can't be right for the noisy start and the detail-polishing end. Automatic CFG replaces that function with one that, each step, looks at the model's denoised prediction, measures its dynamic range (the mean of the top and bottom 25% of values - a topk average), and rescales so each channel hits a target intensity. It's per-batch, per-channel, and it changes every step.

Your CFG box stops being CFG. It becomes the reference around which the rescaling works - 8 is the center, so 4 aims at half the target range and 16 at double. The author's own observation is the effective scale wanders from ~16 near the start to ~4 mid-render and settles near 7 at the end. That self-correcting arc is the whole trick: it starts strong to lock composition, then backs off before it burns the details.

The boost toggle is the other half: it turns off the negative pass once sigma drops below ~1, in the tail of sampling where the image is nearly finished. Skipping the unconditioned pass there is a real speed win, and it's the same trick the Warp Drive node scales up to cut render time by a claimed ~160% average.

The inputs that matter

Only three, and you only need to touch one.

  • model - the MODEL you'd normally feed into your KSampler. Wire the output into the KSampler's model input.
  • hard_mode - toggles between the "hard" and "soft" ways the node measures the prediction's dynamic range each step. Default on, and the setting the author actually tests with.
  • boost - on by default. Disables the negative pass in the low-sigma tail; off if you want full negative guidance for the whole render.

Output is a single patched MODEL. That's it - no latent, no text, just a drop-in replacement for the model line between your checkpoint and KSampler. Set CFG to 8 on the sampler and press go.

Install

Via ComfyUI Manager (search "ComfyUI-AutomaticCFG"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/Extraltodeus/ComfyUI-AutomaticCFG

Then restart ComfyUI. The only dependency is colorama - no model files, no huge wheels. (This clone's requirements.txt contains just that one line.)

Gotchas worth knowing

  • Update ComfyUI if things break. This pack monkey-patches ComfyUI's global sampling function. Back in 2024 there were reports of black images even on workflows that never touched the node - the pack was just installed and the patch had gone stale. The README's answer is blunt: "If you get an error: update your ComfyUI." If a workflow starts producing black output right after installing this, that's the first suspect.
  • Your CFG habits lie to you. Don't treat 7 as 7 anymore - it's an intensity dial with a reference of 8. Lower values than you're used to (even 4) give genuinely nice, non-burned results.
  • This is not a Flux-era tool. It's aimed at models that run live classifier-free guidance (SD 1.5, SDXL, PixArt Sigma). Guidance-distilled models that want CFG at 1 have nothing for this node to rescale - the CFG-panel rule "distilled means leave it at 1" applies. SD3 works only if you avoid the boost/skip-uncond path.

People still reach for this because "no more burns" is a genuinely nice quality of life on SDXL, and it makes the CFG slider forgiving instead of a landmine. Just understand you're adopting a 2024 solution with a 2026 ecosystem, and check Skimmed_CFG before you commit.

Categorymodel_patches/Automatic_CFG/presets

Inputs (3)

NameTypeDefaultDescription
modelMODEL
hard_modeBOOLEANtrue
boostBOOLEANtrue

Outputs (1)

NameTypeDescription
MODELMODEL