AgentRM: Enhancing Agent Generalization with Reward Modeling

Yu Xia, Jingru Fan, Weize Chen, Siyu Yan, Xin Cong, Zhong Zhang, Yaxi Lu, Yankai Lin, Zhiyuan Liu, Maosong Sun

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.

Figure 1: Comparison of policy and reward model fine-tuning. (a) shows how policy fine-tuning improves held-in tasks but degrades held-out performance. (b) and (c) contrast the generalization of policy vs. reward models, showing that reward models maintain positive improvement across tasks.

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:

  1. Supervised Fine-Tuning (SFT): A base LLM is trained on a small set of high-quality trajectories to establish basic task-following capabilities.
  2. Exploration: The SFT agent explores environments using Monte Carlo Tree Search (MCTS) to collect diverse states and estimate expected future rewards (Q-values).
  3. 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.
  4. 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).
Figure 2: The AgentRM workflow, consisting of SFT, environment exploration, reward model training, and reward-guided inference on unseen tasks.

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

BibTeX
@inproceedings{xia2025agentrm,
  author = {Yu Xia and Jingru Fan and Weize Chen and Siyu Yan and Xin Cong and Zhong Zhang and Yaxi Lu and Yankai Lin and Zhiyuan Liu and Maosong Sun},
  title = {{AgentRM: Enhancing Agent Generalization with Reward Modeling}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure