NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

AgentRefine: Enhancing Agent Generalization through Refinement Tuning

Dayuan Fu, Keqing He, Yejie Wang, Wentao Hong, Zhuoma GongQue, Weihao Zeng, Wei Wang, Jingang Wang, Xunliang Cai, Weiran Xu

Introduction

While proprietary large language models (LLMs) like GPT-4 demonstrate sophisticated capabilities as autonomous agents, open-source alternatives often struggle with generalization. Current fine-tuning paradigms frequently lead models to overfit on specific training environments, causing them to fail when introduced to "held-out" tasks.

Research into these failures identifies two primary bottlenecks. First, models often memorize specific observation-action pairs rather than internalizing the underlying logic of the environment. Second, open-source agents frequently fall into a "death loop": when a mistake occurs—such as a formatting error or a logical slip—the model repeats the erroneous action indefinitely, even when the environment provides explicit feedback that the action failed. AgentRefine addresses these issues by shifting the training focus from "memorizing the right path" to "learning how to fix mistakes."

The AgentRefine Framework

AgentRefine is a framework designed to teach models the art of self-correction through a three-stage process: Diverse Script Generation, Trajectory Generation, and Refinement Tuning.

1. Diverse Script Generation

To prevent overfitting to a small set of manual benchmarks, the authors utilize a massive library of human personas from "Persona Hub." By prompting a teacher model (GPT-4o) with these personas, they generate thousands of unique agent environments, tasks, and action spaces. This diversity ensures the model encounters a wide variety of linguistic and logical contexts during training.

2. Trajectory Generation: The DM and the Player

The framework simulates interactions using a dual-role system. The LLM plays both a Dungeon Master (DM), who manages the environment and provides feedback, and a Player, who attempts the task. Crucially, the system forces the "Player" to make intentional mistakes—such as navigating to the wrong location or using incorrect syntax. The Player must then refine its actions based on the DM's feedback until the task is successfully completed. This creates a dataset rich in error-correction pairs.

3. Refinement Tuning

During the training phase, the authors employ a specific loss function strategy. The model is exposed to the entire sequence—the mistake, the feedback, and the correction—but the loss is only calculated on the thought process and the corrected action following the error. By masking the erroneous steps in the loss calculation, the model learns that an error message is a signal to pivot its strategy rather than a pattern to be emulated.

Experimental Evaluation

The researchers trained models on 32,000 synthesized trajectories and evaluated them across five diverse agent benchmarks:

  • Alfworld: Household task completion.
  • BabyAI: Grid-world navigation.
  • SciWorld: Complex science experiments.
  • PDDL: Classical planning tasks.
  • Jericho: Interactive fiction and text-based games.

Additionally, HotpotQA was used to assess whether the self-correction capabilities transferred to pure reasoning tasks.

Key Insights and Results

Superior Generalization and Robustness

AgentRefine significantly outperformed existing state-of-the-art agent-tuning models like Agent-FLAN. On the SciWorld benchmark, AgentRefine achieved a 13.3% higher success rate.

Furthermore, the model demonstrated remarkable robustness. In perturbation tests where action descriptions were slightly reordered or modified, existing models saw their success rates crash by over 30%, revealing that they had merely memorized text patterns. In contrast, AgentRefine’s performance remained stable with a standard deviation of only ~3.7%, proving it had learned the underlying logic of interaction.

Diversity of Thought

Analysis using t-SNE visualizations of Chain-of-Thought (CoT) reasoning showed that AgentRefine produces a much wider variety of "thoughts" compared to baseline models. This suggests a broader exploration space, allowing the agent to navigate complex problem-solving scenarios more flexibly.

Scaling and Reasoning

The study found that agent performance scales consistently with the volume of refinement data, showing no signs of saturation even at 64,000 trajectories. Interestingly, the benefits extended beyond agentic tasks; AgentRefine showed improved zero-shot reasoning on HotpotQA, suggesting that the ability to self-correct is a fundamental component of general intelligence.

Conclusion and Future Work

AgentRefine demonstrates that the key to robust autonomous agents lies not in seeing more perfect examples, but in learning how to interpret and act upon environmental feedback. While the current framework relies on strong teacher models for data generation and focuses on text-based environments, it provides a scalable blueprint for the next generation of open-source agents. Future research may extend these principles to multi-modal environments and integrate refinement trajectories into Reinforcement Learning (RL) frameworks to further enhance autonomous exploration.

Summary updated

BibTeX
@inproceedings{fu2025agentrefine,
  author = {Dayuan Fu and Keqing He and Yejie Wang and Wentao Hong and Zhuoma GongQue and Weihao Zeng and Wei Wang and Jingang Wang and Xunliang Cai and Weiran Xu},
  title = {{AgentRefine: Enhancing Agent Generalization through Refinement Tuning}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=FDimWzmcWn},
}
Figure