Nodes/10S-Comfy-nodes/🎯 LTX Latent Anchor
ComfyUI Node

🎯 LTX Latent Anchor

Freeze the good mid-sample state and stop late-step drift

By TenStripΒ·Created 4 months agoΒ·Updated 26 days agoΒ· 244
🎯 LTX Latent Anchor
  • model
  • sigmas
  • model
β—„strength0.10β–Ί
β—„cache_at_step6β–Ί
β—„similarity_threshold0.50β–Ί
β—„decay_with_distance0.00β–Ί
β—„bypassfalseβ–Ί
β—„advanced_modefalseβ–Ί
β—„cache_modescheduleβ–Ί
β—„forwards_per_step1β–Ί
β—„cache_warmup144β–Ί
β—„anchor_frame0β–Ί
β—„depth_curveflatβ–Ί
β—„block_index_filterβ–Ί
β—„debugfalseβ–Ί

Watch a long LTX sampling run and you'll see the same thing every time: the first handful of steps lock in composition and semantics, then the late steps quietly drift - faces subtly change, the scene's physical logic loosens, prompt alignment fades. LTXLatentAnchor is an inference-time regularizer aimed squarely at that late-step drift. It snapshots the model's own representation at a mid-sampling step (when conditioning alignment peaks) and then pulls subsequent computation back toward that cached state, block by block.

The mechanism is what makes it different from the reference-injection nodes in this pack. It's not adding tokens or external images - it hooks the output of transformer_blocks[i].attn1 (video self-attention) and adds a residual that nudges each token's features toward the cached anchor when they're similar enough. The matching uses centered cosine similarity: raw cosine is dominated by common-mode features every token shares (positional encodings, scaffold features), so the node subtracts the per-frame mean first. That leaves identity-specific deviations that actually discriminate.

The inputs that matter

  • model - required. Returns the same model with per-block attention hooks attached.
  • sigmas - connect this from your scheduler (BasicScheduler, or the STG Guider's schedule). It's the difference between "predictable cache timing" and a fallback that's explicitly described as less reliable.
  • strength (0.10) - pull magnitude. 0.05-0.15 is the typical band. Too high over-damps motion and flattens frame-to-frame variation.
  • cache_at_step (6) - which sampling step locks the anchor. Mid-sampling (3-9 on 13-step schedules) is the sweet spot: conditioning alignment has peaked, fine refinement hasn't started.
  • similarity_threshold (0.50) - minimum centered-cosine similarity for a token to receive pull. Raise to 0.60-0.70 to limit pull to the most similar tokens only.
  • decay_with_distance (0) - per-frame strength decay from frame 0. 0.3-0.5 lets later frames drift more while early frames stay anchored.

That's the simple view. Flip advanced_mode and you get the research knobs - cache_mode (schedule / live_extraction / manual_calls), forwards_per_step, cache_warmup, anchor_frame, depth_curve, block_index_filter. You'll almost never touch these, but the one that matters if you see weirdness: forwards_per_step must match your actual sampler - 1 for distilled CFG=1, 2 for standard CFG>1 (cond + uncond), 3+ for CFG+STG. Get it wrong and the cache fires at the wrong moment.

Where it fits

Chain it on the model path before the sampler: Model β†’ LTXLatentAnchor β†’ Sampler. It coexists with the reference-token and face-anchor nodes - they hook different intervention points and use different sentinel attributes, so they don't collide. It's the basic variant in a family; LTXLatentAnchorAware adds reference-image spatial weighting if you want the pull concentrated on high-energy regions.

Install is the pack-wide clone (10S_Nodes into custom_nodes, restart, or ComfyUI Manager β†’ "10S-Comfy-nodes"), no extra deps, LTX2-class models only. If your LTX clips look great at step six and wander by step thirteen, this is the node that was built for that exact feeling.

Category10S Nodes/Identity

Inputs (15)

NameTypeDefaultDescription
modelMODELLTX2 model to patch with per-block attention hooks. The returned model has the same behavior plus identity anchoring during sampling.
sigmasoptSIGMASConnect from your sigma scheduler (e.g. BasicScheduler, LTX's STG scheduler). Required for predictable cache timing β€” without it the node falls back to manual_calls mode which is less reliable.
strengthoptFLOAT0.100–5Magnitude of pull toward cached anchor state. 0.05-0.15 typical. 0.10 is default. Higher values can over-damp motion or flatten frame-to-frame variation.
cache_at_stepoptINT60–100Sampling step at which to lock the anchor (snapshot the model's representation as the stable target). Mid-sampling values (3-9 on 13-step schedules) work best β€” peak conditioning alignment moment before fine refinement begins.
similarity_thresholdoptFLOAT0.500–1Minimum centered-cosine similarity for a token to receive pull. Lower = broader effect (more tokens pulled). 0.50 is balanced; raise to 0.60-0.70 to limit pull to most similar tokens only.
decay_with_distanceoptFLOAT0.000–1Per-frame strength decay from frame 0 (anchor frame) to last frame. 0 = uniform across all frames. 0.3-0.5 lets later frames drift more freely while keeping early frames anchored.
bypassoptBOOLEANfalseIf True, the node passes the model through unchanged. Useful for A/B comparison without rewiring.
advanced_modeoptBOOLEANfalseToggle to expose research/diagnostic parameters: cache_mode, forwards_per_step, cache_warmup, anchor_frame, depth_curve, block_index_filter, debug.
cache_modeoptCOMBOscheduleHow cache timing is determined. schedule (default, requires sigmas wired): cache fires at the sigma corresponding to cache_at_step. live_extraction: no cache, regenerate target every call (softer effect). manual_calls: cache fires after cache_warmup block calls (fallback when sigmas not wired).
forwards_per_stepoptINT11–8How many model forward passes occur per sampling step. 1 for distilled CFG=1 (typical). 2 for standard CFG > 1 (cond + uncond). 3+ for CFG+STG. Affects cache timing math when in schedule mode. Variable-CFG schedules use a single approximate value.
cache_warmupoptINT1440–5000Number of block calls before cache fires (when cache_mode=manual_calls). 144 β‰ˆ 3 sampling steps Γ— 48 blocks at CFG=1. Used as fallback when sigmas isn't connected.
anchor_frameoptINT00–256Which frame's features to use as anchor source. 0 = first frame (the conditioning frame in i2v workflows β€” recommended). Set higher to anchor to a different frame.
depth_curveoptCOMBOflatPer-block strength scaling across the 48 transformer blocks. flat = uniform (recommended default). ramp_up = stronger late blocks (handles refinement). ramp_down = stronger early blocks (handles semantics). late_focus = quadratic late emphasis. middle = strongest in middle blocks.
block_index_filteroptSTRINGLimit hooks to specific blocks, e.g. '10-30' or '5,7,15-20'. Empty = all 48 blocks. Useful for ablation studies; rarely needed in normal use.
debugoptBOOLEANfalseVerbose per-block diagnostic output during sampling. Shows cache state, similarity stats, and per-block timing. Helpful first time tuning a workflow.

Outputs (1)

NameTypeDescription
modelMODELβ€”