atlas

Research map / Architectures and efficiency / Quantization

SageAttention2: Efficient Attention with Thorough Outlier Smoothing and Per-thread INT4 Quantization

ICML 2025 · Architectures and efficiency › Quantization · approach: Ultra-low-bit LLM quantization · 0 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes SageAttention2, a quantized attention kernel that runs Q,K in INT4 (per-thread granularity, with Q smoothing) and P,V in FP8 (with two-level FP32 accumulation), achieving ~3x FlashAttention2 kernel speed on RTX4090 with negligible end-to-end metric loss.

Problem

Attention is quadratic in sequence length and quantizing its matmuls to low precision (INT4 for QK^T, FP8 for PV) causes large accuracy loss due to outliers, INT4's narrow range, and reduced FP8 accumulator precision.

Approach

Smooth Q (in addition to K) by subtracting block means and correcting with a GEMV bias term; per-thread quantization groups tokens according to the mma instruction layout so each thread needs one dequantization scale; quantize P to FP8 with static scale and V per-channel; and use a two-level accumulation (FP22 mma result added into FP32 buffer) to counter the discovered FP22 accumulator.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
smooth both Q and K instead of leaving them unsmoothed (ablation)INT4 Q,K quantization · CogvideoX layersCosSim: 80.04% -> 99.46%Helped
smooth Q as well as K, rather than smoothing K alone (ablation)INT4 Q,K quantization · CogvideoX layersCosSim: 98.07% -> 99.46%Helped
use per-thread rather than per-block quantization (ablation)INT4 Q,K quantization · CogvideoX layersCos Sim: 98.03% -> 99.45%Helped
use per-thread rather than per-token quantization (ablation)INT4 Q,K quantization · CogvideoX layersTOPS: 268 -> 283Helped
use E4M3 rather than E5M2 for P,V (ablation)SageAttention2-4b · CogvideoX layersCosSim: 99.20% -> 99.44%Helped
smooth V by subtracting its channel mean (ablation)SageAttention2-4b · CogvideoX real tensorsCos Sim: 98.25% -> 99.75%Helped
add per-thread quantization (ablation)SageAttention2 attention kernel · L20TOPS: 284 -> 283No clear effect
add Q smoothing (ablation)SageAttention2 attention kernel · L20TOPS: 284 -> 273Hurt
use SageAttn2-4b rather than full-precision attentionLlama3.1 (8B) · Llama3.1MMLU accuracy: 0.635 -> 0.607Hurt
use SageAttn2-8b rather than full-precision attentionLlama3.1 (8B) · Llama3.1MMLU accuracy: 0.635 -> 0.634No clear effect
use SageAttn2-4b rather than full-precision attentionCogvideoX (1.5-5B) · CogvideoX (1.5-5B)VQA-a: 70.231 -> 57.729Hurt
use SageAttn2-8b rather than full-precision attentionCogvideoX (1.5-5B) · CogvideoX (1.5-5B)VQA-a: 70.231 -> 69.492Hurt

Surprising findings

Limitations

Experimental setup

Datasets: WikiText LAMBADA MMLU LongBench open-sora prompt sets MJHQ-30K ImageNet Librispeech

Benchmarks: WikiText LAMBADA MMLU LongBench open-sora prompts (VBench-style video metrics) MJHQ-30K ImageNet InfiniBench Needle-in-a-Haystack Librispeech

Metrics: perplexity accuracy CLIPSIM VQA-a VQA-t FID cosine similarity relative L1 RMSE TOPS

Baselines: SageAttention FlashAttention2 FlashAttention3 (fp8) xformers HadmdAttn SmoothAttn

Builds on: SageAttention FlashAttention SmoothQuant QServe QuaRot

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy