Reward models: a score learns comparisons, not truth
奖励模型
Fit preference odds, expose unidentified scores and watch proxy optimization damage a separate goal.
reward-modelingThe same comparisons can support very different scores
A wins against B in four out of five comparisons. Does that make A’s reward 0.8? Not necessarily. The comparison frequency concerns two answers, whereas a reward score belongs to an answer under a prompt. Many pairs of scores produce the same probability. An answer never compared with anything is even less constrained.
A reward model maps an input and a candidate behavior to a scalar used for evaluation or optimization. This article focuses on preference-trained reward models. Christiano and colleagues, section 2.2.3, learn a score from trajectory comparisons. Rafailov and colleagues, section 3, state the corresponding response-level preference likelihood. Neither construction makes the score an objective measure of correctness, safety or human welfare.
The executable example fits three tabular rewards, introduces an unobserved answer, and optimizes a deliberately imperfect proxy. Every label and utility in the example is synthetic.
Only differences appear in the likelihood
For answers to the same prompt, a Bradley–Terry model uses:
This assumes a scalar preference scale and a particular noise model. A score difference of zero gives probability 0.5; a difference of gives 0.8. For trajectory segments, the scores can be sums of per-step predicted rewards. Context and segment definition remain part of the model.
For comparisons with soft targets , let . The mean negative log-likelihood can be evaluated stably as:
logaddexp(0, delta) computes the first term without forming an enormous exponential. For actual repeated binary judgments, a count-weighted likelihood preserves the number of observations; equal weighting of distinct pair frequencies is a different objective. Our three authored pair frequencies receive equal weight, and are not reported as collected observations.
The gradient with respect to tabular scores is:
Each comparison adds and subtracts the same residual. The gradient therefore sums to zero, and zero initialization keeps the mean score zero. This fixes one convenient convention; the data itself cannot fix the shared offset:
If the comparison graph is disconnected, each component has its own unconstrained offset. Regularization or an initialization can select one solution without supplying missing evidence. Our fourth answer has no incident comparison, so assigning it reward or leaves the training likelihood identical.
Scale is different from offset. Multiplication generally changes confidence:
Thus centering scores does not calibrate probabilities. Temperature fitting on a separate validation set may adjust confidence, but cannot repair missing features or unsupported behaviors. Hard, perfectly separable preferences can also drive unregularized logistic scores without bound; finite soft targets in this example avoid that case.
Scalar differences must be consistent around a cycle:
If all three ordered pairs have target probability 0.8, each asks for difference , contradicting the identity. With equal weights, the symmetric optimum has equal scores and loss . Disagreement is not always an optimizer bug; the chosen model can be unable to represent the labels.
Finally, consider a policy selected using a proxy reward , while a separate authored utility measures the intended outcome:
These are different quantities. Nothing in this objective guarantees that increasing proxy reward increases . Gao and colleagues, section 2.1, study a related proxy-optimization problem using a larger reward model as synthetic “gold.” Their gold model is not direct access to true human utility; our explicit numerical utility is a separate teaching construction.
Fit, shift, omit, then optimize
Run this complete Python/NumPy program. Three pair targets 0.8,0.8,16/17 recover scores approximately and loss 0.4081743077. Adding 100 to every score preserves the loss within floating-point precision.
"""Original finite reward fitting: synthetic labels, no human or LLM ratings."""
import json
import numpy as np
def sigmoid(x):
x = np.asarray(x, dtype=float)
return np.exp(-np.logaddexp(0, -x))
def softmax(x):
x = np.asarray(x, dtype=float)
if x.ndim != 1 or not len(x) or not np.isfinite(x).all():
raise ValueError("Expected a nonempty finite vector")
e = np.exp(x - x.max())
return e / e.sum()
def preferences(scores, pairs):
return sigmoid(scores[pairs[:, 0]] - scores[pairs[:, 1]])
def pair_loss_grad(scores, pairs, targets):
scores = np.asarray(scores, dtype=float)
pairs = np.asarray(pairs, dtype=int)
targets = np.asarray(targets, dtype=float)
if (scores.ndim != 1 or pairs.ndim != 2 or pairs.shape[1] != 2
or len(pairs) == 0 or targets.shape != (len(pairs),)
or not np.isfinite(scores).all() or not np.isfinite(targets).all()
or np.any((targets < 0) | (targets > 1))
or pairs.min() < 0 or pairs.max() >= len(scores)):
raise ValueError("Invalid scores, pairs or soft labels")
delta = scores[pairs[:, 0]] - scores[pairs[:, 1]]
loss = np.mean(np.logaddexp(0, delta) - targets * delta)
residual = (sigmoid(delta) - targets) / len(pairs)
gradient = np.zeros_like(scores)
np.add.at(gradient, pairs[:, 0], residual)
np.add.at(gradient, pairs[:, 1], -residual)
return float(loss), gradient
def fit_scores(pairs, targets, size=3, steps=2000):
scores = np.zeros(size)
for _ in range(steps):
_, gradient = pair_loss_grad(scores, pairs, targets)
scores -= 0.5 * gradient
return scores
def policy_for_reward(reference, reward, beta):
reference = np.asarray(reference, dtype=float)
reward = np.asarray(reward, dtype=float)
if (reference.ndim != 1 or reference.shape != reward.shape
or not np.isfinite(reference).all() or not np.isfinite(reward).all()
or np.any(reference <= 0) or not np.isclose(reference.sum(), 1)
or not np.isfinite(beta) or beta <= 0):
raise ValueError("Positive normalized reference and beta are required")
return softmax(np.log(reference) + reward / beta)
PAIRS = np.array([[0, 1], [1, 2], [0, 2]])
def demo():
truth = np.array([np.log(4), 0., -np.log(4)])
target = preferences(truth, PAIRS)
learned = fit_scores(PAIRS, target)
cycle = np.array([[0, 1], [1, 2], [2, 0]])
cyclic = fit_scores(cycle, np.full(3, .8))
# Candidate 3 is never compared: both scores fit observed data equally.
low, high = np.r_[learned, -4.], np.r_[learned, 4.]
q = np.array([.8, .19, .01])
proxy, gold = np.array([0., 1., 3.]), np.array([0., 1., -1.])
optimization = []
for beta in [5., 1., .25]:
policy = policy_for_reward(q, proxy, beta)
optimization.append(dict(beta=beta, policy=policy.tolist(),
proxy=float(policy @ proxy), gold=float(policy @ gold)))
return dict(targets=target.tolist(), scores=learned.tolist(),
loss=pair_loss_grad(learned, PAIRS, target)[0],
shifted_loss=pair_loss_grad(learned+100, PAIRS, target)[0],
cycle_scores=cyclic.tolist(), cycle_loss=pair_loss_grad(cyclic, cycle, np.full(3,.8))[0],
unseen_losses=[pair_loss_grad(x, PAIRS, target)[0] for x in [low,high]],
unseen_probability=[float(policy_for_reward(np.full(4,.25),x,1)[3]) for x in [low,high]],
optimization=optimization)
if __name__ == "__main__":
print(json.dumps(demo(), indent=2))
Under a uniform four-answer reference and , the unobserved answer’s optimal probability is about 0.003477 if its score is , or 0.912278 if its score is . Both score assignments fit the observed three-answer comparisons equally well. Training loss cannot choose between them.
For the separate proxy experiment, reference probabilities are (0.8,0.19,0.01), proxy scores (0,1,3) and intended utilities (0,1,-1). As decreases through 5,1,0.25, expected proxy reward rises approximately 0.2730,0.7375,2.9859. Utility moves 0.2036,0.2080,-0.9869: aggressive optimization discovers the proxy’s highly rewarded failure.
Each full fitting update costs for comparisons and scores; the closed-form policy computation costs . The program checks finite inputs and labels in . It fits tabular scores only; there is no representation learning, annotation interface or transformer reward head.
Preference prediction and policy evaluation have different distributions
Held-out comparisons should test prompts, candidates and annotators that match the intended claim. Splitting individual pairs can leak the same prompt or response into both sides. Also evaluate generated responses after optimization, because the policy can find regions rarely seen by the reward model.
A single scalar can combine conflicting objectives in a way that hides tradeoffs. Report the annotation rubric, disagreement, abstentions, coverage and calibration. Human comparisons are informative evidence about a stated judgment task; they are not automatically factual verification. A model that prefers polished wording may still reward a wrong answer.
The synthetic counterexample demonstrates possibility, not a measured failure rate of any deployed system. An ensemble or stronger reference penalty may help in some settings, but neither is a certificate that proxy optimization is safe or accurate.
Look for what the data leaves free
- Does preference probability 0.8 imply reward 0.8?
Answer: No. It implies a score difference under this model; (log4,0) and (log4+20,20) give the same preference probability.
- Why do the and assignments to the fourth answer have equal observed loss?
Answer: That answer occurs in no comparison. Its score is absent from every difference in the likelihood, even though it strongly changes a subsequently optimized policy.
- Can centering rewards fix overconfident probabilities?
Answer: No. Centering subtracts a common constant, leaving differences and probabilities unchanged. Calibration concerns their scale or a more general mismatch, and must be assessed on appropriate data.
- A proxy score improves at every optimization setting. What additional number in the example reveals failure?
Answer: The separately defined expected utility falls to about at . Proxy improvement alone hides this reversal; in an actual application the independent outcome measure needs its own evidence and limitations.
Three separate claims to verify
Use Christiano’s method section to study how comparisons supervise a reward, DPO’s preliminaries for the response-level likelihood, and Gao’s synthetic setup to understand what an overoptimization experiment measures. Keep separate the claims that a reward predicts labels, that a policy optimizes that reward, and that the resulting behavior satisfies the intended goal.
Make a prediction, then check
What changes if the same constant is added to both reward scores?
Learning objectives
- Derive pairwise likelihood and identify data-coverage limits.
- Verify the toy calculation and state what it cannot establish.
Prerequisites & connections
Explore related knowledge →References
- Deep Reinforcement Learning from Human Preferences — v1
Paul F. Christiano; Jan Leike; Tom B. Brown; Miljan Martic; Shane Legg; Dario Amodei · 2017 - Direct Preference Optimization: Your Language Model is Secretly a Reward Model — v2
Rafael Rafailov; Archit Sharma; Eric Mitchell; Stefano Ermon; Christopher D. Manning; Chelsea Finn · 2023 - Scaling Laws for Reward Model Overoptimization — v1
Leo Gao; John Schulman; Jacob Hilton · 2022
Version1 · Editorial status: Recorded technical checks completed
View technical check record (AI)
Codex · 2026-09-20 · Single AI author. Section2.2 through2.2.4 opening; PDF5 viewed: trajectory comparisons, soft labels, negative cross-entropy and actual recipe modifications. Sections3/4, PDF3/4 viewed; gradient and procedure text read. BT, KL objective, partition cancellation and DPO; v2 dated2023-12-13. Sections2.1/2.2 and preceding best-of-n text; PDF4 viewed. Synthetic gold RM versus proxy, deterministic comparisons and recalibration; no empirical scaling fit reproduced. Seven paired equations and four explained exercises. Pairwise likelihood gradients, offset invariance, known odds, cyclic preferences, unobserved score freedom and proxy/utility reversal; no objective human-utility claim.
- Pairwise likelihood gradients, offset invariance, known odds, cyclic preferences, unobserved score freedom and proxy/utility reversal; no objective human-utility claim.
- Four computed SVG variants per topic;10 numeric/geometry tests and30 responsive cases passed. Ten selected final captures directly viewed. Full article acceptance recorded separately.
Source locations checked:
- Deep Reinforcement Learning from Human Preferences — v1 · Section2.2 through2.2.4 opening; PDF5 viewed: trajectory comparisons, soft labels, negative cross-entropy and actual recipe modifications.
- Direct Preference Optimization: Your Language Model is Secretly a Reward Model — v2 · Sections3/4, PDF3/4 viewed; gradient and procedure text read. BT, KL objective, partition cancellation and DPO; v2 dated2023-12-13.
- Scaling Laws for Reward Model Overoptimization — v1 · Sections2.1/2.2 and preceding best-of-n text; PDF4 viewed. Synthetic gold RM versus proxy, deterministic comparisons and recalibration; no empirical scaling fit reproduced.
Related topics