Intuition What this page is
On the parent Reward modeling page we built the pairwise loss L = − log σ ( Δ ) where Δ = r w − r l . Here we stress-test it against every case the formula can face: the model right, the model wrong, a tie, huge margins, negative rewards, shift-invariance, a K -way ranking, the KL-penalized RL objective, and Goodhart over-optimization. If you can follow all ten, you have seen every corner.
First, the symbols we reuse (all from the parent, restated so nothing is assumed):
Definition The core quantities on every line below
x = the prompt (the question or instruction). y = a candidate answer to that prompt.
r θ ( x , y ) = the reward model : a learned function (the letter θ just names its internal weights) that reads a prompt-and-answer pair and outputs a single real number — "how good is answer y for prompt x ". Everywhere below we shorten r θ ( x , y w ) to r w and r θ ( x , y l ) to r l .
r w = reward the model gives the human's preferred answer ("winner"). A plain real number.
r l = reward the model gives the rejected answer ("loser").
Δ = r w − r l = the margin . Positive means the model ranks correctly; negative means it is wrong.
σ ( z ) = 1 + e − z 1 = the sigmoid , a curve that squashes any real number into ( 0 , 1 ) . It is the model's stated probability that the winner beats the loser. σ ( 0 ) = 0.5 (a coin flip), σ ( + ∞ ) → 1 , σ ( − ∞ ) → 0 .
log everywhere on this page means the natural logarithm (log e , base e ≈ 2.718 ). This is the standard convention in machine learning; a base-2 log would just rescale every loss by the constant log 2 ≈ 0.693 and change nothing about which answer wins.
Loss for one pair = − log σ ( Δ ) . Small = good, big = bad.
How to read Figure s01. The horizontal axis is the margin Δ = r w − r l ; the vertical axis is the per-pair loss − log σ ( Δ ) (both labelled on the plot). The blue curve is the loss. Trace it left-to-right: it slides down as Δ grows, so a bigger correct margin always costs less. Three marked dots are the cases we work below — green at Δ = 3 (confidently right, loss ≈ 0.05 ), gray at Δ = 0 (a tie, loss = log 2 ≈ 0.69 ), red at Δ = − 2 (wrong, loss ≈ 2.13 ). The orange dashed line is the straight asymptote − Δ that the loss hugs on the far left, showing the penalty grows without bound when the model is confidently wrong. The steepness of the blue curve at any point is exactly the gradient magnitude σ ( − Δ ) derived above — flat on the right (nothing to fix), steep on the left (big fix).
Every reward-modeling case falls into one of these cells. The examples that follow each tag which cell(s) they hit.
Cell
Case class
What is special
Example
A
Model confidently right (Δ ≫ 0 )
tiny loss, tiny gradient
Ex 1
B
Model wrong (Δ < 0 )
large loss, large gradient
Ex 2
C
Tie / degenerate (Δ = 0 )
loss = log 2 , exactly 0.5 prob
Ex 3
D
Negative rewards (r w , r l < 0 )
only the difference matters
Ex 4
E
Shift invariance (add c to both)
loss unchanged — a proof-by-example
Ex 5
F
Limiting behaviour (Δ → ± ∞ )
loss → 0 or → ∞
Ex 6
G
K -way ranking (K > 2 )
( 2 K ) pairs averaged
Ex 7
H
Real-world word problem
pick winner from raw scores, batch loss
Ex 8
I
RL usage / KL penalty
reward vs. distance-from-reference trade-off
Ex 9
J
Exam twist: Goodhart
measured reward up, true preference down
Ex 10
Worked example Ex 1 — Cell A: confidently right
r w = 3.0 , r l = 0.0 . Find the loss and the full gradient vector ( ∂ L / ∂ r w , ∂ L / ∂ r l ) .
Forecast: the model is clearly right, so guess — is the loss near 0 or near 1 ? Is the gradient big or tiny?
Margin Δ = r w − r l = 3.0 − 0.0 = 3.0 . Why this step? The loss and gradient depend only on Δ , so compute it first.
σ ( 3.0 ) = 1 + e − 3 1 = 1 + 0.0498 1 = 0.9526 . Why this step? This is the model's probability the winner wins; the loss is − log (natural log) of it.
Loss = − log ( 0.9526 ) = 0.0486 . Why this step? Reading the loss curve at Δ = 3 — near the flat right tail.
Gradient: using the boxed result, ∂ L / ∂ r w = − σ ( − 3 ) = − 0.0474 and ∂ L / ∂ r l = + σ ( − 3 ) = + 0.0474 . Why this step? Magnitude 0.0474 is tiny — "almost nothing to fix", the self-correcting property; the two entries are equal and opposite.
Verify: σ ( 3 ) + σ ( − 3 ) = 1 ? 0.9526 + 0.0474 = 1.000 ✓. Tiny loss + tiny opposite gradients = confidently-right cell, as forecast.
Worked example Ex 2 — Cell B: the model is wrong
r w = 0.5 , r l = 2.5 (it scored the rejected answer higher). Loss and full gradient?
Forecast: wrong ordering — will the loss exceed log 2 ≈ 0.693 ?
Δ = 0.5 − 2.5 = − 2.0 . Why? Negative margin is the fingerprint of a mistake.
σ ( − 2.0 ) = 1 + e 2 1 = 1 + 7.389 1 = 0.1192 . Why? The model says the winner has only a 12% chance — badly miscalibrated against the human label.
Loss = − log ( 0.1192 ) = 2.127 . Why? Far up the steep left arm of the loss curve — much bigger than the tie value 0.693 , so yes, forecast holds.
Gradient: ∂ L / ∂ r w = − σ ( − Δ ) = − σ ( 2.0 ) = − 0.8808 and ∂ L / ∂ r l = + σ ( 2.0 ) = + 0.8808 . Why? Big magnitude 0.88 → a strong shove that raises r w and lowers r l by the same amount, swapping the order.
Verify: gradient magnitude σ ( 2 ) = 0.8808 and Ex-1's σ ( − 3 ) = 0.0474 : the wrong case pushes ~18× harder. Size of the fix tracks size of the error ✓.
Worked example Ex 3 — Cell C: a tie (degenerate input)
r w = r l = 1.7 . What are the probability, loss, and full gradient?
Forecast: the model can't tell them apart. What probability must it report?
Δ = 1.7 − 1.7 = 0 . Why? Equal scores → zero margin, the exact centre of the sigmoid.
σ ( 0 ) = 1 + e 0 1 = 2 1 = 0.5 . Why? With no evidence either way, a fair model must say 50/50 .
Loss = − log ( 0.5 ) = 0.6931 = log 2 . Why? This is the reference loss : a model that has learned nothing scores exactly log 2 per pair.
Gradient: ∂ L / ∂ r w = − σ ( 0 ) = − 0.5 and ∂ L / ∂ r l = + 0.5 . Why? A non-zero, equal-and-opposite nudge even at a tie — it still wants to break the symmetry toward the human's choice.
Verify: − log ( 0.5 ) = log 2 = 0.693147 ✓. Any trained loss below 0.693 means the model is beating random.
Worked example Ex 4 — Cell D: both rewards negative
r w = − 1.0 , r l = − 4.0 . Compute the loss.
Forecast: both scores are "bad" numbers. Does the sign of the rewards matter, or only their gap?
Δ = − 1.0 − ( − 4.0 ) = 3.0 . Why? Subtracting a bigger negative makes a positive gap — the winner is still ahead by 3 .
σ ( 3.0 ) = 0.9526 , loss = − log ( 0.9526 ) = 0.0486 . Why? Identical to Ex 1! The negative absolute values are irrelevant.
Verify: same Δ = 3 as Ex 1 → same loss 0.0486 ✓. Negative rewards are perfectly fine; the model reads gaps, not heights.
Worked example Ex 5 — Cell E: shift invariance (mini-proof)
Take Ex 1 (r w = 3.0 , r l = 0.0 ) and add the constant c = 100 to both . Does the loss change?
Forecast: huge new numbers (103 and 100 ). Bigger, so bigger loss?
New margin Δ ′ = ( 3.0 + 100 ) − ( 0.0 + 100 ) = 3.0 . Why? The constant c appears in both terms and cancels in the subtraction.
Loss = − log σ ( 3.0 ) = 0.0486 , unchanged. Why? This is why the parent says "only differences are meaningful" — algebraically σ (( r w + c ) − ( r l + c )) = σ ( r w − r l ) .
Verify: loss at Δ = 103 − 100 = 3 equals loss at Δ = 3 → 0.0486 = 0.0486 ✓. Consequence: mean-center rewards before RL (see Goodhart's law discussion). Relates to the reason DPO Direct Preference Optimization works with implicit rewards too.
Worked example Ex 6 — Cell F: limiting behaviour
What happens to the loss as Δ → + ∞ and as Δ → − ∞ ? Check at Δ = 8 and Δ = − 8 .
Forecast: trace the loss curve's two tails from the figure.
Δ = 8 : σ ( 8 ) = 0.99966 , loss = − log ( 0.99966 ) = 0.000335 . Why? As Δ → + ∞ , σ → 1 and loss → 0 — a flat floor. The model can never be "over-rewarded" for being right; the loss just plateaus.
Δ = − 8 : σ ( − 8 ) = 0.000335 , loss = − log ( 0.000335 ) = 8.0003 . Why? As Δ → − ∞ , loss grows roughly linearly like − Δ (since − log σ ( Δ ) ≈ − Δ for very negative Δ ). No cap on the penalty for being confidently wrong — this is the orange dashed asymptote in Figure s01.
Verify: for large negative Δ , − log σ ( Δ ) ≈ − Δ : at Δ = − 8 we get 8.0003 ≈ 8 ✓. Asymmetric curve: soft floor on the right, unbounded ramp on the left.
Worked example Ex 7 — Cell G: a 4-way ranking
A human ranks four answers best→worst: a ≻ b ≻ c ≻ d , with model scores r a = 2 , r b = 1 , r c = 0.5 , r d = − 1 . Compute the averaged ranking loss.
Forecast: how many pairs, and will the loss be small (rankings mostly obeyed)?
Number of pairs = ( 2 4 ) = 6 : ( a , b ) , ( a , c ) , ( a , d ) , ( b , c ) , ( b , d ) , ( c , d ) . Why? Every ordered "better beats worse" pair is a training signal — reuses one label six times (InstructGPT trick).
Margins: Δ ab = 1 , Δ a c = 1.5 , Δ a d = 3 , Δ b c = 0.5 , Δ b d = 2 , Δ c d = 1.5 . Why? Each margin is winner-minus-loser using the ranking's direction.
Per-pair losses − log σ ( Δ ) : 0.3133 , 0.2014 , 0.0486 , 0.4741 , 0.1269 , 0.2014 . Why? Read each off the same loss curve.
Average = 6 0.3133 + 0.2014 + 0.0486 + 0.4741 + 0.1269 + 0.2014 = 6 1.3657 = 0.2276 . Why? Averaging (not summing) keeps the per-prompt loss scale independent of K .
Verify: average of the six pair losses = 0.2276 ✓. The tightest pair ( b , c ) with margin 0.5 contributes the most (0.4741 ) — the ranking is weakest there, exactly where gradient will push hardest.
Worked example Ex 8 — Cell H: real-world word problem
A support-bot RM must rank two replies to "reset my password" . Reply A (steps + link) scores r = 1.8 ; Reply B (just "google it") scores r = − 0.4 . The human preferred A. (i) Does the RM agree? (ii) What loss does this pair contribute?
Forecast: the helpful reply scored higher — the RM should agree, small loss.
Winner = A (human's choice), so r w = 1.8 , r l = − 0.4 . Why? The winner label comes from the human , not from which score is bigger; we then check whether the model matched.
RM's own ranking: 1.8 > − 0.4 , so the RM ranks A above B — it agrees . Why? Agreement means positive margin, low loss.
Δ = 1.8 − ( − 0.4 ) = 2.2 ; σ ( 2.2 ) = 0.9002 ; loss = − log ( 0.9002 ) = 0.1051 . Why? A modest, healthy loss — the RM is right but not maximally confident, leaving useful gradient.
Verify: Δ = 2.2 , loss = 0.1051 ✓, and the RM's argmax score matches the human's pick ✓. This is one row of a training batch for the support bot's RM (used later by PPO / RLHF ).
Worked example Ex 9 — Cell I: RL objective with a KL leash
After the reward model r θ ( x , y ) (defined at the top of this page) is trained, RLHF tunes the policy to maximize r θ ( x , y ) − β KL , where KL is the KL divergence measuring how far the policy has drifted from a fixed reference model, and β is a knob controlling how hard we penalize that drift.
(A note on units: KL divergence here is measured in nats — the natural unit of information you get when you use the natural log log e . One nat is just "how surprised you are, measured with base-e logs"; a bigger KL in nats means the two distributions disagree more. We only ever compare KL values, so the unit is a label, not a quantity to worry about.)
Suppose for a candidate answer r θ ( x , y ) = 3.0 but that answer has moved the policy so far from the reference that KL = 5.0 nats. With penalty weight β = 0.2 , is this answer a net gain over a "safe" answer with r θ ( x , y ) = 2.0 and KL = 0.5 ?
Forecast: the risky answer has higher raw reward — but the leash might cancel that.
Risky answer objective = r θ − β KL = 3.0 − 0.2 × 5.0 = 3.0 − 1.0 = 2.0 . Why? The KL term converts "distance from the sensible reference model" into a reward penalty, so wandering too far costs points.
Safe answer objective = 2.0 − 0.2 × 0.5 = 2.0 − 0.1 = 1.9 . Why? Small KL → tiny penalty.
Compare: 2.0 > 1.9 , so the risky answer is barely preferred here. Why? The margin is only 0.1 — the leash has nearly erased the risky answer's 1.0 raw-reward lead.
Now turn the knob: raise β to 0.25 . Risky objective = 3.0 − 0.25 × 5.0 = 3.0 − 1.25 = 1.75 , while the safe objective = 2.0 − 0.25 × 0.5 = 2.0 − 0.125 = 1.875 . Now 1.75 < 1.875 , so the safe answer wins . Why? A larger β shortens the leash: the more we distrust the reward model, the more we force the policy to stay near the reference and refuse far-flung answers.
Verify: 3.0 − 1.0 = 2.0 and 2.0 − 0.1 = 1.9 , difference = 0.1 ✓; at β = 0.25 , 1.75 < 1.875 so the ordering flips ✓. The KL weight β literally sets how far the policy may wander to chase reward.
Worked example Ex 10 — Cell J: the exam twist (Goodhart / over-optimization)
As training proceeds the measured RM reward on the policy climbs: r = 1.0 , 2.0 , 3.0 , 4.0 at steps 1 , 2 , 3 , 4 . But a gold human eval gives true preference-win-rate = 0.60 , 0.72 , 0.68 , 0.55 . At which step should we stop, and what is this failure called?
Forecast: measured reward only goes up — but does true quality?
Measured reward is monotonically increasing (1→4). Why? The optimizer is doing its job: it maximizes the proxy r θ .
True win-rate peaks at step 2 (0.72 ), then falls to 0.68 , 0.55 . Why? Past step 2 the policy is exploiting regions where the RM is confidently wrong — Goodhart's law : "when a measure becomes a target, it ceases to be a good measure."
Optimal stopping step = 2 (highest true preference). Why? Early stopping + the KL penalty (Ex 9) are the two standard defenses against this over-optimization gap.
Verify: arg max ( 0.60 , 0.72 , 0.68 , 0.55 ) = step 2 ✓; measured reward at that step = 2.0 while later reward 4.0 is higher yet worse — the signature of reward hacking ✓.
Recall Quick self-test across the matrix
Model gives r w = 1 , r l = 1 — what loss? ::: log 2 ≈ 0.693 (a tie, cell C).
Add 50 to both rewards in any pair — loss changes by? ::: Zero — shift invariance (cell E).
Δ = − 8 loss ≈ ? and why unbounded? ::: ≈ 8 ; for large negative Δ , − log σ ( Δ ) ≈ − Δ grows linearly (cell F).
Ranking of K = 4 gives how many pairwise losses? ::: ( 2 4 ) = 6 (cell G).
What is ∂ L / ∂ r l in terms of the margin? ::: + σ ( − Δ ) — equal and opposite to ∂ L / ∂ r w .
What is a "nat" of KL divergence? ::: The unit of information from using natural (base-e ) logs — a bigger KL in nats means the policy strayed further from the reference.
Measured reward rising while true preference falls is called? ::: Reward hacking / over-optimization (Goodhart, cell J).
Mnemonic One line to hold it all
"Read the GAP, not the height; WIN by a margin; the LEASH and EARLY STOP keep the meter honest."
Related: Bradley-Terry model (where σ ( Δ ) comes from), Logistic regression (same loss shape), DPO Direct Preference Optimization (folds the RM step away), and the Hinglish walkthrough 4.4.02 Reward modeling (Hinglish) .