In RLHF, a reward model gives scores to the human-preferred answer and to the rejected one. Under the Bradley–Terry model, . Compute this probability, the loss , and the gradients with respect to and . What happens when the scores are the other way round, and why does the loss depend only on the difference?
Reinforcement learning, RLHF
Level L3 Intermediate. Length Medium. Nature Th+Mat Both.
What's being asked
Whether you can derive the pairwise preference loss used to train reward models and interpret its gradient.
Key idea
The reward model is trained with . Its gradient with respect to is , so a wrongly ordered pair gets a large push and a correctly ordered pair gets a small one.
Steps
- The model says . Maximising its log-likelihood over human comparisons gives the loss.
- With : .
- Loss: .
- Gradients. Using , with : and . Gradient descent raises and lowers by equal amounts.
- Reverse the scores (, ): , , the loss is , and the gradient magnitude is . A wrong ranking costs more and pushes harder.
- The loss depends only on because adding a constant to every score leaves unchanged. So the reward is defined only up to a shift, and its absolute level means nothing.
- Link to Stage 3. The RL stage uses as the reward, so the shift is harmless, but the scale and the quality of the ranking matter, and the KL penalty is needed to stop over-optimisation of an imperfect reward model.
Common mistakes
- Treating the reward model as a classifier of absolute "good" or "bad". It only ranks, through differences.
- Forgetting the sigmoid, and using directly in the loss. That is unbounded and has no probabilistic meaning.
- Giving the gradient of the wrong sign. The loss falls when increases, so .
How long your answer should be
Half a page; 5 minutes.
Last checked on 4 December 2026.
Read this
Previous in Reinforcement learning: Show that generalised advantage estimation , with , equals when and the Monte Carlo advantage when . How do these limits explain the bias–variance role of ? How do you check your claim on rewards and values with ?
Next in Reinforcement learning: State and prove the policy improvement theorem. If for every state , why does it follow that for every ? How does this justify greedy policy improvement in policy iteration?