Wan Video NAG
Keep your negative prompt, skip the CFG tax
- model
- conditioning
- MODEL
- CONDITIONING
If you generate video with Wan 2.1/2.2 and you've ever stared at the sampler wondering why every step costs twice what it should, this is the node for you. NAG - Normalized Attention Guidance, a NeurIPS 2025 paper - moves the "guidance" that CFG normally applies at the end of each step into attention space. The result: you keep the steering power of a negative prompt, but the sampler doesn't have to compute that expensive unconditional pass anymore. On Wan, the community reaction when this landed was basically "negative prompts without CFG, almost 2x speed."
That's the pitch, and it's real. This node is Nifty's WAN-native implementation, forked from KJNodes' and significantly reworked. It patches the model directly, so it slots into your existing T2V or I2V Wan workflow where a CFG-ish node would go.
How it works
The node clones your model, runs your negative conditioning through the Wan text encoder once to get a reference context, then wraps the forward of every cross-attention block in the diffusion model. From then on, each attention block computes both the positive and negative attention, and NAG blends them using its three core parameters:
- nag_scale (φ) - guidance strength, like a CFG scale but in attention space. Default 11, good range 8–15.
0disables NAG entirely. - nag_alpha (α) - how much NAG-guided attention gets blended with the original positive attention.
0= no effect,1= full NAG. Default 0.25. - nag_tau (τ) - an L1-norm clip that caps how far the guided attention can drift from the positive attention. Lower = safer, higher = stronger correction. Default 2.5.
The paper's ablation (which the tooltips quote) is worth believing: without tau and alpha doing their jobs, output degrades sharply above scale 5. So the official tuning advice is backwards from what you'd expect - settle nag_tau and nag_alpha first, and only tune nag_scale last.
The inputs people get wrong
- conditioning - this is your NEGATIVE conditioning (an empty or negative prompt). The tooltip could not be clearer: "Do NOT connect the positive conditioning here." NAG uses the negative as the internal reference - the direction to push away from in attention space. Connect the positive here and you're steering toward the thing you wanted to suppress.
- cond_zero_out - default
True. It zeroes out the conditioning output, because NAG handles guidance internally and your sampler's negative slot should be empty to avoid double-guidance interference. Disable it only if you're deliberately stacking NAG on top of CFG. - input_type -
defaultis the standard [positive, negative] pair a CFG sampler sends.batchis for sampling without CFG (CFG=1, e.g. few-step Wan with Lightning LoRA), where there's no paired negative. - nag_sigma_end - default
0.0means NAG is always active, which is correct for two-model HN/LN pipelines. For single-model pipelines,0.75gets near-identical quality for noticeably less compute. - inplace - modifies tensors in place to cut peak VRAM; slightly changes numerical results. Only reach for it when you're out of memory.
Outputs are MODEL (the patched model) and CONDITIONING (the input conditioning, zeroed unless you disabled cond_zero_out). Wire the MODEL straight into your sampler.
Recommended starting values
| Scenario | nag_scale | nag_tau | nag_alpha | |---|---|---|---| | T2V multi-step | 11 | 2.5 | 0.25 | | T2V few-step (Lightning LoRA) | 11–15 | 2.5–5 | 0.25–0.5 | | I2V (any) | 11 | 1.5–2.0 | 0.10–0.20 |
The I2V numbers are lower on purpose - too much NAG and you start eroding the reference image. Few-step T2V can push higher.
Installing it
Part of Nifty Nodes for ComfyUI (Stibo/comfyui-nifty-nodes). ComfyUI Manager → search "Nifty Nodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/Stibo/comfyui-nifty-nodes
Restart. The pack needs a current ComfyUI (v3 API, comfy_api.latest), and you need a Wan 2.1/2.2 model - no extra downloads from the pack itself. No pip requirements for this node.
Where people get burned
The two classic mistakes: connecting positive conditioning where the negative belongs, and leaving a real negative in the sampler while cond_zero_out is on - that's stacking guidance and you'll get overcooked, artifact-heavy results. Beyond that, remember NAG is a replacement for CFG, so your sampler settings change too: in few-step Lightning setups that means input_type = batch and a CFG of 1. Get those two right and this is the closest thing Wan has to "guidance for free."
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| enabled | BOOLEAN | true | Master switch. When false the node is a no-op: model and conditioning pass through unchanged. |
| model | MODEL | — | |
| conditioning | CONDITIONING | Your NEGATIVE conditioning (empty or negative prompt). NAG uses this as its internal reference — the direction the model is guided AWAY from in attention space. Do NOT connect the positive conditioning here. With cond_zero_out=True, this also flows to the CONDITIONING output as a zeroed tensor for the sampler's negative slot. | |
| nag_scale | FLOAT | 11.0000–100 | Guidance strength (φ), analogous to CFG scale. Good range for WAN: 8–15. Setting to 0 disables NAG. Tune this last — first settle on nag_tau and nag_alpha. |
| nag_alpha | FLOAT | 0.2500–1 | Blend weight (α) between NAG-guided and original positive attention (Eq. 10). 0 = no effect, 1 = full NAG. T2V default: 0.25 | I2V: use lower (0.10–0.20) to preserve the reference image. Few-step (Lightning LoRA): can go higher (0.3–0.5). |
| nag_tau | FLOAT | 2.5000–10 | L1-norm clipping threshold (τ): caps how far guided attention deviates from positive attention (Eq. 9 in paper). Lower = safer, less drift. Higher = stronger correction. T2V default: 2.5 | I2V: use lower (1.5–2.0) to preserve the reference image. Few-step (Lightning LoRA): can go higher (3–5). Paper ablation: both tau and alpha are critical — without them output degrades sharply above scale=5. |
| nag_sigma_end | FLOAT | 0.000–1 | NAG is skipped when denoising sigma drops below this value. 0.0 = always active (correct for two-model high/low-noise pipelines). For single-model pipelines: 0.75 achieves near-identical quality with significantly less compute (paper authors' recommendation for flow-based models). Note: WAN uses Rectified Flow where sigma runs 1.0 → 0.0. |
| input_type | COMBO | default: sampler sends a [positive, negative] batch pair (standard CFG setup). batch: single conditioning without a paired negative — use when sampling without CFG (e.g. distilled/few-step WAN models with Lightning LoRA). | |
| inplace | BOOLEAN | false | Modify tensors in-place to reduce peak VRAM. Slightly alters numerical results. Enable only if out of memory. |
| cond_zero_out | BOOLEAN | true | Output a zeroed-out (neutral) conditioning instead of the input conditioning. Recommended: NAG handles guidance internally, so the sampler's negative slot should be empty to avoid interference. Disable only if intentionally stacking NAG on top of CFG. |
| nag_scale_endopt | FLOAT | 0.0000–100 | Sigma-adaptive scale: linearly interpolates from 'nag_scale' (at sigma=1.0) to 'nag_scale_end' (at sigma=0.0). 0.0 = disabled (uses constant nag_scale). |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |
| CONDITIONING | CONDITIONING | — |