arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2502.04507cs.CV
收藏

基于滑动分块注意力的快速视频生成

Fast Video Generation with Sliding Tile Attention

University of California, San Diego(加州大学圣地亚哥分校);University of Michigan, Ann Arbor(密歇根大学安娜堡分校);Tsinghua University(清华大学);University of California, Berkeley(加州大学伯克利分校)

Peiyuan Zhang, Yongqi Chen, Runlong Su, Hangliang Ding, Ion Stoica, Zhengzhong Liu, Hao Zhang

AI总结:

本文提出滑动分块注意力(STA),通过硬件感知的分块滑动窗口设计消除视频扩散Transformer全注意力中的冗余,在HunyuanVideo上实现2.8-17倍注意力加速,端到端延迟从945秒降至685秒,微调后进一步降至268秒且质量几乎无损。

摘要:

采用3D全注意力的扩散Transformer(DiTs)在视频生成领域达到了最先进的水平,但其计算成本高得难以承受——仅生成一段5秒720P视频时,注意力计算就占用了总推理时间945秒中的800秒。本文提出滑动分块注意力(STA)来应对这一挑战。STA利用了预训练视频扩散模型中注意力分数主要集中于局部3D窗口内的观察结果。通过在局部时空区域上滑动并执行注意力计算,STA消除了全注意力中的冗余。与传统的逐token滑动窗口注意力(SWA)不同,STA以分块为单位运行,并采用新颖的硬件感知滑动窗口设计,在保持表达能力的同时实现硬件高效。通过细致的核级优化,STA首次提供了高效的2D/3D类滑动窗口注意力实现,达到了58.79%的MFU。具体而言,STA相比FlashAttention-2(FA2)将注意力计算加速了2.8-17倍,相比FlashAttention-3(FA3)加速了1.6-10倍。在领先的视频DiT模型HunyuanVideo上,STA将端到端延迟从945秒(FA3)降低到685秒,且无需训练、无质量下降。进一步启用微调可将延迟降至268秒,在VBench上仅下降0.09%。我们已将代码库公开发布于https://github.com/hao-ai-lab/FastVideo。

英文摘要:

Diffusion Transformers (DiTs) with 3D full attention power state-of-the-art video generation, but suffer from prohibitive compute cost -- when generating just a 5-second 720P video, attention alone takes 800 out of 945 seconds of total inference time. This paper introduces sliding tile attention (STA) to address this challenge. STA leverages the observation that attention scores in pretrained video diffusion models predominantly concentrate within localized 3D windows. By sliding and attending over the local spatial-temporal region, STA eliminates redundancy from full attention. Unlike traditional token-wise sliding window attention (SWA), STA operates tile-by-tile with a novel hardware-aware sliding window design, preserving expressiveness while being hardware-efficient. With careful kernel-level optimizations, STA offers the first efficient 2D/3D sliding-window-like attention implementation, achieving 58.79% MFU. Precisely, STA accelerates attention by 2.8-17x over FlashAttention-2 (FA2) and 1.6-10x over FlashAttention-3 (FA3). On the leading video DiT, HunyuanVideo, STA reduces end-to-end latency from 945s (FA3) to 685s without quality degradation, requiring no training. Enabling finetuning further lowers latency to 268s with only a 0.09% drop on VBench. We make our codebase public at https://github.com/hao-ai-lab/FastVideo.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