Reinforcement Learning from Human Feedback

Reinforcement learning from human feedback (RLHF) trains models from preferences rather than only from gold labels. For language models, humans or AI judges compare candidate responses. A reward model learns which responses are preferred, and the policy is optimized to produce higher-reward responses while staying close to a reference model.

Preference Data

A preference example contains a prompt , a chosen response , and a rejected response . A common reward model uses the Bradley-Terry likelihood:

where is the learned reward and is the logistic function. The reward model is not an oracle; it is a learned proxy for annotator preference.

KL-Regularized Policy Optimization

KL means Kullback-Leibler divergence, a directed measure of how much one distribution differs from another. In RLHF, the distribution being controlled is usually the trained policy relative to a reference policy .

After reward modeling, the policy can be optimized with an objective like

The reward term pushes the model toward preferred responses. The KL penalty keeps it close to the reference policy, usually the supervised instruction-tuned model, so optimization does not exploit reward-model flaws too aggressively. In LLM training notes, “KL objective” often means this reward-minus-KL regularized objective, not a pure KL-minimization task.

Typical LLM Training Stage

StageDataObjectiveRole
Supervised fine-tuningdemonstrationsnext-token loss on target responseteaches instruction following
Preference modelingchosen/rejected pairspairwise reward lossestimates which response is preferred
RLHF policy updateprompts and sampled responsesreward minus KL penaltyimproves preference reward while limiting drift

This is why RLHF belongs both to reinforcement learning and LLM training.

flowchart TD
  Pretrained[Pretrained base model] --> SFT[Supervised fine-tuning on demonstrations]
  SFT --> Reference[Reference policy]
  Prefs[Human preference pairs] --> Reward[Reward model]
  Reference --> PPO[PPO update: reward minus KL penalty to reference]
  Reward --> PPO
  Reference --> DPO[Direct preference optimization]
  Prefs --> DPO
  PPO --> Aligned[Aligned policy]
  DPO --> Aligned

Direct Preference Optimization

Direct Preference Optimization (DPO) avoids a separate reward-model-plus-RL loop by optimizing the policy directly from preference pairs:

The chosen response is pushed up relative to the reference model, and the rejected response is pushed down relative to the same reference. This often makes preference optimization simpler to implement than PPO-based RLHF, though the quality still depends on data, evaluation, and the suitability of the preference objective.

PPO Loop

A PPO loop is the iterative reinforcement-learning stage used in many classic RLHF pipelines. The current policy samples responses, the reward model scores them, the KL penalty compares the current policy to the reference policy, and PPO updates the policy under a clipped objective. That loop is more operationally complex than DPO because it needs sampling, reward evaluation, KL control, optimizer updates, and monitoring for reward hacking or policy drift.

Caveats

Preference optimization can reward verbosity, sycophancy, over-refusal, or stylistic features that annotators prefer in isolation but users do not want in a real workflow. It also does not replace retrieval, tool safety, privacy controls, or domain evaluation. A model can score well on preference data and still fail under adversarial prompts, long-horizon agent tasks, or specialized professional standards.

Connections

References