Sample-Efficient Online Learning in LM Agents via Hindsight Trajectory Rewriting
Hu, Van Durme, Andreas et al.
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.
언어모델(LM) 에이전트가 새로운 환경에 배포될 때, 순차적 상호작용 학습에서 낮은 표본 효율성을 보이는 경향이 있습니다. 이는 상호작용 비용이 높은 환경(예: 인간과의 상호작용 또는 물리 시스템 초기화)에서 이러한 에이전트의 실용성을 심각하게 방해합니다. 기존의 LM 에이전트 아키텍처는 다양한 경험 저장 및 반성 메커니즘을 통합하지만, LM이 완전한 반사실적 궤적을 직접 생성하거나 추론하는 능력의 활용이 제한적입니다. 본 논문은 강화학습의 후견적 경험 재생을 언어모델 에이전트에 적응시킨 프롬프팅 프레임워크인 ECHO(Experience Consolidation via Hindsight Optimization)를 소개합니다. ECHO는 실패한 시도에서 달성 가능한 대체 목표에 대한 최적화된 궤적을 생성하여, 실질적으로 성공하지 못한 상호작용에서 합성 긍정 사례를 만듭니다. 이 방법은 두 가지 구성 요소를 포함합니다: 언어모델 자체를 사용하여 관련 부분목표를 식별하고 최적화된 궤적을 생성하는 후견적 규칙, 그리고 메모리에서 압축된 궤적 표현을 유지하는 업데이트 규칙입니다.
Andrychowicz, M., et al. (2017). Hindsight experience replay. NIPS.
Shinn, N., et al. (2023). Reflexion: language agents with verbal reinforcement learning. NIPS.
Wang, Z. Z., et al. (2025). Agent workflow memory. ICML.
Yao, S., et al. (2023). React: Synergizing reasoning and acting in language models. ICLR.
종합 평가: 본 논문에서 제안한 ECHO 프레임워크는 LM 에이전트의 표본 효율적 학습에서 중요한 진전을 이루었으며, 방법은 혁신적이고 실험 결과는 설득력 있습니다. 일부 한계가 있지만, 이 분야의 향후 발전을 위한 견고한 기초를 마련했으며, 높은 학술 가치와 실제 응용 가능성을 가집니다.