Algorithm Search⌘K

Modelresearch

Preference reward model

Also called Bradley-Terry reward model.

A network that scores a response so that the chance one response is preferred to another is the sigmoid of the score difference.

A preference reward model is a network rθ(x,y)r_\theta(x, y) that maps a prompt xx and a response yy to one real number, the reward. It is trained on human comparisons: a person sees two responses to the same prompt and picks one. The model assumes that the chance that ywy_w is picked over yly_l is σ(rθ(x,yw)−rθ(x,yl))\sigma(r_\theta(x, y_w) - r_\theta(x, y_l)), with σ(z)=1/(1+e−z)\sigma(z) = 1 / (1 + e^{-z}). This is the paired comparison model of Bradley and Terry (1952), which has no page of its own here. The reward model is one part of reinforcement learning from human feedback (RLHF), the pipeline that first fits this model and then tunes a policy against it with PPO. Direct preference optimization (DPO) fits the same Bradley-Terry likelihood, but its reward is implicit in the policy, so it trains no separate reward model. Instruction tuning is supervised fine-tuning on written demonstrations and uses no comparisons at all.

The machine

Shapes. The prompt and the response are joined into one sequence of nn tokens from a vocabulary of size ∣V∣|V|. The backbone is a pretrained transformer of width dd, often the model after supervised fine-tuning. Ouyang et al. (Section 3.5) start from that model and remove the final unembedding layer, a d×∣V∣d \times |V| matrix. In its place goes a head with a weight vector ww of size dd and a bias bb.

  • The input is nn token ids. The embedding gives an n×dn \times d matrix.
  • The transformer layers give the hidden states HH, also n×dn \times d.
  • A common design reads the final hidden state hnh_n of the last token, a vector of size dd, and returns r=w⊤hn+br = w^\top h_n + b, one number.

So the head adds d+1d + 1 parameters, and the model costs the same as one forward pass of the backbone.

The likelihood. Bradley and Terry give each item ii a strength πi>0\pi_i > 0 and set P(i beats j)=πi/(πi+πj)P(i \text{ beats } j) = \pi_i / (\pi_i + \pi_j). With πi=eri\pi_i = e^{r_i} this is

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).

The loss of one comparison is the negative log likelihood, −log⁡σ(rw−rl)-\log \sigma(r_w - r_l), the logistic loss of the score difference. Its derivatives are

∂∂rw=−σ(rl−rw),∂∂rl=+σ(rl−rw),\frac{\partial}{\partial r_w} = -\sigma(r_l - r_w), \qquad \frac{\partial}{\partial r_l} = +\sigma(r_l - r_w),

and backpropagation carries them into the network. For example, rw=1.5r_w = 1.5 and rl=0.5r_l = 0.5 give P=σ(1)=0.731059P = \sigma(1) = 0.731059, a loss of 0.3132620.313262 and a derivative of −0.268941-0.268941 with respect to rwr_w. Equal rewards give the loss log⁡2=0.693147\log 2 = 0.693147.

Rankings of K responses. Ouyang et al. (Section 3.5) show a labeler between K=4K = 4 and K=9K = 9 responses to rank. A ranking gives (K2)\binom{K}{2} comparisons. All comparisons of one prompt go into one batch element, with the loss

loss(θ)=−1(K2) E(x,yw,yl)[log⁡σ(rθ(x,yw)−rθ(x,yl))].\text{loss}(\theta) = -\frac{1}{\binom{K}{2}}\, \mathbb{E}_{(x, y_w, y_l)} \big[ \log \sigma\big(r_\theta(x, y_w) - r_\theta(x, y_l)\big) \big].

This needs one forward pass for each of the KK responses instead of two for each of the (K2)\binom{K}{2} pairs. For K=4K = 4 responses ranked in order with rewards (2,1,0.5,−1)(2, 1, 0.5, -1), the six pair losses average to 0.2276130.227613.

Only differences count. Add any c(x)c(x) to every reward of a prompt and every probability stays the same. So the data fix the reward of one prompt only up to a constant. Ouyang et al. (Section 3.5) add a bias so that the labeler demonstrations get a mean score of 0 before reinforcement learning.

