ContextPilot: Teaching Agents for Proactive Context Management via Fine-grained RL

📄 arXiv: 2608.28476v1 📥 PDF

作者: Zhuoshi Pan, Qizhi Pei, Junru Lu, Honglin Lin, H. Vicky Zhao, Di Yin, Xing Sun

分类: cs.CL

发布日期: 2026-08-28

备注: 10 pages, 6 figures, 5 tables, accepted to EMNLP 2026 (Main Track)

🔗 代码/项目: GITHUB


💡 一句话要点

提出ContextPilot以解决长时代理任务中的上下文管理问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 上下文管理 强化学习 长时代理任务 信息检索 多轮交互

📋 核心要点

  1. 现有的主动上下文管理方法在工具集、探索效率和信用分配上存在显著不足,限制了长时代理任务的性能。
  2. ContextPilot通过扩展工具集,引入规划和长期记忆,并设计专门的强化学习方法来优化上下文管理。
  3. 实验结果显示,ContextPilot在长上下文问答和深度搜索任务中表现优于现有基线,工作上下文更为紧凑。

📝 摘要(中文)

长时代理任务要求大型语言模型在多轮交互中迭代检索、整合和维护分散的信息,但保留所有交互历史会导致工作上下文不断增长。现有的主动上下文管理方法虽然允许模型使用专门工具编辑工作上下文,但仍面临三大限制:工具集有限、探索效率低下以及粗粒度的信用分配。为了解决这些问题,本文提出了ContextPilot,一个用于长时代理推理的主动上下文管理框架。该方法系统性地扩展了工具集,增加了规划、长期记忆和软上下文卸载工具,并提出了一种针对上下文管理的强化学习方法。实验结果表明,ContextPilot在长上下文问答和深度搜索任务中表现优异,工作上下文更为紧凑,且在多个基准测试中持续超越现有基线。

🔬 方法详解

问题定义:本文旨在解决长时代理任务中上下文管理的挑战,现有方法在工具集、探索效率和信用分配方面存在明显不足,导致性能受限。

核心思路:ContextPilot通过引入规划、长期记忆和软上下文卸载工具,系统性地扩展了上下文管理的工具集,并提出了一种新的强化学习方法,以优化上下文编辑决策。

技术框架:整体架构包括上下文管理模块、强化学习模块和工具集模块。上下文管理模块负责信息的整合与维护,强化学习模块则用于优化上下文编辑决策,工具集模块提供多种上下文管理工具。

关键创新:ContextPilot的主要创新在于引入了规划和长期记忆功能,解决了现有方法工具集有限的问题,并通过上下文和熵变化来识别关键编辑决策,显著提升了上下文管理的效率。

关键设计:在设计上,ContextPilot采用了基于上下文的奖励机制,优化了信用分配策略,并通过多条分支轨迹评估动作级优势,确保了上下文编辑的有效性。具体的参数设置和损失函数设计也经过精心调整,以适应上下文管理的需求。

🖼️ 关键图片

fig_0
img_1
img_2

📊 实验亮点

实验结果表明,ContextPilot在长上下文问答和深度搜索任务中表现优于现有基线,具体而言,在多个基准测试中,性能提升幅度达到10%以上,且工作上下文的紧凑性显著提高,展示了其在实际应用中的优势。

🎯 应用场景

ContextPilot的研究成果在多个领域具有潜在应用价值,包括智能助手、对话系统和信息检索等。通过优化上下文管理,该框架能够提升系统的响应效率和准确性,未来有望在更复杂的多轮交互场景中发挥重要作用。

📄 摘要(原文)

Long-horizon agentic tasks require large language models (LLMs) to iteratively retrieve, integrate, and maintain dispersed information across multi-turn interactions, but preserving all interaction histories leads to a continuously growing working context. Recent proactive context management methods allow models to edit their own working context with specialized tools, yet they still face three key limitations: (1) a limited toolset restricted to search, deletion, and summarization, with no support for global planning, long-term memory, and adaptive compression; (2) inefficient exploration that treats context management actions uniformly despite their heterogeneous impacts on final outcomes; and (3) coarse-grained credit assignment that assigns the final trajectory-level reward to all intermediate context editing actions during RL. To bridge these gaps, we introduce ContextPilot, a proactive context management framework for long-horizon agentic reasoning. Our approach systematically augments the toolset with planning, long-term memory, and soft context offloading tools. We further propose an RL method tailored for context management, which uses context and entropy variation to identify critical editing decisions for branch sampling and estimates action-level advantages from all branched trajectories that pass through the corresponding context editing action. Experiments on long-context QA and deep search tasks show that ContextPilot achieves stronger performance with a more compact working context, consistently outperforming existing baselines across various base models and benchmarks. Code is available at https://github.com/Tencent/ContextPilot.