AgentHER: Hindsight Experience Replay for LLM Agent Trajectory Relabeling
On the map: LLM agents and tool use → Software engineering coding agents
Abstract (arXiv)
LLM-agent training pipelines routinely discard failed trajectories even though GPT-4o achieves only 14-20% on WebArena and below 55% pass@1 on ToolBench; even specialised systems at 50-65% leave the majority of trajectories unused. We introduce AgentHER, which recovers this lost signal by adapting Hindsight Experience Replay (HER) to natural-language agent trajectories: a trajectory that fails goal A is often a correct demonstration for an achievable alternative goal B. AgentHER realises this through a four-stage pipeline (failure classification, outcome extraction, LLM-guided relabeling with confidence gating, and data packaging) that converts discarded failures into SFT, DPO, and ShareGPT training data. On WebArena and ToolBench under a strict task-disjoint held-out protocol, AgentHER improves over success-only SFT by +7.6-11.4% across four model families (GPT-4o, Qwen2.5-72B/7B, LLaMA-3.1-8B), achieves 2x sample efficiency, and beats the strongest experience-centric baseline (Agent Workflow Memory) by +3.0-6.2%. Two robustness mechanisms, failure-severity weighting and cross-model multi-judge verification (gpt-4o-mini paired with Qwen2.5-72B-Instruct), reduce label noise from 5.9% to 2.9% and raise human-rated relabeling precision to 97.1% on WebArena and 96.0% on ToolBench. A full system-cost audit shows the entire relabeling pipeline costs 2.98 and 26 wall-clock minutes for 3,000 trajectories, i.e. 1.4 x 10^-3 per accepted pair. Code: https://github.com/alphadl/AgentHER
Key facts. Cited by 13 papers in the map (data through 14 Oct 2026). Placed in Software engineering coding agents, one of 16 directions in LLM agents and tool use. Builds on 32 of its 45 references that are in the map. First posted on arXiv 22 Mar 2026.
Builds on
32 of 45 references.
References · 32
- 2023GPT-4 Technical Reportcited by 18,396
- 2024The Llama 3 Herd of Modelscited by 14,715
- 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 8,065
- 2024Qwen2.5 Technical Reportcited by 4,942
- 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,276
- 2023Toolformer: Language Models Can Teach Themselves to Use Toolscited by 4,182
- 2023Let's Verify Step by Stepcited by 3,789
- 2023Generative Agents: Interactive Simulacra of Human Behaviorcited by 3,568
- 2023Tree of Thoughts: Deliberate Problem Solving with Large Language Modelscited by 3,211
- 2022Self-Instruct: Aligning Language Models with Self-Generated Instructionscited by 2,724
- 2023WebArena: A Realistic Web Environment for Building Autonomous Agentscited by 2,006
- 2023ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIscited by 1,947
20 more
- 2023Improving Factuality and Reasoning in Language Models through Multiagent Debatecited by 1,784
- 2023AgentBench: Evaluating LLMs as Agentscited by 1,267
- 2023Mind2Web: Towards a Generalist Agent for the Webcited by 1,242
- 2023HuggingGPT: Solving AI Tasks with ChatGPT and its Friends in Hugging Facecited by 1,190
- 2017Hindsight Experience Replaycited by 1,136
- 2023Encouraging Divergent Thinking in Large Language Models through Multi-Agent Debatecited by 1,011
- 2022STaR: Bootstrapping Reasoning With Reasoningcited by 940
- 2023ExpeL: LLM Agents Are Experiential Learnerscited by 876
- 2023CRITIC: Large Language Models Can Self-Correct with Tool-Interactive Critiquingcited by 783
- 2023Instruction Tuning with GPT-4cited by 686
- 2023Reinforced Self-Training (ReST) for Language Modelingcited by 500
- 2023AgentTuning: Enabling Generalized Agent Abilities for LLMscited by 338
- 2023FireAct: Toward Language Agent Fine-tuningcited by 256
- 2024V-STaR: Training Verifiers for Self-Taught Reasonerscited by 217
- 2024Agent Q: Advanced Reasoning and Learning for Autonomous AI Agentscited by 208
- 2024Trial and Error: Exploration-Based Trajectory Optimization for LLM Agentscited by 197
- 2023Error Analysis Prompting Enables Human-Like Translation Evaluation in Large Language Modelscited by 87
- 2023SteP: Stacked LLM Policies for Web Actionscited by 66
- 2024A Simple Model of Inference Scaling Lawscited by 36
- 2025Sample-Efficient Online Learning in LM Agents via Hindsight Trajectory Rewritingcited by 13
Built on by
Citing papers per year: 2026: 13.
13 papers.
Sort:
By area:
- 2026Off-Context GRPO: Learning to Reason on Hard Problems using Privileged Informationcited by 7
- 2026TRCA: Transition-wise Rubric Credit Assignment for Long-horizon LLM Agentscited by 7
- 2026Speculate with Memory: Lossless Acceleration for LLM Agentscited by 3
- 2026Agent Memory Distillation: Empowering Small LLM Agents with Hierarchical Teacher Memorycited by 3
- 2026State2State: Environment-Derived Mid-Training for LLM Agentscited by 2
- 2026AgentBrew: Offline Tool-Use Agent Learning from Raw Real-World Trajectoriescited by 2
- 2026From Cognitive Architectures to Language Agents: A Mechanism-Level Review of Lineage, Convergence, and Migration Gapscited by 1
- 2026Terminal Agents: A Survey of AI Agents in Command-Line Environmentscited by 1
- 2026Agent Error Dataset: Scaling 50,000 Error--Diagnosis Pairs for Failure Analysis and Error-Aware Post-Trainingcited by 1
- 2026Grounded Scaling: Why Agentic AI Needs Deterministic Environmentscited by 0
- 2026HindSearch: Trajectory-Level Hindsight Critique for Search-Augmented Reinforcement Learningcited by 0
- 2026MemeMind: Reference-Guided Trace Construction for Offline Context Optimizationcited by 0
1 more
- 2026Agent Error Dataset: Scaling 50,000 Error--Diagnosis Pairs for Failure Analysis and Error-Aware Post-Training30 Sep 2026
- 2026One Rollout Is All You Get: Fully Test-Time Adaptation for GUI Agents28 Sep 2026
- 2026AgentBrew: Offline Tool-Use Agent Learning from Raw Real-World Trajectories5 Sep 2026
- 2026Terminal Agents: A Survey of AI Agents in Command-Line Environments20 Aug 2026
- 2026TRCA: Transition-wise Rubric Credit Assignment for Long-horizon LLM Agents17 Aug 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
- 2026State2State: Environment-Derived Mid-Training for LLM Agents5 Aug 2026
- 2026HindSearch: Trajectory-Level Hindsight Critique for Search-Augmented Reinforcement Learning3 Aug 2026
- 2026From Cognitive Architectures to Language Agents: A Mechanism-Level Review of Lineage, Convergence, and Migration Gaps27 Jul 2026
- 2026Off-Context GRPO: Learning to Reason on Hard Problems using Privileged Information21 Jul 2026
- 2026Speculate with Memory: Lossless Acceleration for LLM Agents14 Jul 2026
1 more
- 2026TRCA: Transition-wise Rubric Credit Assignment for Long-horizon LLM Agentscited by 7
- 2026Speculate with Memory: Lossless Acceleration for LLM Agentscited by 3
- 2026Agent Memory Distillation: Empowering Small LLM Agents with Hierarchical Teacher Memorycited by 3
- 2026State2State: Environment-Derived Mid-Training for LLM Agentscited by 2
- 2026AgentBrew: Offline Tool-Use Agent Learning from Raw Real-World Trajectoriescited by 2
- 2026Terminal Agents: A Survey of AI Agents in Command-Line Environmentscited by 1
- 2026Agent Error Dataset: Scaling 50,000 Error--Diagnosis Pairs for Failure Analysis and Error-Aware Post-Trainingcited by 1
- 2026Grounded Scaling: Why Agentic AI Needs Deterministic Environmentscited by 0
- 2026One Rollout Is All You Get: Fully Test-Time Adaptation for GUI Agentscited by 0
- 2026Agent Error Dataset: Scaling 50,000 Error--Diagnosis Pairs for Failure Analysis and Error-Aware Post-Training30 Sep 2026
- 2026One Rollout Is All You Get: Fully Test-Time Adaptation for GUI Agents28 Sep 2026
- 2026AgentBrew: Offline Tool-Use Agent Learning from Raw Real-World Trajectories5 Sep 2026
- 2026Terminal Agents: A Survey of AI Agents in Command-Line Environments20 Aug 2026
- 2026TRCA: Transition-wise Rubric Credit Assignment for Long-horizon LLM Agents17 Aug 2026
- 2026Agent Memory Distillation: Empowering Small LLM Agents with Hierarchical Teacher Memory7 Aug 2026
- 2026State2State: Environment-Derived Mid-Training for LLM Agents5 Aug 2026
- 2026Speculate with Memory: Lossless Acceleration for LLM Agents14 Jul 2026
- 2026Grounded Scaling: Why Agentic AI Needs Deterministic Environments21 Jun 2026
Similar, not cited
Close in wording, no citation either way
- 2026Spinning Straw into Gold: Relabeling LLM Agent Trajectories in Hindsight for Successful Demonstrations
- 2026Experience Memory Graph: One-Shot Error Correction for Agents
- 2026TRAJDEBUG: Tracing Error Lifecycle to Identify Critical Failures in Long-Horizon Agent Trajectories
- 2025Exploring Expert Failures Improves LLM Agent Tuning
- 2026No Time Like the Present: Agentic Test-Time Training for LLM Agents
- 2026FALAT: Tracing Failures in LLM Agent Trajectories via Dependency-Guided Search
- 2026Can Failed Trajectories Reveal Where Agents Go Wrong? Agentic Failure Attribution Without Step-Level Labels
- 2025AgenTracer: Who Is Inducing Failure in the LLM Agentic Systems?