Nodes/H3-Optimizations/H3 Sparse Attention
ComfyUI Node

H3 Sparse Attention

H3's 2x speed button — and the quality bill that comes with it

By Zironic·Created 5 days ago·Updated about 15 hours ago· 38
H3 Sparse Attention
  • model
  • MODEL
video_budget0.30
denser_early_late_stepsfalse
layer_video_budgets

Sparse attention is where H3 actually gets fast. H3 Memory Optimization shaves a bit off peak VRAM and single-digit percentages off runtime; H3 Sparse Attention is the node that roughly doubles your sampler speed on a 10-second clip. The pack's own measurements put the default configuration at 1.75x faster at 5 seconds and 2.17x at 10 seconds against ComfyUI's dense attention - and the speedup grows with sequence length, so it helps most exactly where H3 hurts.

The idea is simple: most of the attention connections between video tokens just aren't pulling their weight every step, so skip them. The video_budget float (default 0.3) is the percentage of video KV attention you keep. That sounds like a slider for "quality vs speed," and it is - but the README leads with a warning you should believe: this changes model computation, it is not free acceleration, and no percentage is lossless for every prompt. Text, reference conditioning, audio, non-video queries, and the boundary tiles between contexts stay fully dense. Only target-video attention gets cut, so the prompt-to-video link mostly survives; what you lose is dense video-to-video coherence, which shows up as drift in motion or detail when you push the budget too low.

The inputs that matter

  • video_budget - the speed/quality tradeoff. Lower is faster, with real quality risk; 1.0 keeps the full video route. Default 0.3 is a deliberate practical compromise, not a claim that 30% is lossless.
  • denser_early_late_steps - a free-ish quality recovery. H3 is especially sensitive to reduced attention in the first denoising steps, so this adds 30 percentage points to the video budget for the first two and last two sampler steps (capped at 100%). If your results degrade at low budgets, switch this on before raising the budget.
  • layer_video_budgets (advanced) - a comma-separated budget for all 50 H3 layers, applied every step. It can't be combined with denser_early_late_steps. Skip it until you have a specific layer to blame.

A MODEL goes in and a patched MODEL comes out; wire it between the H3 loader and your sampler. The node's status text tells you which backend actually engaged - it prefers a shipped native INT8 kernel, then an installed Sparse Sage, then INT8 Triton, then FlexAttention, and finally falls back to the resolved dense path. The fallback chain is automatic; you mostly don't need to care which rung you landed on, just that one did.

Install and troubleshooting

Same pack, same install: ComfyUI Manager search "H3 Optimizations", or clone into custom_nodes and restart. No extra dependencies - the native kernels ship with the pack, and nothing compiles at startup.

If a scene's prompt adherence or motion falls apart, the fix ladder is: enable denser_early_late_steps first, then nudge video_budget up in 0.1 steps. The quality cost depends on both the prompt and where in the denoising schedule attention is removed, so what breaks for one workflow may be fine in the next. And if you're on an AMD/ROCm stack, the FlexAttention fallback validates on first execution - if your PyTorch/Triton combo can't lower the kernel, auto quietly retires to dense attention, which is safe but means you're not getting the sparse speedup. Check the status text before assuming it's working.

CategoryH3-Optimizations/Model Patches

Inputs (4)

NameTypeDefaultDescription
modelMODEL
video_budgetFLOAT0.300.01–1Controls the speed/quality tradeoff for target-video attention. Lower values are faster but retain fewer video attention connections and can reduce prompt adherence, change motion/detail, or otherwise change the result. There is no universally safe value: some prompts tolerate very low budgets while others require substantially more. The request rounds up to whole KV tiles; non-video context and mixed boundary tiles stay dense. 1.0 retains the full video route.
denser_early_late_stepsBOOLEANfalseAdds 30 percentage points to the video attention budget for the first 2 and last 2 sampling steps, capped at 100%. H3 is especially sensitive to reduced attention in early denoising, so this can preserve prompt/timeline adherence better than using the same low budget throughout.
layer_video_budgetsoptSTRINGOptional comma-separated budget fractions for all 50 H3 layers. Applies at every sampling step and cannot be combined with Denser Early/Late steps.

Outputs (1)

NameTypeDescription
MODELMODEL