What it counts

The size of a task is mm, the number of comparisons, KK, the number of responses for one prompt, nn, the number of tokens of a sequence, and dd, the width. One forward pass of the backbone on nn tokens costs Θ(n2d+nd2)\Theta(n^2 d + n d^2) per layer, as on the transformer page. The head and the loss add Θ(d)\Theta(d) per response and Θ(1)\Theta(1) per pair.

The quantities that people measure are these.

  • Pairwise accuracy. The share of held-out comparisons in which rw>rlr_w > r_l. People do not agree with each other on every pair, so this accuracy has a ceiling well under 1.
  • Log loss. The mean of −log⁡σ(rw−rl)-\log \sigma(r_w - r_l) on held-out pairs. It also checks that the predicted probabilities are calibrated, not only that the order is right.

A small example with a table of rewards. Take one prompt and three responses A, B and C with free rewards, no network. The data are 13 comparisons: A beat B 3 times and lost once, B beat C 3 times and lost once, and A beat C 4 times and lost once. The maximum likelihood rewards, scaled so that they sum to 0, are (0.83614,0,−0.83614)(0.83614, 0, -0.83614). At the maximum, the number of wins of each response equals the sum of its predicted win probabilities over its comparisons: 7 for A, 4 for B and 2 for C. The fitted model gives P(A≻B)=P(B≻C)=0.69765P(A \succ B) = P(B \succ C) = 0.69765, against an observed share of 0.75, and P(A≻C)=0.84188P(A \succ C) = 0.84188, against 0.8. A single strength for each response cannot match all three shares. The negative log likelihood falls from 9.010919.01091 at equal rewards to 7.085437.08543. Hunter's MM update (Hunter 2004), which multiplies each strength by the ratio of its wins to its expected wins in a form that never decreases the likelihood, finds these values. It is a relative of the expectation-maximization algorithm.

Relation to other models

  • Logistic regression. If the reward is linear in a fixed feature vector, r(x,y)=w⊤ϕ(x,y)r(x, y) = w^\top \phi(x, y), the loss is logistic regression on the difference ϕ(x,yw)−ϕ(x,yl)\phi(x, y_w) - \phi(x, y_l) with the label 1 and no intercept. A preference reward model replaces ϕ\phi with a transformer whose weights are also trained.
  • Learning to rank. RankNet scores documents for a query with a network and trains on pairs with the same pairwise logistic loss. A reward model is a pairwise model of learning to rank whose query is a prompt and whose documents are responses.
  • DPO. DPO uses the reward r^(x,y)=βlog⁡(πθ(y∣x)/πref(y∣x))\hat r(x, y) = \beta \log (\pi_\theta(y \mid x) / \pi_{\text{ref}}(y \mid x)) of a policy πθ\pi_\theta and a frozen reference πref\pi_{\text{ref}}, and puts it into the same Bradley-Terry loss.
  • Inverse reinforcement learning. Inverse reinforcement learning recovers a reward function from what an expert does. A preference reward model recovers it from what a person says about two outcomes. In the language setting, the episode is one prompt and one response, and the reward comes only at the end.
  • Kemeny rank aggregation. Kemeny rank aggregation also turns many pairwise preferences into one order, but it finds the order with the fewest disagreements and has no probabilities.
  • Ratings on a scale. A mean opinion score asks people for an absolute rating. A comparison asks only which of two is better, which needs no shared scale between people.

