liveBook · Manning

Objective function

As explained in Reinforcement Learning from Human Feedback

A loss function is a scalar objective that quantifies prediction or optimization error during model training.

An objective function is a scalar target used to quantify prediction or optimization error. Training either maximizes the objective directly or minimizes a loss formed by negating it; these functions guide local parameter updates rather than guaranteeing globally desirable behavior. section 6.2.5 section 14.1.1

In policy optimization, the objective combines policy probabilities with an advantage estimate: actions better than the expected value should become more likely, while worse actions should become less likely. A zero advantage produces no policy update. section 6.3.1

Practical objective design adds structure around the basic gradient signal:

  • PPO corrects distribution mismatch with an importance ratio comparing the current and data-collection policies. section 6.2.5
  • Clipping the ratio to [1−ε, 1+ε] limits destructive policy changes during one update. section 6.2.5
  • Language-model objectives are commonly computed per token from differences in log-probabilities, with token averaging used in practice. section 6.2.5
  • Reward and cost functions can specify explicit success in finite-control domains, whereas human preferences do not reduce to one closed-form reward as easily. section 10.4

Reading a policy-gradient loss

For a positive advantage, the loss encourages the model to increase the action probability. For a negative advantage, it discourages a newly favored action. For a zero advantage, the loss is zero and the policy remains unchanged. section 6.3.1

Equation 6.28
\[\label{eq:PPO_EQN} J(\theta) = \min\left(\frac{\pi_\theta(a|s)}{\pi_{\theta_{\text{old}}}(a|s)}A, \text{clip} \left( \frac{\pi_\theta(a|s)}{\pi_{\theta_{\text{old}}}(a|s)}, 1-\varepsilon, 1+\varepsilon \right) A \right).\]

The PPO clipped surrogate objective takes the smaller of the unclipped and clipped advantage-weighted policy ratios, preventing excessive updates while preserving useful gradient direction. section 6.2.5

How Reinforcement Learning from Human Feedback covers it

How deep it goes
Derives policy-gradient and PPO objectives through ratios, advantages, clipping, log-probabilities, and per-token implementation.
Examples
Uses PPO equations, per-token log-probability ratios, policy-gradient cases, reward functions, and preference-optimization losses.
What it assumes
Assumes policies, actions, advantages, and rewards; clarifies how advantage signs determine probability updates.
What you can do after
Apply it via policy-gradient or PPO losses while recognizing clipping constraints and proxy-objective failure modes.
How it connects
Connects policy gradients, PPO, importance weighting, advantage estimation, reward models, preference optimization, and Goodhart’s law.

Also explained in

Compare how 30 books explain objective function →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Reinforcement Learning from Human Feedback. The section links point to the parts of the book it draws on.