SageAttention: Accurate 8-Bit Attention for Plug-and-play Inference Acceleration

Jintao Zhang, Jia Wei, Pengle Zhang, Jun Zhu, Jianfei Chen
2/12/2026

No official code found. Best implementation: thu-ml/SageAttention (3,705 stars, Apache-2.0, last commit 2026-01-17).

Abstract

The transformer architecture predominates across various models. As the heart of the transformer, attention has a computational complexity of $O(N^2)$, compared to $O(N)$ for linear transformations. When handling large sequence lengths, attention becomes the primary time-consuming component. Although quantization has proven to be an effective method for accelerating model inference, existing quantization methods primarily focus on optimizing the linear layer. In response, we first analyze the feasibility of quantization in attention detailedly. Following that, we propose SageAttention, a highly efficient and accurate quantization method for attention. The OPS (operations per second) of our approach outperforms FlashAttention2 and xformers by about 2.1 times and 2.7 times, respectively. SageAttention also achieves superior accuracy performance over FlashAttention3. Comprehensive experiments confirm that our approach incurs almost no end-to-end metrics loss across diverse models, including those for large language processing, image generation, and video generation. The codes are available at https://github.com/thu-ml/SageAttention.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

[ICLR2025, ICML2025, NeurIPS2025 Spotlight] Quantized Attention achieves speedup of 2-5x compared to FlashAttention, without losing end-to-end metrics across language, image, and video models.

3,705501C, C++Oct 3, 20249 months agoApache-2.0
attentioncudaefficient-attentioninference-accelerationllm+7 more

Similar Papers

Cite this paper

@article{zhang2026sageattention,
  title  = {SageAttention: Accurate 8-Bit Attention for Plug-and-play Inference Acceleration},
  author = {Jintao Zhang and Jia Wei and Pengle Zhang and Jun Zhu and Jianfei Chen},
  year   = {2026},
  eprint = {2410.02367},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2410.02367},
  journal = {ICLR 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2410.02367.svg)](https://codeofpaper.com/paper/2410.02367)

Discussion