atlas

Research map / Architectures and efficiency / Attention and transformers

Reducing Transformer Key-Value Cache Size with Cross-Layer Attention

NeurIPS 2024 · Architectures and efficiency › Attention and transformers · approach: KV cache eviction and compression · 11 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 Cross-Layer Attention (CLA), which shares KV activations between adjacent layers on top of MQA, halving KV cache size with near-MQA perplexity, validated by training 1B and 3B models from scratch.

Problem

The KV cache memory footprint limits batch size and sequence length during LLM decoding, and existing MQA/GQA already share KV heads only within a layer.

Approach

Share key and value activations across layers (sharing factor, e.g. CLA2 shares each KV projection between two consecutive layers), orthogonal to and combinable with MQA/GQA/MHA, to reduce the number of KV-cache layers.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
add CLA2 to H128-MQA1B MQA · SlimPajama validationperplexity: 13.54 -> 13.60Hurt
add CLA2 to H128-MQA while halving KV cache1B MQA · validation and Wikitextperplexity: 12.39 -> 12.43; 19.30 -> 19.29No clear effect
add CLA2 to H64-MQA at the same KV cache footprint1B MQA · validation and Wikitextperplexity: 12.74 -> 12.43; 20.00 -> 19.29Helped
add CLA2 to H128-MQA3B MQA · validation and Wikitextperplexity: 9.52 -> 9.34; 13.63 -> 13.25Helped
add CLA2 to H64-MQA3B MQA, second experiment set · Wikitextperplexity: 12.94 -> 12.99Hurt
add CLA2 using GQA4 (ablation)1B GQA4 · SlimPajama validationperplexity: 13.36 -> 13.48Hurt
add CLA2 using GQA2 (ablation)1B GQA2 · SlimPajama validationperplexity: 13.52 -> 13.59No clear effect
use CLA3 instead of CLA2 (ablation)1B MQA · SlimPajama validationperplexity: 13.60 -> 13.77Hurt
use CLA4 instead of CLA2 (ablation)1B MQA · SlimPajama validationperplexity: 13.60 -> 13.95Hurt
use non-uniform CLA2 sharing that keeps end layers separate (ablation)1B MQA · SlimPajama validationperplexity: 13.60 -> 13.62Hurt
concentrate KV-producing layers at the front (ablation)1B MQA-CLA2 · SlimPajama validationperplexity: 13.60 -> 13.75Hurt
concentrate KV-producing layers at the back (ablation)1B MQA-CLA2 · SlimPajama validationperplexity: 13.60 -> 14.03Hurt

Surprising findings

Limitations

Experimental setup

Datasets: SlimPajama

Benchmarks: SlimPajama validation perplexity WikiText perplexity Hellaswag PIQA WinoGrande SciQ OpenBookQA BoolQ ARC-E

Metrics: perplexity accuracy KV cache bytes per token

Baselines: MHA GQA MQA

Builds on: multi-query attention grouped-query attention Llama architecture SwiGLU

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