Reward Models · Chapter 11

The implicit reward model: a reward hidden in the policy

Abstract. Every earlier chapter trained a separate network to output rewards. Direct Preference Optimization (DPO) trains no such network, yet a reward is still there: the scaled log-ratio between the trained policy and a reference model. This chapter derives that implicit reward from the KL-regularised RL objective, shows why the intractable normaliser cancels inside the Bradley-Terry model, reads off the DPO loss and its gradient, uses a DPO policy as a reward model, splits the reward into per-token and per-step pieces to obtain an implicit PRM, and lists where the idea breaks.

1. A reward inside the policy

Classical RLHF learns a reward, then optimises a policy against it. DPO skips the first stage.

Explicit reward model

Train \(r_\phi(x,y)\) on preference pairs with the Bradley-Terry loss. Then run PPO on the policy, using \(r_\phi\) as the reward.

pairs → r_φ → PPO → π

Implicit reward model

Train the policy directly on the same pairs. The reward is never a separate network; it is a function of the policy's own probabilities.

pairs → π

This is not a heuristic shortcut. Under the same assumptions as classical RLHF, the two routes target the same optimal policy. Sections 3 to 6 show why.

2. Definition

Let \(\pi_\theta\) be the policy being trained and \(\pi_{\text{ref}}\) a frozen reference model, usually the supervised fine-tuned model that training starts from. Fix a scale \(\beta>0\).

Definition 11.1 · Implicit reward

The implicit reward of a response \(y\) to a prompt \(x\) is

\[ \hat r_\theta(x,y)=\beta\log\frac{\pi_\theta(y\mid x)}{\pi_{\text{ref}}(y\mid x)}. \]

The reward is positive when the trained policy has made \(y\) more likely than the reference did, negative when it has made \(y\) less likely, and zero before training starts, when \(\pi_\theta=\pi_{\text{ref}}\). It measures how far training moved the probability of \(y\), not how probable \(y\) is.

For example, with \(\beta=0.1\), a response whose log-ratio is \(2\) gets \(\hat r=0.2\), and one whose log-ratio is \(0.5\) gets \(\hat r=0.05\). The first is preferred.

3. The KL-regularised objective

Start from the objective that PPO-based RLHF optimises. Given a reward \(r(x,y)\), maximise expected reward while staying close to the reference model:

(1) \[ \max_{\pi}\;\mathbb E_{x\sim\mathcal D}\Big[\mathbb E_{y\sim\pi(\cdot\mid x)}\big[r(x,y)\big] -\beta\,\mathrm{KL}\big(\pi(\cdot\mid x)\,\big\|\,\pi_{\text{ref}}(\cdot\mid x)\big)\Big]. \]

The KL term stops the policy from drifting into text the reward model has never seen and can be fooled by. Larger \(\beta\) means a tighter leash. The objective splits over prompts, so from here on we fix one prompt \(x\).

4. The optimal policy has a closed form

Define the normaliser and a candidate policy:

(2) \[ Z(x)=\sum_{y}\pi_{\text{ref}}(y\mid x)\,e^{r(x,y)/\beta}, \qquad \pi^{*}(y\mid x)=\frac{\pi_{\text{ref}}(y\mid x)\,e^{r(x,y)/\beta}}{Z(x)}. \]

Write the KL as an expectation and collect terms. Since \(r=\beta\log\big(\pi^*Z/\pi_{\text{ref}}\big)\) by Equation (2),

(3) \[ \mathbb E_{\pi}[r]-\beta\,\mathrm{KL}(\pi\,\|\,\pi_{\text{ref}}) =\mathbb E_{\pi}\Big[\beta\log\frac{\pi^{*}Z}{\pi_{\text{ref}}}-\beta\log\frac{\pi}{\pi_{\text{ref}}}\Big] =-\beta\,\mathrm{KL}(\pi\,\|\,\pi^{*})+\beta\log Z(x). \]

The last term does not depend on \(\pi\). The KL term is never negative and is zero only when \(\pi=\pi^*\).

Proposition 11.1 · Optimal KL-regularised policy

For a fixed reward \(r\) and \(\beta>0\), the unique maximiser of Equation (1) is \(\pi^*(y\mid x)\propto\pi_{\text{ref}}(y\mid x)\,e^{r(x,y)/\beta}\). The optimal policy reweights the reference model, raising each response by a factor that grows exponentially with its reward.

