Description
Applies Normalized Attention Guidance (NAG) to the given model during inference. This technique modifies the attention mechanism to reduce artifacts and improve generation quality, particularly in the context of long video generation with LTXV. The node is based on the approach described in the Normalized-Attention-Guidance repository.
Inputs
| Name | Type | Required | Default | Range | Tooltip / Description |
|---|---|---|---|---|---|
model | MODEL | Yes | — | — | The input diffusion model to apply NAG to. |
nag_scale | FLOAT | Yes | 11.0 | 0.0 – 100.0 (step 0.001) | Strength of the negative guidance effect. Higher values produce a stronger correction. |
nag_alpha | FLOAT | Yes | 0.25 | 0.0 – 1.0 (step 0.001) | Mixing coefficient that controls the balance between the normalized guided representation and the original positive representation. |
nag_tau | FLOAT | Yes | 2.5 | 0.0 – 10.0 (step 0.001) | Clipping threshold that limits how much the guided attention can deviate from the positive attention. |
nag_cond_video | CONDITIONING | No | — | — | Optional video conditioning to guide the attention normalization. |
nag_cond_audio | CONDITIONING | No | — | — | Optional audio conditioning to guide the attention normalization. |
inplace | BOOLEAN | No | True | — | If enabled, modifies tensors in place to save memory. May produce slightly different numerical results compared to out‑of‑place operations. |
Outputs
| Name | Type | Description |
|---|---|---|
model | MODEL | The same model with NAG applied to its internal attention operations. |
Usage Notes
- This node is intended for use with the LTXV video generation pipeline (category
KJNodes/ltxv). It modifies the model’s forward path, so it should be connected before the sampling process. - The three parameters (
nag_scale,nag_alpha,nag_tau) together control the behavior of the guidance. Start with the defaults and adjust based on visual quality – increasingnag_scaletypically reduces over‑exposure and artifacts, whilenag_alphaandnag_taufine‑tune the normalization. nag_cond_videoandnag_cond_audioare optional. When provided, they supply additional conditioning signals that influence the attention normalization. Leave disconnected if no such conditioning is desired.- Enabling
inplace(the default) reduces memory usage during inference. If you observe numerical inconsistencies between runs or need exact reproducibility, setinplacetoFalse.
Comments
Sign in with GitHub to join the discussion.