用结构化矩阵提升视频扩散模型的注意力效率,大幅降低计算开销。
VMonarch: Efficient Video Diffusion Transformers with Structured Attention
- 引入蒙德矩阵结构,实现动态稀疏注意力的亚二次计算。
- 在VBench上生成质量接近全注意力,计算量减少17.5倍,速度提升5倍以上。
- 适合需要长视频生成且追求高效推理的研究者与开发者。
视频扩散模型(Video DiTs)中的注意力机制存在二次复杂度,严重限制了上下文扩展能力。我们发现视频DiTs中高度稀疏的时空注意力模式可自然由蒙德矩阵表示,这类结构化矩阵具有灵活稀疏性,可通过交替最小化算法实现亚二次注意力计算。为此,我们提出VMonarch:一种新型注意力机制,利用结构化蒙德矩阵高效处理视频数据的动态稀疏模式。首先,将时空蒙德分解适配到视频数据,显式建模帧内与帧间相关性;其次,引入重计算策略缓解蒙德矩阵交替最小化过程中的不稳定性导致的伪影;第三,设计一种融合FlashAttention的在线熵算法,支持长序列下快速更新蒙德矩阵。大量实验表明,经少量调优后,VMonarch在VBench上达到与全注意力相当或更优的生成质量,突破视频扩散模型的注意力瓶颈,在长视频场景下注意力浮点运算量降低17.5倍,注意力计算速度提升超5倍,优于90%稀疏率下的现有稀疏注意力方法。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。