Introduction: The Generalization Gap in LLM Agents
Large Language Model (LLM) based agents have shown remarkable potential in interactive environments, from web navigation to embodied robotics. A common practice to improve these agents is fine-tuning the base policy model on task-specific trajectories. However, this approach often leads to a significant "generalization gap." While performance improves on familiar tasks, it frequently collapses when the agent is deployed in unseen environments.
As illustrated in Figure 1, direct policy fine-tuning increases the likelihood of generating seen action tokens but suppresses novel ones, leading to severe overfitting. To address this, the authors propose AgentRM, a framework that shifts the focus from teaching the agent what to do (policy) to teaching it how to evaluate a good state (reward modeling) and allowing it to search for the optimal path at test time.
The AgentRM Framework
AgentRM decouples the evaluation of states from the generation of actions. Instead of fine-tuning the policy model directly, the framework trains a robust reward model (RM) to guide the agent during inference. The process follows a four-stage pipeline:
- Supervised Fine-Tuning (SFT): A base LLM is trained on a small set of high-quality trajectories to establish basic task-following capabilities.
- Exploration: The SFT agent explores environments using Monte Carlo Tree Search (MCTS) to collect diverse states and estimate expected future rewards (Q-values).
- Reward Model Training: A regression model is trained to predict these step-level values using Mean Squared Error (MSE). This Explicit Reward Modeling approach was found to be more effective than implicit preference-based methods.
- Inference (Reward-Guided Search): At test time, the frozen policy model generates multiple candidates, and the trained RM selects the best path using strategies like Best-of-N (picking the highest-scoring complete trajectory) or Beam Search (step-by-step pruning).
Experimental Evaluation
The authors evaluated AgentRM across nine diverse tasks, categorized into "held-in" tasks used for training (Webshop, Alfworld, Sciworld) and "held-out" tasks used for evaluation (Babyai, Jericho, Pddl, Maze, ToolQuery, ToolOperation).
Key Results
- Superior Generalization: Using Explicit RM with Best-of-5 sampling improved the LLaMA-3-8B policy model by an average of 8.8 points across all tasks, outperforming generalist baselines like AgentGym by 4.0 points.
- Weak-to-Strong Generalization: A reward model trained exclusively on data from an 8B model successfully guided a much larger 70B model, resulting in a massive 12.6-point performance boost.
- Specialization Synergy: When paired with a task-specific fine-tuned policy, AgentRM outperformed the top specialized agent (Agent-R) by 11.4 points on held-in tasks.
Key Insights
- Evaluation vs. Generation: Reward models are inherently more robust to distribution shifts in action tokens. Their regression objective (predicting a score) is less sensitive to specific token frequencies than the policy's generative objective (predicting the next token).
- Action-Centric Rewards: Ablation studies revealed that the RM primarily relies on action tokens to determine state quality. Removing "thought" or "observation" tokens from the input had a negligible impact on accuracy.
- Test-Time Scaling: Explicit RM demonstrates strong scaling properties; increasing the number of candidates ($N$) in Best-of-N search consistently leads to better outcomes, whereas LLM-as-a-judge baselines tend to saturate or degrade due to context window limits.
Conclusion
AgentRM demonstrates that reward modeling is a more generalizable path for agent development than direct policy fine-tuning. By leveraging test-time search guided by a robust evaluator, agents can maintain their general reasoning capabilities while excelling in novel environments. Future work will focus on scaling the diversity of training tasks and refining search algorithms to further bridge the gap between specialized and generalist agents.
Summary updated