NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

MiniKV: Pushing the Limits of 2-Bit KV Cache via Compression and System Co-Design for Efficient Long Context Inference

Akshat Sharma, Hangliang Ding, Jianping Li, Neel Dani, Minjia ZhangACL 2025

Abstract

MiniKV is a novel system designed to significantly reduce the memory footprint of Large Language Model (LLM) Key-Value (KV) caches by over 80% without compromising accuracy. By integrating aggressive 2-bit quantization with a "pyramid" token eviction strategy and a custom-built "Selective FlashAttention" kernel, MiniKV enables high-throughput inference for long-context tasks on a single GPU.

Introduction

As Large Language Models (LLMs) are increasingly deployed for long-document processing, the memory requirements of the KV cache become a critical bottleneck. This cache, which stores contextual information to avoid redundant computation, can easily exceed the VRAM capacity of modern GPUs. Existing solutions typically involve either quantization (reducing numerical precision) or adaptive eviction (pruning unimportant tokens). However, combining these methods often leads to accuracy degradation due to quantization noise and incompatibility with hardware-optimized kernels like FlashAttention, which typically bypass the calculation of importance scores needed for pruning.

Methods: System and Algorithm Co-Design

MiniKV addresses these challenges through a synergistic approach involving three primary innovations:

  1. 2-Bit Sub-channel Quantization: To mitigate the impact of outliers at ultra-low precision, MiniKV employs fine-grained quantization. By grouping Key states into sub-channels, the system maintains model stability and accuracy even at 2-bit precision.
  2. Pyramid-like Eviction Policy: Recognizing that different layers contribute differently to context retention, MiniKV uses a "pyramid" strategy. Lower layers are allocated a larger memory budget to maintain broad context, while higher layers are more aggressively pruned.
  3. Selective FlashAttention Kernel: A custom Triton-based kernel was developed to bridge the gap between algorithmic pruning and hardware efficiency. This two-pass kernel performs memory-efficient attention while simultaneously recovering cumulative attention scores, enabling effective cache pruning without sacrificing the speed of FlashAttention.
Overview of MiniKV's architecture, illustrating the Prefill and Decoding phases, including Selective Flash Attention and the Pyramid Budgeting mechanism.

Experimental Evaluation

The effectiveness of MiniKV was evaluated using several long-context benchmarks, including LongBench (QA, summarization), InfiniteBench (extremely long sequences), and GSM8K (mathematical reasoning). Tests were conducted across various models, including LLaMA2 (7B, 13B), LLaMA3 (1B, 3B, 8B), and Mistral-7B.

Key Results and Insights

MiniKV demonstrates that "heavy hitter" tokens identified during the prefill stage remain consistently important throughout generation, allowing for a stable cache selection strategy. The system achieves an 86% reduction in KV cache memory usage compared to full-precision baselines.

Analysis of KV cache selectivity and the impact of cache budget on LongBench accuracy, comparing Heavy Hitter (HH) and Recent Window (RW) strategies.

Key performance highlights include:

  • Accuracy: On LongBench, 2-bit MiniKV outperformed state-of-the-art adaptive methods like H2O and SnapKV, even when those competitors used higher precision.
  • Throughput: MiniKV achieved a 48% higher throughput than the strongest baseline on an NVIDIA A100.
  • Scalability: The system successfully processed prompts up to 44K tokens on a single 40GB A100, avoiding the Out-of-Memory (OOM) errors that plague standard implementations.

Conclusion and Future Work

MiniKV proves that aggressive quantization and intelligent eviction can be combined effectively through system-algorithm co-design. While it significantly alleviates the KV cache bottleneck, future work could explore combining MiniKV with weight quantization (e.g., GPTQ, AWQ) to further reduce total memory usage. Additionally, enhancing the robustness of eviction strategies across different quantization schemes and porting the custom kernels to non-NVIDIA hardware remain important areas for development.

Summary updated

BibTeX
@inproceedings{sharma2025minikv,
  author = {Akshat Sharma and Hangliang Ding and Jianping Li and Neel Dani and Minjia Zhang},
  title = {{MiniKV: Pushing the Limits of 2-Bit KV Cache via Compression and System Co-Design for Efficient Long Context Inference}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure