Abstract
The quadratic complexity of the attention mechanism severely limits the context scalability of Video Diffusion Transformers (DiTs). We find that the highly sparse spatio-temporal attention patterns exhibited in Video DiTs can be naturally represented by the Monarch matrix. It is a class of structured matrices with flexible sparsity, enabling sub-quadratic attention via an alternating minimization algorithm. Accordingly, we propose VMonarch, a novel attention mechanism for Video DiTs that enables efficient computation over the dynamic sparse patterns with structured Monarch matrices. First, we adapt spatio-temporal Monarch factorization to explicitly capture the intra-frame and inter-frame correlations of the video data. Second, we introduce a recomputation strategy to mitigate artifacts arising from instabilities during alternating minimization of Monarch matrices. Third, we propose a novel online entropy algorithm fused into FlashAttention, enabling fast Monarch matrix updates for long sequences. Extensive experiments demonstrate that VMonarch achieves comparable or superior generation quality to full attention on VBench after minimal tuning. It overcomes the attention bottleneck in Video DiTs, reduces attention FLOPs by a factor of 17.5, and achieves a speedup of over 5x in attention computation for long videos, surpassing state-of-the-art sparse attention methods at 90% sparsity.
Introduction
Video generation has seen rapid progress with the advent of Diffusion Transformers (DiTs). However, as the industry pushes toward high-resolution, long-duration video synthesis, the computational demands of the self-attention mechanism have become a critical bottleneck. Standard self-attention scales quadratically ($O(N^2)$) with the sequence length $N$. In long-video scenarios where $N$ can reach millions of tokens, attention computation can account for over 95% of total FLOPs.
Existing solutions like sparse attention or linear attention often force a trade-off between hardware efficiency and representational capacity. We observe that attention maps in Video DiTs are inherently sparse and structured, reflecting the spatio-temporal locality of video data. To exploit this, we introduce VMonarch, an efficient attention mechanism based on structured Monarch matrices.
Methodology: Structured Sparsity with Monarch Matrices
VMonarch replaces the dense attention matrix with a product of structured, block-diagonal matrices known as Monarch factors. This factorization allows for sub-quadratic complexity while maintaining high expressivity.
Spatio-Temporal Factorization
A key innovation in VMonarch is aligning the mathematical structure of Monarch matrices with the physical structure of video data. We factorize the attention into two primary components:
- Temporal Factor: Captures dependencies across different frames ($T$).
- Spatial Factor: Captures dependencies within individual frames ($H \times W$). By setting the block sizes of the Monarch factors to correspond to these dimensions, we ensure that the model explicitly learns the intra-frame and inter-frame correlations essential for coherent video synthesis.
Addressing the "Attention Sink" via Recomputation
Iterative optimization of Monarch matrices can lead to numerical instabilities, particularly affecting the first frame of a video. In DiTs, the first frame often serves as an "attention sink" or anchor for the entire sequence. To prevent visual artifacts and maintain global consistency, VMonarch employs a first-frame recomputation strategy. We compute the attention for the initial frame using exact full attention, while the remaining frames utilize the efficient Monarch approximation.
Online-Entropy FlashAttention
Updating Monarch matrices requires calculating Shannon entropy, a process that is traditionally memory-intensive. To overcome this, we developed a custom GPU kernel: Online-Entropy FlashAttention. By fusing the softmax and entropy calculations into a single pass within the GPU's SRAM, we eliminate redundant memory transfers (HBM access), enabling the processing of extremely long sequences that would otherwise trigger out-of-memory errors.
Experimental Results
We evaluated VMonarch by fine-tuning state-of-the-art base models (Wan2.1 and Wan2.2) on large-scale synthetic video datasets.
Efficiency Gains
VMonarch demonstrates exceptional scalability. As shown in Figure 1, it reduces normalized self-attention FLOPs by up to 17.5x for sequence lengths of 118k tokens. In terms of wall-clock time, our custom kernel achieves a 5x speedup over FlashAttention-2 at 62k tokens, significantly outperforming other sparse attention methods like VSA.
Generation Quality
Despite the drastic reduction in computation, VMonarch maintains high visual fidelity. Evaluation on the VBench suite shows that VMonarch matches or exceeds the performance of full-attention models in categories such as Aesthetic Quality and Subject Consistency after minimal fine-tuning (800–1500 steps).
Conclusion
VMonarch effectively overcomes the self-attention bottleneck in Video DiTs. By combining the mathematical elegance of Monarch matrices with hardware-aware kernel optimization and video-specific factorization, it enables the generation of high-quality, long-duration videos with a fraction of the computational cost. This work paves the way for scaling video generation models to even higher resolutions and longer contexts.
Summary updated