ChunkKV: Semantic-Preserving KV Cache Compression for Efficient Long-Context LLM Inference

Xiang Liu, Zhenheng Tang, Peijie Dong, Zeyu Li, Liuyue, Bo Li, Xuming Hu, Xiaowen Chu

Introduction

Large Language Models (LLMs) are increasingly deployed for long-context tasks, such as multi-document summarization, codebase analysis, and complex mathematical reasoning. However, as context length grows, the Key-Value (KV) cache—which stores previous token activations to prevent redundant computation—becomes a significant hardware bottleneck. In many long-context scenarios, the KV cache can consume up to 70% of total GPU memory, severely limiting throughput and increasing inference latency.

Existing compression techniques, such as H2O and SnapKV, attempt to mitigate this by pruning "unimportant" tokens based on attention scores. While effective at reducing memory footprints, these methods operate at a discrete, token-level granularity. This often results in semantic fragmentation, where the model retains isolated keywords but loses the surrounding linguistic structure (e.g., keeping a specific noun but pruning its associated verb or preposition). This "word salad" effect degrades the model's ability to maintain coherent reasoning and retrieve specific information from the context.

The ChunkKV Framework

To address these limitations, we introduce ChunkKV, a novel compression strategy that shifts the unit of pruning from individual tokens to semantic chunks. ChunkKV is built upon three core pillars:

1. Chunk-Based Compression

Instead of evaluating tokens in isolation, ChunkKV groups tokens into fixed-size segments (typically 10 tokens per chunk). The importance of a chunk is determined by the cumulative attention score of its constituent tokens. If a chunk is deemed significant, the entire block is preserved in the KV cache; otherwise, it is discarded. This approach ensures that subjects, verbs, and objects remain together, preserving the semantic flow necessary for the model to reconstruct meaning even under high compression ratios.

2. Layer-Wise Index Reuse

Empirical analysis reveals that the "important" regions of context tend to be highly consistent across different transformer layers. ChunkKV exploits this stability by calculating pruning indices for a single layer and reusing those indices for several subsequent layers ($N_{reuse}$). This strategy significantly reduces the computational overhead associated with calculating importance scores at every layer, leading to substantial gains in inference speed.

3. Hybrid Strategy Analysis

The framework also supports a hybrid approach to granularity. In early layers, where the model processes local semantic structures, chunk-level pruning is prioritized. In deeper layers, where the model focuses on abstract, global signals, the system can transition to finer-grained token-level pruning to capture specific high-signal activations.

Experimental Evaluation

ChunkKV was evaluated across a diverse range of benchmarks and models, including Llama-3 (8B/70B), Mistral-7B, Qwen2-7B, and DeepSeek-R1-Distill-Llama-8B. The benchmarks included:

  • LongBench: For comprehensive long-context understanding.
  • Needle-In-A-Haystack (NIAH): To test information retrieval precision.
  • GSM8K: To evaluate mathematical reasoning resilience.
  • JailbreakV: To assess safety and robustness under compression.

Key Results and Insights

Superior Accuracy and Precision

On the LongBench suite, ChunkKV achieved up to an 8.7% improvement in precision over state-of-the-art methods like SnapKV and H2O, while maintaining the same 10% compression ratio. By preserving semantic integrity, the model avoids the performance collapse often seen in discrete pruning methods.

Enhanced Inference Efficiency

The implementation of layer-wise index reuse provided a 26.5% boost in throughput and a 20.7% reduction in latency compared to standard KV cache management. This efficiency is driven by the high Jaccard similarity of important chunks across layers (reaching up to 57%, compared to ~25% for token-based methods).

Robustness in Retrieval and Reasoning

In "Needle-In-A-Haystack" tests, ChunkKV maintained near-perfect retrieval accuracy at aggressive compression levels where competing methods failed. Furthermore, the model showed significantly higher resilience in mathematical reasoning tasks (GSM8K), suggesting that preserving the "semantic plot" is critical for multi-step logic.

Conclusion and Future Work

ChunkKV demonstrates that semantic coherence is more vital for LLM performance than the retention of isolated high-attention tokens. By treating the KV cache as a series of linguistic units rather than a collection of discrete points, ChunkKV achieves a superior balance between memory efficiency and model intelligence.

Future research will explore adaptive chunk boundaries—using punctuation or linguistic cues rather than fixed sizes—and dynamic granularity adjustments tailored to specific domains like legal or technical documentation, where verbatim detail is paramount.

Summary updated

BibTeX
@inproceedings{liu2025chunkkv,
  author = {Xiang Liu and Zhenheng Tang and Peijie Dong and Zeyu Li and Liuyue and Bo Li and Xuming Hu and Xiaowen Chu},
  title = {{ChunkKV: Semantic-Preserving KV Cache Compression for Efficient Long-Context LLM Inference}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=20JDhbJqn3},
}
Figure