We need a probabilistic model of preferences. Start from first principles.
Step 1 — Assume each response has a hidden "quality" score.
Let the reward model assign rw=rθ(x,yw) and rl=rθ(x,yl).
Why? We must convert two scalars into a probability that yw is chosen.
Step 2 — The Bradley–Terry model.
Assume the probability a human prefers yw depends only on the score difference, monotonically. The standard choice: probability grows with rw−rl through a logistic (sigmoid).
P(yw≻yl∣x)=erw+erlerw=σ(rw−rl)
Why the sigmoid?er is a positive "strength". The share of strength going to the winner is erw+erlerw. Dividing top and bottom by erw gives 1+e−(rw−rl)1=σ(rw−rl). So only the difference matters, not the absolute scale.
Step 3 — Maximize likelihood = minimize negative log-likelihood.
For one example the likelihood of the observed human choice is σ(rw−rl). Take −log:
Step 4 — Check the gradient makes sense.
Let Δ=rw−rl. Using dΔdlogσ(Δ)=1−σ(Δ)=σ(−Δ):
∂rw∂L=−σ(−Δ),∂rl∂L=+σ(−Δ).Why sensible? If the model is already confident (Δ large positive), σ(−Δ)→0 — tiny gradient, "nothing to fix". If it's wrong (Δ<0), σ(−Δ) is large — big correction. Self-correcting.
A learned scalar function rθ(x,y) trained on human preferences to score how good response y is for prompt x; usually the base LM with a scalar output head.
Why can't we just hand-write the reward for "be helpful"?
The property is easy to recognize but impossible to specify formulaically; humans can compare outputs though, so we learn the reward from comparisons.
State the Bradley–Terry preference probability.
P(yw≻yl)=σ(rθ(x,yw)−rθ(x,yl)).
Write the pairwise reward-model loss.
L=−E[logσ(rθ(x,yw)−rθ(x,yl))].
Why does only the reward difference matter, not the absolute value?
The sigmoid depends only on rw−rl; adding a constant to all rewards leaves the loss unchanged (scale/shift invariant).
What is the gradient w.r.t. rw and why is it self-correcting?
∂L/∂rw=−σ(−Δ); large when the model is wrong (Δ<0), near zero when confidently right.
How is a ranking of K responses turned into training data?
Form all (2K) pairs and average their pairwise losses.
What is reward hacking / over-optimization?
The policy exploits regions where the RM is confidently wrong, raising measured reward while true preference drops (Goodhart).
Why include a KL penalty when optimizing against the RM?
To keep the policy near the reference distribution so the RM stays in-distribution and can't be exploited.
Why prefer pairwise comparison loss over MSE regression on ratings?
Comparisons are more reliable than absolute human scores; the logistic loss is scale-free.
Recall Feynman: explain to a 12-year-old
Imagine you're teaching a robot to write nice birthday cards, but "nice" is hard to describe. So instead you show it two cards and just point to the one you like more, again and again. From all your pointing, the robot builds a little "niceness meter" that gives every card a score. It doesn't matter if the numbers are 5 and 3 or 105 and 103 — what matters is that your favourite gets the higher one. Later the robot writes new cards trying to make the meter go up. But careful: if it only chases the meter, it might find a silly trick the meter loves but you actually hate — so we keep it on a short leash to stay sensible.
Reward modeling ka core idea simple hai: hum chahte hain ki AI humans ki pasand ke hisaab se behave kare, lekin "achha jawab" ka koi formula nahi likha ja sakta. Toh hum humans se sirf comparison lete hain — "Answer A better hai ya B?" — aur usse ek reward modelrθ(x,y) sikhaate hain jo har answer ko ek number (score) deta hai. Ye model actually base LM hi hota hai, bas last mein ek scalar head laga dete hain.
Ab in comparisons ko loss mein convert kaise karein? Yahan Bradley–Terry model aata hai. Maan lo winner ka score rw aur loser ka rl hai. Human winner ko choose karega with probability σ(rw−rl) — sirf difference matter karta hai, absolute value nahi. Iska −log le lo toh loss ban jaata hai: −logσ(rw−rl). Iska matlab: model ko winner ko loser se comfortably upar rakhna hai. Beauty ye hai ki agar model already sahi hai toh gradient chhota, aur agar galat hai toh gradient bada — yaani ye khud ko correct karta hai.
Ye kyun important hai? Kyunki ye RLHF ka bilkul beech ka step hai: pehle SFT, phir ye reward model, phir PPO se policy is reward ko maximize karti hai. Par ek warning: reward model perfect nahi hota. Agar policy sirf iss score ko andha-dhundh chase kare, toh wo aise tricks dhoondh legi jinko meter pasand karta hai par insaan nahi — isko reward hacking / Goodhart's law kehte hain. Isliye ek KL penalty lagate hain jo policy ko reference model ke paas rakhta hai, taaki reward model apne "comfort zone" mein rahe. Yaad rakho: reward sirf relative hai, per-prompt — absolute number ka koi matlab nahi.