LowRAM:用于测试时组合式KV缓存压缩的低秩键与摊销值

·

研究论文 · 2026/11/09

自回归解码依赖KV缓存,其内存随上下文长度线性增长,限制了批大小和吞吐量。现有后训练方法利用跨token、层和特征维度的冗余或降低数值精度。我们识别出一个互补维度:在每个注意力头内,值很大程度上可由对应的键预测。我们利用值缓存摊销,在测试时拟合轻量级每头预测器,并仅对重建最差的token存储残差,实现4倍近无损值压缩。预测器可通过元学习初始化以减少预填充开销,或在允许一次性成本的设置(如多查询推理)中从头拟合。我们将值摊销与跨层低秩键压缩结合,产生LowRAM,一种非对称压缩流水线,在三个模型家族中保持接近无损。通过在每个解码步骤仅重建选定的KV对子集,LowRAM保持解码开销最小,并在4倍压缩下实现高达5倍的峰值解码吞吐量。LowRAM进一步与量化和驱逐组合,在长上下文上达到26.9倍压缩,性能为基线的94.5%。这些结果表明,将键和值视为结构上不同的元素可实现高效、激进且可组合的KV缓存压缩。

该论文提出了一种新颖的KV缓存压缩视角,将键和值视为结构上不同的元素,通过值摊销和低秩键压缩实现高效、激进且可组合的压缩,在保持近无损性能的同时显著提升吞吐量,对长上下文推理和部署具有重要价值。

Autoregressive decoding relies on the KV cache, whose memory footprint grows linearly with context length and caps batch size and throughput. Existing post-training methods exploit redundancy across tokens, layers, and feature dimensions, or lower numerical precision. We identify a complementary axis: within each attention head, values are largely predictable from their corresponding keys. We exploit this with value cache amortisation, which fits a lightweight per-head predictor at test time and stores residuals only for the tokens it reconstructs worst, giving 4times near-lossless value compression. The predictor can be initialised by meta-learning for substantially reduced prefill overhead, or fitted from scratch in settings that allow a one-off cost, such as multi-query inference. We pair value amortisation with cross-layer low-rank key compression to produce LowRAM, an asymmetric compression pipeline that stays close to lossless across three model families. By reconstructing only a selected subset of KV pairs at each decoding step, LowRAM can keep decoding overhead minimal and achieve up to 5times higher peak decode throughput at 4times compression. LowRAM further composes with quantisation and eviction, reaching 26.9times compression at 94.5% of baseline performance on long contexts. These results show that treating keys and values as structurally distinct enables efficient, aggressive, and composable KV cache compression.

阅读原文

参与讨论