ReCache: Efficient KV Cache Reuse and Compression for Tool-Augmented LLM Agents
Organizations: Shanghai Jiao Tong University · Eastern Institute of Technology, Ningbo · Xi’an Jiaotong University
Abstract
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.
Figures & tables
| Model | CC L | CC G | Inv-F1 (%) | |||
|---|---|---|---|---|---|---|
| 20/36 | 3/8 | 97.7 | 47.3 | 79.2 | ||
| 20/28 | 7/8 | 99.8 | 99.3 | 37.5 |
| Method | Inv-F1 | ID-F1 | Halluc. | TTFT (ms) |
|---|---|---|---|---|
| Dense | 82.4 | 96.0 | 0.0 | 26.319 |
| Block | 82.2 | 95.8 | 0.1 | – |
| 82.3 | 96.0 | 0.2 | 7.200 |
| Method | Attn. | Mem. | Inv-F1 | ID-F1 | Halluc. |
|---|---|---|---|---|---|
| Dense | – | – | 82.4 | 96.0 | 0.0 |
| 1.001 | 0.47% | 82.3 | 96.0 | 0.2 | |
| Structural pruning | |||||
| 1.016 | 44.71% | 82.5 | 95.7 | 0.3 | |
| + SPEED | 1.013 | 44.71% | 79.3 | 92.9 | 2.8 |
| 1.314 | 79.27% | 82.1 | 95.6 | 0.2 | |
| Method | Inv-F1 | ID-F1 | Halluc. |
|---|---|---|---|
| Dense | 66.3 | 95.6 | 0.0 |
| 64.7 | 94.4 | 0.4 | |
| Structural pruning | |||
| 64.3 | 94.3 | 0.5 | |
| + SPEED | 54.3 | 81.6 | 13.4 |
| 63.2 | 93.3 | 0.5 | |
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
| Group | Source | Train pool | Distinct names | Subset dup. | Recurring names | IND cand. | OOD cand. |
| Tool | ToolACE | 8,400 | 14,566 | 178 | 7,144 | 200 | 195 |
| APIGEN | 10,000 | 2,806 | 734 | 2,805 | 500 | 146 | |
| Toucan (all generators) | 13,071 | 4,355 | 6,901 | 4,355 | 600 | 493 | |
| - Kimi-K2 | 3,333 | 1,103 | 1,772 | 1,103 | 200 | 145 | |
| - GPT-OSS-120B | 4,184 | 1,412 | 2,162 | 1,412 | 200 | 130 | |
| - Qwen3-32B | 5,554 | 1,840 | 2,967 | 1,840 | 200 | 218 |
| Config | Inv-F1 | Resource ID | Halluc. | ||
|---|---|---|---|---|---|
| ID-P | ID-R | ID-F1 | |||
| 72.1 | 92.0 | 90.8 | 90.9 | 0.4 | |
| 49.6 | 74.5 | 73.5 | 73.4 | 4.8 | |
| 53.4 | 79.6 | 77.9 | 78.3 | 3.2 | |
| 57.3 | 83.4 | 81.8 | 82.1 | 2.9 | |
| 69.3 | 89.2 | 88.3 | 88.3 | 1.1 | |
| Config | Inv-F1 | Resource ID | Halluc. | ||
|---|---|---|---|---|---|
| ID-P | ID-R | ID-F1 | |||
| 80.7 | 94.9 | 94.3 | 94.4 | 0.1 | |
| 78.8 | 94.1 | 93.5 | 93.6 | 0.5 | |
| 80.0 | 94.7 | 94.0 | 94.1 | 0.3 | |
| Config | Inv-F1 | Resource ID | Halluc. | ||
|---|---|---|---|---|---|
| ID-P | ID-R | ID-F1 | |||
| 76.1 | 93.1 | 92.8 | 92.5 | 0.9 | |
| Schema representation ablation | |||||
| Suffix-only Schema | 14.8 | 22.8 | 23.0 | 22.9 | 76.0 |
| + Resource Name | 45.2 | 89.9 | 88.8 | 88.9 | 1.8 |
| + Arg Name | 67.7 | 92.1 | 91.1 | 91.2 | 1.3 |
| Layers | |||||||
|---|---|---|---|---|---|---|---|
| (Qwen3-4B) | (Qwen3-1.7B) | ||||||
| rank | unit | (%) | CC (%) | rank | unit | (%) | CC (%) |
| 1 | 15.56 | 15.6 | 1 | 20.09 | 20.1 | ||
| 2 | 10.53 | 26.1 | 2 | 12.90 | 33.0 | ||
| 3 | 9.37 | 35.5 | 3 | 12.14 | 45.1 | ||
| 4 | 8.31 | 43.8 | 4 | 10.90 | 56.0 | ||
KV-Cache Reuse
Key-value (KV) cache reuse lets language models reuse previously computed attention states to cut repeated prefill work and serving latency.
See all 71 papers