Command Palette
Search for a command to run...
LOWRAM: テスト時における組み合わせ可能なKVキャッシュ圧縮のための低ランクキーと償却されたバリュー
LOWRAM: テスト時における組み合わせ可能なKVキャッシュ圧縮のための低ランクキーと償却されたバリュー
Teresa R. Delgado Hugo Hazard Martin Benfeghoul Jun Wang Zafeirios Fountas
概要
自己回帰デコーディングはKVキャッシュに依存しており、そのメモリ使用量は文脈長に比例して増大し、バッチサイズとスループットを制限する。既存のポストトレーニング手法は、トークン・レイヤー・特徴次元にわたる冗長性を活用するか、数値精度を下げる。我々は相補的な軸を特定する。すなわち、各アテンションヘッド内で、バリューは対応するキーから大部分予測可能である。我々はこれをバリューキャッシュ償却(value cache amortisation)によって活用する。これはテスト時にヘッドごとの軽量な予測器を適合させ、再構成が最も悪いトークンについてのみ残差を保存するもので、4倍のほぼ無損失なバリュー圧縮を実現する。予測器は、メタ学習によって初期化することでプリフィル時のオーバーヘッドを大幅に削減できる。あるいは、マルチクエリ推論のような一度きりのコストが許容される設定ではゼロから適合させることもできる。我々はバリュー償却と層間低ランクキー圧縮を組み合わせてLowRAMを構築する。これは非対称な圧縮パイプラインであり、3つのモデルファミリーにわたりほぼ無損失を維持する。各デコーディングステップで選択されたKVペアの部分集合のみを再構成することで、LowRAMはデコードのオーバーヘッドを最小限に抑え、4倍圧縮時で最大5倍高いピークデコードスループットを達成できる。LowRAMはさらに量子化およびエビクションと組み合わせることが可能で、長い文脈においてベースライン性能の94.5%を維持しつつ26.9倍の圧縮に達する。これらの結果は、キーとバリューを構造的に異なるものとして扱うことで、効率的かつ積極的で、組み合わせ可能なKVキャッシュ圧縮が可能になることを示している。
One-sentence Summary
Researchers from Huawei Noah’s Ark Lab, AI Centre, and University College London propose LowRAM, an asymmetric KV cache compression pipeline that pairs test-time value cache amortisation with cross-layer low-rank key compression to achieve 4× near-lossless compression, up to 5× higher peak decode throughput, and 26.9× compression at 94.5% of baseline performance when composed with quantisation and eviction.
Key Contributions
- The paper identifies within-head key-to-value predictability as a complementary redundancy source and introduces value cache amortisation, which fits a lightweight per-head predictor at test time and stores residuals only for the hardest-to-reconstruct tokens, yielding 4× near-lossless value compression.
- The paper presents LowRAM, an asymmetric pipeline that pairs value cache amortisation with cross-layer low-rank key compression; LowRAM stays close to lossless across three model families and composes with quantisation and eviction to reach 26.9× compression at 94.5% of baseline performance on long contexts.
- The paper reduces decoding overhead through a meta-learned predictor initialisation and selective reconstruction, enabling substantially reduced prefill overhead and up to 5× higher peak decode throughput at 4× compression.
Introduction
Transformers dominate language modelling, but autoregressive decoding at long context lengths becomes memory-bound because the key-value cache grows linearly with context and batch size. Architectural alternatives such as linear attention, state-space models, and reduced-cache attention variants can address this, but they typically require pretraining or substantial finetuning. Post-training compression methods for frozen models have therefore focused on eviction, quantisation, and low-rank decomposition, yet they largely overlook redundancy between keys and values. The authors identify within-head key-to-value predictability as an underexplored source of cache redundancy and introduce value cache amortisation, which fits a lightweight per-head network to reconstruct values from keys and stores residuals only for poorly predicted tokens. They then propose LowRAM, an asymmetric pipeline that combines amortised values with cross-layer low-rank key compression, achieving near-lossless moderate compression and composing with quantisation and eviction to reach 26.9x compression while retaining 94.5% of baseline performance.
Method
The authors propose LowRAM, an asymmetric compression pipeline that treats the key and value caches as structurally distinct objects. For keys, they adopt a low-rank cross-layer compression approach. For values, they introduce value cache amortisation, a learned associative memory that predicts each token's value vector directly from its key, retaining residuals only for the hardest-to-predict tokens. Prior to both decomposition and prediction, they invert RoPE, as pre-RoPE representations are more amenable to compression, with the rotation reapplied at attention time.
To determine the optimal representation for predictive compression, the authors perform a source-target analysis over the KV cache. They train a predictor to reconstruct either current-layer keys or values using various source representations, including previous-layer keys, previous-layer values, and current-layer representations.
The analysis reveals that reconstructing values from current-layer keys achieves the highest recovered downstream performance. Furthermore, value reconstruction generally recovers more downstream performance than key reconstruction, and reconstruction error correlates only weakly with downstream performance. Consequently, the authors base their design decisions primarily on recovered downstream performance rather than reconstruction error.
Building on the KL→VL prediction direction, the authors model this relationship with a lightweight parametric function. Let K∈RT×dk and V∈RT×dv denote the key and value matrices for a single attention head over a sequence of length T. They learn a mapping fθ:Rdk→Rdv applied row-wise to the key cache, independently per layer and KV head. The function fθ is a two-layer MLP with a learned linear residual branch:
fθℓ,h(k)=σ(kWℓ,h(1)+bℓ,h(1))Wℓ,h(2)+bℓ,h(2)+kWℓ,hlinwhere σ is a ReLU nonlinearity. During prefill, the parameters θ are adapted to the current context by minimising the value reconstruction loss L(θ)=T1∥fθ(K)−V∥F2.
At decoding time, the value cache is reconstructed from the retained keys as V^=fθ(K). Since not all tokens are reconstructed equally well, the authors store residual corrections only for the tokens with the largest prediction errors. For each token i, the reconstruction error is ei=∥fθ(ki)−vi∥22. Let p∈(0,1] denote the fraction of residuals retained. They select the top-p fraction of tokens according to ei and define a binary gate:
gi=1[rank(ei)>(1−p)T]The reconstructed value cache is then computed as:
V~=fθ(K)+G⊙ΔVwhich replaces the original value cache in standard attention.
To reduce the computational overhead of fitting the value predictor, the authors employ a meta-learned initialisation using First-Order MAML. Each sequence defines a meta-learning task consisting of its observed KV pairs, and the inner loop adapts the per-head predictor for K gradient updates. At inference, the predictor is initialised from the learned parameters ϕ⋆ and adapted to the new context using the same K-update budget. Additionally, they implement selective reconstruction to avoid reconstructing the complete cache at every decoding step. They partition the prefix into chunks represented by mean-key landmarks, retain outlier chunks and a local window exactly, and reconstruct only the top-k chunks selected by the current query. A persistent buffer reuses chunks selected across consecutive decoding steps, and they replace the exact key cache SVD with a randomised Cholesky-QR decomposition to achieve significant speedups without loss in downstream quality.
Experiment
Evaluation across RULER and LongBench with Mistral, Llama, and Qwen models shows that LowRAM preserves near-baseline performance at moderate compression by predicting value caches from keys and storing residuals for poorly reconstructed tokens. Efficiency experiments indicate that meta-learned initialization reduces prefill overhead and selective reconstruction improves decoding throughput, with a tradeoff favoring full adaptation when contexts are reused. Stacking with quantization improves recovery and allows higher compression, while eviction is only beneficial when sequences remain long enough to amortize the reconstruction network; value amortization in isolation remains nearly lossless. Overall, LowRAM is best suited to long contexts and supports compressing keys and values asymmetrically, with future work needed for long generations and cross-context reuse.
LowRAM recovers most baseline accuracy across Mistral-7B, Llama-3.1-8B, and Qwen3.5-4B at moderate compression. Mistral and Llama remain within a few points of baseline at 3x and 4x compression, with one larger drop for Llama on RULER at 4x. Qwen matches its RULER baseline across reported compression ratios, while LongBench recovery declines as compression increases. Mistral-7B and Llama-3.1-8B retain nearly all baseline performance at 3x and 4x compression, except for a larger RULER drop for Llama at 4x. Qwen3.5-4B matches its RULER baseline across reported compression ratios, while its LongBench recovery falls to the low nineties at stronger compression.
At 4x compression on Llama-3.1-8B-Instruct, LowRAM retains most baseline performance on long-context RULER and LongBench tasks. Selective reconstruction matches or slightly improves full reconstruction accuracy, while meta-initialization adds a small accuracy cost in exchange for lower prefill overhead. Even with both mechanisms enabled, recovery stays above 92 percent on both benchmarks. Selective reconstruction preserves LongBench recovery exactly and remains within about one point of, or above, full reconstruction on RULER at 16K, 32K, and 64K contexts. Adding meta-initialization lowers RULER recovery by 1.4 to 4.4 points and LongBench recovery by 2.4 points relative to full 300-update adaptation. With both selective reconstruction and meta-initialization enabled, recovered performance ranges from 92.4 to 96.8 percent on RULER and reaches 92.9 percent on LongBench.
Combining LowRAM with quantisation improves recovered performance while raising compression, with LowRAM-Q reaching near-baseline scores on both benchmarks and matching eviction-level recovery on LongBench at a higher compression ratio. Adding eviction to LowRAM increases compression but often reduces accuracy, especially on RULER where the fixed cost of the reconstruction network is less amortised over shorter contexts. Overall, quantisation pairs more favourably with LowRAM than eviction does. Quantisation combines well with LowRAM: LowRAM-Q improves recovery over LowRAM alone while also increasing the compression ratio. Eviction combined with LowRAM raises compression further but lowers recovery, with a larger penalty on RULER than on LongBench. Standalone quantisation retains high recovered performance at a substantially higher compression ratio than standalone eviction. LowRAM-EQ reaches the highest LongBench compression among the stacked methods, but its recovery remains below LowRAM-Q.
On LongBench contexts longer than 10K tokens, the full stack of eviction, quantisation, and LowRAM reaches 26.9× compression while recovering 94.5% of Mistral-7B baseline performance, outperforming each standalone method. Standalone eviction, quantisation, and LowRAM retain at least 90% performance only at compression ratios between 7.5× and 10×. The combined method therefore improves both compression and recovered accuracy on long contexts. The full stack achieves 26.9× compression with 94.5% recovered performance on long contexts, exceeding standalone methods in both compression ratio and score. Standalone methods keep at least 90% recovery at 7.5× to 10× compression, with quantisation scoring highest and eviction compressing most among them.
For value-cache-only compression with exact keys, amortisation stays near lossless across the evaluated ratios, retaining 98.2% of RULER and 99.3% of LongBench at 4x compression. xKV is slightly better on RULER at higher compression, but amortisation is consistently stronger on LongBench and stays ahead at every ratio. This supports treating value caches predictively rather than using low-rank compression. Amortisation keeps LongBench performance near or above baseline across 2x to 4x value compression. xKV gains a small edge on RULER at higher compression ratios but drops to roughly 95 percent on LongBench across all ratios.
The experiments evaluate LowRAM, selective reconstruction, meta-initialization, quantization, eviction, and value-cache amortization on Mistral-7B, Llama-3.1-8B, and Qwen3.5-4B using RULER and LongBench. LowRAM retains most baseline accuracy at moderate compression, and selective reconstruction matches or slightly improves full reconstruction while meta-initialization adds only a small accuracy cost. Quantization combines more favorably with LowRAM than eviction, and the full stack reaches 26.9x compression while recovering 94.5% of long-context performance. For value-only compression with exact keys, amortization remains near lossless and consistently stronger than xKV on LongBench.