ChatPaper.aiChatPaper

SageAttention2++: Een efficiëntere implementatie van SageAttention2

SageAttention2++: A More Efficient Implementation of SageAttention2

May 27, 2025
Auteurs: Jintao Zhang, Xiaoming Xu, Jia Wei, Haofeng Huang, Pengle Zhang, Chendong Xiang, Jun Zhu, Jianfei Chen
cs.AI

Samenvatting

De efficiëntie van aandacht is cruciaal omdat de tijdcomplexiteit ervan kwadratisch toeneemt met de sequentielengte. SageAttention2 lost dit op door kwantisering te gebruiken om matrixvermenigvuldigingen (Matmul) in aandacht te versnellen. Om SageAttention2 verder te versnellen, stellen we voor om de snellere instructie van FP8 Matmul geaccumuleerd in FP16 te benutten. Deze instructie is 2x sneller dan de FP8 Matmul die in SageAttention2 wordt gebruikt. Onze experimenten tonen aan dat SageAttention2++ een 3,9x versnelling bereikt ten opzichte van FlashAttention, terwijl dezelfde aandachtnauwkeurigheid als SageAttention2 wordt behouden. Dit betekent dat SageAttention2++ effectief verschillende modellen versnelt, waaronder die voor taal-, beeld- en videogeneratie, met verwaarloosbaar verlies in end-to-end metrieken. De code zal beschikbaar zijn op https://github.com/thu-ml/SageAttention.
English
The efficiency of attention is critical because its time complexity grows quadratically with sequence length. SageAttention2 addresses this by utilizing quantization to accelerate matrix multiplications (Matmul) in attention. To further accelerate SageAttention2, we propose to utilize the faster instruction of FP8 Matmul accumulated in FP16. The instruction is 2x faster than the FP8 Matmul used in SageAttention2. Our experiments show that SageAttention2++ achieves a 3.9x speedup over FlashAttention while maintaining the same attention accuracy as SageAttention2. This means SageAttention2++ effectively accelerates various models, including those for language, image, and video generation, with negligible end-to-end metrics loss. The code will be available at https://github.com/thu-ml/SageAttention.
PDF463May 29, 2025