通过语义块压缩键值缓存,提升长文本推理效率与精度
ChunkKV: Semantic-Preserving KV Cache Compression for Efficient Long-Context LLM Inference
- 以语义块为单位压缩键值缓存,保留完整语言结构
- 在相同压缩比下,精度最高提升8.7%,吞吐提高26.5%
- 适合需要高效长文本处理的场景,如问答与复杂推理
大语言模型在处理长文本时需大量GPU内存,其中键值(KV)缓存占总内存高达70%。现有压缩方法仅评估单个词元重要性,忽略词元间的语义关系,导致上下文断裂、性能下降。本文提出ChunkKV,将语义块而非孤立词元作为基本压缩单元,有效保持语言结构与上下文完整性。创新引入分层索引复用技术,利用压缩后索引在层间更高的相似性,降低计算开销,提升吞吐26.5%。在LongBench、Needle-In-A-Haystack、GSM8K和JailbreakV等挑战性基准上,相较于最先进方法,精度最高提升8.7%,且保持相同压缩比。结果表明,语义感知压缩显著提升长文本推理的效率与性能,为缓解内存瓶颈提供简单而有效的解决方案。
原文摘要 · Abstract (English)
Large Language Models (LLMs) require significant GPU memory when processing long texts, with the key value (KV) cache consuming up to 70\% of total memory during inference. Although existing compression methods reduce memory by evaluating the importance of individual tokens, they overlook critical semantic relationships between tokens, resulting in fragmented context and degraded performance. We introduce ChunkKV, which fundamentally reimagines KV cache compression by treating semantic chunks - rather than isolated tokens - as basic compression units. This approach preserves complete linguistic structures and contextual integrity, ensuring that essential meaning is retained even under aggressive compression. Our innovation includes a novel layer-wise index reuse technique that exploits the higher cross-layer similarity of preserved indices in ChunkKV, reducing computational overhead and improving throughput by 26.5\%. Comprehensive evaluations on challenging benchmarks: LongBench, Needle-In-A-HayStack, GSM8K, and JailbreakV demonstrate that ChunkKV outperforms state-of-the-art methods by up to 8.7\% in precision while maintaining the same compression ratio. These results confirm that semantic-aware compression significantly enhances both efficiency and performance for long-context LLM inference, providing a simple yet effective solution to the memory bottleneck problem. The code is available at \href{https://github.com/NVIDIA/kvpress}{link}.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。