Nodes/ComfyUI-AnimaDynamicCFG/Anima Adaptive CFG
ComfyUI Node

Anima Adaptive CFG

The CFG node that watches how hard your model is pushing

By DanrisiUA·Created 3 months ago·Updated 3 months ago· 5
Anima Adaptive CFG
  • model
  • MODEL
cfg_base5.0
min_cfg2.0
max_cfg15.0
adaptation_strength0.50
target_divergence1.00

Here's the frustration this whole pack exists for. You're running a realism fine-tune of Anima and you've parked CFG at 5, its sweet spot. Most steps are fine - then the model spends a few steps really leaning into its anime prior, and the skin goes flat and stylized again. A static CFG can't tell "steering confidently" from "fighting you." Anima Adaptive CFG can, because it reads the tension at every step and nudges CFG in response.

It comes from the same author (Danrisi, on GitHub as DanrisiUA) who trained the UltraReal realism fine-tune of Anima, and it shows: this is a tool built from the pain of watching an anime base refuse to look like a photo.

The idea: divergence as a stress gauge

Every CFG step runs the model twice - once with your prompt, once without. The gap between those two predictions (cond - uncond) is the model telling you how strongly it's committing. Big divergence means it's pushing hard toward whatever it knows (on an anime base, that's the anime look). Small divergence means it's drifting and structure is at risk.

The node measures that gap each step, then scales CFG from a baseline:

effective_cfg = cfg_base * (target_divergence / actual_divergence) ^ adaptation_strength

Divergence running hot, above your target? CFG drops. Divergence cold? CFG climbs back up to keep the prompt in charge. The result is clamped into min_cfgmax_cfg so it can't run away.

The inputs that matter

You'll mostly touch two of them:

  • adaptation_strength (default 0.5) - how reactive the node is. At 0 it's just a fixed cfg_base. At 1 it responds fully to divergence. 0.5 is a sensible middle.
  • target_divergence (default 1.0) - the "normal" reference point. There's no universal right value because divergence magnitude scales with resolution and sampler; this is your calibration knob, not a physics constant.

cfg_base (5), min_cfg (2) and max_cfg (15) draw the box the adaptive value lives in. min_cfg is your safety valve - if output ever collapses into mush, raise it.

Wiring it in

It's a model patch like every node in this pack: MODEL in, MODEL out, one connection between your checkpoint loader and your sampler.

Checkpoint Loader → Anima Adaptive CFG → KSampler

One thing that trips people up: this node replaces ComfyUI's CFG formula, so the CFG field on your KSampler is ignored. Change it all you like; nothing happens. That's expected, not a bug.

Installing

Grab it via ComfyUI Manager (search "AnimaDynamicCFG") or clone it in:

cd ComfyUI/custom_nodes
git clone https://github.com/DanrisiUA/ComfyUI-AnimaDynamicCFG.git

Then restart ComfyUI. It shows up under Anima/sampling. There's no requirements.txt and nothing to download - the whole pack is torch and math, so it won't fight any of your other nodes for dependencies.

Gotchas

  • Don't chain it after Anima CFG Schedule. Both replace the same sampler_cfg_function hook; the last one wins and silently clobbers the first. If you want schedule and adaptive, that's what Anima CFG Schedule (Advanced) is for - one node that does both internally.
  • Tune target_divergence first. If the node is basically never moving CFG, your target is set so high the model rarely exceeds it. Lower it until you see movement.
  • The CFG-family nodes want real CFG territory. On a distilled checkpoint running at CFG 1, adaptive guidance is meaningless - that's the Turbo regime, and it's baked in.
CategoryAnima/sampling

Inputs (6)

NameTypeDefaultDescription
modelMODEL
cfg_baseFLOAT5.00–100
min_cfgFLOAT2.00–100
max_cfgFLOAT15.00–100
adaptation_strengthFLOAT0.500–1
target_divergenceFLOAT1.000.01–100

Outputs (1)

NameTypeDescription
MODELMODEL