This closed form is of no direct use for sampling: \(Z(x)\) sums over every possible response, which is astronomically many sequences. Its value is what it says about the relation between \(r\) and \(\pi^*\).

5. Inverting: the reward in terms of the policy

Take logs in Equation (2) and solve for \(r\):

(4) \[ r(x,y)=\beta\log\frac{\pi^{*}(y\mid x)}{\pi_{\text{ref}}(y\mid x)}+\beta\log Z(x). \]

Read in this direction, the equation says that a policy determines a reward. Any policy \(\pi_\theta\) is the optimal policy of Equation (1) for the reward \(\beta\log(\pi_\theta/\pi_{\text{ref}})+\beta\log Z(x)\). The first term is the implicit reward of Definition 11.1. The second is a problem: it is intractable.

6. Why \(Z(x)\) cancels

Preference data only ever compares two responses to the same prompt. Under the Bradley-Terry model of the scalar chapter, the probability of a preference depends only on the reward difference. Substitute Equation (4) for both rewards:

(5) \[ P(y_w\succ y_l\mid x)=\sigma\big(r(x,y_w)-r(x,y_l)\big) =\sigma\Big(\beta\log\frac{\pi^{*}(y_w\mid x)}{\pi_{\text{ref}}(y_w\mid x)} -\beta\log\frac{\pi^{*}(y_l\mid x)}{\pi_{\text{ref}}(y_l\mid x)}\Big). \]

The two copies of \(\beta\log Z(x)\) are equal, because both responses share the prompt \(x\), and they subtract to zero. What remains involves only the policy and the reference, both of which we can evaluate.

Remark · The same cancellation as in Chapter 01

In the scalar chapter we saw that adding a constant to both rewards leaves the Bradley-Terry probability unchanged. Here the constant is \(\beta\log Z(x)\), different for each prompt but shared by the two responses in a pair. The shift invariance that made scalar rewards "relative, not absolute" is exactly what makes DPO possible.

7. The DPO loss

Replace the unknown \(\pi^*\) in Equation (5) by the trainable \(\pi_\theta\) and take the negative log-likelihood of the observed preferences. Writing \(\hat r_w=\hat r_\theta(x,y_w)\) and \(\hat r_l=\hat r_\theta(x,y_l)\):

(6) \[ \mathcal L_{\text{DPO}}(\theta) =-\log\sigma\Big(\beta\log\frac{\pi_\theta(y_w\mid x)}{\pi_{\text{ref}}(y_w\mid x)} -\beta\log\frac{\pi_\theta(y_l\mid x)}{\pi_{\text{ref}}(y_l\mid x)}\Big) =-\log\sigma\big(\hat r_w-\hat r_l\big). \]

This is the Bradley-Terry loss of the scalar chapter, with the reward network replaced by the implicit reward. Fitting a reward model and fitting the policy have become the same act.

With the numbers from Section 2, \(\hat r_w=0.2\) and \(\hat r_l=0.05\): the margin is \(0.15\), \(\sigma(0.15)\approx0.537\), and the loss is about \(0.621\), only a little below the starting value \(\log 2\approx0.693\).

1 · Take a preference triple \((x,y_w,y_l)\).
↓
2 · Compute \(\log\pi_\theta(y\mid x)\) for both responses with the policy.
↓
3 · Compute \(\log\pi_{\text{ref}}(y\mid x)\) for both with the frozen reference (often cached once).
↓
4 · Form the implicit rewards \(\hat r_w,\hat r_l\) and the loss of Equation (6).
↓
5 · Backpropagate through \(\pi_\theta\) only: raise \(\hat r_w\), lower \(\hat r_l\).

8. The gradient and its weight

Use \(\frac{d}{dz}\big[-\log\sigma(z)\big]=-\sigma(-z)\), and note that \(\pi_{\text{ref}}\) is frozen, so \(\nabla_\theta\hat r=\beta\nabla_\theta\log\pi_\theta\):

(7) \[ \nabla_\theta\mathcal L_{\text{DPO}} =-\beta\,\underbrace{\sigma\big(\hat r_l-\hat r_w\big)}_{\text{weight}} \Big[\nabla_\theta\log\pi_\theta(y_w\mid x)-\nabla_\theta\log\pi_\theta(y_l\mid x)\Big]. \]

The bracket is the direction: make the winner more likely and the loser less likely. The weight sets the step size. It is the probability the implicit reward model currently assigns to the wrong ordering.

Margin \(\hat r_w-\hat r_l\)Weight \(\sigma(\hat r_l-\hat r_w)\)LossReading
\(-2\)0.8812.127Wrong and confident: large update
\(0\)0.5000.693Undecided
\(0.15\)0.4630.621Barely right
\(3\)0.0470.049Already right: almost ignored

Without the weight, every pair would push equally hard, and pairs that are already separated would keep being pushed apart. The weight concentrates learning on the pairs the model still gets wrong.

9. Using a DPO policy as a reward model

Once trained, \(\pi_\theta\) and \(\pi_{\text{ref}}\) together form a reward model. To pick the best of \(n\) candidate responses, score each by its implicit reward:

(8) \[ \hat y=\arg\max_{i\in\{1,\ldots,n\}}\;\beta\log\frac{\pi_\theta(y_i\mid x)}{\pi_{\text{ref}}(y_i\mid x)}. \]

Scoring costs two forward passes per response, one through each model, and no generation. Benchmarks of reward models such as RewardBench evaluate DPO-trained models in exactly this way, next to explicit classifiers.

Two cautions carry over from Section 6. The score is defined only up to the per-prompt constant \(\beta\log Z(x)\), so comparing implicit rewards across different prompts is not meaningful. And the score is a sum over tokens, so responses of very different lengths can differ in score partly because of length.

10. Token-level rewards and implicit PRMs

A language model factorises over tokens, so the log-ratio does too. For a response \(y=(y_1,\ldots,y_T)\):

(9) \[ \hat r_\theta(x,y)=\sum_{t=1}^{T}\beta\log \frac{\pi_\theta(y_t\mid x,y_{<t})}{\pi_{\text{ref}}(y_t\mid x,y_{<t})}. \]

Each term is a per-token credit: how much training raised or lowered the probability of that token in its context. Summing up to position \(t\) gives a running total for the prefix,

(10) \[ q_t=\sum_{i=1}^{t}\beta\log\frac{\pi_\theta(y_i\mid x,y_{<i})}{\pi_{\text{ref}}(y_i\mid x,y_{<i})}, \qquad \rho_k=q_{t_k}-q_{t_{k-1}}, \]

where \(t_k\) is the last token of reasoning step \(k\) and \(\rho_k\) is the reward of that step. This is an implicit PRM: step-level rewards with no step-level labels. The model is trained only on whole-response signals, either preference pairs with Equation (6) or outcome labels \(o\in\{0,1\}\) with a cross-entropy loss on the implicit reward:

(11) \[ \mathcal L_{\text{CE}}=-\Big[o\log\sigma\big(\hat r_\theta(x,y)\big)+(1-o)\log\big(1-\sigma(\hat r_\theta(x,y))\big)\Big]. \]
Note · Compare with Chapter 07

The step reward \(\rho_k=q_{t_k}-q_{t_{k-1}}\) has the same shape as the progress reward \(V(z_t)-V(z_{t-1})\) of the value model chapter, and it telescopes in the same way: the step rewards add up to the whole-response reward \(q_T\). The value model needed rollouts to get its targets; the implicit PRM gets its per-step signal from the parameterisation alone.

11. Weaknesses

  • Needs the reference model. Every score needs \(\pi_{\text{ref}}\) as well as \(\pi_\theta\): two models in memory, or cached reference log-probabilities for fixed data.
  • Offline data only. The pairs were usually sampled from another model. The policy never sees its own outputs judged, unlike PPO. Iterative or online DPO samples fresh pairs from the current policy and labels them with a judge to close this gap.
  • Poor calibration off-distribution. The implicit reward is shaped only on the training pairs. On responses unlike them, the log-ratio reflects whatever incidental drift fine-tuning caused, and can rank such responses badly.
  • Overfitting to confident labels. If a pair is always preferred, the Bradley-Terry optimum wants an infinite margin. The loss keeps pushing the log-ratios apart, and the KL leash of Equation (1) is never enforced directly.
  • Both likelihoods can fall. The loss depends only on the margin, so it can be lowered by making both responses less likely, as long as the loser falls faster (see the note below).
Note · A falling winner

