arXiv:2608.29363cs.AI2026-08

让大模型工具调用更省资源,自动判断该保留哪些中间结果。

TRACER: Per-Tool Context Retention for LLM Agents via Consequence-Attributed Reinforcement Learning

论文配图:TRACER: Per-Tool Context Retention for LLM Agents via Consequence-Attributed Reinforcement Learning
图 1 · 摘自论文原文
  • 基于后果感知的强化学习,动态决定每步工具输出是否保留。
  • 相比全保留减少29%~46%上下文token,任务成功率不降反升。
  • 适合作为长序列推理类大模型系统的优化组件使用。

企业级数据代理在回答业务问题时,需通过多轮推理与工具调用,每会话累积数十万上下文标记。现有压缩策略未考虑删除单个工具输出的下游影响,激进压缩可能引发昂贵的工具重调用,抵消节省效果。我们称之为压缩-后果差距。为此提出TRACER,将压缩建模为逐工具的序列决策问题。轻量级REINFORCE策略根据查询条件动态分配保留比例,其目标函数联合优化任务成功率、总标记消耗与压缩后工具重调用次数。为提升信用分配,TRACER使用学习到的后果模型,比较所选保留比例与完全保留的预测后果。在三个压缩器后端的生产级测试中,TRACER相较保留全部上下文减少29%~46%的标记消耗,且任务成功率相当或更高。相比基于工具类型的静态策略,额外节省15%~18%标记。干预性上线实验表明,学习到的每工具信用评分与实际单工具后果高度相关。该策略在不同代理骨架和压缩架构间迁移也有效,在五个独立的LOCA-bench环境中降低18%~25%的标记消耗。结果证明,后果感知的逐工具上下文保留对提升长程语言代理效率具有显著价值。

原文摘要 · Abstract (English)

Enterprise data agents answer business queries by chaining many tool calls over multiple reasoning steps, routinely accumulating hundreds of thousands of context tokens per session. Existing compression strategies typically allocate retention budgets without accounting for the downstream consequences of removing individual tool outputs. Aggressive compression may therefore trigger costly tool re-invocations that offset the initial savings. We call this the compression--consequence gap. To close it, we propose TRACER, which formulates compression as a sequential per-tool decision problem. A lightweight REINFORCE policy assigns query-conditioned retention ratios using only information available at each compression event. Its consequence-aware objective jointly accounts for task success, total token consumption, and post-compression tool re-invocations. To improve credit assignment, TRACER uses a learned outcome model to compare the predicted consequences of the selected retention ratio with those of fully retaining each tool output. On held-out production queries across three compressor backends, TRACER reduces total token consumption by 29--46% relative to keeping all context while maintaining comparable or higher task success. Compared with a tool-type-conditional static policy, TRACER provides an additional 15--18% of token savings. Interventional rollouts show that the learned per-tool credit scores correlate with measured single-tool consequences. The learned policy also yields positive savings when transferred across agent backbones and compressor architectures, and reduces token consumption by 18--25% on five held-out LOCA-bench environments. These results demonstrate the value of consequence-aware, per-tool context retention for improving the efficiency of long-horizon language agents.

大模型推理上下文压缩强化学习工具调用

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。