Feed 0% source
AI/ML AI-generated

LVSA: Training-Free Sparse Attention for Long Video Diffusion

Generated by a local model (nvidia/Gemma-4-26B-A4B-NVFP4) from a scientific paper, claim-checked against the full text. Provenance is open by design.

Generating long videos with current AI models is a struggle between compute costs and visual quality. As you increase the number of frames, the cost of dense self-attention grows quadratically. This means the computational load increases by the square of the sequence length. Even worse, once you push past the model's original training horizon, the video often "collapses." This results in frozen, repetitive, or looping footage.

Current state-of-the-art approaches attempt to solve this in two ways. They either retrain models for longer contexts or use mathematical hacks that fail to maintain high-quality motion. This paper introduces LVSA (Long Video Sparse Attention). It is a training-free method that allows existing models to generate much longer videos. It does this by only attending to a smart subset of frames. It promises speed and a way to bypass the "frozen video" failure mode.

The Problem

The fundamental issue is the $O(N^2)$ complexity of dense self-attention in Video Diffusion Transformers (DiTs). For a model like HunyuanVideo, generating extra frames pushes the KV (key-value) memory requirements toward the 80 GB limit of a standard GPU.

Even if you have the VRAM, there is a qualitative wall. When a model is trained on 81 frames, attempting to generate 400 frames using dense attention causes the model to lose temporal coherence. As seen in, the video tends to converge to a near-static output.

Figure 5
Figure 5. Wan 2.1 1.3B at a 6× horizon (481 frames), prompt cat window, same seed. Frames 20, 200, 380, 460 shown for each backend. Dense converges to near-static output — the cat barely moves across ∼440 frames — while LVSA produces genuine pose and lighting variation.

The subject barely moves across the sequence. Interestingly, the authors note that standard evaluators like VBench-Long actually reward this failure. Because the subject remains consistent, the metric gives it a high score. This "static-rewarding bias" hides the fact that the model has failed to generate meaningful motion.

How It Works

LVSA replaces the dense attention matrix with a sparse pattern. This pattern scales linearly with the number of frames. The architecture relies on three main components:

  1. Hybrid Sparsity Pattern: Each query frame attends to two specific sets. It attends to a local temporal window ($W$) of nearby frames to maintain local continuity. It also attends to a set of equidistant global anchor frames ($G$) spread across the entire video. This maintains global structure. This is visualized in .
Figure 1
Figure 1. Basic versus expanded window pattern. The basic adaptive window (a) wastes attention budget when the local window overlaps global frames, leaving the per-query attended set below the target C.

The "Expanded window" logic ensures the total attention budget per frame remains constant. This happens even when local windows overlap with global anchors. 2. Expanded Window Bounds: A naive window might waste the attention budget when it lands on a global anchor. The authors use an adaptive algorithm (Algorithm 1) to expand the window boundaries. This ensures every frame gets a predictable, uniform amount of computation. 3. Rotating Periodic Global Frames: This is the most critical innovation for quality. If the global anchors were fixed, the model would develop a "fixed-grid bias." In this scenario, frames not in the anchor set become progressively impoverished in representation. To fix this, the authors rotate the global anchor set $G$ at every denoising step (the iterative process of removing noise to create an image). As shown in, every single frame eventually serves as a global anchor over a full cycle.

Figure 2
Figure 2. Rotating periodic global frames with Tper = 4. The set Gs shifts by one position per denoising step and wraps modulo T. Over any Tper consecutive steps, each frame appears as a global anchor exactly once. See Figure 2 for a visual depiction. Two properties make this rotation principled.

This prevents the temporal artifacts common in other sparse methods.

Numbers

The performance gains are substantial and scale with video length. The authors report that when using a FlashInfer kernel, LVSA achieves a 3.17× speedup on Wan 2.1 1.3B. It also achieves a 2.98× speedup on Wan 2.1 14B at a 6× horizon compared to dense attention.

Crucially, LVSA solves the Out-of-Memory (OOM) problem for certain architectures. For HunyuanVideo 1.5, dense attention fails at a 2× horizon on a single 80GB GPU. LVSA completes the task while capping peak memory at approximately 60.4 GB [Table 1]. This leaves roughly 19 GB of headroom for the system.

Regarding quality, the authors introduce VQeval to expose "looping" failures. On the Wan 2.1 1.3B model at a 6× horizon, LVSA-FI (using the FlashInfer kernel) achieved a VQeval composite of 60.2. This significantly outperformed the dense attention score of 48.2 [Table 2]. While dense attention's VBench score actually increased as the video became more static, LVSA maintained better imaging quality and genuine motion.

What's Missing

While the results are impressive, there are gaps a practitioner should consider:

  • Single-Scene Assumption: The paper explicitly focuses on a single-scene scenario. In production, long videos often involve camera pans or scene transitions. It is unclear how the rotating global anchors handle sudden shifts in visual context.
  • Hyperparameter Selection: The effectiveness depends on selecting the right window size ($W$) and anchor period ($T_{per}$). The authors suggest using the model's training budget as a heuristic. However, they do not provide an exhaustive study on how sensitive the results are to these specific values.
  • Implementation Requirements: The speedups rely heavily on specialized kernels like FlashInfer. You cannot simply drop this into any standard PyTorch environment and expect these speeds. You need the appropriate backend to realize the reported throughput.

Should You Prototype This

Yes, if you are hitting the VRAM ceiling or seeing "frozen" videos during long-form generation. Unlike many sparse attention papers, LVSA is training-free and model-agnostic. This makes it a low-risk plugin for existing DiT pipelines.

The code is reportedly available at https://github.com/JiusiServe/LongVideoSparseAttention. If you are currently struggling with HunyuanVideo OOMs or Wan model temporal collapse, this is worth a weekend prototype. Just be prepared to tune your window parameters to match your specific model's training characteristics.

Figures from the paper

Figure 6
Figure 6 — from the original paper
Figure 3
Figure 3. HunyuanVideo 1.5 at 2× horizon (257 frames), generated by LVSA-FI on a single 80GB GPU; dense attention is infeasible at this setting due to OOM (Table 1). Frames 32, 96, 160, 224 from the prompt coral reef (best-VQeval prompt at this cell, composite 62.9). Hardware.
Figure 4
Figure 4. Wall-time scaling across three video DiTs (Wan 2.1 1.3B, Wan 2.1 14B, HunyuanVideo 1.5) for dense attention, LVSA, and LVSA-FI. Speedup grows monotonically with the horizon for all three models; HunyuanVideo 1.5 at 2× horizon (257 frames) has no dense point due to OOM on 80GB GPU.
Novelty
0.0/10
Overall
0.0/10
#video diffusion#sparse attention#inference acceleration#long video generation
How this was made
Generation

Model: nvidia/Gemma-4-26B-A4B-NVFP4
Persona: habr_engineer
Refinement: 0
Pipeline: forge-1.0

Verification

Evaluator: nvidia/Gemma-4-26B-A4B-NVFP4
Score: 97% (passed)
Claims verified: 18 / 18

Translation

Model: nvidia/Gemma-4-26B-A4B-NVFP4

Hardware & cost

NVIDIA GB10 · 128 GB unified · NVFP4 · 100% local · $0 cloud
Tokens: 73,270
Wall-time: 323.4s
Tokens/s: 226.6

Related
Next up

LongLive-RAG: Enhancing Long Video Consistency via Latent Retrieval

8.3/10· 6 min