Nestor G Pestelos Jr · Reference · Print this page

Archived version captured 20260911. Read the current entry.

Artificial Intelligence · Model Alignment

Reinforcement Learning from Human Feedback (RLHF), archived 20260911

Reference entry · last updated September 10, 2026

Reinforcement learning from human feedback (RLHF) is a machine learning method that fits a reward model to human comparisons of candidate outputs, then optimizes a generative policy against that learned reward while a divergence penalty holds the policy near its starting point. It is the dominant post-training step for aligning large language models with instructions, tone, and safety norms that are simple to judge by example but hard to write down as a rule.

1. First Principles: Preference as the Training Signal

RLHF exists to optimize an objective that cannot be written directly. Qualities such as helpfulness, harmlessness, and honesty have no closed-form scoring function, but a person shown two responses to the same prompt can usually say which one is better. RLHF converts that comparative judgment into a scalar reward and then into gradient updates.[1]

The method assumes a latent reward function \(r^*(x, y)\) over prompt \(x\) and response \(y\), and models a human's pairwise choice with the Bradley-Terry model: given a preferred response \(y_w\) and a rejected response \(y_l\), the probability that a rater picks \(y_w\) is[2, 8]

$$P(y_w \succ y_l \mid x) = \sigma\big(r^*(x, y_w) - r^*(x, y_l)\big)$$

where \(\sigma\) is the logistic function. Only reward differences are identifiable, so an additive constant is free, and the model treats disagreement between raters as logistic noise around a single shared utility.

Given a reward function, the alignment target is the Kullback-Leibler (KL) constrained policy objective. The tuned policy \(\pi_\theta\) should raise expected reward without moving far from a reference policy \(\pi_{\text{ref}}\), usually the supervised fine-tuned model:[4]

$$\max_\theta \; \mathbb{E}_{x \sim \mathcal{D},\, y \sim \pi_\theta(\cdot \mid x)} \big[ r(x, y) \big] - \beta \, D_{\text{KL}}\big(\pi_\theta(y \mid x) \,\|\, \pi_{\text{ref}}(y \mid x)\big)$$

The coefficient \(\beta\) sets the price of divergence. A small \(\beta\) lets the policy chase reward and drift into degenerate text; a large \(\beta\) keeps fluency and diversity but limits how much behavior can change. RLHF therefore needs three inputs: a competent base policy, a dataset of human comparisons, and a divergence budget.

2. The Standard Three-Stage Pipeline

The pipeline that produced InstructGPT and most instruction-tuned chat models runs in three stages: supervised fine-tuning, reward model training, and reinforcement learning against that reward.[4]

2.1 Supervised Fine-Tuning

A base model is first fine-tuned on curated prompt-response demonstrations so that it follows the conversational schema and produces on-task answers. This model becomes both the starting point for reinforcement learning and the reference policy \(\pi_{\text{ref}}\) in the KL term.[4]

2.2 Reward Modeling

Human labelers rank or compare multiple sampled responses to each prompt. A reward model \(r_\psi(x, y)\), typically the SFT model with a scalar output head, is trained on these comparisons by minimizing the negative log-likelihood of the Bradley-Terry model:[3, 4]

$$\mathcal{L}(\psi) = -\,\mathbb{E}_{(x,\, y_w,\, y_l) \sim \mathcal{D}} \Big[ \log \sigma\big( r_\psi(x, y_w) - r_\psi(x, y_l) \big) \Big]$$

The reward model compresses a finite set of human comparisons into a function that can score any response. Its accuracy on held-out comparisons, and its behavior far from the data it was trained on, bound the quality of everything downstream.

2.3 Policy Optimization with PPO

The policy is then optimized against the reward model with a policy gradient algorithm, most often Proximal Policy Optimization (PPO).[6] The KL constraint is applied as a per-token penalty folded into the reward, so the quantity actually maximized for a full response is

$$R(x, y) = r_\psi(x, y) - \beta \, \log \frac{\pi_\theta(y \mid x)}{\pi_{\text{ref}}(y \mid x)}$$

Token generation is treated as a sequential decision process: the state is the prompt plus the tokens produced so far, each action is the next token, and the environment transition is deterministic concatenation. PPO's clipped surrogate objective limits how far each update moves the policy; see reinforcement learning for that objective in full. A separate value network estimates the advantage, which adds memory and tuning cost and motivates the offline alternatives below.

3. Direct Preference Optimization

Direct Preference Optimization (DPO) removes the separate reward model and the online sampling loop.[8] Rafailov et al. showed that the optimal policy for the KL-constrained objective corresponds to an implicit reward

$$r(x, y) = \beta \, \log \frac{\pi_\theta(y \mid x)}{\pi_{\text{ref}}(y \mid x)} + \beta \, \log Z(x)$$

