Reward-model RLHF versus direct preference optimization
I was asked this
No reports yet. Sign in to say where you were asked it.
An AI/ML design interview question asked in Microsoft's system design round, last asked Jan 2026. It tests rlhf, alignment and fine-tuning.
Compare two ways of aligning a language model with human preferences, starting from a supervised fine-tuned (SFT) model: the classic RLHF pipeline with a reward model and PPO, and direct preference optimization (DPO). Explain the data each one needs, its training stages, its objective, and the role of the reference policy in each. Then compare cost, stability and failure modes and say when you would choose each.
Requirements
- Functional:
- The shared start: an SFT model trained on demonstrations, and a dataset of prompts each with a preferred and a rejected response.
- RLHF: a reward model trained on the pairs with a Bradley-Terry loss; the policy optimized with PPO to maximize reward minus a KL penalty to the reference (SFT) model; sampling from the policy inside the loop.
- DPO: the same KL-regularized objective solved in closed form, giving a loss directly on the pairs: a logistic loss on the difference of log-probability ratios (policy over reference) between the chosen and rejected responses, scaled by
beta. - The reference model in each: a KL anchor in RLHF; inside the loss in DPO, where it defines the implicit reward.
- Non-functional: compare compute and memory (how many models are in memory at once), stability and tuning effort, and how each handles data that was not sampled from the current policy.
Clarifying questions
- Is the preference data fixed and offline, or can we collect new labels on the current model's outputs?
- What is the goal: helpfulness, safety, or a checkable skill such as math or code?
- How much compute and engineering time is available?
What a strong answer covers
- The RLHF objective,
max E[r(x, y)] - beta * KL(pi || pi_ref), and the four models PPO keeps (policy, reference, reward model, value model). - The DPO loss,
-log sigmoid(beta * [log pi(y_w|x)/pi_ref(y_w|x) - log pi(y_l|x)/pi_ref(y_l|x)]), and why it needs no reward model and no sampling: the optimal policy of the KL-regularized problem defines an implicit reward. - Cost and stability: DPO is a supervised loss over two models, simpler and cheaper; PPO is sensitive to hyperparameters but learns from fresh samples.
- Failure modes: reward hacking and over-optimization against a learned reward in RLHF; DPO overfitting the offline pairs, lowering the probability of both responses, and losing signal as the policy drifts from the data.
- When to pick each: DPO (or its iterative and online variants) for a fixed preference set and a limited budget; RL with a reward model or a verifier when you can generate and score new samples, or when rewards are checkable.
Follow-ups
- What does
betacontrol in DPO, and what goes wrong when it is too small or too large? - How would you detect reward hacking during an RLHF run?
- How do online or iterative DPO try to close the gap with on-policy RL?
- Where do verifiable rewards (unit tests, math answers) change the choice?
Where it's asked
- Microsoft · System design · Last asked Jan 202660 min · Design discussion
What it tests
rlhf · alignment · fine-tuning
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
