Abstract
Standard Reinforcement Learning from Human Feedback (RLHF) relies on scalar reward models that evaluate complete sequences, often failing to provide granular guidance during the generation process. This paper introduces a novel method for training Language Model (LM) reward models using contrastive, goal-conditioned representation learning. By mapping intermediate states to a latent space that measures the distance to a successful "goal state," the resulting reward model provides dense signals that approximate Q-values. This approach improves reward accuracy, enables real-time error localization, and facilitates fine-grained attribute steering without additional fine-tuning.
1. Introduction
The alignment of Large Language Models (LLMs) with human preferences typically involves training a reward model (RM) to provide a single scalar score for a full response. While effective for simple preferences, this approach suffers from a significant "credit assignment" problem in complex tasks like multi-step mathematical reasoning. If a model produces a long, logical chain that fails due to a single calculation error, a scalar RM may struggle to pinpoint the exact location of the failure. Furthermore, these rewards are "sparse," offering no feedback until the entire sequence is generated.
To address these limitations, we propose a Goal-Conditioned Reward Model. By teaching the model to recognize the proximity of any given token to a successful conclusion, we transform the RM from a passive evaluator into a dense signal generator capable of guiding the model at every step of the decoding process.
2. Methodology: Goal-Conditioned Representations
The core innovation lies in the training objective. Instead of a simple regression to a scalar score, the model learns a hidden representation space through contrastive learning.
2.1 Contrastive Learning Objective
The model is trained to minimize the distance between the representation of an intermediate token (the source state) and tokens from a "preferred" or successful trajectory (the goal state). Conversely, it maximizes the distance between that source state and tokens from "dispreferred" or unsuccessful trajectories.
This similarity score serves as a proxy for a Q-value—a fundamental concept in reinforcement learning representing the expected future reward of an action taken from a specific state. By bridging goal-conditioned RL with LLM hidden states, the RM learns the underlying structure of successful task completion.
3. Experimental Setup
The researchers evaluated the method across three primary domains:
- Mathematical Reasoning: Training was conducted on the OpenMathInstruct-1 dataset (1.8M pairs). Evaluation included GSM8k and MATH, alongside five out-of-distribution (OOD) sets such as SVAMP and GSM-Hard to test generalization.
- General Alignment: The Anthropic Helpful-Harmless dataset was used to assess the model's ability to learn human preferences.
- Attribute Steering: Using Nvidia’s HelpSteer dataset, the authors defined "prototypes"—average representations of specific attributes like helpfulness, coherence, and complexity—to guide model behavior.
4. Key Insights and Applications
4.1 Real-Time Error Localization
Because the model tracks the "distance to the goal," the approximated Q-value acts as a diagnostic tool. The authors observed that the Q-value drops sharply at the exact moment a logical or mathematical error occurs. This allows for automated error localization without the need for expensive, human-labeled step-by-step data.
4.2 Inference Efficiency via Pruning
The dense Q-value signal enables "early exit" strategies during inference. In tasks involving majority voting (Self-Consistency), the model can identify trajectories that have gone "off the rails" early. By pruning these paths, the authors filtered up to 55% of generated tokens without any loss in final accuracy, offering a path toward significantly lower inference costs.
4.3 Representation Steering
Beyond evaluation, these representations can actively steer generation. By favoring tokens that move the model's hidden state closer to a pre-defined "goal prototype" (e.g., a high-complexity or high-helpfulness state), the researchers improved Llama 3’s performance on these specific attributes during the decoding process.
5. Results
The goal-conditioned RM demonstrated superior performance across all benchmarks:
- Reward Modeling: Achieved an improvement of up to 0.09 AUROC on math benchmarks and a 2.3% accuracy increase in general alignment.
- Policy Generalization: When used in a PPO (Proximal Policy Optimization) loop, the goal-conditioned signal led to better out-of-distribution generalization in math tasks compared to standard DPO or scalar RM training.
- Steering Efficacy: Guided decoding improved helpfulness by 9.6% and complexity by 21.6% over a standard supervised fine-tuning (SFT) baseline.
6. Discussion and Future Work
While the results are promising, the authors identify several areas for further exploration. Currently, the "goal state" is defined as a static mean representation of successful training examples; developing context-dependent, dynamic goal states could further refine the signal. Additionally, while the model is robust, the risk of "reward hacking"—where a policy learns to maximize similarity scores without solving the underlying task—remains a challenge in RL alignment. Future work will focus on more deeply integrating these dense Q-value signals directly into the RL training loop to replace or augment sparse scalar rewards.
Summary updated