Known results in the model

  • Theorem (a convex loss for a linear reward). Hypotheses: the reward is linear in fixed features, r=w⊤ϕr = w^\top \phi. Then −log⁡σ(z)-\log \sigma(z) is convex in zz and zz is linear in ww, so the loss is convex in ww. For a transformer the loss is not convex in the weights, and training finds a local solution. This is the standard argument for logistic regression.
  • Theorem (existence and uniqueness, Zermelo 1929 and Ford 1957). Hypotheses: the table model with one free reward per item, and a directed graph with an edge from ii to jj when ii beat jj at least once. Then the maximum likelihood rewards exist and are unique up to an additive constant if and only if the graph is strongly connected. If some item never lost, its reward goes to infinity. Hunter (2004) states the condition and proves that the MM update converges under it.
  • Theorem (the model is transitive). Hypotheses: preferences follow the Bradley-Terry model. If P(a≻b)≥1/2P(a \succ b) \ge 1/2 and P(b≻c)≥1/2P(b \succ c) \ge 1/2, then ra≥rb≥rcr_a \ge r_b \ge r_c, so P(a≻c)≥max⁡(P(a≻b),P(b≻c))P(a \succ c) \ge \max(P(a \succ b), P(b \succ c)), because σ\sigma is increasing. So the model cannot fit a cycle. Example: if A beats B, B beats C and C beats A, each 9 times out of 10, the maximum likelihood rewards are all equal and the model predicts 0.5 for every pair, although each observed share is 0.9.
  • Measurement (people disagree). Ouyang et al. (Section 3.4) report that training labelers agree with each other on 72.6±1.5%72.6 \pm 1.5\% of comparisons and held-out labelers on 77.3±1.3%77.3 \pm 1.3\%. In Section 4.1 they split the labelers into 5 groups and trained reward models on 4 of them. The accuracy on the held-out group was 69.6±0.9%69.6 \pm 0.9\%, against 72.4±0.4%72.4 \pm 0.4\% on the training groups.
  • Measurement (correlated pairs overfit). Ouyang et al. (Section 3.5) found that if the (K2)\binom{K}{2} comparisons of a prompt are shuffled into one data set as separate examples, one pass over the data overfits the reward model. Putting them into one batch element fixed this. They trained for a single epoch, because more epochs overfit (Appendix C.2).
  • Measurement (size and stability). Ouyang et al. used a 6B reward model for policies of all sizes. A 175B reward model could reach a lower validation loss, but its training was less stable and it was more expensive as the value function of PPO (Appendix C.2).
  • Measurement (overoptimization). Gao, Schulman and Hilton (2022) labeled data with a 6B gold reward model, trained proxy reward models of 3M to 3B parameters on it, and optimized a 1.2B policy against the proxy. With d=KL(π ∥ πinit)d = \sqrt{\mathrm{KL}(\pi \,\|\, \pi_{\text{init}})}, the gold score fit d(α−βd)d(\alpha - \beta d) for best-of-n sampling and d(α−βlog⁡d)d(\alpha - \beta \log d) for reinforcement learning (Section 1). Both rise and then fall: pushing too hard on the proxy lowers the true score. With 90,000 comparisons, the coefficients changed smoothly with the size of the proxy model (Section 3.2). This is a fit to one synthetic setup, not a law for all reward models.

References

  1. Bradley and Terry 1952, the paired comparison model, with the probability that i beats j equal to the ratio of the strength of i to the sum of the two strengths
  2. Paul Christiano, Jan Leike, Tom B. Brown, Miljan Martic, Shane Legg and Dario Amodei, Deep reinforcement learning from human preferences, 2017, Section 2.2 (fitting the reward function to comparisons of trajectory segments with the Bradley-Terry model)
  3. Nisan Stiennon, Long Ouyang, Jeff Wu and others, Learning to summarize from human feedback, NeurIPS 2020, Section 3.4 (the reward model, a language model with a scalar head trained on pairs of summaries)
  4. Long Ouyang, Jeff Wu, Xu Jiang and others, Training language models to follow instructions with human feedback, NeurIPS 2022, Section 3.5 (the reward model, equation 1, the K-way ranking loss and the normalization by a bias), Section 3.4 (agreement between labelers), Section 4.1 (accuracy on held-out labelers), Appendix C.2 (the 6B reward model and its training)
  5. Leo Gao, John Schulman and Jacob Hilton, Scaling laws for reward model overoptimization, 2022, Section 1 (the functional forms of the gold score in the square root of the KL divergence), Section 2.1 (the synthetic setup with a 6B gold reward model), Section 3.2 (scaling with the size of the reward model), Section 3.6 (the effect of the KL penalty)
  6. Hunter 2004, the MM update for the Bradley-Terry maximum likelihood estimate, and the condition of Zermelo and Ford for existence and uniqueness

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/6TWK9K/text.yaml