Start with both log-ratios at 0, so the loss is \(\log2\approx0.693\). After some training, the winner's log-ratio is \(-1\) and the loser's is \(-3\). With \(\beta=0.1\), \(\hat r_w=-0.1\), \(\hat r_l=-0.3\), the margin is \(0.2\), and the loss is \(-\log\sigma(0.2)\approx0.598\). The loss went down, yet the preferred response is now \(e^{-1}\approx0.37\) times as likely as under the reference. The probability mass went to responses that appear in neither column of the data.

12. Laboratory: implicit rewards and the DPO weight

Set the log-ratios \(\log(\pi_\theta/\pi_{\text{ref}})\) of the winner and the loser, and the scale \(\beta\). The lab computes the implicit rewards, the margin, the Bradley-Terry probability, the DPO loss, and the gradient weight \(\sigma(\hat r_l-\hat r_w)\).

DPO on one pair

\(\mathcal L=-\log\sigma(\hat r_w-\hat r_l)\)
Winner log-ratio
Loser log-ratio
KL scale
Presets
Rewards r̂_w, r̂_l-
Margin r̂_w − r̂_l-
P(y_w ≻ y_l)-
DPO loss-
Weight σ(r̂_l − r̂_w)-
Likelihood vs reference-

Computation

Move a slider.

Start from "Section 2" and slide the loser's log-ratio above the winner's: the weight climbs toward 1. Then try "Both fall": the loss is below \(\log 2\) even though the winner is less likely than under the reference. Changing \(\beta\) rescales every reward and so changes how quickly the weight saturates.

13. Worked example, step by step

For one prompt, the policy and the reference give these sequence log-probabilities: \(\log\pi_\theta(y_w)=-42.0\), \(\log\pi_{\text{ref}}(y_w)=-45.0\), \(\log\pi_\theta(y_l)=-40.0\), \(\log\pi_{\text{ref}}(y_l)=-38.0\). Take \(\beta=0.1\). Compute the implicit rewards, the loss and the gradient weight.

  1. Log-ratios: winner \(-42.0-(-45.0)=+3.0\); loser \(-40.0-(-38.0)=-2.0\).
  2. Implicit rewards: \(\hat r_w=0.1\times3.0=0.30\), \(\hat r_l=0.1\times(-2.0)=-0.20\).
  3. Margin: \(0.30-(-0.20)=0.50\). Probability: \(\sigma(0.5)\approx0.622\).
  4. Loss: \(-\log 0.622\approx0.474\).
  5. Gradient weight: \(\sigma(-0.5)\approx0.378\). The update is \(\beta\times0.378\approx0.038\) times \(\nabla\log\pi_\theta(y_w)-\nabla\log\pi_\theta(y_l)\).
  6. Note: the policy gives the loser the higher raw likelihood (\(-40\) vs \(-42\)), yet the loser has the lower reward. The implicit reward measures the change from the reference, not the likelihood itself.

14. What comes next

So far every reward model, explicit or implicit, has scored responses for an average user. The next chapter conditions the reward on who is asking, or on a stated preference, so that the same response can earn different rewards in different contexts.

Key idea to remember
\[ \hat r_\theta(x,y)=\beta\log\frac{\pi_\theta(y\mid x)}{\pi_{\text{ref}}(y\mid x)} \]

The optimal KL-regularised policy determines its reward up to a per-prompt constant. Bradley-Terry only sees reward differences within a prompt, so the constant cancels, and training the policy on preferences is training a reward model.

See also

  • Rafailov et al., 2023, Direct Preference Optimization: your language model is secretly a reward model.
  • Rafailov et al., 2024, from \(r\) to \(Q^*\): your language model is secretly a Q-function (token-level view of DPO).
  • Azar et al., 2023, a general theoretical paradigm to understand learning from human preferences (IPO, overfitting with deterministic preferences).
  • Lambert et al., 2024, RewardBench: evaluating reward models, including DPO models scored by implicit reward.
  • Yuan et al., 2024, free process rewards without process labels (implicit PRM).
  • Cui et al., 2025, process reinforcement through implicit rewards (PRIME).
  • The scalar chapter for Bradley-Terry, and the RL notes on PPO.

Previous

← Critique-then-Score

Next chapter

Conditional reward model

One reward model, different preferences for different users.

Continue →