atlas

Research map / Architectures and efficiency / Attention and transformers

RazorAttention: Efficient KV Cache Compression Through Retrieval Heads

ICLR 2025 · Architectures and efficiency › Attention and transformers · approach: KV cache eviction and compression

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 RazorAttention, a training-free KV cache compression that keeps full cache for retrieval heads (identified via induction/echo scores) and compresses remote tokens of other heads into a single compensation token, achieving ~3x KV reduction.

Problem

KV cache growth is the main memory and compute bottleneck for long-context LLM inference, and importance-based token dropping irreversibly discards information that later queries may need.

Approach

Use head-wise caching: a small set of retrieval heads (found via induction and echo scores on repeated random tokens) keep the full KV cache, while all other heads keep only recent tokens and sink tokens, with the dropped tokens averaged into one compensation key/value; the head-wise criterion does not need attention maps, so it works with FlashAttention.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
compress the KV cache with RazorAttention at the reported 3X compression ratioQwen1.5-7B-Chat · LongBench averagescore: 36.03 -> 35.87No clear effect
compress the KV cache with RazorAttention at the reported 3X compression ratioQwen1.5-72B-Chat · LongBench averagescore: 46.15 -> 45.97No clear effect
compress the KV cache with RazorAttention at the reported 3X compression ratioLlama3-8B-Instruct · LongBench averagescore: 35.44 -> 34.86No clear effect
compress the KV cache with RazorAttention at the reported 3X compression ratioBaichuan2-13B · LongBench averagescore: 36.41 -> 36.45No clear effect
protect retrieval heads rather than random heads while keeping only recent 4K tokens in the restQwen1.5-7B-Chat · MultiFieldQA-enscore: 40.7% -> 45.48%Helped
increase protected induction heads from 5% to 8% while protecting 1% echo heads (ablation)RazorAttention · Needle in a Haystackscore: 69.54% -> 78.40%Helped
increase protected induction heads from 8% to 11% while protecting 1% echo heads (ablation)RazorAttention · Needle in a Haystackscore: 78.40% -> 84.55%Helped
increase protected induction heads from 11% to 14% while protecting 1% echo heads (ablation)RazorAttention · Needle in a Haystackscore: 84.55% -> 86.59%Helped
add a compensation token for the dropped KV cache (ablation)RazorAttention · long-context tasksaccuracyHelped
add 1% echo heads to the protected retrieval-head group (ablation)RazorAttention on Llama2-7B-80K · Needle in a Haystackretrieval performanceHelped

Surprising findings

Limitations

Experimental setup

Datasets: LongBench Needle In A Haystack

Benchmarks: LongBench Needle In A Haystack

Metrics: LongBench score needle retrieval accuracy

Baselines: H2O StreamingLLM

Builds on: H2O StreamingLLM FlashAttention induction heads

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