SemantiCache: Efficient KV Cache Compression via Semantic Chunking and Clustered Merging

Shunlong Wu, Hai Lin, Shaoshen Chen, Tingwei Lu, Yongqin Zeng, Shaoxiong Zhan, Hai-Tao Zheng, Hong-Gee KimarXiv 2026

TL;DR

SemantiCache is a novel KV cache compression framework that eliminates "semantic fragmentation" by aligning cache reduction with the natural hierarchical structure of language. By chunking text along linguistic boundaries and merging redundant tokens using a fast clustering algorithm, it accelerates LLM decoding by up to 2.61× and slashes memory usage while fully preserving long-context task performance.

What Problem Does This Paper Address?

As Large Language Models (LLMs) tackle increasingly long documents, they run into a massive infrastructure bottleneck: the Key-Value (KV) cache. The KV cache stores attention keys and values for all preceding tokens to avoid redundant computations during autoregressive generation, but it grows linearly with sequence length. This causes a prohibitive memory footprint and spikes inference latency.

To fix this, existing methods either permanently discard "unimportant" tokens (eviction-based) or blend tokens together (merging-based). However, these approaches share a fundamental flaw: they operate blindly on discrete tokens or arbitrary, fixed-size chunks. This ignores the natural structure of language, resulting in semantic fragmentation—the breaking apart of coherent phrases, clauses, or sentences. This fragmentation causes irreversible information loss and severely degrades model accuracy.

Methods

SemantiCache mimics the cognitive strategy humans use to memorize long texts: first segmenting text into complete semantic units, and then distilling the core meaning. It introduces a three-stage, semantically hierarchical pipeline:

  1. Semantic Chunking: Instead of using fixed block sizes, the framework partitions the KV cache using natural linguistic delimiters (e.g., punctuation marks, tabs, and newlines). Crucially, these delimiter tokens are kept entirely intact to serve as structural anchors for the model's attention mechanism.
  2. Similarity Clustering: Within each chunk, a computationally efficient Greedy Seed-Based Clustering (GSC) algorithm groups semantically related tokens together based on the cosine similarity of their Key states.
  3. Clustered Merging: The tokens within each cluster are consolidated into a single "semantic core" via mean-pooling. To counteract the information dilution that normally happens when merging tokens, the authors introduce a Proportional Attention mechanism. This adds the log-size of the cluster ($\log s$) to the pre-softmax attention logits, mathematically ensuring that a merged core's contribution scales proportionally to the number of tokens it represents.
Fig. 1. An overview of SemantiCache.

Datasets

The authors evaluated SemantiCache across several popular open-source LLMs (including Llama-3-8B-Instruct and Mistral-7B-Instruct-v0.2) using two primary benchmarks:

  • LongBench: A rigorous multi-task benchmark containing 21 datasets that span single/multi-document QA, summarization, few-shot learning, synthetic tasks, and code completion.
  • Needle-in-a-Haystack (NIAH): A targeted evaluation designed to test a model's ability to retrieve a specific, isolated sentence hidden deep within a massive document.

Key Insights and Ideas

  • Language is Hierarchical, Not Flat: Compressing KV caches by slicing them into arbitrary token counts destroys linguistic integrity. Respecting natural boundaries prevents the model from losing the broader context.
  • Delimiters are High-Value Anchors: Building on prior observations that punctuation marks consistently receive outsized attention scores, SemantiCache treats them as uncompressed structural pillars that stabilize the remaining compressed representations.
  • Log-Size Scaling Prevents Dilution: Naively averaging vectors causes the model to under-attend to large concepts. Adding $\log s$ to the attention logits perfectly rebalances the attention distribution without requiring model retraining.

Key Results

SemantiCache demonstrates a superior Pareto frontier between efficiency and accuracy compared to state-of-the-art baselines like StreamingLLM, H2O, SnapKV, CaM, and D2O.

  • Inference Speedup & Memory Savings: On Llama-3-8B with a 32k context length, SemantiCache achieves a 2.61× speedup in Time Per Output Token (TPOT) compared to the uncompressed full model, while dropping the memory footprint from 24.27 GB down to 15.94 GB.
Table 3. Efficiency evaluation results on Llama-3-8B with a 32k context length.
  • Accuracy Retention: Across various cache budgets (20%, 35%, and 50%), SemantiCache consistently outperforms both eviction- and merging-based baselines on LongBench.
Table 1. Average scores on LongBench for different com- pression methods, evaluated across various cache budgets and models.
  • The Power of Semantic Chunking: An ablation study confirmed that replacing semantic chunking with fixed-size chunking (64 tokens) or removing chunking entirely (global clustering) causes a noticeable drop in performance, validating the core linguistic hypothesis of the paper.
Table 4. Comparison of different chunking strategies.

Limitations and Future Work

While the paper demonstrates impressive results, a few limitations and areas for future exploration remain:

  • Hyperparameter Sensitivity: The compression ratio and model performance are tightly bound to the similarity threshold $\tau$. Tuning this parameter is required to balance aggressive compression against accuracy requirements.
  • Static Delimiter Set: The current implementation relies on a predefined, hardcoded set of characters for semantic chunking. This approach is language-dependent and might not optimally capture semantic boundaries in non-English text or specialized domains (like mathematical notation or programming languages). Future work could explore learning dynamic, model-driven delimiter boundaries.

Summary updated

BibTeX
@misc{wu2026semanticache,
  author = {Shunlong Wu and Hai Lin and Shaoshen Chen and Tingwei Lu and Yongqin Zeng and Shaoxiong Zhan and Hai-Tao Zheng and Hong-Gee Kim},
  title = {{SemantiCache: Efficient KV Cache Compression via Semantic Chunking and Clustered Merging}},
  year = {2026},
  eprint = {2603.14303},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.14303},
}
Figure