Organizations: School of Mathematical Sciences, Beijing University of Posts and Telecommunications, Beijing 100876, China · School of Mathematics and Statistics, Chongqing University, Chongqing 401331, China · School of Science, Beijing Forestry University, Beijing 100083, China
Tool use in LLM systems faces a structural trade-off. Progressive disclosure keeps the prompt small by showing only the tools relevant to the current task, while prompt caching rewards a request prefix that stays fixed across calls; every change to the visible tool list invalidates the cached prefix. This paper treats the trade-off as a problem of request architecture and proposes a dual-path routing design that assigns tool selection and tool delivery to separate channels. The main model always sees a small, fixed set of core tools, so the head of its request is unchanged across calls; all other tools are reached through an independent routing channel, in which a router sub-model searches the full tool list, selects one tool, executes it, and returns the result. Tool registration is automated from source code and supports runtime updates, so the tool set can grow without modifying the main model's request prefix. The design generalizes progressive disclosure: capabilities are disclosed through the routing channel, and the main model's prefix stays stable. A prototype implementation was exercised on 55 functional queries and a 30-turn dialogue; token-level cache hit rates reached 90.99% and 95.2%, cutting input cost to about 12.0% and 8.0% of a no-cache baseline under DeepSeek's pricing, where cache-hit input tokens cost roughly 1/30 of cache-miss tokens.
Figures & tables
Figure 1: Five-layer architecture. Each layer encapsulates complexity downward and provides service abstractions upward; inter-layer communication is entirely based on the MCP protocol or inter-process parameter passing, with no shared internal state.
ID
Rounds
Router
Time (s)
Answer summary
1.1
11
5
150.8
Beijing weather query, saved to file and verified via Router (switched to /tmp sandbox path after path restriction)
1.2
3
0
12.3
rag_project1 retrieved campus, 1 hit
1.3
4
0
23.3
Beijing 31.5°C vs. Shanghai 29.4°C, Beijing hotter
1.4
10
6
115.7
faculty retrieved 0 hits, wrote to file via Router (succeeded after whitelist restriction)
1.5
4
1
26.6
Beijing weather vs. campus retrieval, structured output
Table 1: Experiment 1: Results of multi-step sequential tasks
ID
Rounds
Router
Time (s)
Answer summary
2.1
11
0
25.7
Parallel Beijing/Shanghai weather queries, including humidity and dew point details
2.2
3
0
19.1
Parallel retrieval across two RAG projects (BUPT + Mathematics), both successful
2.3
4
0
17.7
Beijing weather and rag_project1 in parallel
2.4
4
0
25.2
Shanghai weather and rag_project2 in parallel (doctoral retrieval succeeded)
2.5
13
0
68.3
Parallel weather queries for three cities, summarized
Table 2: Experiment 2: Results of parallel tasks
Group
ID
Rounds
Router
Time (s)
Answer summary
A
Q1
4
0
15.7
Beijing weather
A
Q2
3
0
18.2
rag_project1 BUPT retrieval
A
Q3
3
0
11.1
Shanghai weather
A
Q4
3
0
10.1
rag_project2 Mathematics retrieval
A
Q5
3
0
9.3
Guangzhou weather
B
Q1
3
0
14.3
Beijing weather (cold start)
Table 3: Experiment 3: Results of long-chain dialogue
Agentic language models repeatedly encode tool and skill schemas that recur across requests in different combinations and orders, preventing standard prefix caching from reusing their key--value (KV) states. We introduce ReCache, a framework for independently caching resource representations while reducing their inference-time computational and memory overhead. Resource-wise attention removes cross-resource interactions and assigns resource-local positions, producing composition-invariant KV blocks. ReCache then restricts resource visibility to contribution-selected layer--KV-head-group routes and retains only invocation-critical fields through structural and semantic pruning. We evaluate ReCache on a benchmark assembled from seven public tool- and skill-use datasets, including resource-disjoint tests. Resource-wise attention matches dense invocation performance (82.3% versus 82.4% Inv-F1) while providing a 3.655× time-to-first-token speedup. The complete framework reduces allocated KV-tensor memory by 92.43% and accelerates attention by 1.423×. These results show that separating reusable schema encoding from selective resource access substantially reduces agentic inference costs with limited effectiveness loss. The code is available at https://github.com/EIT-NLP/ReCache.
Yichu Fang, Sitong Wei, Haozhe Hu +1
Shanghai Jiao Tong University · Eastern Institute of Technology, Ningbo · Xi’an Jiaotong University
We present CacheRL, a system for training small agent foundation models that achieves 92 percent process accuracy on multi-step tool-calling tasks, approaching GPT-5's 94 percent while requiring 100 times less compute. Our approach addresses three challenges in practical agent training: transferring tool-calling knowledge from large models at scale, enabling reinforcement learning without costly live tool execution, and learning robustly from noisy cached environments. CacheRL introduces three key innovations. First, a hybrid thinking trajectory pipeline augments agent trajectories with LLM-generated reasoning traces, producing training examples that teach models not only what tools to call but also why. Second, the CacheAgentLoop eliminates live execution costs through a three-tier fuzzy cache while preserving trajectory fidelity using token-level masking. Third, a cache-tier-aware reward dynamically adjusts answer-quality weights to avoid penalizing models for cache-induced limitations. Through iterative supervised fine-tuning (SFT) and Group Relative Policy Optimization (GRPO), CacheRL improves Qwen3-4B-Thinking's validation reward from 0.43 to 0.78. On public agentic tool-calling benchmarks, our model achieves competitive performance against frontier models such as GPT-5. Ablation studies show that removing knowledge transfer reduces performance by 41 percent, while cache-aware rewards contribute a 17 percent improvement. Interestingly, reinforcement learning improves training stability but yields limited gains beyond strong supervised fine-tuning, suggesting that data quality and reward design play a more important role than complex optimization methods in building practical small agent models.
Agentic LLM workloads put bit-identical tokens at shifted positions every turn, voiding prefix caches at the first byte of divergence. Operators report cache-hit regressions ranging from moderate slowdowns to severe TTFT spikes of 10-16s on unchanged content. Prior position-independent caching systems correct RoPE on the full dK-dimensional key, an architectural cost imposed by GQA, not by caching itself. Multi-Head Latent Attention, deployed at scale in DeepSeek-V2/V3/R1, Kimi-K2/Moonlight, GLM-5, and Mistral Large 3, factors each KV row into a position-free cKV and a 64-dim kr correctable in closed form; this structure motivates content-addressed caching as a natural fit rather than a GQA workaround. We present Irminsul, which extends SGLang's radix cache with content-hash keying over CDC-chunked segments and a δ-rotation rule for kr. We evaluate three native MLA-MoE deployments - DeepSeek-V2-Lite (16B/2.4B), Kimi Moonlight-16B-A3B, and JoyAI-Flash (48B/3B) - with output-consistency on all three and recovery measured on the two endpoints; Irminsul recovers up to ~83% of prompt tokens above exact-prefix on agentic traffic while delivering 63% prefill energy savings per cache hit. We argue that content-addressed caching belongs in the serving stack as a first-class primitive, not a retrofit over prefix matching.
Bole Ma, Jan Eitzinger, Harald Köstler
Erlangen National High Performance Computing Center · Erlangen, Germany