CFG ExtrasβPAG ππ π
PAG for AnimateDiff
- prev_extras
- CFG_EXTRAS
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 anotherCFG_EXTRASnode (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.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| scale | FLOAT | 3.00β100 | β |
| prev_extrasopt | CFG_EXTRAS | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CFG_EXTRAS | CFG_EXTRAS | β |