Nodes/AnimateDiff Evolved/Custom CFG [Multival] πŸŽ­πŸ…πŸ…“
ComfyUI Node Runs on cloud

Custom CFG [Multival] πŸŽ­πŸ…πŸ…“

Override the sampler's CFG with a schedule or a mask

By KosinkadinkΒ·Created 3 years agoΒ·Updated 8 days agoΒ· 3,520
Custom CFG [Multival] πŸŽ­πŸ…πŸ…“
  • cfg_multival
  • cfg_extras
  • CUSTOM_CFG

Normal CFG is one flat number for the entire render, set once on your KSampler. Custom CFG is AnimateDiff-Evolved's way of breaking that: instead of a single value, it lets a whole schedule - different CFG at different points in the sampling process, or even different CFG across the frame - override the sampler's own CFG widget entirely.

What it does

cfg_multival (required) is a MULTIVAL, which in this pack's convention means it accepts a plain float, a list of per-frame floats, or a mask - so the value driving CFG doesn't have to be a single number applied uniformly. cfg_extras (optional) is an escape hatch for additional CFG behavior from elsewhere in the pack; it's not something you need for a first pass, and there's no dedicated node for it among the pack's headline features, so leave it unplugged unless you have a specific reason to use it. Output is CUSTOM_CFG, which plugs into AnimateDiff-Evolved's Sample Settings node to actually override the sampler.

Why you'd want this over just typing a CFG number

The real answer showed up, almost word for word, in a r/comfyui thread from someone coming from Deforum asking whether AnimateDiff could keyframe CFG the way Deforum keyframes settings across a render. The reply: "AnimateDiff-Evolved lets you set a custom CFG schedule through the Sampling Settings node and adjust many other parameters." That's the use case in one sentence. A flat CFG works fine for a short clip. Once you're running a longer animation, there's a real case for starting CFG higher to lock in strong prompt adherence and composition early, then easing it down for the back half so later frames don't over-sharpen or burn - the same "CFG too high produces oversaturated, artifacted images" problem that applies to any SD 1.5 generation, just applied per-stretch of a video instead of as one flat setting for the whole thing.

Installing it

ComfyUI Manager: search AnimateDiff Evolved, author Kosinkadink, install, restart. Manually: git clone https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved into custom_nodes, restart. No model download for this node specifically - it needs whatever motion module your broader AnimateDiff workflow is already using.

Common issues

This node alone doesn't do anything without a Sample Settings node downstream to actually apply it - if you've wired cfg_multival and nothing about your CFG behavior changes, check that CUSTOM_CFG is actually reaching Sample Settings, and that Sample Settings itself is wired into your AnimateDiff model apply node. And since cfg_multival accepts a mask as well as a float, it's easy to accidentally wire in a mask meant for something else in a busy graph - if your CFG behavior looks bizarre rather than simply wrong, double-check what's actually feeding this input.

CategoryAnimate Diff πŸŽ­πŸ…πŸ…“/sample settings/custom cfg

Inputs (2)

NameTypeDefaultDescription
cfg_multivalMULTIVALβ€”
cfg_extrasoptCFG_EXTRASβ€”

Outputs (1)

NameTypeDescription
CUSTOM_CFGCUSTOM_CFGβ€”