Reproduce “Dynamic Memory Compression: Retrofitting LLMs for Accelerated Inference” on OpenResearch

Turn your favorite coding agents into research agents that review literature, develop hypotheses, and run experiments.

Universal app for Apple silicon and Intel. Requires macOS 11 or later.

About this paper

Piotr Nawrot, Adrian Łańcucki, Marcin Chochowski, David Tarjan, Edoardo M. Ponti

Dynamic Memory Compression (DMC), developed by researchers at NVIDIA, the University of Wrocław, and the University of Edinburgh, introduces an online, adaptive method to compress the Key-Value (KV) cache of Large Language Models during inference by intelligently merging tokens. The retrofitting approach, applied to Llama 2 models, achieves up to a 7x throughput increase while preserving or slightly improving downstream performance, and a combined 16x compression when integrated with Grouped Query Attention.

Key insights

  • LLMs can learn an adaptive, per-head and per-layer strategy for KV cache compression by merging token representations without adding new parameters.
  • The learned compression schema reveals that deeper layers are preferentially compressed, with minimal dependence on the token's absolute position.
  • Interpretable compression patterns emerge, such as merging subwords or semantically related tokens, providing insights into how LLMs manage information redundancy.

Summary by alphaXiv.

Tip: change arxiv.org to autoarxiv.org in any arXiv abstract link to open the paper here.