The Reward Model

Suppose two engineers ask an instruction-tuned language model the same question. They get two different answers. One is accurate but curt; the other is friendly but subtly wrong. Which is better? A human can tell instantly, but a training loop cannot backpropagate through a person's judgment. The reward model exists to solve exactly this problem. It is a learned function that converts human preferences into a differentiable score. This gives downstream optimization — most notably Reinforcement Learning from Human Feedback — something concrete to maximize. This gap between "what a model can generate" and "what humans actually want" is the central challenge of modern alignment. After Instruction Tuning, a language model can follow formatting and task instructions reasonably well. But it has no internal notion of tone, helpfulness, honesty, or harmlessness beyond what its next-token objective implicitly encodes. Human feedback is the richest available signal for these qualities. However, humans cannot label millions of generations by hand. Even if they could, raw text feedback is not a loss function. The reward model bridges this gap. It learns to imitate human comparative judgments at scale, cheaply and consistently. It does this after being trained on a comparatively small set of human-labeled preference pairs. The big picture is a pipeline. First, collect prompts, then sample multiple completions from a language model. Next, ask human annotators to rank or compare them. Then train a separate neural network — usually initialized from the same base model — to predict which completion a human would prefer. Once trained, this reward model can score any completion for any prompt without further human involvement. It turns subjective quality judgments into a scalar signal. A reinforcement learning algorithm can then optimize against this signal. This scalar is imperfect and can be gamed. Still, it is dramatically more scalable than direct human supervision. This article gives a precise, mechanistic account of how reward models are built. It covers the data format, the architecture, the pairwise loss function, and why that loss is the right one to train on. It covers the algorithm end to end with pseudocode, a worked numerical trace, and a discussion of failure modes like reward hacking and miscalibration. It also traces the historical lineage from early preference-learning theory to the models that power today's aligned chat assistants.

Key takeaways
  • A reward model (RM) takes a prompt and a completion and outputs a single scalar score estimating human preference.
  • It is trained on pairs of completions ranked by human annotators, not on absolute scores.
  • The standard training objective is the Bradley-Terry pairwise loss, derived from a simple probabilistic model of choice.
  • The RM is typically initialized from an instruction-tuned model, replacing the language-modeling head with a scalar output head.
  • Once trained, the RM supplies the reward signal for Reinforcement Learning from Human Feedback, removing the human from the optimization loop.
  • Reward models are imperfect proxies for human judgment and can be exploited by a downstream policy — a failure mode called reward hacking.
The core insight

A reward model turns human comparisons of "which answer is better" into a scalar scoring function that reinforcement learning can optimize.

The idea

A reward model is a learned function rϕ(x,y)r_\phi(x, y), parameterized by weights ϕ\phi, that maps a prompt xx and a candidate completion yy to a real-valued score representing how much a human would prefer that completion. The output is a single scalar, not a probability distribution over tokens — the reward model is not trying to generate text, only to evaluate it. This distinguishes it sharply from the base language model, whose job is next-token prediction. The key design decision is that reward models are trained on relative judgments rather than absolute ratings. Asking an annotator "rate this response from 1 to 10" produces noisy, poorly calibrated labels: different annotators use different internal scales, and the same annotator is inconsistent across sessions. Asking "which of these two responses is better" is a far easier and more reliable task — humans are much better at pairwise comparison than at absolute scoring. This is the same insight behind the classical Bradley-Terry model of paired comparisons, originally developed for ranking chess players and sports teams from win/loss records, and it gives the reward model its precise probabilistic training objective. Formally, given a prompt xx and two completions ywy_w (the one a human preferred, "winner") and yly_l (the "loser"), the Bradley-Terry model assumes

P(yw≻yl∣x)=σ(rϕ(x,yw)−rϕ(x,yl)),P(y_w \succ y_l \mid x) = \sigma\big(r_\phi(x, y_w) - r_\phi(x, y_l)\big),

where σ\sigma is the logistic sigmoid. This says the probability that a human prefers ywy_w over yly_l depends only on the difference in their underlying reward scores — larger gaps mean more confident preferences, and a reward model that assigns equal scores predicts a coin-flip preference. Training the reward model means finding ϕ\phi that makes this probability match the observed human choices as closely as possible, which is done by maximum likelihood, equivalently by minimizing a logistic (cross-entropy) loss over preference pairs.

How it works

