Reproduce “MiniKV: Pushing the Limits of LLM Inference via 2-Bit Layer-Discriminative KV Cache” on OpenResearch

Run Claude Code, Codex or any coding agent as a research agent: literature, hypotheses and experiments on your laptop, cluster or cloud GPUs.

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

About this paper

Akshat Sharma, Hangliang Ding, Jianping Li, Neel Dani, Minjia Zhang

MiniKV, developed by researchers at the University of Illinois at Urbana-Champaign, introduces a co-designed system that combines 2-bit KV cache quantization with adaptive policies and custom kernels, achieving up to 86% KV cache memory reduction. This allows for processing prompts 10% longer and boosting inference throughput by 48% on an NVIDIA A100 GPU while maintaining high accuracy in long-context Large Language Model tasks.

Key insights

  • Effective 2-bit KV cache compression, when coupled with adaptive policies, requires careful design to prevent re-encoding issues and maintain accuracy, as demonstrated by persistent heavy hitter selection.
  • Robust performance in long-context tasks necessitates a balanced retention of both 'heavy hitter' and 'recent window' tokens, with optimal KV cache allocation varying across transformer layers (e.g., pyramid-like distribution).
  • System-algorithm co-design is crucial, as hardware-friendly kernels (like the two-pass selective FlashAttention) are essential for translating algorithmic memory savings into actual system performance gains and resolving incompatibilities with existing optimizations.

Summary by alphaXiv.

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