TL;DR
A reward model is a neural network that reads a prompt and a response and outputs one number, a score for how good a human would judge that response to be. It is trained not on absolute scores but on pairs: people look at two responses to the same prompt and say which one they prefer. The network learns to give the preferred one the higher number.
Once trained, the reward model stands in for the human. A reinforcement learning algorithm can then generate millions of responses and be pushed toward the ones the model scores highly, which is how human judgement gets into a language model without a person grading every answer.
Where you'll see it: the second stage of RLHF, where a chat model is tuned to prefer answers that people rate as helpful and harmless.
Intuition
Learning taste from pairs
Asking a person to score an answer out of 10 is hard. Their scale drifts from one day to the next, and two people rarely agree on what a 7 means. Asking which of two answers is better is much easier and more consistent. A rater can say "this one" without knowing the scale at all.
A reward model turns those choices into a training signal. Each comparison says, in effect, "answer A beats answer B for this prompt". The network's only job is to make its scores agree with those choices. It never needs to know what a "7" is. Only the difference between two scores matters, and that is what the training signal pushes on.
The reason this is worth doing is that the thing we care about is hard to write down as a rule but easy to recognise when we see it. Helpfulness, tone and honesty are like that. A reward model is a learned, compressed copy of the judgement a group of raters applied to many examples, and it can be queried millions of times at almost no cost.
flowchart LR P[Prompt] --> A[Response A] P --> B[Response B] H[Human picks the better one] --> D[Training pair: winner and loser] A --> D B --> D D --> R[Reward model scores both] R --> L[Loss pushes winner score above loser score]
The plot below shows the training signal for one comparison. The horizontal axis is the score gap between the preferred and the rejected response. When the gap is large and positive, the model already agrees with the human and the loss is near zero. When the gap is negative, the model is ranking the pair the wrong way round and the loss grows roughly linearly with how wrong it is.
- loss
- P(preferred wins)
The math
Setup
Let be a prompt and a response. The reward model is a function , with parameters . It returns a single real number. Higher means better according to the human raters it was trained on.
The training data is a set of triples , where is the response the rater preferred (the winner) and is the one they rejected (the loser). The data says nothing about how much better the winner is, only that it was chosen.
The preference model
To turn a pair of scores into a probability, the standard choice is the Bradley–Terry model, first proposed for paired comparisons in sports and tournaments. It says that the probability a rater prefers over depends only on the difference of their scores:
Under the Bradley–Terry model, the probability that the rater prefers to given prompt is
where is the sigmoid function .
Here reads "is preferred to", and reads "given". The quantity inside the sigmoid, , is the score gap. Because the sigmoid maps any real number into , the model always gives a valid probability, whatever the scores are.
An equivalent form makes the link to softmax clear. Since , the same probability is a two-way softmax over the two scores:
Maximum likelihood gives a loss
Assume the comparisons are independent. The likelihood of the whole dataset is the product over pairs of the probability the model assigns to each observed choice. Taking the logarithm turns the product into a sum, and maximum likelihood estimation means maximising that sum. Equivalently, we minimise the negative log-likelihood:
Here is the average over the dataset, and is the natural logarithm. This is the whole training objective. It is a binary cross-entropy in disguise: each comparison is a binary label that says the first response won, and the model's predicted probability for that label is . With label 1 the binary cross-entropy reduces to .
Two facts that follow from the form
The loss depends only on differences. If we add the same constant to every score, does not change, so the loss does not change. A reward model is therefore only defined up to an additive constant. Nothing in the training signal fixes the zero point, and the absolute number a reward model outputs has no meaning on its own. Only comparisons between responses mean something.
The gradient is bounded in a useful way. Write for the score gap of one pair. The derivative of the loss with respect to is
When the model already ranks the pair correctly by a wide margin, is close to zero, so the pair contributes almost nothing. When the model ranks it wrongly, the push is close to full strength. The model therefore spends its effort on the comparisons it gets wrong.
Architecture
The reward model is almost always built from a pretrained language model. The usual recipe is to take a transformer trained to predict text, remove its output head that produces a distribution over tokens (the Softmax over the vocabulary), and attach a single linear layer that maps the final hidden state of the last token to one scalar. Writing for that hidden state, the score is
Here is a learned vector and a learned scalar. The earlier layers are initialised from the language model and fine-tuned on the comparison data, usually for a single pass over the data. The head is a plain feedforward layer with no activation, because the score is allowed to take any real value.
Worked examples
Take a prompt with two candidate responses. The reward model gives and .
- Score gap: .
- Preference probability: .
- Compute , so the denominator is and .
- Suppose the rater picked . The loss is .
- Suppose instead the rater picked . The probability of that choice is , and the loss is .
Interpretation: when the model already agrees with the rater, the loss is small (0.20). When it disagrees, the loss is about eight and a half times larger (). The model was fairly confident in , so the surprise of the rater choosing is large. As a check, the two losses are and , which match the values above.
Three comparisons produce score gaps , and . Each term in the loss is .
- First pair: .
- Second pair: . The model ranked this pair the wrong way round, so the loss is high.
- Third pair: .
- Mean loss: .
Now add 10 to every score in all three pairs. The gaps are unchanged, so the mean loss is still . This is the shift invariance from the math section: the loss cannot tell an absolute score of 10 from an absolute score of 0, and training will not try to.
Interpretation: a mean loss near means the model is no better than a coin flip on these pairs. Here it is better than that on average, but the wrong-way pair dominates the loss, which is exactly where the next round of training pushes hardest.
Human raters often rank more than two answers at once. If a rater orders responses to one prompt, the ranking splits into pairwise comparisons. In the InstructGPT work, labellers ranked between four and nine outputs per prompt, so one prompt yielded between 6 and 36 pairs from a single rating task. This is a cheap way to get many training pairs from one piece of human effort, and it is why the pairs in a batch share a prompt: the score gaps are only meaningful within one prompt.
Tradeoffs and failure modes
A reward model is a proxy. It is useful only as long as its scores track what the raters actually wanted, and the optimiser that uses it will look for every place they stop tracking.
| Situation | What goes wrong | Better choice |
|---|---|---|
| Policy is optimised hard against the reward model | Reward hacking: the policy finds responses the model scores highly but humans dislike, such as long, confident or flattering text | Add a KL penalty to a reference model, stop early, or ensemble several reward models |
| Raters disagree or are inconsistent | The loss averages over contradictory labels, and the model learns a blurred notion of quality | Measure inter-rater agreement, write clearer guidelines, and drop low-agreement pairs |
| Responses drift away from the training distribution | Scores on new kinds of answers are unreliable, and the policy exploits that | Collect fresh comparisons from the current policy and retrain the reward model |
| The task has a checkable answer, such as a unit test or a maths result | Preference labels are a noisy and expensive stand-in for the truth | Use a programmatic reward or verifier, which cannot be flattered |
| Using reward scores as calibrated probabilities | Only differences are identified, so absolute values have no fixed meaning | Compare scores within one prompt, and do not threshold them across prompts |
The most important failure is reward overoptimisation. In the summarisation work of Stiennon et al., training against a learned reward model improved the score on that model well past the point where human judgements stopped improving. Gains on the proxy and gains for people came apart.
History
The idea of ranking things from pairwise comparisons is old. Ralph Bradley and Milton Terry set out the model in 1952, for paired comparisons such as taste tests. Its use for training a neural network to match human preferences came much later.
In 2017, Paul Christiano and co-authors at OpenAI and DeepMind trained a reward model from human comparisons of short video clips of simple robot and Atari behaviour, then used it as the reward for reinforcement learning. This showed that a learned reward could replace a hand-written one. In 2020, Nisan Stiennon and co-authors applied the same recipe to summarising text, and showed that the reward model could guide a language model toward summaries people preferred. In 2022, Long Ouyang and co-authors at OpenAI used reward models in the InstructGPT pipeline, which combined supervised fine-tuning, reward modelling and reinforcement learning to produce a model that follows instructions better. The reward model became a standard component after that, because it is the cheapest way to turn a small amount of human judgement into a training signal for a very large model.
Check yourself
QuestionRecall: what does a reward model output for a single prompt and response, and what is its training data?Show answer
It outputs one real number, a score for how good the response is. It is trained on triples of a prompt, a preferred response and a rejected response, taken from human comparisons. The scores are never supervised directly, so only their differences are learned.
QuestionCompute: a reward model gives the preferred response a score of 1.0 and the rejected response a score of −0.5. What is the loss for this pair, to three decimal places?Show answer
The score gap is . The loss is . The model agrees with the rater, so the loss is small.
QuestionWhy: adding 100 to every score a reward model outputs leaves the training loss unchanged. Why is that the right behaviour?Show answer
The loss depends only on the score gap between the preferred and rejected response, and adding a constant to both scores cancels in the subtraction. The comparisons carry no information about absolute values, so the model should not be penalised for a shift that makes no difference to the ranking. It also means the absolute score has no fixed meaning.
QuestionApplied: a team trains a reward model on comparisons from an early chat model, then uses it to tune a much stronger later model. Scores climb sharply but the human evaluators are unimpressed. What is the most likely cause, and what would you change?Show answer
The later model produces responses that lie outside the distribution the reward model was trained on, and the optimiser has found responses the proxy scores highly but people do not value. The fix is to collect fresh comparisons from the current policy, retrain or update the reward model on them, and add a KL penalty so the policy does not move too far from its starting point while it is being tuned.