Step 1 — Collect comparison data. Sample a set of prompts xx from a distribution representative of real usage. For each prompt, generate kk completions (commonly k=4k = 4 to 99) from one or more instruction-tuned policy checkpoints, using varied sampling temperature to get diverse candidates.

Step 2 — Human ranking. Show annotators the prompt and the kk completions. Annotators produce a ranking (or a sequence of pairwise choices) reflecting overall quality — typically weighing helpfulness, honesty, and harmlessness. A ranking of kk items is decomposed into (k2)\binom{k}{2} pairwise comparisons for training, though in practice only a subset of pairs, or a suitably weighted subset, is used to control redundancy.

Step 3 — Initialize the reward model. Start from an instruction-tuned language model (same tokenizer, same transformer backbone). Strip the token-prediction head (the final linear layer that outputs a distribution over the vocabulary) and attach a new linear head that maps the final hidden state at the last token to a single scalar. This reuses the rich language understanding already learned during pretraining and instruction tuning, rather than learning to read English from scratch.

Step 4 — Train with the pairwise loss. For every (x,yw,yl)(x, y_w, y_l) triple, compute rϕ(x,yw)r_\phi(x, y_w) and rϕ(x,yl)r_\phi(x, y_l) by running both sequences through the network, and minimize the negative log-likelihood of the observed preference under the Bradley-Terry model.

Step 5 — Freeze and deploy. Once trained, the reward model's weights are frozen and it is used purely for inference: given any prompt-completion pair, it emits a scalar reward. This scalar becomes the reward signal in an RL loop (foreshadowing Reinforcement Learning from Human Feedback), or it can be used directly for best-of-nn re-ranking of sampled completions. ```

# Training a reward model from pairwise human preferences Input: base_model # instruction-tuned transformer, weights theta_0 D # dataset of (prompt x, completion_w, completion_l)

# where w was preferred to l by a human annotator num_epochs, lr, batch_size Initialize: reward_model = base_model with LM head replaced by a linear layer: hidden_state -> scalar phi = reward_model.parameters() # includes reused backbone weights for epoch in 1..num_epochs: for batch in minibatches(D, batch_size): loss_sum = 0 for (x, y_w, y_l) in batch: seq_w = concat(x, y_w) seq_l = concat(x, y_l) h_w = reward_model.encode(seq_w) # final hidden state h_l = reward_model.encode(seq_l) # at last token r_w = linear_head(h_w) # scalar reward r_l = linear_head(h_l) # scalar reward

# Bradley-Terry pairwise logistic loss loss = -log_sigmoid(r_w - r_l) loss_sum += loss loss_sum = loss_sum / len(batch) gradients = backprop(loss_sum, wrt=phi) phi = phi - lr gradients # or Adam / AdamW update return reward_model # frozen after training; used to score (x, y) pairs ``` Two implementation details matter in practice. First, when multiple completions are ranked (not just pairs), all (k2)\binom{k}{2} comparisons from a single prompt are usually normalized so that a batch is not dominated by prompts with many completions — a common approach is to compute the loss as a sum over all pairs from one ranking, divided by (k2)\binom{k}{2}, so that each prompt contributes comparably to the gradient regardless of kk. Second, the reward model's raw scale is arbitrary: only score differences* matter, since σ(rw−rl)\sigma(r_w - r_l) is invariant to adding any constant to both. In practice the mean reward on a validation set is often normalized to zero to keep the scores centered before the RL stage, since RL algorithms are sensitive to the absolute scale and offset of the reward signal.

Figure
Reward model architecture: shared transformer backbone scores two completions and compares them via the Bradley-Terry loss
x + y_w (preferred) x + y_l (rejected) Shared Transformer Backbone (weights φ, initialized from instruction-tuned model) same weights applied to both sequences r(x, y_w) r(x, y_l) loss = -log σ(r_w − r_l) Bradley-Terry pairwise loss gradient flows back through both branches

Complexity & correctness

Time complexity. Each forward pass through the transformer backbone on a sequence of length LL costs O(L2⋅d+L⋅d2)O(L^2 \cdot d + L \cdot d^2) for self-attention and feed-forward layers respectively, where dd is the hidden dimension — the same cost as a standard transformer forward pass, since the reward model reuses that architecture unchanged except for the final head. Training over a dataset of NN preference pairs for EE epochs costs O(N⋅E⋅(L2d+Ld2))O(N \cdot E \cdot (L^2 d + L d^2)) total, dominated by two forward-backward passes per pair (one for ywy_w, one for yly_l). This is comparable in cost to one epoch of ordinary supervised fine-tuning over 2N2N sequences, so reward model training is not asymptotically more expensive than instruction tuning itself — its cost is dominated by data collection (human annotation), not compute.

