LycheeCluster: Efficient Long-Context Inference with Structure-Aware Chunking and Hierarchical KV Indexing
Organizations: Harbin Institute of Technology · University of Electronic Science and Technology of China
Abstract
The quadratic complexity of the attention mechanism and the substantial memory footprint of the Key-Value (KV) cache present severe computational and memory challenges for Large Language Models (LLMs) processing long contexts. Existing retrieval-based methods often compromise semantic integrity through fixed-size chunking and suffer from inefficient linear scanning. In this paper, we propose LycheeCluster, a novel method for efficient KV cache management. LycheeCluster preserves local semantic coherence via boundary-aware chunking and constructs a recursive hierarchical index rooted in the triangle inequality. This design transforms cache retrieval from a linear scan into a theoretically bounded, logarithmic-time pruning process, while a lazy update strategy supports efficient streaming generation. Experiments demonstrate that LycheeCluster achieves up to a 3.6x end-to-end inference speedup with negligible degradation in model performance, outperforming state-of-the-art KV cache management methods (e.g., Quest, ClusterKV). We will release our code and kernels after publication.
Figures & tables
| Method | Overall | Short | Medium | Long |
|---|---|---|---|---|
| Full Attention | 30.02 | 35.56 | 27.91 | 25.00 |
| RazorAttention Tang et al. (2025) | 27.44 | 33.89 | 25.12 | 21.30 |
| RaaS Hu et al. (2025) | 28.23 | 33.89 | 26.51 | 22.02 |
| ArkVale Chen et al. (2024) | 28.63 | 33.89 | 26.98 | 23.15 |
| ShadowKV Sun et al. (2025a) | 25.45 | 32.78 | 22.79 | 18.52 |
| Quest Tang et al. (2024) | 20.68 | 22.78 | 19.07 | 20.37 |
| Method | DeepSeek-R1-Distill | DeepSeek-R1-Distill |
|---|---|---|
| Llama-8B | Qwen-14B | |
| Full Attention | 78.40 | 74.00 |
| RazorAttention | 72.00 | 70.00 |
| RaaS | 74.00 | 68.00 |
| ArkVale | 72.00 | 72.00 |
| ShadowKV | 76.00 | 76.00 |
| Strategy | Overall | Short | Medium | Long | Recall Rate |
|---|---|---|---|---|---|
| Max | 28.83 | 35.56 | 26.98 | 21.3 | 33.60% |
| Mean | 30.82 | 37.22 | 28.84 | 24.07 | 40.37% |
| Priority Level | Category | Details & Examples |
|---|---|---|
| Level-1 | Structural Separators | Paragraphs ( \n\n ), Markdown ( --- , *** , ‘‘‘ ), Structural Language ( } , ] , > ) |
| Level-2 | Grammatical & Semantic | Sentence Terminators (., ?, !, 。? !), Single Newline ( \n ) |
| Level-3 | Phrasal Separators | English Punctuation (,, ;, :), Chinese Punctuation (, ; : 、) |
| Level-4 | Whitespace | Spaces, Tabs |
Appendix figures & tables7 assets
Supplementary material from the paper’s appendix.
Appendix
| Task | # Samples | Avg. Length | Max Length | Expert Acc. | Expert Time |
|---|---|---|---|---|---|
| Code Repository Understanding | 50 | 1M | 4M | 44% | 6.4 min |
| Long In-context Learning | 81 | 259k | 1.5M | 63% | 8.3 min |
| Long Structured Data Understanding | 33 | 390k | 3M | 73% | 6.4 min |
| Long-dialogue History Understanding | 39 | 74k | 120k | 79% | 8.2 min |
| Multi-Document QA | 125 | 127k | 1.7M | 36% | 6.1 min |
| Single-Document QA | 175 | 110k | 860k | 55% | 8.9 min |
| Context / Task | single | multikey | multivalue | multiquery | vt | fwe | qa1 | qa2 | Avg. |
|---|---|---|---|---|---|---|---|---|---|
| Full Attention | |||||||||
| 4k | 100.0 | 100.0 | 100.0 | 100.0 | 82.5 | 84.4 | 89.8 | 59.2 | 89.5 |
| 8k | 91.8 | 100.0 | 100.0 | 99.0 | 79.6 | 87.1 | 81.6 | 59.2 | 87.3 |
| 16k | 63.3 | 100.0 | 98.5 | 98.5 | 82.0 | 93.9 | 79.6 | 51.0 | 83.3 |
| 32k | 95.9 | 95.9 | 97.5 | 97.5 | 76.3 | 76.9 | 79.6 | 59.2 | 84.8 |
| LycheeCluster | |||||||||
KV-Cache Management
Key-value (KV) cache management reduces and coordinates Transformer attention state to make long-context inference faster and more memory-efficient.
See all 199 papers