让语言模型智能自我纠错,实时修正错误动作。
Agent-R: Training Language Model Agents to Reflect via Iterative Self-Training
- 用MCTS动态构建纠错训练数据,自动修复错误路径。
- 在失败轨迹中定位首个错误点,拼接正确后续路径,实现及时修正。
- 在3个交互环境测试中性能提升5.59%,适合需要容错的AI代理场景。
大型语言模型代理在交互环境中解决复杂任务日益重要。现有方法主要通过从更强专家处行为克隆来提升性能,但这类方法在真实应用中常因无法从错误中恢复而失效,而步骤级批评数据难以获取且成本高。为此,我们提出迭代自训练框架Agent-R,使语言代理能够实时反思与修正。不同于仅基于正确性奖励或惩罚动作的传统方法,Agent-R利用蒙特卡洛树搜索(MCTS)构建训练数据,从错误轨迹中恢复正确路径。关键挑战在于需及时修正而非等待完整执行结束。为此,我们引入模型引导的批评构造机制:由执行者模型识别失败轨迹中首个可察觉的错误步骤(在其当前能力范围内),并从该点开始,将其与共享同一父节点的相邻正确路径拼接。此策略使模型基于自身当前策略学习反思,显著提升学习效率。为进一步探索该自提升范式的可扩展性,我们研究了错误纠正能力与数据构造的迭代优化。实验表明,Agent-R持续增强模型的纠错能力,支持及时修正,避免循环。在三个交互环境上的测试显示,其有效纠正错误动作,优于基线方法5.59%。
原文摘要 · Abstract (English)
Large Language Models (LLMs) agents are increasingly pivotal for addressing complex tasks in interactive environments. Existing work mainly focuses on enhancing performance through behavior cloning from stronger experts, yet such approaches often falter in real-world applications, mainly due to the inability to recover from errors. However, step-level critique data is difficult and expensive to collect. Automating and dynamically constructing self-critique datasets is thus crucial to empowering models with intelligent agent capabilities. In this work, we propose an iterative self-training framework, Agent-R, that enables language Agent to Reflect on the fly. Unlike traditional methods that reward or penalize actions based on correctness, Agent-R leverages MCTS to construct training data that recover correct trajectories from erroneous ones. A key challenge of agent reflection lies in the necessity for timely revision rather than waiting until the end of a rollout. To address this, we introduce a model-guided critique construction mechanism: the actor model identifies the first error step (within its current capability) in a failed trajectory. Starting from it, we splice it with the adjacent correct path, which shares the same parent node in the tree. This strategy enables the model to learn reflection based on its current policy, therefore yielding better learning efficiency. To further explore the scalability of this self-improvement paradigm, we investigate iterative refinement of both error correction capabilities and dataset construction. Our findings demonstrate that Agent-R continuously improves the model's ability to recover from errors and enables timely error correction. Experiments on three interactive environments show that Agent-R effectively equips agents to correct erroneous actions while avoiding loops, achieving superior performance compared to baseline methods (+5.59%).
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。