4.4.2 · D3Alignment, Prompting & RAG

Worked examples — Reward modeling

2,847 words13 min readBack to topic

First, the symbols we reuse (all from the parent, restated so nothing is assumed):

Figure — Reward modeling

How to read Figure s01. The horizontal axis is the margin ; the vertical axis is the per-pair loss (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 (confidently right, loss ), gray at (a tie, loss ), red at (wrong, loss ). 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).


The scenario matrix

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 () tiny loss, tiny gradient Ex 1
B Model wrong () large loss, large gradient Ex 2
C Tie / degenerate () loss , exactly prob Ex 3
D Negative rewards () only the difference matters Ex 4
E Shift invariance (add to both) loss unchanged — a proof-by-example Ex 5
F Limiting behaviour () loss or Ex 6
G -way ranking () 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

The worked examples


Recall Quick self-test across the matrix

Model gives — what loss? ::: (a tie, cell C). Add to both rewards in any pair — loss changes by? ::: Zero — shift invariance (cell E). loss ≈ ? and why unbounded? ::: ; for large negative , grows linearly (cell F). Ranking of gives how many pairwise losses? ::: (cell G). What is in terms of the margin? ::: — equal and opposite to . What is a "nat" of KL divergence? ::: The unit of information from using natural (base-) 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).

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