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

- **ID:** 570
- **Kind:** paper
- **URL:** https://arxiv.org/abs/2410.02367
- **Authors:** Jintao Zhang, Jia Wei, Haofeng Huang, Pengle Zhang, Jun Zhu, Jianfei Chen
- **Venue:** arXiv / Tsinghua University
- **Published:** 2024
- **License:** CC BY 4.0
- **License family:** Permissive (auto-classified)
- **Tags:** sageattention, int8, flashattention, quantization, triton, iclr, tsinghua, inference
- **Topics:** quantization, attention kernels, inference
- **Added:** 2026-10-01
- **Research status:** done
- **Page:** https://papers.projxon.ai/entries/570

## Summary

PTQ attention: subtract the token-mean of K to smooth channel outliers so QK can be INT8, and keep PV in FP16 with an FP16 accumulator (INT8 PV is too noisy on some layers). Triton kernels on RTX4090/3090; peak ~341 TOPS at headdim 64/128 vs FlashAttention2 ~165. ~2.1× FA2 and ~2.7× xformers. Plug-and-play: Llama2-7B WikiText 5.824 vs FP 5.823, MMLU 0.46=FP; CogVideoX/Unidiffuser/UltraPixel/TIMM/Llava1.6 near-parity. ICLR 2025. Code https://github.com/thu-ml/SageAttention.

## Attributes

- **Purpose:** Accelerate attention at inference with plug-and-play INT8 quantization that keeps end-to-end metrics
- **Scale:** RTX4090/3090; Llama2-7B, CogVideoX, Unidiffuser, UltraPixel, TIMM ViT-B/16, Llava1.6; headdim 64/128; CogVideoX QKV (2, 30, 17776, 64)
- **Time period:** 2024-10-03 (arXiv 2410.02367 v1); last revised 2025-10-01 (v9). ICLR 2025. HF paper publishedAt 2024-10-03.

## From the source (fetched 2026-10-03)

- **Published:** Oct 3, 2024 (arXiv)
- **Last revised:** Oct 1, 2025 (arXiv)
- **arXiv categories:** cs.LG (arXiv)
- **Journal reference:** The Thirteenth International Conference on Learning Representations (ICLR 2025) (arXiv)
- **Author comment:** @inproceedings{zhang2025sageattention, title={SageAttention: Accurate 8-Bit Attention for Plug-and-play Inference Acceleration}, author={Zhang, Jintao and Wei, Jia and Zhang, Pengle and Zhu, Jun and Chen, Jianfei}, booktitle={International Conference on Learning Representations (ICLR)}, year={2025} } (arXiv)
- **Citations:** 185 (13 influential) (Semantic Scholar)
- **References:** 80 (Semantic Scholar)
- **Published in:** International Conference on Learning Representations (Semantic Scholar)

## 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.

## Research notes

- Primary: arxiv abs (cs.LG). License CC BY 4.0 on HTML at check. Comment: ICLR 2025 bibitem; journal_ref The Thirteenth International Conference on Learning Representations (ICLR 2025). Corresponding Jianfei Chen; Tsinghua CST / Institute for AI / BNRist / Tsinghua-Bosch Joint ML Center. Code https://github.com/thu-ml/SageAttention (HF projectPage; 3,640 stars at check; Apache-2.0). HF paper page 50 upvotes; unofficial linked model jt-zhang/SageAttention2_plus not copied into hf_* fields. Discord posted abs with a speed/accuracy blurb. Kernel library, not a new corpus, so no datasets_local row.

## Cites, within this collection

- [FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precision](https://papers.projxon.ai/entries/575) (paper 2024, #575)

## Cited by, within this collection

- [Helios: Real Real-Time Long Video Generation Model](https://papers.projxon.ai/entries/531) (paper 2026, #531)
- [DC-Gen: Post-Training Diffusion Acceleration with Deeply Compressed Latent Space](https://papers.projxon.ai/entries/945) (paper 2025, #945)

## Similar entries

- [Disaggregated Quantization: Specializing LLM Prefill and Decode](https://papers.projxon.ai/entries/829) (paper, #829)
- [FlashHead: Efficient Drop-In Replacement for the Classification Head in Language Model Inference](https://papers.projxon.ai/entries/983) (paper, #983)
- [VBR: Variable Bit-Rate KV Cache for llama.cpp](https://papers.projxon.ai/entries/631) (code, #631)
- [BitNet a4.8: 4-bit Activations for 1-bit LLMs](https://papers.projxon.ai/entries/556) (paper, #556)
- [KohakuFA: Attention Kernel with Fixed Backward-Pass Precision](https://papers.projxon.ai/entries/1217) (code, #1217)
- [Bi-Mamba: Towards Accurate 1-Bit State Space Models](https://papers.projxon.ai/entries/561) (paper, #561)
