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

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

One point in a hand-built CFG schedule

By KosinkadinkΒ·Created 3 years agoΒ·Updated 8 days agoΒ· 3,519
Custom CFG Keyframe [Multival] πŸŽ­πŸ…πŸ…“
  • cfg_multival
  • prev_custom_cfg
  • cfg_extras
  • CUSTOM_CFG
β—„start_percent0.000β–Ί
β—„guarantee_steps1β–Ί

Custom CFG's root node takes one MULTIVAL for the whole render. This node is how you actually build a schedule out of that - one point at a time, chained together, the same pattern used across every scheduling family in this pack.

What it does

cfg_multival (required) is the CFG value at this point in the schedule - same Multival flexibility as the root node: float, list, or mask. start_percent (required, default 0) is where in the sampling process this keyframe takes over. guarantee_steps (required, default 1) is the floor - this keyframe is guaranteed to run for at least that many steps even if another one is scheduled to take over right after it. prev_custom_cfg (optional) chains this onto an earlier Custom CFG Keyframe to build a multi-point schedule. cfg_extras (optional) is the same escape hatch as the root node's - leave it alone unless you have a specific reason to use it.

Output is CUSTOM_CFG, exactly the same type as the root node's output - chain enough of these and feed the last one straight into Sample Settings the same way you'd feed the root node.

The workflow this exists for

This is literally what a r/comfyui poster asked for when coming from Deforum-style A1111 workflows - the ability to keyframe CFG, and other settings, across a render the way Deforum keyframes them across a single-image generation's steps. A concrete, common shape: start at CFG 8–9 for the first stretch of steps to lock composition and prompt adherence, then drop to something like 4–5 for the remainder so later steps refine detail without pushing into the oversaturated, artifacted look CFG values much above 9 tend to produce.

A concrete example

A common two-point schedule: one keyframe at start_percent 0 with cfg_multival around 8-9 and guarantee_steps set high enough to cover the opening stretch of steps you want locked at that value, chained via prev_custom_cfg into a second keyframe at start_percent around 0.4 dropping cfg_multival down to 4-5 for the remainder. That mirrors the CFG-taper pattern from general SD 1.5 guidance - strong prompt adherence early, less risk of burning detail late - just expressed as an explicit schedule instead of a single flat number.

Installing it

ComfyUI Manager: search AnimateDiff Evolved, author Kosinkadink, install, restart. Or git clone https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved into custom_nodes and restart manually.

Common issues

Same ordering rule as every other keyframe-chain node in this pack: start_percent values need to ascend as you walk the prev_custom_cfg chain. Get that wrong and the schedule silently does something other than what you intended, rather than obviously failing - worth double-checking before a long render, since this particular node has no print_keyframes-style output to sanity-check the chain visually (that's what its List and Interpolation siblings offer).

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

Inputs (5)

NameTypeDefaultDescription
cfg_multivalMULTIVALβ€”
start_percentFLOAT0.0000–1β€”
guarantee_stepsINT10–9007199254740991β€”
prev_custom_cfgoptCUSTOM_CFGβ€”
cfg_extrasoptCFG_EXTRASβ€”

Outputs (1)

NameTypeDescription
CUSTOM_CFGCUSTOM_CFGβ€”