arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2406.08552cs.CV
收藏

DiTFastAttn:面向扩散Transformer模型的注意力压缩方法

DiTFastAttn: Attention Compression for Diffusion Transformer Models

Tsinghua University(清华大学);Infinigence AI(无问芯穹AI);Shanghai Jiao Tong University(上海交通大学)

Zhihang Yuan, Hanling Zhang, Pu Lu, Xuefei Ning, Linfeng Zhang, Tianchen Zhao, Shengen Yan, Guohao Dai, Yu Wang

AI总结:

本文提出DiTFastAttn训练后压缩方法,通过窗口注意力、跨时间步和跨CFG注意力共享减少DiT推理中的空间、时间和条件冗余,在图像生成中最多降低76%注意力FLOPs并实现1.8倍加速。

摘要:

扩散Transformer(DiT)在图像和视频生成方面表现出色,但由于自注意力算子的二次复杂度而面临计算挑战。我们提出DiTFastAttn,一种训练后压缩方法,以缓解DiT的计算瓶颈。我们识别出DiT推理过程中注意力计算的三个关键冗余:(1)空间冗余,许多注意力头关注局部信息;(2)时间冗余,相邻步骤的注意力输出之间具有高度相似性;(3)条件冗余,条件推理和无条件推理表现出显著相似性。我们提出三种技术来减少这些冗余:(1)带残差共享的窗口注意力以减少空间冗余;(2)跨时间步的注意力共享以利用步骤之间的相似性;(3)跨CFG的注意力共享以在条件生成期间跳过冗余计算。我们将DiTFastAttn应用于图像生成任务的DiT、PixArt-Sigma以及视频生成任务的OpenSora。我们的结果表明,对于图像生成,我们的方法在高分辨率(2k x 2k)生成中最多减少76%的注意力FLOPs,并实现高达1.8倍的端到端加速。

英文摘要:

Diffusion Transformers (DiT) excel at image and video generation but face computational challenges due to the quadratic complexity of self-attention operators. We propose DiTFastAttn, a post-training compression method to alleviate the computational bottleneck of DiT. We identify three key redundancies in the attention computation during DiT inference: (1) spatial redundancy, where many attention heads focus on local information; (2) temporal redundancy, with high similarity between the attention outputs of neighboring steps; (3) conditional redundancy, where conditional and unconditional inferences exhibit significant similarity. We propose three techniques to reduce these redundancies: (1) Window Attention with Residual Sharing to reduce spatial redundancy; (2) Attention Sharing across Timesteps to exploit the similarity between steps; (3) Attention Sharing across CFG to skip redundant computations during conditional generation. We apply DiTFastAttn to DiT, PixArt-Sigma for image generation tasks, and OpenSora for video generation tasks. Our results show that for image generation, our method reduces up to 76% of the attention FLOPs and achieves up to 1.8x end-to-end speedup at high-resolution (2k x 2k) generation.

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

↑