Skip to content
tezvyn:

Reward models in RLHF and PPO

Source: interviewMediumHow cards are made

Summary

understanding of the reward model in RLHF.

Key points

it learns from human preference comparisons to score responses, then supplies the reward signal that PPO maximizes while a KL penalty keeps the policy near the reference.

What's really being asked

The question checks whether you can separate the three models in RLHF and explain how subjective human preference is converted into an optimizable reward.

The full answer

The reward model is a separate network, usually initialized from the same base LLM, with the language head replaced by a scalar output. It is trained on comparison data: for a given prompt, humans rank two or more candidate responses, and the model learns via a pairwise loss so the preferred response receives a higher score. In the PPO loop, the policy generates a completion, the reward model assigns a scalar reward, and PPO uses that reward to compute advantages and update the policy toward higher-scoring outputs. Critically, a KL-divergence penalty against the frozen reference model is added to the reward so the policy does not drift into degenerate text that games the reward model.

The mistakes people make

Saying humans score each PPO rollout in real time, confusing the reward model with the policy being trained, or omitting the KL penalty. Without the KL term, PPO exploits weaknesses in the reward model and produces incoherent or repetitive reward-hacking outputs.

What usually comes next

Expect questions on reward hacking, on why DPO removes the explicit reward model, on the Bradley-Terry preference loss, and on how reward-model overoptimization is detected.

A concrete example

Humans see two summaries of an article and pick the better one thousands of times. The reward model learns to predict that preference as a number. During PPO, the policy writes a new summary, the reward model rates it, and the policy nudges its weights to earn higher ratings, while the KL penalty keeps the summary fluent and on-topic rather than collapsing into reward-maximizing gibberish.

Interview question

During PPO-based RLHF, why is a KL-divergence penalty against the reference model added to the reward signal?

  • a.To eliminate the need for any human preference data
  • b.To merge the reward model and policy into a single network
  • c.To prevent the policy from exploiting the reward model and degenerating into reward-hacking textCorrect
  • d.To let humans relabel every generated sample inside the loop
Why?

The KL term keeps the policy close to the trusted reference so it cannot drift into degenerate outputs that game the reward model. It has nothing to do with relabeling samples or removing preference data.

Just read this? Test yourself on what you have been reading.

Read the original → en.wikipedia.org

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles