atlas

Research map / Architectures and efficiency / Attention and transformers

DuoAttention: Efficient Long-Context LLM Inference with Retrieval and Streaming Heads

ICLR 2025 · Architectures and efficiency › Attention and transformers · approach: KV cache eviction and compression · 2 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 DuoAttention, which splits attention heads into full-KV retrieval heads and constant-KV streaming heads, identified by optimizing per-head gate values on synthetic passkey data, to cut long-context decoding and pre-filling cost and memory.

Problem

Long-context LLM inference is limited by KV cache memory growing linearly with context and by attention compute, while existing KV cache pruning methods either hurt long-context ability or give limited efficiency gains.

Approach

Only a fraction of heads (retrieval heads) need full attention; the rest (streaming heads) can attend only to attention sinks and recent tokens. Head roles are identified by optimizing per-head gates that blend full and streaming attention, using a distillation loss on a synthetic passkey dataset plus L1 regularization, rather than by attention-score profiling.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use DuoAttention instead of H2O at the 50% KV budgetLlama-3-8B-Instruct-1048K · LongBench Averagescore: 35.76 -> 40.21Helped
Use DuoAttention instead of FastGenLlama-3-8B-Instruct-1048K · LongBench Averagescore: 32.82 -> 40.01Helped
Use DuoAttention instead of H2O at the 25% KV budgetLlama-2-7B-Instruct-32K · LongBench Averagescore: 26.84 -> 34.49Helped
Use DuoAttention instead of FastGenLlama-2-7B-Instruct-32K · LongBench Averagescore: 19.01 -> 32.81Helped
Add DuoAttention to full attentionLlama-2-7B-Instruct-32K · LongBench Averagescore: 37.52 -> 34.49Hurt
Use DuoAttention instead of full attentionLlama-3-8B-Instruct-1048K · LongBench Averagescore: 40.08 -> 40.21No clear effect
Add optimization-based retrieval-head identification rather than attention profiling (ablation)DuoAttention · Mistral-7B-Instruct-v0.2 passkey retrievalexact match accuracyHelped
Add synthetic passkey data for retrieval-head identification rather than language-modeling data (ablation)DuoAttention · Mistral-7B-Instruct-v0.2 passkey retrievalexact match accuracyHelped
Use both sink and recent tokens during retrieval-head optimization rather than only one token group (ablation)DuoAttention · Mistral-7B-Instruct-v0.2 passkey retrievalexact match accuracyHelped
Increase deployment sink and recent-token counts beyond 16 and 64 (ablation)DuoAttention · Mistral-7B-Instruct-v0.2 passkey retrieval and MMLUperformanceNo clear effect

Surprising findings

Limitations

Experimental setup

Datasets: BookSum synthetic passkey retrieval dataset

Benchmarks: Needle-in-a-Haystack LongBench MMLU MBPP MT-Bench

Metrics: accuracy decoding latency memory usage pre-filling latency speedup

Baselines: H2O TOVA FastGen StreamingLLM RazorAttention

Builds on: StreamingLLM FlashAttention-2 Needle-in-a-Haystack CNN filter pruning

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