atlas

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

CaM: Cache Merging for Memory-efficient LLMs Inference

ICML 2024 · Large language models › Reasoning and chain of thought · approach: KV cache compression

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 Cache Merging (CaM), which merges to-be-evicted KV cache value vectors into retained local tokens using a Bernoulli sampling mask based on accumulated attention, to reduce output perturbation of KV cache eviction methods.

Problem

KV cache eviction for memory-efficient LLM inference causes output perturbation that grows with compression ratio, degrading performance on QA, summarization and language modeling.

Approach

Instead of discarding evicted KV value caches, merge them evenly into a window of local tokens' value caches, with a probabilistic merge mask proportional to the cumulative attention of the evicted token relative to the local window average; this provably reduces output perturbation relative to eviction under a condition on attention ratios.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Add CaM to ScissorhandsLLaMA-7B · OpenBookQAaccuracy: 22.0 -> 25.4±0.2Helped
Add CaM to StreamingLLMLLaMA-7B · PiQAaccuracy: 67.6 -> 69.8±0.2Helped
Add CaM to StreamingLLMLLaMA-7B · Winograndeaccuracy: 52.7 -> 54.5±0.1Helped
Add CaM to StreamingLLMLLaMA-7B · COPAaccuracy: 64.0 -> 68.0±0.0Helped
Add CaM to ScissorhandsLLaMA-7B · RTEaccuracy: 51.6 -> 53.4±0.1Helped
Add CaM to H2OLLaMA-7B · MathQAaccuracy: 22.1 -> 22.4±0.0Helped
Use average merging across local tokens instead of merging into a randomly selected local token (ablation)CaM on LLaMA-7B · OpenBookQAaccuracy: 30.4±0.3 -> 31.8±0.2Helped
Add the merge mask (ablation)CaM on LLaMA-7B · COPAaccuracy: 63.0±0.0 -> 68.0±0.0Helped
Use accumulated attention rather than current-step attention to derive the merge mask (ablation)CaM on LLaMA-7B · RTEaccuracy: 54.5±0.2 -> 54.6±0.2No clear effect
Add CaM to StreamingLLMPG-19 test set, first sample · PG-19 test set, first samplethroughput: 26.1 ms/token -> 27.3 ms/tokenHurt
Add CaM to StreamingLLMPG-19 test set, first sample · PG-19 test set, first sampleGPU memory: 19.1GB -> 19.3GBHurt

Surprising findings

Limitations

Experimental setup

Datasets: COPA MathQA OpenBookQA PiQA RTE Winogrande XSUM CNN/DailyMail Wikitext-2 PG-19

Benchmarks: OpenBookQA PiQA Winogrande COPA RTE MathQA XSUM CNN/DailyMail Wikitext-2 PG-19

Metrics: accuracy Rouge-1 coverage perplexity generation throughput GPU memory

Baselines: StreamingLLM H2O Scissorhands Full cache

Builds on: StreamingLLM H2O Scissorhands Token Merge (ToMe)

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