2025-02-10 · 专家 · 计算机视觉

Fast Video Generation with Sliding Tile Attention

本文提出了一种名为滑动瓦片注意力(STA)的硬件感知注意力机制,显著提高了视频扩散模型的推理速度,并在不损失视频质量的前提下,实现了高达3.53倍的端到端加速。

更新于 2025-02-10。作者:Peiyuan Zhang、Yongqi Chen、Runlong Su、Hangliang Ding、Ion Stoica、Zhenghong Liu、Hao Zhang。

中文摘要

扩散Transformer(DiT)凭借其3D全注意力机制在视频生成领域达到了最先进的水平,但其计算成本却高得令人望而却步——生成一个仅5秒长的720P视频,仅注意力机制就占用了总推理时间945秒中的800秒。本文介绍了一种滑动平铺注意力机制(STA)来应对这一挑战。STA 利用了预训练视频扩散模型中注意力分数主要集中在局部3D窗口内的观察结果。通过对局部时空区域进行滑动和注意力计算,STA 消除了全注意力机制的冗余。与传统的基于标记的滑动窗口注意力(SWA)不同,STA 以平铺为单位进行操作,并采用了一种新颖的硬件感知滑动窗口设计,在保持表达能力的同时提高了硬件效率。通过仔细的内核级优化,STA 提供了第一个高效的2D/3D滑动窗口式注意力实现,实现了58.79%的MFU。准确地说,与FlashAttention-2(FA2)相比,STA 将注意力计算速度提高了2.8-17倍;与FlashAttention-3(FA3)相比,提高了1.6-10倍。在领先的视频DiT模型——鸿元视频上,STA 将端到端延迟从945秒(FA3)降低到685秒,而无需牺牲质量,并且无需进行训练。启用微调后,延迟进一步降低到268秒,VBench上的指标仅下降了0.09%。

英文摘要

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.

解读

一句话总结

本文提出了一种名为滑动瓦片注意力(STA)的硬件感知注意力机制,显著提高了视频扩散模型的推理速度,并在不损失视频质量的前提下,实现了高达3.53倍的端到端加速。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源