Organizations: Beijing University of Posts and Telecommunications, Beijing, China · Tsinghua University, Beijing, China · University of Electronic Science and Technology of China, Chengdu, China · Peking University, Beijing, China
The increasing complexity of AI tasks has shifted the paradigm from monolithic models toward multi-agent large language model (LLM) systems. However, these collaborative architectures introduce a critical bottleneck: redundant prefill computation for shared content generated by previous agents, which significantly increases KV cache memory usage and time-to-first-token (TTFT). While various KV cache methods have been proposed to mitigate prefill redundancy, they either fail to maintain accuracy on agent-generated outputs or exhibit low reuse rates due to rigid constraints. We present RelayCaching, a training-free inference method that directly reuses decoding phase KV caches from previous agents in subsequent prefill phases. Our key insight is that KV caches for identical content are highly consistent across phases, while prefix-induced deviations are sparse and localized within a limited range of layers and token positions. By selectively recomputing KV caches at these positions, RelayCaching preserves model accuracy with minimal overhead, yielding a superior accuracy-efficiency trade-off over existing methods. Experiments on diverse collaborative LLM tasks spanning mathematical reasoning, general knowledge, and code generation demonstrate that RelayCaching achieves over 80% KV cache reuse, reduces TTFT by up to 4.7× compared to the standard pipeline, all with negligible accuracy degradation.
Figures & tables
Figure 1: Overview of KV cache reuse in multi-agent LLM collaboration. Top: A typical workflow where an Architect generates {spec} , a Developer produces {code} based on it, and a Reviewer evaluates the result, so each agent’s output becomes the next agent’s input, causing cascading redundant prefill. Bottom: Comparison of caching strategies. (a) Prefix Caching fails due to prefix mismatch; (b) Pre-computed Caching cannot handle dynamic content; (c) RelayCaching enables decode-to-prefill KV reuse via selective rectification.
Figure 2: Macro-level KV similarity. Average cosine and norm similarity between Decoding KV caches and Full-Prefill KV caches across layers and tokens on 2WikiMQA, compared against Random KV and Independent KV .
Figure 3: Layer-wise structured deviations. (a) Layer-wise similarity between decoding and full-prefill KV caches, highlighting a U-shaped value cosine similarity profile across layers. (b) Relative recovery of value cosine similarity for tokens after the reuse position when decoding KV caches are replaced with their full-prefill counterparts either up to or from a given layer index.
Figure 4: Token-wise structured deviations. (a) Token-wise similarity between decoding and full-prefill KV caches, averaged over layers, revealing a sparse set of high-deviation positions. (b) Spearman rank correlation of token-wise value cosine deviations between adjacent layers, showing that high-deviation positions, once emerged, tend to persist.
Figure 5: Overview of RelayCaching. (1) An offline layer-range profiler analyzes calibration data to identify a critical layer range [Lstart,Lend] from the similarity profile and a detection layer Ldet from the inter-layer correlation profile. (2) During stage- (i−1) decoding, the cache manager stores pre-RoPE KV caches, saves hidden states at Lstart , and accumulates influence scores sinf(j) . (3) At stage- i prefilling, RelayCaching re-applies RoPE to align reused KV caches to new positions, performs token selection at Ldet via combined deviation- and influence-based criteria, and finally applies sparse rectification on selected tokens within [Lstart,Lend] .
Figure 6: Computational reuse efficiency across diverse benchmarks. We compare the Reuse Rate of RelayCaching against baselines on (a) GSM8K, (b) MMLU, and (c) HumanEval as the number of agents increases.
Dataset
Method
2 Agents
3 Agents
4 Agents
Llama-3.1-8B-Instruct (Accuracy %)
GSM8K
Full Prefill
85.97
84.69
84.69
Zero Reuse
40.33
40.03
53.68
CacheBlend
76.72
77.56
74.73
EPIC
58.73
66.46
58.42
KVComm
84.23
82.34
84.91
Table 1: RelayCaching consistently maintains performance comparable to the Full-prefill . Columns indicate the number of agents in the workflow. Bold indicates the best performance; underline marks the second best.
Figure 7: Ablation on key RelayCaching hyperparameters. We analyze the trade-off between Accuracy (left axis) and Reuse Rate (right axis) by varying: (a) the influence score factor τdown , (b) the deviation score factor τdiff , and (c) the suffix length Lsuf . Red markers denote the default configuration used in the main experiments.
Figure 8: Scalability of TTFT with context growth. We measure the average TTFT of downstream agents as the cumulative output length scales from 512 to 12,288 tokens.
Method
Reuse (%)
Acc (%)
Full Prefill
0.00
85.97
+ Layer Range Profiler
46.88
85.90
+ Idev
90.37
79.68
+ Iinf-score
85.84
81.65
+ Iinf-suffix (Ours)
85.35
84.84
Table 3: Ablation study on GSM8K (Llama-3.1-8B-Instruct).
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 9: Universality of layer-wise structured deviations. Left Column: Layer-wise cosine similarity and norm similarity profiles. The distinct U-shaped drop in value cosine similarity (red lines) is consistent across diverse models. Right Column: Relative recovery curves. In all cases, recomputing the middle layers (where the similarity drops) yields the most efficient recovery of downstream token fidelity.
Figure 10: Universality of token-wise structured deviations. Left Column: Token-wise similarity profiles averaged over middle layers. The deviations are consistently sparse, with most tokens retaining high fidelity. Right Column: Spearman rank correlation of value cosine deviation between adjacent layers. The high correlation confirms that deviation patterns are persistent and predictable across depths.
Symbol
Description
Default
τlow
Lower similarity threshold
0.99
T
Right-tail layers
5
λ
Stable multiplier
2.0
Nmin
Min rise samples
3
C
Consecutive stables
2
Appendix
Table 4: Hyperparameters for Critical Layer Selection. These values are used to identify the deviation-prone middle layers based on the U-shaped similarity profile.
Model
Lstart
Ldet
Lend
Llama-3.1-8B-Instruct
1
3
18
Qwen2.5-Coder-7B-Instruct
3
4
22
Qwen3-0.6B
2
3
19
Appendix
Table 5: Model-specific layer configurations derived from offline profiling.
LLM inference acceleration develops algorithms and systems that reduce language-model latency, memory use, and serving cost while preserving output quality.
Multi-LoRA agent systems enable efficient role specialization by sharing a common backbone model. However, each agent repeatedly processes the growing shared trajectory and constructs its own KV cache, introducing substantial memory and computation redundancy in long-horizon tasks. Existing KV cache sharing methods reduce this repeated prefill, but they either require additional training or architectural constraints or retain substantial model computation. Moreover, direct cache reuse causes the current agent to rely on cache states generated by the previous agent's adapter, weakening the role-specific behavior encoded by its own LoRA. We present PReCache, a training-free KV cache sharing framework with two designs, namely PreLRShared and ReBaseShared, that share the base cache computed using the pretrained weights and precompute a compact agent-specific low-rank (LR) cache. To remove repeated prefill, PreLRShared precomputes each agent's LR cache when the shared context is first processed, allowing the current agent to use its own LR cache without reprocessing context processed by previous agents. To improve sharing accuracy, ReBaseShared reconstructs the shared base cache from adapter-free hidden states, reducing the remaining error caused by the previous agent's adapted representation. To minimize its reconstruction cost, we propose two inference schemes tailored to single-stream inference and concurrent serving, performing the same reconstruction after each agent's turn or alongside its execution, respectively. Across multiple models and agent benchmarks, PreLRShared achieves up to a 3.1x TTFT speedup and a 2.3x improvement in per-request throughput over inference without KV cache sharing. ReBaseShared best preserves accuracy overall among the evaluated cache-sharing methods, with an average drop of only 1.1 points relative to inference without cache sharing.
Hyesung Jeon, Hyeongju Ha, Jae-Joon Kim
Department of Electrical and Computer Engineering Seoul National University
Cross-model KV-cache reuse remains a key challenge in modern LLM serving. Coding agents and multi-model systems increasingly route a shared context across models: a user may switch models mid-session, or a cascade may escalate a difficult query. Because KV caches contain model-specific representations, each switch typically forces the receiving model to prefill the entire context from scratch. Recent work shows that closed-form linear maps can translate KV caches between models in the same family, but transfer accuracy degrades as the model-size gap widens. In this paper, we establish that these transfer failures are concentrated in a small subset of information-dense tokens. To bridge this gap, we introduce RaReCache, a framework that enables a large target model to decode accurately from a cache prefilled by a much smaller source via selective recomputation. RaReCache identifies these critical positions using a novel rank disagreement metric, scoring each token by the energy of its mapped KV in output directions weakly supported by the calibration data. Across two model families and five benchmarks, on a 23x parameter gap (Qwen3-0.6B to 14B) recomputing just 30% of positions retains 95-99% of the target accuracy, whereas on a 8.8x gap (Llama3-8B to 70B), recomputing 40% retains 96.5% of the target accuracy. RaReCache largely removes sensitivity to source-model size, and achieves up to a 3.04x prefill speedup. For online serving, it handles 1.8x the request throughput of target prefill on a single GPU, and at the target's saturation load, reduces median and 99th-percentile time-to-first-token (TTFT) by 5.0x and 6.4x respectively, with a 30% recompute budget. RaReCache establishes an efficient serving paradigm where small models prefill on behalf of massive targets, enabling large models to recompute only critical tokens, drastically reducing prefill latency.
Sreetama Sarkar, Saptarshi Mitra, Sitao Huang +2
University of Southern California · University of California, Irvine · Intel Labs
Non-prefix KV cache reuse is a promising approach for improving inference efficiency in multi-agent systems as agents share the same context blocks. However, when agents have conflicting tasks, directly reusing non-prefix KV caches across agents can severely degrade model performance, causing up to a 90% drop. Existing remedies, including selective recomputation and offset-based calibration, recover a limited fraction of this loss. We argue that the problem lies not only in contaminated KV representations but also in the agent's difficulty interpreting reused context under its own instructions. To this end, we introduce LatentRemedy, which uses a few task-conditioned latent tokens to help the target agent leverage reused context without recomputing the shared block. Specifically, we use an MLP to map the last hidden state of the target prefix into a small number of latent tokens, which are placed after the reused KV block to interact with the shared context. To guide subsequent predictions toward the target task, we train the MLP through full-prefill distillation. Experiments show that LatentRemedy consistently outperforms existing reuse baselines on conflicting tasks while maintaining TTFT close to direct reuse as cache size grows. Code and data are available at https://github.com/chenzhwsysu57/kvreuse.
Zhiwei Chen, Zhongtao Rao, Waikit Xiu +4
The Hong Kong University of Science and Technology (Guangzhou) · Microsoft · The University of Hong Kong