ChatPaper.aiChatPaper

SageAttention2++: SageAttention2의 더 효율적인 구현

SageAttention2++: A More Efficient Implementation of SageAttention2

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

초록

어텐션의 효율성은 시퀀스 길이에 따라 시간 복잡도가 제곱으로 증가하기 때문에 매우 중요합니다. SageAttention2는 어텐션 내 행렬 곱셈(Matmul)을 가속화하기 위해 양자화를 활용하여 이 문제를 해결합니다. SageAttention2를 더욱 가속화하기 위해, 우리는 FP8 Matmul을 FP16으로 누적하는 더 빠른 명령어를 활용할 것을 제안합니다. 이 명령어는 SageAttention2에서 사용된 FP8 Matmul보다 2배 빠릅니다. 우리의 실험 결과, SageAttention2++는 FlashAttention 대비 3.9배의 속도 향상을 달성하면서도 SageAttention2와 동일한 어텐션 정확도를 유지합니다. 이는 SageAttention2++가 언어, 이미지, 비디오 생성 모델을 포함한 다양한 모델을 효과적으로 가속화하며, 최종 지표에서의 손실은 미미하다는 것을 의미합니다. 코드는 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.
PDF473May 29, 2025