atlas

Research map / Large language models / Instruction and fine-tuning

SparQ Attention: Bandwidth-Efficient LLM Inference

ICML 2024 · Large language models › Instruction and fine-tuning · approach: Efficient LLM fine-tuning systems · 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 SparQ Attention, a training-free inference method that reduces KV-cache memory transfers by selecting top query components for approximate scores, fetching only top-k keys/values, and adding a mean-value correction.

Problem

LLM token generation with long, batched inputs is bottlenecked by memory bandwidth from reading the full KV cache at each decoding step.

Approach

Approximate attention scores using only the r largest-magnitude query components to read a slice of the keys, fetch full keys/values only for the top-k positions, and reallocate the unattended softmax mass to a running mean value vector, all applied to off-the-shelf pretrained models without fine-tuning.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use SparQ instead of H₂O at 1/8 compressionLlama 2 13B · SQuADaccuracy: 63.0 -> 74.9Helped
Use SparQ instead of H₂O at 1/8 compressionLlama 2 13B · TriviaQAaccuracy: 78.4 -> 78.2Hurt
Use SparQ instead of H₂O at 1/8 compressionLlama 2 13B · CNN/DailyMailROUGE-L: 20.3 -> 21.6Helped
Use SparQ instead of H₂O at 1/8 compressionLlama 2 13B · WikiText-103BPC: 0.64 -> 0.70Hurt
Use SparQ instead of LM-Infinite at 1/8 compressionLlama 2 13B · Repetitioncharacters before divergence: 29 -> 190Helped
Replace LM-Infinite or H₂O with SparQ at 1/4 compressionLLaMA-2-7B-32K · Needle in a haystack, 8k–16kaccuracy: 23.5% -> 100%; 5.9% -> 100%Helped
Replace LM-Infinite or H₂O with SparQ at 1/8 compressionLLaMA-2-7B-32K · Needle in a haystack, 8k–16kaccuracy: 11.8% -> 79.4%; 2.9% -> 79.4%Helped
Set approximate softmax temperature to the proposed query-dependent temperature (ablation)SparQ Attention · Llama 2 7B ablation taskstask performanceHelped
Do not reallocate attention mass to the mean value (α=0) (ablation)SparQ Attention · Llama 2 7B ablation taskstask performanceHurt
Reduce the number of selected key-value positions k (ablation)SparQ Attention · Llama 2 7B ablation taskstask performanceHurt
Reduce the query rank r (ablation)SparQ Attention · Llama 2 7B ablation taskstask performanceHurt
Use the top-r query components rather than the first r components (ablation)SparQ Attention · Llama 2 7B attention-score approximationtop-k agreementHelped

Surprising findings

Limitations

Experimental setup

Datasets: SQuAD v1.1 TriviaQA CNN/DailyMail WikiText-103 Tiny-Shakespeare Paul Graham essays

Benchmarks: SQuAD 1-shot TriviaQA 0-shot CNN/DailyMail WikiText-103 Text Repetition Needle in a haystack

Metrics: exact match accuracy ROUGE-L bits per character repetition length tokens per second speedup top-k agreement

Baselines: H2O LM-Infinite FlexGen oracle top-k random low-rank projection

Builds on: H2O FlexGen LM-Infinite grouped-query attention

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