arXiv:2509.16518cs.CVcs.AR2025-09被引 3

提出细粒度稀疏注意力机制,显著加速视频生成扩散模型推理。

FG-Attn: Leveraging Fine-Grained Sparse Attention in Video Diffusion Models

  • 按MxN块跳过冗余注意力计算,实现细粒度稀疏化。
  • 在70%稀疏度下比FlashInfer快2.45倍,平均提速14.7%。
  • 适合追求高效视频生成的开发者与部署工程师。

使用扩散变换器进行媒体生成可能需要对极长序列进行注意力计算,而注意力层占用了大部分生成延迟。利用注意力图中的稀疏性可有效降低计算成本。本文发现,视频生成模型中的注意力图存在显著的细粒度稀疏性。现有稀疏注意力方法过于粗粒度,无法消除大量冗余计算,或在更细粒度下引入高开销。为此,我们提出FG-Attn,一种低开销的细粒度稀疏注意力机制,通过跳过MxN块(其中N≥1,M≥16)的得分计算,每个块为M个查询与N个键的点积结果。FG-Attn解决了现代GPU上稀疏注意力核硬件利用率低的关键问题,避免了不规则内存访问和冗余操作的开销。该方法可完全替代现有稀疏注意力技术,并将块稀疏注意力扩展至更细粒度。在70%稀疏度下,相比最先进方案FlashInfer,FG-Attn速度提升达2.45倍,平均减少注意力内核耗时14.7%;在端到端视频生成中,最快提速1.40倍(平均1.18倍)超过Flash Attention 3。

原文摘要 · Abstract (English)

Using diffusion transformers for media generation may require evaluating attention over extremely long sequences, with attention layers accounting for the majority of generation latency. Exploiting sparsity in attention maps offers a promising opportunity to reduce this cost. In this work, we show that attention maps in diffusion transformers exhibit significant fine-grained sparsity in video generation models. Existing sparse attention methods, however, are too coarse-grained, leaving a large fraction of redundant computation unaddressed, or incur high overheads at finer granularity. We propose FG-Attn, a novel, low-overhead fine-grained sparse attention mechanism that skips score computations at the granularity of a MxN tile, where N>=1 and M>=16, and where each block is the result of query-key dot products between M queries and N keys. FG-Attn addresses the key challenge of hardware underutilization in sparse attention kernels on GPUs, without incurring the overheads of irregular memory access and redundant operations. FG-Attn can fully supersede existing sparse attention methods and extend block sparse attention methods to finer granularities on modern GPUs. At 70% sparsity, FG-Attn is up to 2.45X faster than the state-of-art FlashInfer, and reduces attention kernel time by 14.7% on average. FG-Attn speeds up end-to-end video generation times by up to 1.40X (1.18X on average) over Flash Attention 3.

视频生成扩散模型稀疏注意力性能优化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。