让语言模型从失败中学习,用虚拟成功轨迹提升试错效率。
Sample-Efficient Online Learning in LM Agents via Hindsight Trajectory Rewriting
- 用语言模型自动生成失败经历的替代成功路径,构造虚拟正样本。
- 在两个任务上比基础模型提升最高80%,且优于多个先进架构。
- 适合需要快速适应新环境的低成本交互场景,如人机协作或物理系统调试。
部署于新环境的语言模型(LM)代理在序列交互中常表现出差的样本效率,严重限制其在交互成本高的场景(如与人类交互或重置物理系统)中的应用。尽管现有架构引入了经验存储与反思机制,但未能充分利用语言模型生成或推理完整反事实轨迹的能力。本文提出ECHO(Experience Consolidation via Hindsight Optimization),一种将强化学习中的事后经验回放思想适配至语言模型代理的提示框架。ECHO通过语言模型自身识别相关子目标并生成优化后的替代目标轨迹,从失败尝试中构建合成正例。该方法包含两个组件:用于识别子目标和生成优化轨迹的“事后规则”,以及在内存中维护压缩轨迹表示的“更新规则”。我们在状态化版本的XMiniGrid(文本导航与规划基准)和PeopleJoinQA(协作信息收集企业模拟)上评估ECHO,结果表明在两个领域中均比基线语言代理最高提升80%;在XMiniGrid上也优于Reflexion和AWM等复杂代理架构,证明其通过更高效利用过往经验实现更快环境适应。
原文摘要 · Abstract (English)
Language model (LM) agents deployed in novel environments often exhibit poor sample efficiency when learning from sequential interactions. This significantly hinders the usefulness of such agents in environments where interaction is costly (for example, when they interact with humans or reset physical systems). While a number of existing LM agent architectures incorporate various mechanisms for experience storage and reflection, they make limited use of LMs' abilities to directly generate or reason about full counterfactual trajectories. We introduce ECHO (Experience Consolidation via Hindsight Optimization), a prompting framework that adapts hindsight experience replay from reinforcement learning for language model agents. ECHO generates optimized trajectories for alternative goals that could have been achieved during failed attempts, effectively creating synthetic positive examples from unsuccessful interactions. Our approach consists of two components: a hindsight rule that uses the language model itself to identify relevant subgoals and generate optimized trajectories, and an update rule that maintains compressed trajectory representations in memory. We evaluate ECHO on stateful versions of XMiniGrid, a text-based navigation and planning benchmark, and PeopleJoinQA, a collaborative information-gathering enterprise simulation. Across both domains, ECHO outperforms vanilla language agent baselines by up to 80%; in XMiniGrid, it also outperforms a number of sophisticated agent architectures including Reflexion and AWM, demonstrating faster adaptation to novel environments through more effective utilization of past experiences.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。