AB-Attention:精准块注意力加速视频扩散Transformer

·

研究论文 · 2026/10/30

视频扩散Transformer生成高质量视频,但3D全注意力的二次成本主导推理。动态块稀疏注意力通过仅对当前激活中选择的键/值块计算精确注意力来降低成本,但在激进稀疏下保真度下降:块评分来自粗糙摘要或昂贵的全局聚类,被剪枝的块从softmax中消失,且整个块被保留或丢弃,即使其中只有少数键重要。为解决这些限制,我们提出精确块注意力(AB-Attention),一种无需训练的方法,在高稀疏下准确近似密集注意力。其块内聚类选择器(IBCS)通过仅在每个查询块内聚类查询来忠实且廉价地估计块重要性,无需置换令牌。然后,包含概率加权采样(SIP)按这些估计比例采样块,并通过逆包含概率重新加权,使得一次传递估计密集注意力而非截断它。最后,其内核将远小于一个块的键/值块聚集为完整的张量核心块,在不增加张量核心成本的情况下细化选择。在Wan2.1和HunyuanVideo上,AB-Attention跳过89-92%的注意力,而基线计算量是其1.8-3.6倍,但仍比最强基线提高PSNR高达4.4 dB,并实现高达2.23倍的端到端加速。代码见https://github.com/InfRec-Cardinal/AB-Attention。

该论文提出了一种无需训练的高稀疏注意力近似方法,在显著加速视频扩散Transformer的同时保持甚至提升生成质量,对高效视频生成有重要价值。

Video diffusion transformers generate high-quality videos, but the quadratic cost of 3D full attention dominates their inference. Dynamic block-sparse attention reduces this cost by computing exact attention only on key/value blocks selected from current activations. However, its fidelity degrades under aggressive sparsity: blocks are scored from coarse summaries or formed by costly global clustering, pruned blocks vanish from the softmax, and whole tiles are kept or dropped even when only a few of their keys matter. To address these limitations, we propose Accurate Block Attention (AB-Attention), a training-free method that accurately approximates dense attention at high sparsity. Its Intra-Block Clustering Selector (IBCS) estimates block importance faithfully yet cheaply by clustering queries only within each query block, without permuting tokens. Sampling with Inclusion-Probability Weighting (SIP) then samples blocks in proportion to these estimates and reweights them by inverse inclusion probability, so that one pass estimates dense attention rather than truncating it. Finally, its kernel gathers key/value blocks much smaller than a tile into full tensor-core tiles, refining selection at no extra tensor-core cost. On Wan2.1 and HunyuanVideo, AB-Attention skips 89--92\% of attention, whereas the baselines compute 1.8--3.6times as much, yet it still improves PSNR by up to 4.4~dB over the strongest baseline and achieves up to 2.23times end-to-end speedup. Our code is available at https://github.com/InfRec-Cardinal/AB-Attention.

阅读原文

参与讨论