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

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

Perturbed-Attention Guidance for AnimateDiff's sample settings

By KosinkadinkΒ·Created 3 years agoΒ·Updated 8 days agoΒ· 3,519
CFG Extrasβ—†PAG [Multival] πŸŽ­πŸ…πŸ…“
  • scale_multival
  • prev_extras
  • CFG_EXTRAS

Cranking CFG higher usually buys you more prompt adherence and costs you saturation and burnt, over-contrasty output. Perturbed-Attention Guidance (PAG) is a technique for getting some of that adherence back without paying the saturation tax, by adding a second guidance term computed from a deliberately degraded version of the model's self-attention rather than from raising CFG itself. This node is AnimateDiff-Evolved's way of plugging PAG into its Sample Settings system as a "CFG Extra."

How it works, roughly

Standard classifier-free guidance compares a conditional and unconditional prediction and extrapolates between them. PAG adds a third comparison: the model's prediction when its self-attention has been perturbed (degraded toward uniform attention) versus the normal prediction. The difference between those two acts as an additional guidance signal that pushes toward more structurally coherent output - closer to what raising CFG buys you, but through a different mechanism, and generally with less of the oversaturation cost. It's a technique that showed up broadly across image and video diffusion tooling, not something specific to AnimateDiff - this node is just the AnimateDiff-Evolved wiring for it.

Inputs and output

  • scale_multival (MULTIVAL, required) - how strong the PAG term is. Per the pack's README, multival inputs generally accept a single float, a list of floats, or a mask, so you can schedule PAG strength across the clip or apply it uniformly, same as scale/effect multivals elsewhere in the pack.
  • prev_extras (optional, CFG_EXTRAS) - chain this onto another CFG Extras node (for instance, ADE_CFGExtrasRescaleCFG) to combine multiple guidance modifications at once.
  • Output: CFG_EXTRAS - wire into your Sample Settings node so it actually reaches the sampler.

Note there's no separate "layer" or "location" input here to pick which attention layers get perturbed - this node exposes the strength knob and leaves the rest to the pack's defaults.

Installing the pack

ComfyUI Manager: search AnimateDiff Evolved, confirm the author is Kosinkadink, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved

restart. This node needs no separate model download of its own - it's a sampling-time technique, not a weights file - but you'll need a motion module (mm_sd_v15_v2, v3_sd15_mm, etc.) for the rest of your AnimateDiff graph.

Common issues

Output gets muddier or over-smoothed, not sharper. PAG is a real quality-guidance technique but it's not free - pushed too hard, it can flatten fine detail the same way any guidance term can when overdone. Start at a modest scale and increase gradually rather than assuming higher is strictly better.

No visible difference at all. Confirm CFG_EXTRAS is actually wired into your Sample Settings node - it's a chainable settings object, and like the rest of this pack's settings nodes, it does nothing unconnected.

Combining with RescaleCFG and not sure which order matters. Both are CFG Extras nodes chained via prev_extras, and the pack lets you stack them; if you're using both, treat it as two independent adjustments layered together rather than assuming one supersedes the other, and tune them one at a time so you can tell which is doing what.

KB gap: our knowledge base doesn't cover Perturbed-Attention Guidance specifically, or how the community has actually used it inside AnimateDiff workflows versus static image generation - worth a dedicated look next time PAG comes up across any pack, not just this one.

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

Inputs (2)

NameTypeDefaultDescription
scale_multivalMULTIVALβ€”
prev_extrasoptCFG_EXTRASβ€”

Outputs (1)

NameTypeDescription
CFG_EXTRASCFG_EXTRASβ€”