LinVideo: A Post-Training Framework towards O(n) Attention in Efficient Video Generation

Yushi Huang, Xingtong Ge, Ruihao Gong, Chengtao Lv, Jun Zhang

TL;DR

LinVideo is an efficient, data-free post-training framework designed to accelerate video diffusion models by selectively replacing computationally heavy quadratic attention layers with linear attention. By framing layer selection as a learnable binary classification problem and introducing a novel distribution matching objective, LinVideo achieves up to a 1.71× speedup (and up to 20.9× when combined with few-step distillation) while fully preserving video generation quality.

What Problem Does This Paper Address?

State-of-the-art video diffusion models (DMs) like Sora and Wan excel at generating high-quality, physically consistent videos. However, adding a temporal dimension dramatically increases the sequence length ($n$) that the model must process—often exceeding 50,000 tokens for a 10-second video.

Because standard self-attention scales quadratically ($O(n^2)$) with sequence length, it quickly becomes a massive computational bottleneck during inference. While linear attention ($O(n)$) offers a much more scalable alternative, completely replacing quadratic attention typically demands intensive, costly pre-training from scratch. This is because linear attention lacks the expressiveness required to capture complex spatiotemporal video dynamics out of the box. LinVideo addresses this challenge by asking: Can we efficiently swap out quadratic attention layers for linear ones after a model has already been trained, without degrading video quality?

Methods

LinVideo introduces a data-free post-training pipeline that optimizes both where to replace attention layers and how to train the modified network:

  1. Data-Free Training Set Construction: To avoid the need for massive, curated video datasets, LinVideo samples initial noise directly from the pre-trained model and saves the inputs and outputs along its own sampling trajectories to serve as training data.
  2. Selective Transfer: Not all layers are equally replaceable. LinVideo introduces a learnable parameter $r$ for each layer that acts as a classification score, smoothly blending quadratic and linear attention during training. Specialized constraint and regularization losses ($L_{con}$ and $L_{reg}$) gradually force these scores to snap to exactly 0 or 1, automatically identifying the optimal subset of layers to linearize.
  3. Anytime Distribution Matching (ADM): Standard fine-tuning objectives often introduce temporal artifacts like flickering. To fix this, the authors propose ADM, which aligns sample distributions at any arbitrary timestep along the generation trajectory. Crucially, instead of training a costly auxiliary model to estimate the score functions for distribution matching, LinVideo uses the model currently being trained to estimate its own score function, drastically reducing training overhead.
Figure 1. Overview of the proposed efficient data-free post-training framework, LINVIDEO. (a) This framework first applies selective transfer (Sec. 4.1), which assigns each layer a learnable score r and progressively, automatically replaces quadratic attention with linear attention while minimizing the resulting performance drop. This process also combines with Lcon (i.e., Eq. (9)) and Lreg (i.e., Eq. (10)) to ensure a given target number of layers replaced by linear attention and mitigate the fluctuation (around 0.5) of r to improve training, respectively. (b) Moreover, LINVIDEO integrates an anytime distribution matching objective (Sec. 4.2), which aims to match the sample distributions between ˆuω and uω across any timestep in the sampling trajectory. This significantly recovers performance and enables high efficiency compared with previous objectives in our scenarios.

Datasets

  • Training: A data-free dataset consisting of 50,000 input-output pairs generated directly by the pre-trained models themselves.
  • Evaluation: The framework was evaluated on VBench and VBench-2.0, which are comprehensive benchmarks for video generative models that measure dimensions such as subject consistency, motion smoothness, and imaging quality.

Key Insights and Ideas

  • Shallow Layers are More Forgiving: The authors discovered a clear pattern in layer replaceability: errors introduced by linearizing shallow layers are much easier for subsequent layers to correct than errors introduced deep in the network (see Figure 2).
  • The First Layer is Critical: Despite shallow layers being easier to replace generally, converting the very first layer results in catastrophic, unrecoverable quality drops, proving its unique importance in initial feature extraction.
  • Eliminating Auxiliary Models: Traditional distribution matching requires training a separate multi-step DM to approximate score fields, which can increase training costs by 5–10×. LinVideo proves that a multi-step model can accurately estimate its own score function during the transfer process, cutting down training time significantly.
Training hours comparison showing that ADM reduces training time by ~4.4× compared to traditional distribution matching.

Key Results

  • Inference Speedups: LinVideo achieves a 1.43× to 1.71× end-to-end latency speedup on Wan 1.3B and 14B models while maintaining competitive video quality.
  • Distillation Breakthrough: When combined with 4-step distillation (DMD2), LinVideo achieves a massive 15.9× to 20.9× speedup, making it highly practical for real-time deployment.
  • Quality Preservation: On VBench benchmarks, LinVideo consistently outperforms existing sparse-attention baselines (like SVG and DFA) and matches the performance of the lossless FlashAttention2 baseline across metrics like overall consistency and scene composition.
Figure 5. Visual results at 480p across Wan 1.3B [49] (Upper), 1.3B LINVIDEO (Middle), and 1.3B LINVIDEO+ 4-step DMD2 [56] (Lower). Prompt: “A wide pink flower field under a stormy twilight sky with a faint magical glow. Buds burst into luminous blossoms that spread in waves across the meadow. Above, massive black storm clouds roll hard and fast, with layered billows, shelf-cloud structure, and clear turbulence; inner lightning pulses for drama, no ground strikes. A few bioluminescent motes drift between flowers; faint aurora-like ribbons sit behind the storm.”

Limitations and Future Work

  • Lack of Specialized Kernels: The current implementation relies on standard hardware operations. Developing a custom, hardware-optimized CUDA kernel specifically for this linearized attention mechanism could unlock even higher practical speedups.
  • Combining with Sparsification: LinVideo focuses entirely on inter-layer mixed attention (choosing between dense quadratic or dense linear attention). Because this approach is orthogonal to attention sparsification (skipping redundant tokens), combining the two methods represents a promising frontier for even more efficient video generation.

Summary updated

BibTeX
@inproceedings{huang2026linvideo,
  author = {Yushi Huang and Xingtong Ge and Ruihao Gong and Chengtao Lv and Jun Zhang},
  title = {{LinVideo: A Post-Training Framework towards O(n) Attention in Efficient Video Generation}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2026},
  url = {https://openreview.net/forum?id=4rftSitty7},
}
Figure