Space complexity. Memory is O(P)O(P) for model parameters plus O(B⋅L⋅d)O(B \cdot L \cdot d) for activations in a batch of size BB, identical in form to standard transformer training; the only structural difference is that the LM head, which is O(d⋅∣V∣)O(d \cdot |V|) for vocabulary size ∣V∣|V|, is replaced by a O(d)O(d) scalar head, making the reward model marginally smaller than the base language model.

Correctness argument. The claim to justify is that minimizing the pairwise logistic loss recovers a scoring function consistent with the underlying human preference structure, under the Bradley-Terry assumption. Consider the population-level objective: if preferences are generated by some latent scalar function r∗(x,y)r^*(x,y) satisfying P(yw≻yl∣x)=σ(r∗(x,yw)−r∗(x,yl))P(y_w \succ y_l \mid x) = \sigma(r^*(x,y_w) - r^*(x,y_l)), then the expected loss

L(ϕ)=−E(x,yw,yl)[log⁡σ(rϕ(x,yw)−rϕ(x,yl))]\mathcal{L}(\phi) = -\mathbb{E}_{(x,y_w,y_l)}\big[\log \sigma(r_\phi(x,y_w) - r_\phi(x,y_l))\big]

is minimized in expectation precisely when rϕr_\phi induces the same pairwise probabilities as r∗r^* — this is the standard maximum-likelihood argument for logistic regression, here applied to the difference of two learned scores rather than to a single input. Formally, for a fixed pair of scores (a,b)=(rϕ(x,yw),rϕ(x,yl))(a, b) = (r_\phi(x,y_w), r_\phi(x,y_l)) and true probability p∗=σ(r∗(x,yw)−r∗(x,yl))p^* = \sigma(r^*(x,y_w) - r^*(x,y_l)), the expected loss −p∗log⁡σ(a−b)−(1−p∗)log⁡σ(b−a)-p^*\log\sigma(a-b) - (1-p^*)\log\sigma(b-a) is a strictly convex function of a−ba - b with a unique minimum at a−b=r∗(x,yw)−r∗(x,yl)a - b = r^*(x,y_w) - r^*(x,y_l) — this follows because the cross-entropy loss of a logistic model is minimized exactly at the true log-odds, a classical fact from logistic regression. Since this holds for every pair, at the population optimum rϕr_\phi and r∗r^* induce identical pairwise preference probabilities everywhere, and rϕr_\phi recovers r∗r^* up to an additive constant per prompt (the invariance noted earlier, since only differences enter the loss).

Honest caveats. This correctness argument has real gaps in practice. Human preferences are not a perfect Bradley-Terry process: annotators disagree with each other, are inconsistent with themselves, and the "reward" they implicitly optimize for is not a single well-defined scalar (it conflates helpfulness, safety, verbosity bias, and stylistic preference). The reward model is trained on a finite sample, so it generalizes only as well as the training distribution covers the space of completions the eventual RL policy will produce — completions far outside this distribution get unreliable scores. This mismatch is the root cause of reward hacking (discussed below), where a downstream policy finds completions that score highly under rϕr_\phi without actually being preferred by real humans.

Worked example

Consider the prompt x=x = "Explain why the sky is blue." Suppose the base policy sampled three completions, and a human annotator ranked them best-to-worst as y1≻y2≻y3y_1 \succ y_2 \succ y_3:

  • y1y_1: "Sunlight scatters off air molecules; blue light scatters more due to its shorter wavelength (Rayleigh scattering)." — accurate, concise.
  • y2y_2: "The sky is blue because of how light interacts with the atmosphere." — vague but not wrong.
  • y3y_3: "The sky is blue because water reflects the ocean's color upward." — fluent but factually false.

This ranking decomposes into (32)=3\binom{3}{2}=3 pairwise comparisons: (y1,y2)(y_1, y_2), (y1,y3)(y_1, y_3), (y2,y3)(y_2, y_3), each with the first element preferred. Suppose at some point during training the reward model produces these raw scores:

CompletionReward rϕ(x,y)r_\phi(x, y)
y1y_12.10
y2y_20.40
y3y_3-1.30

Compute the loss contribution from each pair using ℓ=−log⁡σ(rw−rl)\ell = -\log \sigma(r_w - r_l):

