arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2607.01520cs.LG
收藏

KV缓存压缩的风险

The risk of KV cache compression

RWTH Aachen University(亚琛工业大学);Stanford University(斯坦福大学)

Lukas Haverbeck, Carmen Amo Alonso, Andres Felipe Posada-Moreno, Sebastian Trimpe, Marco Pavone

AI总结:

针对长序列Transformer推理中KV缓存压缩的瓶颈,本文通过最小化最大风险理论,揭示了缓存内在可压缩性决定准确压缩的边界,并设计出在因果掩码下达到最优风险的实用算法,在LongBench上取得良好效果。

摘要:

长序列上的Transformer推理成本高昂,因为softmax注意力反复读取大型KV缓存。应对这一瓶颈的常见方法是KV缓存压缩,即用紧凑摘要替换完整缓存。尽管具有实际重要性,这类摘要的设计主要由经验实验驱动。在理论方面,现有结果表明KV缓存压缩在最坏情况下可能不可行,但在可实现准确压缩的场景中缺乏系统性的算法设计指导。我们通过以缓存的内在可压缩性来刻画KV缓存压缩的最小化最大风险,弥补了这一差距,揭示了何时以及如何实现准确压缩。这些结果在因果掩码下产生了新颖的KV缓存压缩设计原则,可高效映射到预填充和自回归解码,同时达到最小化最大最优风险。我们将这些原则实例化为一个实用算法,并在LongBench上的定向实验中报告了有前景的性能。总体而言,我们的结果为具有理论保证的实用KV缓存压缩提供了原则性途径。

英文摘要:

Transformer inference on long sequences is expensive because softmax attention repeatedly reads from a large KV cache. The prevalent approach to this bottleneck is KV cache compression, which replaces the full cache with a compact summary. Despite its practical importance, the design of such summaries is largely driven by empirical experimentation. On the theoretical side, existing results show that KV cache compression can be impossible in the worst case, but offer little systematic guidance for designing algorithms in regimes where accurate compression is possible. We bridge this gap by characterizing the minimax risk of KV cache compression in terms of the intrinsic compressibility of a cache, revealing when and how accurate compression is possible. In particular, we show that, once attention can sharply retrieve individual tokens, compression can only uniformly outperform random sampling by exploiting information about future queries, regardless how redundant the cache is inherently. Additionally, our results yield novel design principles for KV cache compression under causal masking that map efficiently to prefill and autoregressive decoding while achieving minimax-optimal risk. We instantiate these principles in a practical algorithm and illustrate how our theoretical findings can be put to practical use. Overall, our results opens a principled avenue for KV cache compression with theoretical guarantees.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