Nodes/AnimateDiff Evolved/CFG Extrasβ—†PAG πŸŽ­πŸ…πŸ…“
ComfyUI Node Runs on cloud

CFG Extrasβ—†PAG πŸŽ­πŸ…πŸ…“

PAG for AnimateDiff

By KosinkadinkΒ·Created 3 years agoΒ·Updated 9 days agoΒ· 3,519
CFG Extrasβ—†PAG πŸŽ­πŸ…πŸ…“
  • prev_extras
  • CFG_EXTRAS
β—„scale3.0β–Ί

PAG stands for Perturbed-Attention Guidance - a guidance technique that improves sample quality by deliberately perturbing the model's self-attention maps mid-sampling and using the difference between the normal and perturbed prediction as an extra steering signal, layered on top of (or sometimes instead of leaning on) regular CFG. Unlike classifier-free guidance, it doesn't strictly need a negative prompt to have an effect - it's generating its own contrast signal from the model's own attention behavior. It shipped in ComfyUI core as its own sampling technique, and this node is AnimateDiff-Evolved's version of it, wired to plug into the pack's own CFG Extras chain.

The one input that matters

  • scale - how strongly the PAG signal steers generation, 0 to 100, default 3. This works similarly in spirit to CFG scale itself: higher pushes harder toward whatever PAG is correcting for (often sharper, more coherent detail), and going too high can introduce its own artifacts, the same way over-cranked CFG does. Start near the default and adjust in small steps rather than jumping straight to a high number.
  • prev_extras (optional) - chains another CFG_EXTRAS node (like CFG Extrasβ—†RescaleCFG) so you can combine multiple CFG modifications in one pass.

Output is CFG_EXTRAS, feeding into Custom CFG's cfg_extras input, which then feeds Sample Settings.

How to install it

Ships with the base pack.

  • ComfyUI Manager - search AnimateDiff Evolved by Kosinkadink, install, restart.
  • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved, restart.

Common issues & troubleshooting

You wired it in and see no change. Same wiring requirement as every other CFG Extras node: its output has to reach Custom CFG, and Custom CFG has to feed Sample Settings, which has to actually be connected into the model chain you're sampling with. It's inert sitting off to the side.

Combining PAG and RescaleCFG at once. Chain them through prev_extras - one CFG Extras node feeds the next, and both land in the same CFG_EXTRAS value going into Custom CFG. They address different problems (RescaleCFG corrects overexposure from high CFG; PAG adds an attention-based sharpening/coherence signal) and there's no conflict running both, but as always, more knobs means more to tune - introduce them one at a time so you know which one is doing what to your output.

This is a genuinely deep-cut corner of the pack - expect thin documentation. PAG inside AnimateDiff-Evolved specifically doesn't have much community writeup floating around; most PAG discussion out there is about still-image workflows, not animation. Treat the default scale as your starting point and adjust by eye rather than expecting a well-worn recipe.

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

Inputs (2)

NameTypeDefaultDescription
scaleFLOAT3.00–100β€”
prev_extrasoptCFG_EXTRASβ€”

Outputs (1)

NameTypeDescription
CFG_EXTRASCFG_EXTRASβ€”