Overview

5 Reward Modeling

Reward modeling is the mechanism that lets reinforcement learning from human feedback learn from human judgments rather than a fixed environment reward. In this setup, a language model is trained to turn prompt-completion pairs into a scalar score or preference probability, compressing complex human notions of quality into a signal that can guide later optimization. The chapter frames this as a proxy objective for alignment: instead of directly specifying what good behavior is, humans provide comparisons or labels, and the model learns to imitate those preferences.

The standard reward model is based on the Bradley-Terry preference framework, which assumes that preferences arise from latent scores and can be modeled through pairwise comparisons. A reward model typically attaches a small linear head to a language model and is trained on chosen versus rejected completions using a contrastive objective that pushes the preferred answer higher than the rejected one. The chapter also notes practical implementation details, such as using the final hidden state or end-of-sequence token to produce the scalar reward, and emphasizes that the core training loss is simple even if the surrounding data pipeline is not.

Beyond the default pairwise preference model, the chapter surveys several reward-model variants used for different tasks. Outcome reward models predict correctness, often at the token level, while process reward models score intermediate reasoning steps instead of only the final answer; both use classification-style losses but differ in supervision granularity. The chapter also compares these with value functions, which estimate expected future return rather than immediate correctness, and with generative reward modeling, where another language model acts as the judge. Overall, the main takeaway is that reward modeling is a family of related but distinct approaches, each designed to capture quality, correctness, or reasoning quality at different levels of detail.

The reward model in RLHF plays the role of the environment component that returns rewards in standard RL. The key difference is that in RLHF, we get to control and learn this reward function from human preferences, rather than having it fixed by the environment.
figure
Training a preference reward model requires pairs of chosen and rejected completions. The model computes a scalar score for each completion from a sequence-level representation, often the end-of-sequence (EOS) token’s hidden state, and the contrastive loss depends only on the score difference between the two.
figure
At inference time, an outcome reward model outputs per-token correctness probabilities. Prompt tokens are masked (e.g., label=-100), while completion tokens each receive a probability indicating whether the model believes the response leads to a correct answer.
figure
Training an outcome reward model uses offline labels from a verifier or dataset (e.g., all 1s for correct completions). Each completion token is trained with binary cross-entropy against the outcome label, and per-token probabilities are aggregated into a final score for verification, filtering, or reranking.
figure
Process reward models provide supervision only at step boundaries (e.g., newline tokens). Each step receives a 3-class label: correct (+1), neutral (0), or incorrect (-1). All other tokens are masked during training.
figure

Summary

  • Reward models are the component of RLHF that learns to represent human preferences – they compress complex, hard-to-specify human judgments into a scalar signal that downstream optimization can act on.
  • The standard reward model for RLHF is derived from the Bradley-Terry model of preferences, trained with a contrastive loss to predict the probability that one completion is preferred over another.
  • Beyond preference reward models, two popular variants for reasoning tasks include outcome reward models (ORMs) that predict per-token correctness in a response and process reward models (PRMs) that score individual reasoning steps.
  • Reward models are typically implemented by appending a linear head to a pretrained language model (e.g., via AutoModelForSequenceClassification), outputting a single scalar score per sequence. Value functions, covered in the RL chapter, share a similar architecture but differ in what they predict and how they are trained.
  • Generative reward models use LLM-as-a-judge prompting to approximate human preferences, enabling cheaper data collection and evaluation. Many other research variants exist – including margin losses, K-wise ranking models, and aspect-conditioned reward models – though none have converged into a single best practice.

FAQ

What is a reward model in RLHF, and why is it important?A reward model is a learned proxy objective that captures human preferences from comparison data. In RLHF, it is important because it turns hard-to-specify judgments like “good answer” or “better response” into a scalar signal that downstream training can optimize.
How does a Bradley-Terry reward model represent human preferences?It assumes each candidate has a latent strength or score, and the probability that one item is preferred over another depends on the difference between their scores. In the unbounded form used for RLHF, this becomes a sigmoid over the score difference between the chosen and rejected completions.
What loss function is used to train a standard pairwise reward model?The standard loss is the negative log-likelihood of the chosen completion being preferred over the rejected one. Equivalent forms include the log-sigmoid loss and the softplus form, both of which encourage the reward model to assign higher scores to preferred responses.
What does the default reward model architecture look like?Typically, a pretrained language model is augmented with a small linear head that maps a sequence-level representation to a single scalar reward. The last non-padding token, often the EOS token, is commonly used as the sequence representation.
Why do reward model scores depend only on differences between completions?In the Bradley-Terry formulation, adding the same constant to every score does not change the preference probability. Only the relative difference between the chosen and rejected completions matters, not the absolute scale of the scores.
What is the purpose of a preference margin loss?Preference margin loss incorporates the strength of preference, such as rating gaps from a Likert scale, instead of only binary chosen/rejected labels. It adds a margin term so the model is trained to reflect not just which answer is better, but by how much.
Why do some methods weight or group multiple comparisons from the same prompt?When many completions are compared for one prompt, the resulting pairwise examples are highly correlated. Grouping or reweighting them helps prevent overfitting and keeps prompts with more sampled completions from dominating the loss.
How is an outcome reward model different from a standard reward model?An outcome reward model predicts correctness at the token level, usually for verifiable tasks where answers are marked correct or incorrect. In contrast, a standard reward model typically gives one sequence-level preference score for a whole completion.
How is a process reward model different from an outcome reward model?A process reward model scores intermediate reasoning steps rather than the final outcome alone. It is trained with step-level supervision, often using labels such as correct, neutral, or incorrect at step boundaries.
How do reward models differ from value functions in RL?Reward models estimate preference or quality of a response, usually from offline labels, while value functions estimate expected remaining return from a state and are usually trained from rollouts under the current policy. They may look similar architecturally, but they serve different learning and inference purposes.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Reinforcement Learning from Human Feedback ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Reinforcement Learning from Human Feedback ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Reinforcement Learning from Human Feedback ebook for free