Nodes/ComfyUI-LTXVideo/LTX Prepare Attn Injection
ComfyUI Node Runs on cloud

LTX Prepare Attn Injection

Keep the source structure when you FlowEdit an LTX video

By Lightricks·Created 2 years ago·Updated about a month ago· 3,956
LTX Prepare Attn Injection
  • latent
  • attn_bank
  • blocks
  • LATENT
  • ATTN_INJ
queryfalse
keyfalse
valuefalse
inject_steps0

This is the node that makes an LTX video edit look like an edit instead of a fresh generation. When you're remixing a clip toward a new prompt, the danger is that the model happily obeys the prompt and throws away the layout, the framing, the motion - everything that made it this clip. Attention injection is the fix: you capture the source video's attention maps and feed them back in during the edit, so the new content grows on the old skeleton. LTXPrepareAttnInjections is where that capture gets packaged.

The fluxtapoz category is the tell. This whole cluster of nodes descends from the Fluxtapoz/HunyuanLoom family of inversion-and-editing tools that the community built for Flux and Hunyuan, now ported to LTX. The trick is well-worn at this point: store the query, key, and value tensors from the reference pass, then re-inject some subset of them while sampling the edit. What you inject and where controls how tightly the result hugs the original.

How it works

You hand it the latent you're working on and an ATTN_BANK - the stored attention captured from the source video earlier in the graph - plus flags for which parts of attention to inject and for how many steps. It bundles all that into an ATTN_INJ object and passes the latent through. The ATTN_INJ then rides along into the sampler, which applies the injections step by step. Optionally you scope the injection to specific transformer blocks (that's what LTXAttentioOverride produces).

The inputs and outputs that matter

The ones a beginner actually sets:

  • query, key, value (all BOOLEAN, default false) - which attention components to inject. These are the strength/character controls. Injecting key and value tends to preserve content and structure hardest; query shifts what the model attends to. Most people start by toggling one or two and watching what happens. All false and the node does nothing.
  • inject_steps (INT, default 0) - how many of the early denoising steps carry the injection. More steps = the source structure holds longer into the generation = a more faithful, less free edit. At 0, again, nothing is injected. This plus the three booleans are the real dials.

The wired-in inputs: latent (LATENT), attn_bank (ATTN_BANK, from the capture stage), and optional blocks (LTX_BLOCKS, to limit which blocks get touched).

Outputs: LATENT (passes through to your sampler) and ATTN_INJ (the injection package the sampler consumes).

How to install it

ComfyUI Manager: Ctrl+M, search LTXVideo, install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/Lightricks/ComfyUI-LTXVideo

and restart. Part of Lightricks' official pack. The node downloads nothing itself; the surrounding LTX edit workflow needs the LTX checkpoints and the usual heavy stack (32GB+ VRAM territory, 100GB+ disk for the model set).

Common issues & troubleshooting

Injection had no effect. Two default traps stacked: inject_steps is 0 and query/key/value are all false out of the box. You have to turn at least one flag on and set steps above 0. Nothing happens until both are true.

The edit ignores your new prompt. You're injecting too hard. Drop inject_steps, or turn off query, or scope to fewer blocks via a blocks input. Structure preservation and prompt freedom trade directly against each other here.

The result looks like the source with noise on top. Same cause - over-injection early in sampling. Ease off the steps.

You don't have an ATTN_BANK to plug in. This node is the second half of a two-part process; something upstream has to capture the source attention into that bank first. If you built this node in isolation, you're missing the inversion/capture stage. Start from a pack FlowEdit example so the whole capture → prepare → sample chain is wired correctly, then tune from there.

Categoryfluxtapoz

Inputs (7)

NameTypeDefaultDescription
latentLATENT
attn_bankATTN_BANK
queryBOOLEANfalse
keyBOOLEANfalse
valueBOOLEANfalse
inject_stepsINT00–1000
blocksoptLTX_BLOCKS

Outputs (2)

NameTypeDescription
LATENTLATENT
ATTN_INJATTN_INJ