SageAttention2++ : Une implémentation plus efficace de SageAttention2
SageAttention2++: A More Efficient Implementation of SageAttention2
May 27, 2025
papers.authors: Jintao Zhang, Xiaoming Xu, Jia Wei, Haofeng Huang, Pengle Zhang, Chendong Xiang, Jun Zhu, Jianfei Chen
cs.AI
papers.abstract
L'efficacité de l'attention est cruciale car sa complexité temporelle croît de manière quadratique avec la longueur de la séquence. SageAttention2 aborde ce problème en utilisant la quantification pour accélérer les multiplications matricielles (Matmul) dans l'attention. Pour accélérer davantage SageAttention2, nous proposons d'utiliser l'instruction plus rapide de Matmul FP8 accumulée en FP16. Cette instruction est 2 fois plus rapide que la Matmul FP8 utilisée dans SageAttention2. Nos expériences montrent que SageAttention2++ atteint une accélération de 3,9 fois par rapport à FlashAttention tout en maintenant la même précision d'attention que SageAttention2. Cela signifie que SageAttention2++ accélère efficacement divers modèles, y compris ceux pour la génération de langage, d'images et de vidéos, avec une perte négligeable des métriques de bout en bout. Le code sera disponible à l'adresse 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.