atlas

Research map / Architectures and efficiency / Attention and transformers

Dynamic Memory Compression: Retrofitting LLMs for Accelerated Inference

ICML 2024 · Architectures and efficiency › Attention and transformers · approach: KV cache eviction and compression · 1 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.

Retrofits pre-trained Llama 2 (7B/13B/70B) with Dynamic Memory Compression, a learned per-head online KV-cache merge/append policy, via continued pre-training, achieving up to 4x cache compression without performance loss and up to 7x inference throughput on H100.

Problem

The KV cache of Transformer LLMs grows linearly with sequence length and batch size, making auto-regressive generation memory-bound and inefficient.

Approach

Learn, end-to-end and per head/layer, whether each new token's key-value pair is appended to the cache or accumulated (weighted-averaged) into the last cache entry, using a Gumbel-sigmoid relaxation during training and a global compression-ratio loss; the decisions and importance scores reuse existing q/k neurons so no parameters are added.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use DMC instead of up-trained GQA at the same compression ratioLlama 2 7B/13B · MMLUaccuracy: +5.4 for 2× CR; +9.2 for 4× CR (7B); +4.6 for 2× CR; +5.6 for 4× CR (13B)Helped
Use DMC 2× on top of existing GQA 8×Llama 2 70B · MMLU, CS-QA, HumanEvaldownstream performanceNo clear effect
Increase DMC compression from 4× to 8×Llama 2 7B/13B · MMLUaccuracy: -2.8 at 8× CR (7B); -2.4 at 8× CR (13B)Hurt
DMC instead of cache eviction with increasing compressionLlama 2 · HumanEvalPass@1Helped
Replace learned dynamic compression with fixed memory pooling (ablation)DMC · Downstream benchmarksaccuracyHurt
Use a global compression prior instead of a layer-wise local prior (ablation)DMC · MMLUaccuracyHelped
Constrain heads in each layer to have similar compression ratios (DMC-C) (ablation)DMC · MMLUaccuracy: -6.4 in MMLU compared to the ceiling (7B 4×)Hurt
Share decision and importance scores across heads within each layer (DMC-HardC) (ablation)DMC · MMLUaccuracyHurt
Use uniform rather than learned importance weights for accumulation (ablation)DMC-C · Downstream benchmarksperformanceHurt
Set the target compression ratio immediately instead of linearly increasing it (ablation)DMC · MMLUaccuracyHurt
Use a shorter versus longer training schedule for increasing compression (ablation)DMC-C · Downstream performanceperformanceMixed
Continue training for a fixed compression ratio after reaching the target (ablation)DMC · Downstream benchmarksperformanceHelped

Surprising findings

Limitations

Experimental setup

Datasets: The Pile mC4 Common Crawl dumps 2017-2023 ArXiv The Stack PubMed Central Wikipedia

Benchmarks: MMLU HumanEval PIQA BoolQ ARC-C ARC-E HellaSwag WinoGrande

Metrics: MMLU 5-shot accuracy HumanEval pass@1 CS-QA average accuracy inference throughput latency

Baselines: Grouped Query Attention H2O TOVA Original Llama 2

Builds on: Grouped Query Attention Dynamic Token Pooling PagedAttention FlashAttention

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