Zenaique

Explain how a reward model is trained from pairwise human preferences

Short answer·Medium·4.0 · 0·~3 min·Asked atElasticRazorpay
Attempt it

Explain how a reward model is trained from pairwise human preferences.

Free · 2 AI evals / day
TL;DR

A reward model learns from chosen-vs-rejected pairs by pushing the preferred completion to a higher scalar score with a Bradley-Terry pairwise objective.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

Imagine two essays on the same topic and a teacher says which one reads better. You do not get a perfect scorecard, only who won. After thousands of these mini face-offs, you can train a coach that predicts which essay humans would pick. That coach is the reward model. In RLHF, the model reads two candidate answers, gives each a score, and learns to rank the human-preferred one higher. Later, RLHF trains the policy model to produce answers that this coach tends to score well.

Key concepts

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

A reward model reads a prompt and a response and outputs one number: how good the response is. People cannot give such numbers reliably, but they can say which of two responses is better. The Bradley-Terry model bridges the two. It treats each response as having a hidden score. The chance that one response beats another depends only on the difference between their scores.

Training then becomes logistic regression on pairs. For each comparison, the reward model scores the chosen and the rejected response, and the loss pushes the chosen score above the rejected one. The result is a scorer that RL, best-of-n sampling or data filtering can use.

The Bradley-Terry model turns scores into win probabilities

The Bradley-Terry model comes from 1952 work on paired comparisons, long before language models. Each item i has a strength. The probability that item i beats item j is its strength divided by the total strength of the pair. Writing strengths as exponentials of scores, e^{r_i}, gives a clean form:

P(yw≻yl∣x)=er(x,yw)er(x,yw)+er(x,yl)=σ(r(x,yw)−r(x,yl))P(y_w \succ y_l \mid x) = \frac{e^{r(x, y_w)}}{e^{r(x, y_w)} + e^{r(x, y_l)}} = \sigma\big(r(x, y_w) - r(x, y_l)\big)

Here x is the prompt, y_w is the preferred (winning) response, y_l is the rejected (losing) one, and σ is the logistic sigmoid.

Three properties follow from this form. Only the difference between scores matters, so adding the same constant to every score changes nothing. A difference of 0 means a coin flip, and each extra unit of difference moves the win probability along the sigmoid. The model is also transitive by construction: if A usually beats B and B usually beats C, then A has the higher score and usually beats C. Real human preferences are not always transitive, and the model cannot represent such cycles.

The pairwise loss and what its gradient does
Model and data: a scalar head on a language model
Only differences are learned: offsets and margins
Measuring a reward model, and where it breaks
How the reward model is used downstream
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.

Real products, models, and research that use this idea.

  • InstructGPT trained a 6B reward model on rankings of 4 to 9 responses per prompt, with all pairs from a prompt in one batch element
  • Llama 2 trained separate helpfulness and safety reward models with a margin term set by how strongly annotators preferred one response
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QHow would you detect length bias in a reward model before PPO?
A

Slice evaluation pairs by completion length and compare reward deltas to human preference consistency across bins.

1 more follow-up an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

Treating reward-model training as normal classification. That misses the ranking objective, which is built on score differences between paired completions.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • Bradley-Terry probability from score difference

  • Why pairwise labels are easier than absolute ratings

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
What is RLHF, and why is it used after pretraining?
MCQ·Easy