where \(Z(x)\) is a partition function that cancels inside a Bradley-Terry difference. Substituting this parameterization into the preference loss gives an objective in the policy alone, trained on a fixed dataset of comparison pairs with a binary cross-entropy loss:

$$\mathcal{L}_{\text{DPO}}(\theta) = -\,\mathbb{E}_{(x,\, y_w,\, y_l)} \left[ \log \sigma \left( \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)} \right) \right]$$

DPO reaches alignment quality comparable to PPO-based RLHF on many benchmarks with a simpler and more stable training loop. Because it only sees a fixed preference set, it cannot gather fresh comparisons on its own current outputs, which online RLHF can.

4. Reward Model Overoptimization

The reward model is a proxy for human judgment, not human judgment itself. Optimizing against it past a point makes the proxy score keep rising while the true quality it stands in for stalls or falls, an instance of Goodhart's law. Gao et al. measured this by holding out a larger "gold" reward model as a stand-in for ground truth and tuning against a smaller proxy.[9] They fit simple functional forms relating the gold-reward gain to the square root of the KL divergence between the tuned and initial policies, with coefficients that vary predictably with reward-model size and the amount of preference data. Larger reward models and more comparisons push the turning point further out but do not remove it. The KL penalty, early stopping on a held-out judge, and reward-model ensembles are the common mitigations.

5. Reinforcement Learning from AI Feedback

Human comparison labeling is the cost and latency bottleneck of RLHF. Reinforcement learning from AI feedback (RLAIF) replaces some or all of the human labels with preferences generated by another language model.[10, 11]

Constitutional AI applies this to harmlessness: the model critiques and revises its own responses against a written list of principles, then a preference model is trained on AI-labeled comparisons and used for the RL stage, keeping human input mostly at the level of the principles.[10] Lee et al. compared RLAIF against RLHF on summarization and dialogue and reported comparable human win rates, along with a variant that scores responses directly with an off-the-shelf model instead of training a separate reward model.[11] AI feedback inherits the biases and blind spots of the labeling model.

6. Limitations and Open Problems

Casper et al. survey the failure modes of RLHF and separate problems that better engineering can address from ones that are structural to the approach.[12] The recurring issues:

7. Development

See also

References

  1. [1] P. Christiano, J. Leike, T. B. Brown, M. Martic, S. Legg, and D. Amodei, "Deep reinforcement learning from human preferences," in NeurIPS, 2017. https://arxiv.org/abs/1706.03741
  2. [2] R. A. Bradley and M. E. Terry, "Rank Analysis of Incomplete Block Designs: I. The Method of Paired Comparisons," Biometrika, vol. 39, no. 3/4, pp. 324–345, 1952. DOI: 10.2307/2334029
  3. [3] Y. Bai, A. Jones, K. Ndousse, et al., "Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedback," arXiv:2204.05862, 2022. https://arxiv.org/abs/2204.05862
  4. [4] L. Ouyang, J. Wu, X. Jiang, et al., "Training language models to follow instructions with human feedback," in NeurIPS, 2022. https://arxiv.org/abs/2203.02155
  5. [5] D. M. Ziegler, N. Stiennon, J. Wu, T. B. Brown, A. Radford, D. Amodei, P. Christiano, and G. Irving, "Fine-Tuning Language Models from Human Preferences," arXiv:1909.08593, 2019. https://arxiv.org/abs/1909.08593
  6. [6] J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov, "Proximal Policy Optimization Algorithms," arXiv:1707.06347, 2017. https://arxiv.org/abs/1707.06347
  7. [7] N. Stiennon, L. Ouyang, J. Wu, D. M. Ziegler, R. Lowe, C. Voss, A. Radford, D. Amodei, and P. Christiano, "Learning to summarize from human feedback," in NeurIPS, 2020. https://arxiv.org/abs/2009.01325
  8. [8] R. Rafailov, A. Sharma, E. Mitchell, S. Ermon, C. D. Manning, and C. Finn, "Direct Preference Optimization: Your Language Model is Secretly a Reward Model," in NeurIPS, 2023. https://arxiv.org/abs/2305.18290
  9. [9] L. Gao, J. Schulman, and J. Hilton, "Scaling Laws for Reward Model Overoptimization," in ICML, 2023. https://arxiv.org/abs/2210.10760
  10. [10] Y. Bai, S. Kadavath, S. Kundu, et al., "Constitutional AI: Harmlessness from AI Feedback," arXiv:2212.08073, 2022. https://arxiv.org/abs/2212.08073
  11. [11] H. Lee, S. Phatale, H. Mansoor, et al., "RLAIF vs. RLHF: Scaling Reinforcement Learning from Human Feedback with AI Feedback," in ICML, 2024. https://arxiv.org/abs/2309.00267
  12. [12] S. Casper, X. Davies, C. Shi, et al., "Open Problems and Fundamental Limitations of Reinforcement Learning from Human Feedback," Transactions on Machine Learning Research, 2023. https://arxiv.org/abs/2307.15217