2025-01-22 · 进阶 · 机器学习 · 自然语言处理

Agent-R: Training Language Model Agents to Reflect via Iterative Self-Training

本文提出了一种名为Agent-R的迭代自训练框架,通过动态构建和修正轨迹,使语言模型代理能够在交互环境中进行实时自我纠正和自我改进。

更新于 2025-01-22。作者:Siyu Yuan、Zehui Chen、Zhiheng Xi、Junjie Ye、Zhengyin Du、Jiecao Chen。

中文摘要

大型语言模型(LLMs)代理在解决交互环境中的复杂任务中越来越关键。现有工作主要关注通过从更强的专家那里进行行为克隆来提升性能,然而,这种方法在现实世界应用中往往失效,主要是因为无法从错误中恢复。然而,步骤级批评数据的收集既困难又昂贵。因此,自动化和动态构建自我批评数据集对于赋予模型智能代理能力至关重要。在这项工作中,我们提出了一种迭代自训练框架,称为Agent-R,它使语言代理能够即时反思。与传统方法不同,Agent-R利用蒙特卡洛树搜索(MCTS)构建训练数据,从错误轨迹中恢复正确轨迹。代理反思的一个关键挑战在于需要及时修订,而不是等到轮次结束。为了解决这个问题,我们引入了一种模型引导的批评构建机制:动作模型识别失败轨迹中的第一个错误步骤(在其当前能力范围内)。从它开始,我们将其与相邻的正确路径拼接,这两个路径在树中共享相同的父节点。这种策略使模型能够根据其当前策略学习反思,从而提高学习效率。为了进一步探索这种自我改进范式的可扩展性,我们研究了错误纠正能力和数据集构建的迭代细化。我们的发现表明,Agent-R不断改进模型从错误中恢复的能力,并实现及时错误纠正。在三个交互环境上的实验表明,Agent-R有效地使代理能够纠正错误行为并避免循环,与基线方法相比,性能更优(+5.59%)。

英文摘要

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%).

解读

一句话总结

本文提出了一种名为Agent-R的迭代自训练框架,通过动态构建和修正轨迹,使语言模型代理能够在交互环境中进行实时自我纠正和自我改进。

问题1:这篇论文想要解决什么具体问题?

• 问题背景:语言模型代理在交互环境中执行任务时,由于缺乏有效的错误检测和修正机制,容易陷入错误循环,导致任务执行失败。 • 现有方案不足:现有的方法主要依赖于行为克隆,难以主动自我纠正错误,且无法有效地收集和利用错误修正数据。 • 研究目标:提出一种能够使语言模型代理在交互环境中进行实时自我纠正和自我改进的迭代自训练框架。

问题2:论文的核心创新点是什么?

• 技术创新:利用蒙特卡洛树搜索(MCTS)动态构建和修正轨迹,使代理能够从错误中恢复并学习。 • 方法改进:引入模型引导的批评构建机制,使代理能够及时修正错误,避免延迟修正导致的灾难性错误。 • 优势:与基线方法相比,Agent-R能够更有效地识别和纠正错误,避免循环,并实现更好的性能(+5.59%)。

问题3:实验结果如何验证了方法的有效性?

• 关键实验:在三个代表性的交互环境中进行实验,包括WebShop、SciWorld和TextCraft。 • 性能提升:Agent-R在三个环境中的性能均优于基线方法,平均性能提升+5.59%。 • 对比结果:与仅使用专家轨迹训练的代理相比,Agent-R能够更有效地识别和纠正错误,避免循环,并实现更好的性能。

问题4:这个研究的实际应用价值是什么?

• 应用场景:Agent-R可以应用于需要自主决策、错误纠正和任务优化的交互环境,如在线购物、科学推理和Minecraft物品制作。 • 实施建议:在实际部署中,建议结合多任务训练和通用数据集,以提高代理的泛化能力。 • 局限与展望:Agent-R在处理复杂任务和长轨迹时可能存在局限性。未来研究方向包括改进错误检测和修正机制,以及探索更有效的训练策略。

来源

机器可读索引:llms.txt