KJNodes/ltxvgenerated

LTX2 NAG(LTX2_NAG)

https://github.com/ChenDarYen/Normalized-Attention-Guidance

LTX2 NAG

model
nag_cond_video
nag_cond_audio
model
nag_scale
11.000
nag_alpha
0.250
nag_tau
2.500
inplace
KJNodes

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

NameTypeRequiredDefaultRangeTooltip / Description
modelMODELYesThe input diffusion model to apply NAG to.
nag_scaleFLOATYes11.00.0 – 100.0 (step 0.001)Strength of the negative guidance effect. Higher values produce a stronger correction.
nag_alphaFLOATYes0.250.0 – 1.0 (step 0.001)Mixing coefficient that controls the balance between the normalized guided representation and the original positive representation.
nag_tauFLOATYes2.50.0 – 10.0 (step 0.001)Clipping threshold that limits how much the guided attention can deviate from the positive attention.
nag_cond_videoCONDITIONINGNoOptional video conditioning to guide the attention normalization.
nag_cond_audioCONDITIONINGNoOptional audio conditioning to guide the attention normalization.
inplaceBOOLEANNoTrueIf enabled, modifies tensors in place to save memory. May produce slightly different numerical results compared to out‑of‑place operations.

Outputs

NameTypeDescription
modelMODELThe 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 – increasing nag_scale typically reduces over‑exposure and artifacts, while nag_alpha and nag_tau fine‑tune the normalization.
  • nag_cond_video and nag_cond_audio are 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, set inplace to False.

Comments

Sign in with GitHub to join the discussion.

Loading comments…
LTX2 NAG (LTX2_NAG) - ComfyUI-KJNodes | ComfyUI Wiki