Anima CFG Rescale
Un-fry your high-CFG output with one slider
- model
- MODEL
Crank CFG up and the image obeys your prompt - and the colors go deep-fried, the contrast turns to burn, and skin loses all subtlety. That's not a coincidence; it's what CFG does. Amplifying cond - uncond every step doesn't just steer the model, it inflates the magnitude of the prediction, and a too-large latent pushes saturation and contrast off a cliff. Anima CFG Rescale is the antidote: after CFG does its thing, it snaps the output's amplitude back to a sane size.
This is the pack author's own tool for the Anima realism fine-tunes he ships, but the trick is model-agnostic. It's the "CFG rescale" trick from the paper Common Diffusion Noise Schedules and Sample Steps are Flawed (arXiv:2305.08891) - the same family as ComfyUI's built-in RescaleCFG node. Fair warning up front: if you already use RescaleCFG in your graphs, this node does basically the same job, and you don't strictly need it. What you get here is one less pack in your workflow and a single rescale knob instead of remembering which input on the core node does what.
What it actually does
After the sampler produces the CFG'd prediction, the node looks at two things: the standard deviation of that output, and the standard deviation of the conditional prediction alone (what the model wanted without CFG inflation). It rescales the CFG output so its std matches the conditional's, then blends by your rescale value:
result = rescale * (denoised * std_cond / std_cfg) + (1 - rescale) * denoised
So the scale of the prediction is normalized while CFG keeps doing the steering. You get the prompt adherence at higher CFG without the oversaturation that usually tags along.
The one input that matters
rescale(default 0.7) - how much of the correction to apply. 0 does nothing; 1 fully normalizes the output's std. The README's recommended range is 0.5–0.7, and 0.7 as a default is a solid starting point.
That's the entire node. One model input, one float, one MODEL output. It's a post_cfg_function patch, so it sits in the post-processing chain rather than replacing the CFG formula - which means it plays nice alongside any of the other realism nodes in this pack.
Checkpoint Loader → Anima CFG Rescale → KSampler
Installing
ComfyUI Manager (search "AnimaDynamicCFG") or:
cd ComfyUI/custom_nodes
git clone https://github.com/DanrisiUA/ComfyUI-AnimaDynamicCFG.git
Restart, and it appears under Anima/sampling. No extra dependencies, no model downloads - it's pure torch.
Gotchas
- It doesn't fix a CFG that's just too low. Rescale normalizes amplitude; it can't manufacture structure that isn't there. If your image is mushy, raise CFG - then let rescale clean up the side effects.
- Over-normalizing washes out contrast. Push
rescaletoward 1 and you trade oversaturation for a flatter, more neutral look. 0.7 is usually the sweet spot; that's why it's the default. - One subtle thing under the hood: this node (and the other post-CFG patches in the pack) registers with
disable_cfg1_optimization, so the unconditional pass gets computed even at CFG 1. On normal workflows that's invisible. It's only a thought if you're on a distilled model that lives at CFG 1 - in which case you're probably not reaching for CFG-taming nodes anyway.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| rescale | FLOAT | 0.700–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |