2025-05-30 · 进阶 · 机器学习 · 自然语言处理

KVzip: Query-Agnostic KV Cache Compression with Context Reconstruction

本文提出了一种名为KVzip的查询无关的KV缓存压缩方法,通过重建原始上下文来量化KV对的重要性,从而有效地减少KV缓存大小和注意力解码延迟。

更新于 2025-05-30。作者:Jang-Hyun Kim、Jinuk Kim、Sangwoo Kwon、Jae W. Lee、Sangdoo Yun、Hyun Oh Song。

中文摘要

基于Transformer的大型语言模型(LLMs)在推理过程中将上下文作为键值对(KV)缓存。随着上下文长度的增加,KV缓存的大小也会扩大,导致显著的内存开销和增加的注意力延迟。本文介绍了一种名为KVzip的查询无关的KV缓存淘汰方法,它能够有效地在不同查询间重复使用压缩后的KV缓存。KVzip通过使用底层LLM从缓存的KV对重建原始上下文来量化KV对的重要性,随后淘汰重要性较低的键值对。广泛的实证评估表明,KVzip可以将KV缓存大小减少3-4倍,并将FlashAttention解码延迟减少大约2倍,在问答、检索、推理和代码理解任务中几乎没有性能损失。评估包括各种模型,如LLaMA3.1-8B、Qwen2.5-14B和Gemma3-12B,上下文长度可达170K个标记。KVzip在性能上显著优于现有的查询感知KV淘汰方法,后者在多查询场景下即使缓存预算比达到90%也会出现性能下降。

英文摘要

Transformer-based large language models (LLMs) cache context as key-value (KV) pairs during inference. As context length grows, KV cache sizes expand, leading to substantial memory overhead and increased attention latency. This paper introduces KVzip, a query-agnostic KV cache eviction method enabling effective reuse of compressed KV caches across diverse queries. KVzip quantifies the importance of a KV pair using the underlying LLM to reconstruct original contexts from cached KV pairs, subsequently evicting pairs with lower importance. Extensive empirical evaluations demonstrate that KVzip reduces KV cache size by 3-4times and FlashAttention decoding latency by approximately 2times, with negligible performance loss in question-answering, retrieval, reasoning, and code comprehension tasks. Evaluations include various models such as LLaMA3.1-8B, Qwen2.5-14B, and Gemma3-12B, with context lengths reaching up to 170K tokens. KVzip significantly outperforms existing query-aware KV eviction methods, which suffer from performance degradation even at a 90% cache budget ratio under multi-query scenarios.

解读

一句话总结

本文提出了一种名为KVzip的查询无关的KV缓存压缩方法,通过重建原始上下文来量化KV对的重要性,从而有效地减少KV缓存大小和注意力解码延迟。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源