每日AI论文 artwork

每日AI论文 · Jingwen Liang, Gengyu Wang

Cache Engineering for Agents

🤗 Upvotes: 55 | cs.CL 作者: Tianyu Fu, Ruoxi Wang, Zihan Min, Zhongqi Ren, Zhihao Li, Tengxuan Liu, Shengxu Mu, Hanling Zhang, Yu Wang 标题: Cache Engineering for Agents Arxiv: http://arxiv.org/abs/2610.28577v1 摘要: Large Language Model (LLM) agents can handle increasingly complex tasks, navigating long trajectories of observations and actions. As these trajectories grow, key-value (KV) cache I/O and storage become the dominant cost. Trajectories can also exceed the LLM's maximum context length, requiring control over active cache growth. Prior work uses context engineering to reduce cache size by trimming or summarizing history. However, modifying the trajectory prefix invalidates subsequent cached states and triggers costly re-prefilling of retained context. Task accuracy can also suffer when too little context is retained to limit re-prefill costs. We propose cache engineering as a new scheme. It allows agents to directly control their active KV cache without modifying the trajectory or re-prefilling retained context. Specifically, agents can proactively use drop to exclude selected cache from future attention and repos to adjust retained keys' position encodings. We formalize these cache operations and identify history dependence as a serving challenge: identical token sequences can yield different cache states under different cache operation sequences, making prefix matching insufficient for correct cache reuse. Thus, we co-design the AKV serving engine. It provides a stateless interface compatible with existing serving APIs, while internally managing stateful cache reuse, eviction, and restoration. Experiments show that a tool-response rolling-drop cache policy improves average benchmark scores by 1.7 points and reduces average cost by 27.7%, compared with conventional threshold-triggered summarization. With AKV, it achieves up to 1.2x the output throughput and a 1.5x speedup in P95 request latency. Recursive self-improvement of cache policies further reduces cost by 7.1% over expert design. Our code is at https://github.com/thu-nics/AKV.

Oct 222026
15 minlength
145transcript lines
Publishertranscript source

Transcript first 15 of 145 lines

0:03Xiaolin: 欢迎收听《每日论文速递》。

0:05今天是 2026 年 10 月 22 日,我们来看一篇来自 Hugging Face 每日论文榜、拿了五十五个 upvotes 的文章,标题是 Cache Engineering for Agents。

0:17前两位作者是清华大学的 Tianyu Fu 和 Ruoxi Wang,通讯作者是同校的 Yu Wang,还有部分作者来自香港中文大学。

0:25Xiaoman: 这篇论文关注的是 LLM agent 在长轨迹任务里的 KV cache 管理问题。

0:32现在 agent 动辄交互几百轮,论文里提到,KV cache 的读取占了总 API 成本的百分之八十二点四。

0:41Xiaolin: 这确实是个大头。

0:43而且轨迹太长不仅费钱,还会超出上下文窗口,或者让模型 attend 到太多无关状态,导致准确率下降。

0:51现在的常规做法是用 context engineering,对历史消息做截断或者总结。

0:57Xiaoman: 但这里有个两难。

0:58如果你修改了前面的文本,比如删掉或总结了一段,后面的 KV cache 就全部失效了,必须重新 prefill。

1:07Xiaolin: 等一下,改前面的文本,为什么后面的 cache 会失效?

1:12Xiaoman: 因为自回归生成是依赖前缀的。

1:14你改了前面某一轮的文本,后面那一轮计算 attention 时看到的上下文就变了,它的 KV 状态自然就不对了。

1:24Xiaolin: 哦,我懂了。

1:25所以为了减少重新 prefill 的开销,现有的框架通常会拖延,直到 context 快爆了,再一次性砍掉一大半历史。

More 每日AI论文 episodes →