Pair (winner, loser)rw−rlr_w - r_lσ(rw−rl)\sigma(r_w-r_l)Loss −log⁡σ(⋅)-\log\sigma(\cdot)
(y1,y2)(y_1, y_2)1.700.84590.1674
(y1,y3)(y_1, y_3)3.400.96770.0328
(y2,y3)(y_2, y_3)1.700.84590.1674

Averaging over the three pairs, this ranking contributes a mean loss of (0.1674+0.0328+0.1674)/3≈0.1225(0.1674+0.0328+0.1674)/3 \approx 0.1225. Gradient descent on this loss pushes rϕ(x,y1)r_\phi(x, y_1) up and rϕ(x,y3)r_\phi(x, y_3) down (and y2y_2's score adjusts based on both comparisons it appears in), sharpening the score gaps until the predicted preference probabilities approach 1 for confidently-ranked pairs. If the model instead had assigned y3y_3 the highest score (a clear failure to reject the factually wrong answer), the loss for pair (y1,y3)(y_1, y_3) would spike — e.g. if rϕ(x,y3)=3.0r_\phi(x,y_3) = 3.0 while rϕ(x,y1)=2.10r_\phi(x,y_1)=2.10, then rw−rl=−0.90r_w - r_l = -0.90, σ(−0.90)≈0.289\sigma(-0.90) \approx 0.289, giving a loss of −log⁡(0.289)≈1.24-\log(0.289) \approx 1.24, roughly ten times larger than the correct-ranking case — illustrating how the loss surface directly penalizes score inversions on human-labeled pairs.

Common pitfalls & traps

PitfallWhy it happensConsequence
Reward hackingRL policy exploits regions of completion-space where rϕr_\phi is miscalibrated, e.g., unusually long or repetitive answersPolicy optimizes the proxy reward while actual human-judged quality stagnates or drops
Distribution shift between RM training and RL policyRM is trained on completions from an earlier checkpoint; the RL policy evolves and drifts away from that distributionRM scores become unreliable extrapolations outside its training support
Treating raw reward magnitude as meaningfulOnly score differences are identifiable under the Bradley-Terry lossComparing absolute scores across prompts, or across different reward model checkpoints, is meaningless without renormalization
Overfitting to annotator idiosyncrasiesSmall preference datasets, annotator fatigue, or a narrow annotator poolRM learns superficial cues (length, confident tone) rather than true quality
Sparse or inconsistent human labelsAnnotators disagree with each other or with themselves on ambiguous promptsNoisy gradient signal; RM loss plateaus at a nontrivial floor reflecting genuine label noise
Ignoring calibration in favor of ranking accuracy aloneTraining only tracks pairwise accuracy, not the sharpness of predicted probabilitiesRM may rank correctly but assign overconfident or underconfident reward gaps, destabilizing downstream RL

Pioneers & history

Origins · 1 minRalph Allan Bradley and how this was discovered
RA
Ralph Allan Bradley
1923-2001 · American statistician who, with Milton Terry, formalized the pairwise-comparison model underlying modern preference-based learning

Bradley worked in industrial statistics and experimental design, and the 1952 model he developed with Terry was originally intended to rank objects — teams, products, tasting samples — from incomplete data consisting only of pairwise comparisons. Neither author could have anticipated that seven decades later their model would become the mathematical backbone of training large language models to align with human values, but the core insight — that comparative judgments are more reliable than absolute ratings, and that a simple logistic relationship between latent scores explains observed choice probabilities — transferred almost unchanged into deep learning.

History
1952
Bradley and Terry publish the Bradley-Terry model for ranking from paired comparisons.
2017
Christiano et al. demonstrate learning reward functions from human preferences over trajectory pairs in deep reinforcement learning for continuous control and Atari.
2019-2020
OpenAI applies preference-based reward modeling to text summarization and instruction following, establishing the reward-model-plus-RL recipe for language models.
2022
InstructGPT formalizes the three-stage pipeline — supervised fine-tuning, reward model training, and PPO-based RLHF — used as the template for aligning large chat models.
2023
onward: Reward modeling becomes a standard, widely studied component of alignment pipelines, with active research into reward model robustness, calibration, and alternatives that avoid an explicit reward model entirely.

Where this matters

Reward models are the linchpin of the Reinforcement Learning from Human Feedback pipeline used to align production chat assistants: after supervised Instruction Tuning teaches a model to follow instructions, the reward model supplies the objective that a policy-gradient algorithm like PPO optimizes to make outputs more genuinely helpful and less harmful. Beyond RLHF, reward models power best-of-nn sampling, where multiple completions are generated for a single prompt and the reward model simply picks the highest-scoring one — a cheap inference-time alternative to full RL fine-tuning. They also underlie automated evaluation harnesses that compare model checkpoints during development without requiring a human to re-judge every candidate response, and they are central to red-teaming and safety pipelines that score outputs for harmfulness. Techniques like Direct Preference Optimization reformulate the same Bradley-Terry preference data to skip the explicit reward model and RL loop entirely, but they still rest on the identical probabilistic foundation this article develops — a testament to how central the reward-modeling idea has become to the entire alignment stack.

Ask the tutor: How does the KL-divergence penalty in RLHF prevent a policy from exploiting reward model weaknesses?

Why not just train the model to predict a numeric quality score directly?

Directly predicting an absolute score (say, 1-10) is far noisier than pairwise comparison because annotators lack a shared, stable internal scale — one person's "7" is another's "5," and even the same annotator drifts across sessions and fatigue levels. Pairwise comparisons ("which is better?") are cognitively easier and far more consistent, since humans are reliably good at relative judgments even when they're bad at absolute ones. The Bradley-Terry framework converts these reliable relative judgments into a scalar function through a principled probabilistic model, which is provably consistent with the comparisons in the limit of enough data, giving a cleaner training signal than regression on noisy absolute ratings.

Does the reward model generate text, like the base language model?

No. The reward model shares the same transformer architecture and often the same initial weights as the language model, but its output head is different: instead of a distribution over the vocabulary for the next token, it produces a single scalar attached to the final hidden state, typically at the last token of the full prompt-plus-completion sequence. It is purely an evaluator, not a generator — it never samples text of its own. During the RLHF stage, a separate policy model generates completions, and the frozen reward model simply scores them.

How much human-labeled data does training a reward model actually require?

Substantially less than pretraining or even instruction tuning, because the reward model reuses a pretrained and instruction-tuned backbone and only needs to learn a comparative scoring function. Production systems have used datasets ranging from tens of thousands to low hundreds of thousands of comparisons, a small fraction of the token counts involved in pretraining. The exact amount needed depends on prompt diversity and the granularity of preferences being captured — nuanced distinctions like subtle factual errors typically require more, cleaner comparisons than coarse quality differences.

What happens if the reward model disagrees with human judgment after RL training?

This is precisely reward hacking, and it is the main practical limitation of the reward-model approach. Because RL optimization pushes the policy toward regions of high predicted reward, and the reward model's predictions are only reliable near its training distribution, the policy can drift into regions where the reward model overestimates quality. Mitigations include adding a KL-divergence penalty that keeps the policy close to the reference instruction-tuned model, periodically collecting fresh human comparisons on the current policy's outputs, and retraining or ensembling reward models to reduce single-model blind spots.

Is the reward model the same thing as a value function in reinforcement learning?

They are related but distinct. In the standard RLHF setup, the reward model provides the reward signal — a scalar per completed sequence — analogous to the reward R(s,a)R(s,a) in classical reinforcement learning. A separate value function, often another head on the policy network, estimates expected future reward from a partial sequence to reduce variance in the policy gradient (as in actor-critic methods like PPO). The reward model is trained once on human preference data and then frozen; the value function is trained continuously alongside the policy during RL fine-tuning.

Can a single reward model capture all the qualities we care about, like helpfulness, honesty, and harmlessness simultaneously?

In practice, most reward models are trained on a single blended preference signal where annotators are instructed to weigh all these criteria together into one overall judgment, which the model then compresses into one scalar. This is a real simplification: a single number cannot fully represent a multidimensional notion of quality, and different applications sometimes train separate reward models for different axes (for instance, a distinct safety or toxicity classifier) that are combined at RL time. This tension between a unified scalar reward and genuinely multidimensional human values is an active area of alignment research.

Why is the Bradley-Terry model specifically the right choice, rather than some other pairwise model?

Bradley-Terry is popular because it is the simplest model consistent with a latent-scalar-score assumption: if you believe each completion has some "true" quality number, the logistic difference form is the natural way to convert a score gap into a preference probability, and it reduces to ordinary logistic regression, which is well understood, convex in the score difference, and cheap to optimize. Alternative choices exist, such as the Thurstone-Mosteller model based on a Gaussian noise assumption instead of a logistic one, but they behave similarly in practice and Bradley-Terry's closed-form sigmoid link makes it the standard default in reward modeling implementations.

Before this

Where this leads