The Residual Stream Is All You Need: On the Redundancy of the KV Cache in Transformer Inference
- URL: http://arxiv.org/abs/2603.19664v1
- Date: Fri, 20 Mar 2026 05:59:50 GMT
- Title: The Residual Stream Is All You Need: On the Redundancy of the KV Cache in Transformer Inference
- Abstract summary: Key-value (KV) cache is widely treated as essential state in transformer inference.<n>We prove that keys and values at every layer are deterministic projections of the residual stream.<n>We build on this result with KV-Direct, a bounded-memory inference scheme.
- Score: 3.378773775514883
- License: http://creativecommons.org/licenses/by/4.0/
- Abstract: The key-value (KV) cache is widely treated as essential state in transformer inference, and a large body of work engineers policies to compress, evict, or approximate its entries. We prove that this state is entirely redundant: keys and values at every layer are deterministic projections of the residual stream, and recomputing them from a single residual vector per token incurs exactly zero reconstruction error, not approximately, but bit-identically. We verify this across six models from four architecture families (135M to 4B parameters). Cross-task residual patching at every layer produces D_KL = 0 between patched and original output distributions, confirming that the residual stream satisfies a Markov property and is the sole information-carrying state. Removing the cache entirely and recomputing from scratch yields token-identical output under greedy decoding on all models tested. We build on this result with KV-Direct, a bounded-memory inference scheme that checkpoints residual vectors (5 KB per token on Gemma 3-4B) instead of full KV pairs (136 KB), recomputing keys and values on demand. Over 20 conversation turns, KV-Direct holds peak memory at 42 MB while the standard cache grows past 103 MB. Against five eviction baselines (H2O, StreamingLLM, SnapKV, TOVA, window-only), KV-Direct maintains 100% token match at every cache budget; all baselines degrade to 5-28%. A per-operation latency analysis shows recomputation runs up to 5x faster than reading cached tensors at moderate batch sizes. Code is available at https://github.com/Kaleemullahqasim/KV-Direct.
Related papers
- RestoreKV: Recovering Full-Cache Behavior Under Aggressive Query-Agnostic KV Cache Eviction [10.668136973950453]
KV cache eviction compresses a context once and reuses the resulting cache for arbitrary future queries, but performance can collapse under tight budgets.<n>We introduce RestoreKV, which complements this selection-based formulation with learned restoration under the same total KV budget.<n>Our key insight is that, although the information lost through eviction is context-specific, the mechanism for generating its compact complement can be shared across contexts.
arXiv Detail & Related papers (2026-08-02T13:58:42Z) - Back from the Future: Key-Value Cache Management by Counter-Causal Surprise [67.1056509495879]
Key-value (KV) cache management through compression and eviction strategies has emerged as an important research direction in recent years.<n>We propose a simple yet effective KV eviction scheme motivated by the insight that past tokens which can be well-predicted from more recent tokens are redundant.<n>We evaluate our strategy on various open-source LLMs and benchmark datasets showing competitive or improved performance over other state-of-the-art methods.
arXiv Detail & Related papers (2026-07-30T02:42:51Z) - VeriCache: Turning Lossy KV Cache into Lossless LLM Inference [24.571166055469508]
We present VeriCache, the first inference framework that ensures the same output as full- KV-cache decoding.<n>We show that VeriCache achieves up to 4X higher throughput than full- KV-cache.
arXiv Detail & Related papers (2026-05-17T19:18:39Z) - AgentKVShift: Efficient KV Cache Reuse for Agentic Memory Systems [15.913507689262573]
AgentKVShift is a training-free, probe-guided residual correction method that operates per retrieved memory unit.<n>We show that AgentKVShift achieves near full recompute performance while refreshing only 10-30% of the cache.<n>It requires up to 5x lower recompute to reach this near-full performance, which prior reuse methods only attain at 45-55% refresh.
arXiv Detail & Related papers (2026-05-15T16:29:36Z) - Make Each Token Count: Towards Improving Long-Context Performance with KV Cache Eviction [65.710271475739]
We introduce a global retention-based KV eviction method that learns each token's future utility under a unified memory budget.<n>We show that our method substantially reduces KV memory while matching or surpassing full-cache inference.<n>These results suggest that learned, globally calibrated KV eviction is not only a compression technique, but also a mechanism for improving long-context reasoning.
arXiv Detail & Related papers (2026-05-10T16:47:50Z) - RDKV: Rate-Distortion Bit Allocation for Joint Eviction and Quantization of the KV Cache [28.54642982960947]
Large language models (LLMs) have shown strong performance across diverse tasks, but their inference with long input contexts is bottlenecked by memory size and bandwidth.<n>Existing methods reduce the cache by either eviction or quantization, but typically treat the two in isolation.<n>In this paper, we cast KV cache compression as a rate-distortion problem, under which eviction and quantization are two end-points of the same bit allocation scheme.
arXiv Detail & Related papers (2026-05-08T15:15:06Z) - KVReviver: Reversible KV Cache Compression with Sketch-Based Token Reconstruction [20.53279247581787]
We propose KVReviver, a reversible KV cache compression method based on the sketch algorithm.<n>In 2k-length contexts, it requires only 10% of KV Cache budget while maintaining identical end-to-end inference accuracy.<n>For 32k-length contexts, it achieves equivalent or comparable accuracy 2% accuracy loss.
arXiv Detail & Related papers (2025-12-01T03:59:20Z) - KV Cache Transform Coding for Compact Storage in LLM Inference [2.20003167536462]
We present KVTC, a lightweight transform coder that compresses KV caches for compact on- GPU and off- GPU storage.<n>By exploiting redundancies in KV caches, KVTC achieves up to 20$times$ compression while maintaining reasoning and long-context accuracy.<n>We test KVTC with Llama 3, Mistral NeMo, and R1-Qwen 2.5 models across benchmarks including AIME25, LiveCodeBench, GSM8K, MMLU, Qasper, RULER, and MATH-500.
arXiv Detail & Related papers (2025-11-03T18:20:35Z) - PatternKV: Flattening KV Representation Expands Quantization Headroom [37.83913102876393]
KV cache in autoregressive LLMs eliminates redundant recomputation but has emerged as the dominant memory and bandwidth bottleneck during inference.<n> KV quantization is a key lever for reducing cache cost, but accuracy drops sharply as the native KV distribution lacks flatness.<n>We show that the K cache maintains a stable structure that evolves gradually with context, while the V cache carries latent semantic regularities.
arXiv Detail & Related papers (2025-10-05T12:09:14Z) - ReCalKV: Low-Rank KV Cache Compression via Head Reordering and Offline Calibration [69.57122277845293]
We propose ReCalKV, a post-training low-rank KV cache compression approach with tailored strategies for Keys and Values.<n>For Keys, we propose Similarity aware Recontext (HSR), which clusters structurally similar heads into groups, enabling more accurate low-rank approximation.<n>For Values, we propose Offline Head-wise Value (OVC), which efficiently calibrates the value projection matrix using calibration data without training.
arXiv Detail & Related papers (2025-05-30T08:49:27Z) - R-KV: Redundancy-aware KV Cache Compression for Reasoning Models [77.84539432982307]
We propose Redundancy-aware KV Cache Compression for Reasoning models (R-KV)<n>R-KV preserves nearly 100% of the full KV cache performance using only 10% of the KV cache.<n>Remarkably, R-KV even achieves 105% of full KV cache performance with 16% of the KV cache.
arXiv Detail & Related papers (2025-05-30T02:03:24Z) - KVzip: Query-Agnostic KV Cache Compression with Context Reconstruction [37.97434606840326]
Transformer-based large language models (LLMs) cache context as key-value ( KV) pairs during inference.<n>As context length grows, KV cache sizes expand, leading to substantial memory overhead and increased attention latency.<n>This paper introduces KVzip, a query-agnostic KV cache eviction method enabling effective reuse of compressed KV caches across diverse queries.
arXiv Detail & Related papers (2025-05-29T13:05:47Z) - QuantSpec: Self-Speculative Decoding with Hierarchical Quantized KV Cache [67.84112700032007]
Large Language Models (LLMs) are increasingly being deployed on edge devices for long-context settings.<n>In these scenarios, the Key-Value ( KV) cache is the primary bottleneck in terms of both GPU memory and latency.<n>We propose a novel self-speculative decoding framework, QuantSpec, where the draft model shares the architecture of the target model but employs a hierarchical 4-bit quantized KV cache and 4-bit quantized weights for acceleration.
arXiv Detail & Related papers (2025-02-05T20:43:48Z) - ClusterKV: Manipulating LLM KV Cache in Semantic Space for Recallable Compression [10.003118268356017]
Long context poses significant challenges for inference efficiency.<n>We introduce ClusterKV, which recalls tokens at the granularity of semantic clusters.<n>Experiment results show that ClusterKV attains negligible accuracy loss across various tasks with 32k context lengths.
arXiv Detail & Related papers (2024-12-04T10:58:27Z) - KIVI: A Tuning-Free Asymmetric 2bit Quantization for KV Cache [67.9776980972508]
We develop a tuning-free 2bit KV cache quantization algorithm named KIVI.
KIVI can enable Llama, Falcon, and Mistral models to maintain almost the same quality while using $mathbf2.6times$ less peak memory.
arXiv Detail & Related papers (2024-02-05T06:06:47Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.