Sample-Efficient Online Learning in LM Agents via Hindsight Trajectory Rewriting
On the map: LLM agents and tool use → Agent memory systems
Abstract (arXiv)
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.
Key facts. Cited by 13 papers in the map (data through 14 Oct 2026). Placed in Agent memory systems, one of 16 directions in LLM agents and tool use. Builds on 21 of its 27 references that are in the map. First posted on arXiv 11 Oct 2025.
Builds on
21 of 27 references.
References · 21
- 2022ReAct: Synergizing Reasoning and Acting in Language Modelscited by 8,695
- 2024GPT-4o System Cardcited by 4,588
- 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,276
- 2023Toolformer: Language Models Can Teach Themselves to Use Toolscited by 4,182
- 2023WebArena: A Realistic Web Environment for Building Autonomous Agentscited by 2,006
- 2023AgentBench: Evaluating LLMs as Agentscited by 1,267
- 2017Hindsight Experience Replaycited by 1,136
- 2015Prioritized Experience Replaycited by 1,099
- 2023ChatDev: Communicative Agents for Software Developmentcited by 919
- 2023ExpeL: LLM Agents Are Experiential Learnerscited by 876
- 2023Cognitive Architectures for Language Agentscited by 429
- 2024Agent Workflow Memorycited by 383
9 more
- 2023Can Large Language Models Transform Computational Social Science?cited by 250
- 2023Synapse: Trajectory-as-Exemplar Prompting with Memory for Computer Controlcited by 187
- 2025Measuring AI Ability to Complete Long Software Taskscited by 156
- 2025Inducing Programmatic Skills for Agentic Taskscited by 111
- 2023Synthetic Experience Replaycited by 101
- 2023XLand-MiniGrid: Scalable Meta-Reinforcement Learning Environments in JAXcited by 55
- 2024BAGEL: Bootstrapping Agents by Guiding Exploration with Languagecited by 34
- 2024CodeIt: Self-Improving Language Models with Prioritized Hindsight Replaycited by 23
- 2023Interpreting User Requests in the Context of Natural Language Standing Instructionscited by 5
Built on by
Citing papers per year: 2026: 13.
13 papers.
Sort:
By area:
- 2026Skill-SD: Skill-Conditioned Self-Distillation for Multi-turn LLM Agentscited by 90
- 2026AgentHER: Hindsight Experience Replay for LLM Agent Trajectory Relabelingcited by 13
- 2026GRASP: Gated Regression-Aware Skill Proposer for Self-Improving LLM Agentscited by 11
- 2026Off-Context GRPO: Learning to Reason on Hard Problems using Privileged Informationcited by 7
- 2026Planning with the Viewscited by 3
- 2026Agent Memory Distillation: Empowering Small LLM Agents with Hierarchical Teacher Memorycited by 3
- 2026View-oriented Conversation Compiler for Agent Trace Analysiscited by 2
- 2026HindSearch: Trajectory-Level Hindsight Critique for Search-Augmented Reinforcement Learningcited by 0
- 2026MemeMind: Reference-Guided Trace Construction for Offline Context Optimizationcited by 0
- 2026My FAULT: Self-Diagnosis as Credit Assignment in Self-Evolving Agentic Reinforcement Learningcited by 0
- 2026TeleTune: Evolving Agent Skills From Offline Telemetrycited by 0
- 2026Fan Out or Relay? Ownership-Aware Routing for LLM Agents Querying Siloed Tablescited by 0
1 more
- 2026Co-Evolving Acting and Forecasting for Language Agentscited by 0
- 2026Co-Evolving Acting and Forecasting for Language Agents14 Oct 2026
- 2026Fan Out or Relay? Ownership-Aware Routing for LLM Agents Querying Siloed Tables13 Oct 2026
- 2026TeleTune: Evolving Agent Skills From Offline Telemetry4 Oct 2026
- 2026My FAULT: Self-Diagnosis as Credit Assignment in Self-Evolving Agentic Reinforcement Learning1 Oct 2026
- 2026MemeMind: Reference-Guided Trace Construction for Offline Context Optimization10 Aug 2026
- 2026Agent Memory Distillation: Empowering Small LLM Agents with Hierarchical Teacher Memory7 Aug 2026
- 2026HindSearch: Trajectory-Level Hindsight Critique for Search-Augmented Reinforcement Learning3 Aug 2026
- 2026Off-Context GRPO: Learning to Reason on Hard Problems using Privileged Information21 Jul 2026
- 2026GRASP: Gated Regression-Aware Skill Proposer for Self-Improving LLM Agents28 May 2026
- 2026Planning with the Views28 May 2026
- 2026Skill-SD: Skill-Conditioned Self-Distillation for Multi-turn LLM Agents12 Apr 2026
- 2026View-oriented Conversation Compiler for Agent Trace Analysis31 Mar 2026
1 more
- 2026Skill-SD: Skill-Conditioned Self-Distillation for Multi-turn LLM Agentscited by 90
- 2026AgentHER: Hindsight Experience Replay for LLM Agent Trajectory Relabelingcited by 13
- 2026GRASP: Gated Regression-Aware Skill Proposer for Self-Improving LLM Agentscited by 11
- 2026Agent Memory Distillation: Empowering Small LLM Agents with Hierarchical Teacher Memorycited by 3
- 2026My FAULT: Self-Diagnosis as Credit Assignment in Self-Evolving Agentic Reinforcement Learningcited by 0
- 2026TeleTune: Evolving Agent Skills From Offline Telemetrycited by 0
- 2026Fan Out or Relay? Ownership-Aware Routing for LLM Agents Querying Siloed Tablescited by 0
- 2026Co-Evolving Acting and Forecasting for Language Agentscited by 0
- 2026Co-Evolving Acting and Forecasting for Language Agents14 Oct 2026
- 2026Fan Out or Relay? Ownership-Aware Routing for LLM Agents Querying Siloed Tables13 Oct 2026
- 2026TeleTune: Evolving Agent Skills From Offline Telemetry4 Oct 2026
- 2026My FAULT: Self-Diagnosis as Credit Assignment in Self-Evolving Agentic Reinforcement Learning1 Oct 2026
- 2026Agent Memory Distillation: Empowering Small LLM Agents with Hierarchical Teacher Memory7 Aug 2026
- 2026GRASP: Gated Regression-Aware Skill Proposer for Self-Improving LLM Agents28 May 2026
- 2026Skill-SD: Skill-Conditioned Self-Distillation for Multi-turn LLM Agents12 Apr 2026
- 2026AgentHER: Hindsight Experience Replay for LLM Agent Trajectory Relabeling22 Mar 2026
- 2026Planning with the Viewscited by 3
- 2026View-oriented Conversation Compiler for Agent Trace Analysiscited by 2
- 2026MemeMind: Reference-Guided Trace Construction for Offline Context Optimizationcited by 0
- 2026MemeMind: Reference-Guided Trace Construction for Offline Context Optimization10 Aug 2026
- 2026Planning with the Views28 May 2026
- 2026View-oriented Conversation Compiler for Agent Trace Analysis31 Mar 2026
Similar, not cited
Close in wording, no citation either way
- 2026From Outcomes to Actions: Leveraging Hindsight for Long-Horizon Language Agent Training
- 2026Spinning Straw into Gold: Relabeling LLM Agent Trajectories in Hindsight for Successful Demonstrations
- 2026Experience is the Best Teacher: Motivating Effective Exploration in Reinforcement Learning for LLMs
- 2026Experience Funnel: A State-Policy Alternating Loop for Self-Evolving Agents
- 2026ECHO: Prune To Act, Trace To Learn With Selective Turn Memory In Agentic RL
- 2026LifeMem: Enabling Lifelong Experience Reuse for LLM Agents
- 2026MemCo: Memory-Centric Collaboration for Generalizing LLM Agents to Unseen Environments
- 2025H2R: Hierarchical Hindsight Reflection for Multi-Task LLM Agents