atlas

Research map / Large language models / Reasoning and chain of thought

CHAI: Clustered Head Attention for Efficient LLM Inference

ICML 2024 · Large language models › Reasoning and chain of thought · approach: Efficient LLM serving · 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 CHAI, a training-free runtime method that clusters attention heads with correlated attention patterns (clusters decided from the first five tokens) and computes self-attention only for one representative per cluster, reducing compute and K,V cache for LLM inference.

Problem

Multi-head attention in LLMs is compute- and memory-intensive at inference time (K,V cache growth and repeated attention ops), and existing runtime pruning (DejaVu) and architectural co-design (GQA/MQA) either fail on parameter-efficient models like LLaMA or require retraining.

Approach

Observe that many heads in a layer produce highly correlated attention scores; offline pick the number of clusters per layer via elbow analysis on C4, then per request cluster heads by their attention activations from the first five tokens, compute attention only for one head per cluster, and drop the redundant heads' keys (values kept) from the K,V cache.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
cluster attention heads dynamically rather than using MHACHAI on OPT-66B · PIQA, HellaSwag, Arc-Challenge, Arc-Easy, BoolQaccuracy change vs MHA: -0.15; 0.1; 0.1; -0.1; -0.6Mixed
cluster attention heads dynamically rather than using MHACHAI on LLaMA-7B · PIQA, HellaSwag, Arc-Challenge, Arc-Easy, BoolQaccuracy change vs MHA: -2.0; -3.2; -0.5; 0.3; 0.1Mixed
cluster attention heads dynamically rather than using MHACHAI on LLaMA-33B · PIQA, HellaSwag, Arc-Challenge, Arc-Easy, BoolQaccuracy change vs MHA: 0; -0.14; -0.21; 0.9; -0.04Mixed
replace context-dependent cluster membership with static membership (ablation)CHAI on LLaMA-7B · PIQA, HellaSwag, Arc-Challenge, Arc-Easy, BoolQaccuracy change vs MHA: -4.0; -4.3; -3.7; -2.5; -0.8Hurt
replace context-dependent cluster membership with static membership (ablation)CHAI on LLaMA-33B · PIQA, HellaSwag, Arc-Challenge, Arc-Easy, BoolQaccuracy change vs MHA: -0.5; -0.2; -1.3; -3.7; -1.5Hurt
reuse the selected head's value vector along with query and key (ablation)CHAI on LLaMA-7B · Arc-Challengeaccuracy: 47.0 -> 41.29Hurt
reuse the selected head's value vector along with query and key (ablation)CHAI on LLaMA-7B · PIQAaccuracy: 77.8 -> 61.93Hurt
cluster redundant attention headsCHAI on LLaMA-7B · KV cachememory reduction: 21.4%Helped
cluster redundant attention headsCHAI on LLaMA-7B · sequence length 2048time-to-first-token speedup: 1.72×Helped
cluster redundant attention headsCHAI on LLaMA-7B · sequence length 2048time-to-next-token speedup: over 5×Helped

Surprising findings

Limitations

Experimental setup

Datasets: C4

Benchmarks: PIQA HellaSwag ARC-Challenge ARC-Easy BoolQ

Metrics: accuracy accuracy deviation from MHA time to first token latency time to next token latency K,V cache memory reduction

Baselines: MHA DejaVu SpAtten CHAI-static

Builds on: DejaVu Grouped-Query Attention SpAtten xFormers

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