[Paper Review] MiniCache: KV Cache Compression in Depth Dimension for Large Language Models
MiniCache proposes a training-free, cross-layer KV cache compression method that exploits inter-layer similarity in deep transformer layers by decomposing key-value states into magnitude and direction components, enabling efficient merging across adjacent layers. It achieves up to 5.02× compression ratio with 4-bit quantization, 5× higher throughput, and 41% lower memory usage than FP16 baseline, while maintaining near-lossless performance on LLaMA-2 and other models.
A critical approach for efficiently deploying computationally demanding large language models (LLMs) is Key-Value (KV) caching. The KV cache stores key-value states of previously generated tokens, significantly reducing the need for repetitive computations and thereby lowering latency in autoregressive generation. However, the size of the KV cache grows linearly with sequence length, posing challenges for applications requiring long context input and extensive sequence generation. In this paper, we present a simple yet effective approach, called MiniCache, to compress the KV cache across layers from a novel depth perspective, significantly reducing the memory footprint for LLM inference. Our approach is based on the observation that KV cache states exhibit high similarity between the adjacent layers in the middle-to-deep portion of LLMs. To facilitate merging, we propose disentangling the states into the magnitude and direction components, interpolating the directions of the state vectors while preserving their lengths unchanged. Furthermore, we introduce a token retention strategy to keep highly distinct state pairs unmerged, thus preserving the information with minimal additional storage overhead. Our MiniCache is training-free and general, complementing existing KV cache compression strategies, such as quantization and sparsity. We conduct a comprehensive evaluation of MiniCache utilizing various models including LLaMA-2, LLaMA-3, Phi-3, Mistral, and Mixtral across multiple benchmarks, demonstrating its exceptional performance in achieving superior compression ratios and high throughput. On the ShareGPT dataset, LLaMA-2-7B with 4-bit MiniCache achieves a remarkable compression ratio of up to 5.02x, enhances inference throughput by approximately 5x, and reduces the memory footprint by 41% compared to the FP16 full cache baseline, all while maintaining near-lossless performance.
Motivation & Objective
- To address the high memory footprint of KV caches in autoregressive LLM inference, especially under long context lengths.
- To explore and exploit inter-layer redundancy in KV cache states across the depth dimension of LLMs, a direction previously overlooked.
- To design a training-free, generalizable compression method that complements existing strategies like quantization and sparsity.
- To maintain near-lossless performance while drastically reducing memory usage and improving inference throughput.
- To enable efficient deployment of long-context LLMs through a simple yet effective merging strategy based on vector decomposition.
Proposed method
- Decompose KV cache states into magnitude and direction components using reparameterization, similar to weight normalization, to enable stable inter-layer merging.
- Interpolate the direction components of adjacent layer states while preserving their magnitudes, allowing for accurate merging of similar states.
- Introduce a token retention strategy that identifies and preserves highly distinct state pairs to avoid information loss during merging.
- Apply the method across multiple layers starting from the middle-to-deep portion of the network, where inter-layer similarity is highest.
- Integrate seamlessly with existing compression techniques such as 4-bit quantization and sparsity, enhancing overall memory efficiency.
- Operate in an end-to-end, inference-only manner without requiring retraining or fine-tuning.

Experimental results
Research questions
- RQ1Can inter-layer redundancy in KV cache states be effectively exploited to reduce memory footprint in LLM inference?
- RQ2How can KV cache states from adjacent layers be merged accurately while preserving model performance?
- RQ3What is the impact of merging KV cache states across the depth dimension on inference speed and memory consumption?
- RQ4How does MiniCache compare to baseline methods like mean averaging or full FP16 caching in terms of accuracy and efficiency?
- RQ5Can MiniCache be combined with other compression techniques like quantization to achieve even greater gains?
Key findings
- On the ShareGPT benchmark, LLaMA-2-7B with 4-bit MiniCache achieves a compression ratio of 5.02×, reducing memory footprint by 41% compared to FP16 baseline.
- MiniCache boosts inference throughput by approximately 5× on the same setup, significantly improving serving efficiency.
- The method maintains near-lossless performance, with minimal drop in generation quality across multiple benchmarks including GSM8K, COQA, and TruthfulQA.
- The performance gain is most pronounced in deeper layers, where inter-layer similarity is highest, validating the core design choice of starting merging from mid-to-deep layers.
- MiniCache outperforms the simple mean-baseline merging strategy, demonstrating the effectiveness of its magnitude-direction decomposition and selective retention mechanism.
- The approach generalizes across diverse models including LLaMA-2, LLaMA-3, Phi-3, Mistral, and Mixtral, showing consistent gains across architecture types.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.