Welcome to the post-PPO landscape: alignment after Proximal Policy Optimization. We will move from reward-model reinforcement learning toward preference objectives that are stabler, cheaper, and easier to audit.
Preference learning replaces hand-written rules with a comparator: given two responses, a human labeler chooses the better one, and we fit a Bradley Terry reward model whose log odds define an implicit utility.
The motivation is concrete: PPO is on-policy, sensitive to the K L penalty, and vulnerable to reward hacking when the learned reward is misspecified; small trust-region errors become large behavior changes.
Our roadmap compares three representatives: Direct Preference Optimization, K L regularized trajectory optimization, and off-policy relative policy optimization, spanning closed-form preference fitting, constrained sequential control, and reuse of logged comparisons.
The through-line is the alignment tax: how much capability, sample efficiency, and evaluation reliability each method trades away to keep the policy near a trusted reference.
Next we derive the objectives, inspect gradient pathologies, and ask which assumptions actually prevent deceptive or over-optimized behavior rather than merely benchmark gains.
Reinforcement Learning from Human Feedback (RLHF) Recap
We revisit reinforcement learning from human feedback, the alignment recipe behind InstructGPT, in which a learned reward signal steers a pretrained policy toward human preferences.
The slide summarizes three pillars: the Taste Tester analogy for pairwise preference elicitation, the base model's characteristic failure modes, and the reward model that distills those judgments.
The Taste Tester formalizes pairwise comparison: a human ranks two sampled completions, and those rankings are fit with a Bradley Terry preference model.
Before feedback, the base model is a pure next token predictor: fluent, but it maximizes likelihood rather than helpfulness, so generations drift toward misaligned behavior.
Human comparisons train a reward model, a scalar head over the residual stream, whose scores drive proximal policy optimization with a Kullback Leibler penalty to the reference policy.
Together, preference data, reward model, and constrained policy gradient constitute the RLHF loop, the prerequisite for direct preference optimization and more recent alignment methods.
Equations, code and original cards
RLHF Recap: Preference Learning and Reward Modeling
Key Concepts of RLHF
• Taste Tester: pairwise preference elicitation
• Base model failure modes: likelihood vs. alignment
• Reward model: Bradley-Terry head, PPO with KL penalty
Moment 03 / 11
Human Feedback Simulation: Be the Taste Tester
Start here: this simulation isolates the preference step of reinforcement learning from human feedback, turning rankings into reward.
Each scenario shows candidate completions from the same policy. Drag the better completion into the target; your pairwise choice is one preference label, not an absolute grade.
The metrics approximate a learned reward model: helpfulness should rise, toxicity should fall, and changes across iterations expose label noise and annotator disagreement.
Vary your selections and watch the policy drift toward the reward you induce; that is the lesson of InstructGPT and the failure mode called reward hacking, or Goodhart's law.
Equations, code and original cards
Moment 04 / 11
Mathematical Framework of Direct Preference Optimization (DPO)
DPO, introduced by Rafailov and colleagues, replaces explicit reward modeling and PPO with a closed form preference objective. The key move is to read the language model as its own implicit reward, regularized toward a reference policy by a KL term.
Preference data are triples: a prompt, a chosen completion y plus, and a rejected completion y minus. Under a Bradley Terry model, the probability that y plus wins is the sigmoid of the reward gap, so the dataset gives pairwise constraints rather than absolute scores.
The loss is the negative log likelihood of those pairwise outcomes: minus the sum over examples of log sigmoid of beta times the log ratio of policy to reference on the chosen completion, minus the same log ratio on the rejected completion. It is a logistic regression on implicit reward differences.
Formally, the implicit reward is beta times the log of pi theta of y given x divided by pi reference of y given x. Substituting the RLHF optimum into Bradley Terry yields one convex objective in the policy logits, with no separate reward network.
Optimization needs the gradient with respect to theta. By the chain rule, the sigmoid residual one minus sigma of the reward margin gates each pair, while the policy score difference supplies the direction in parameter space.
The gradient is minus the sum of delta times that residual, times the score of the chosen response minus the score of the rejected response. Confident mistakes get large weight; pairs already classified correctly contribute almost nothing.
So the pipeline is: derive the closed form optimum of KL regularized RLHF, express the reward as a log policy ratio, and maximize pairwise likelihood. Watch beta, reference drift, length bias, and preference noise; DPO is simple, but its inductive bias is entirely in those choices.
Equations, code and original cards
Direct Preference Optimization: Closed-Form Preference Learning
Manipulate the chosen and rejected reward sliders to probe the DPO loss, which fits preferences directly on the policy without an explicit reward model.
Watch the sigmoid of beta times the log probability margin reshape the loss surface, and track how the implicit reward gap moves the entropy term.
Cycle through the preset scenarios to build intuition for why DPO matches PPO-based RLHF empirically while avoiding its instability and computational overhead.
This ablation clarifies how Rafailov's closed-form Bradley-Terry preference model yields stable, supervised-style optimization without sampling rollouts.
Equations, code and original cards
Moment 06 / 11
KTO: Model Alignment as Prospect Theoretic Optimization
KTO means Kahneman-Tversky Optimization. It uses a prospect-theory-inspired objective and can learn from individual outputs labeled desirable or undesirable.
It is not Kahneman-Tversky Optimization or KL Target Optimization. The choice of feedback and objective matters; no method is universally best.
Equations, code and original cards
KTO: Model Alignment as Prospect Theoretic Optimization
KTO means Kahneman-Tversky Optimization. It uses a prospect-theory-inspired objective and can learn from individual outputs labeled desirable or undesirable.
It is not Kahneman-Tversky Optimization or KL Target Optimization. The choice of feedback and objective matters; no method is universally best.
Moment 07 / 11
ORPO: Monolithic Preference Optimization
ORPO means Odds Ratio Preference Optimization. It combines a supervised negative-log-likelihood term with a preference term comparing chosen and rejected output odds.
The original method does not require a separate reference model. Odds are p divided by one minus p; odds and probabilities are different.
Equations, code and original cards
ORPO: Monolithic Preference Optimization
ORPO means Odds Ratio Preference Optimization. It combines a supervised negative-log-likelihood term with a preference term comparing chosen and rejected output odds.
The original method does not require a separate reference model. Odds are p divided by one minus p; odds and probabilities are different.
Moment 08 / 11
Advanced Implementation: Python and PyTorch Code Examples
Let's implement preference optimization in PyTorch, translating the Direct Preference Optimization objective of Rafailov and colleagues into working code.
Here is the DPO loss as a PyTorch function. Note that log softmax followed by gather extracts the per-token log probabilities the objective requires, with autograd handling differentiation.
The loss compares log probabilities of chosen versus rejected completions, scaled by the temperature beta, which controls how sharply the policy separates the two responses.
The inline comments map each operation to its mathematical counterpart: gather indexes per-token log probabilities, and the mean averages the Bradley-Terry preference term across the batch.
The training loop is standard: zero the gradients, forward the batch, backpropagate the preference loss, then step Adam at three times ten to the minus five.
For efficiency, use mixed precision, gradient accumulation when memory limits batch size, and profiling to locate bottlenecks; reference model log probabilities can be precomputed and cached.
These examples close the gap between the DPO derivation and a runnable system, giving you a template for reward-free preference optimization on your own datasets.
Equations, code and original cards
Advanced Implementation: DPO in Python and PyTorch
# DPO loss (simplified; full objective subtracts reference-model log probs)
import torch
def dpo_loss(logits, chosen_ids, rejected_ids, beta=1.0):
# Per-token log probabilities via log_softmax + gather
logp_chosen = torch.log_softmax(logits, dim=-1).gather(-1, chosen_ids.unsqueeze(-1)).squeeze(-1)
logp_rejected = torch.log_softmax(logits, dim=-1).gather(-1, rejected_ids.unsqueeze(-1)).squeeze(-1)
# Bradley-Terry preference term, scaled by inverse temperature beta
return -torch.mean(beta * (logp_chosen - logp_rejected))# Gradient computation and training loop
optimizer = torch.optim.Adam(model.parameters(), lr=3e-5)
model.train()
for batch in dataloader:
optimizer.zero_grad()
logits = model(batch['input_ids'])
loss = dpo_loss(logits, batch['chosen_ids'], batch['rejected_ids'])
loss.backward() # Autograd: d loss / d theta
optimizer.step() # Adam parameter update# Efficiency optimizations and best practices
# - Mixed precision (bf16) for throughput
# - Gradient accumulation when memory caps batch size
# - Cache reference-model log probs (computed once)
# - Profile to identify bottlenecks
# Inline comments map code to the underlying math
Moment 09 / 11
Research Trends and Future Directions (2026)
We survey the research frontier for 2026, where preference optimization, scaling behavior, and alignment failures increasingly determine whether capability gains translate into trustworthy systems.
Preference learning has moved beyond PPO-based RLHF toward direct preference optimization and its variants, which fit a reward signal implicitly from pairwise comparisons and avoid reinforcement learning's instability.
Scaling laws remain the predictive backbone: Kaplan and colleagues showed loss follows a power law in parameters, data, and compute, while Chinchilla corrected the tradeoff toward roughly twenty tokens per parameter.
Alignment does not obviously scale with capability. Larger models acquire sharper situational awareness and more convincing deception, so evaluation, interpretability, and control must improve faster than the behaviors they constrain.
The open problems are concrete: reward hacking under distribution shift, scalable oversight of superhuman outputs, pluralistic value aggregation, and whether compute-optimal scaling worsens or eases these failure modes.
The through-line is that alignment is now a scaling problem, not an afterthought: the same laws driving capability also shape the difficulty of keeping systems corrigible.
Equations, code and original cards
Research Trends and Future Directions (2026)
Preference optimization, scaling laws, and alignment at the frontier
Advanced Quiz: Conceptual and Computational Assessment
Let's assess what you've internalized. Work through each question independently — reward model derivation, KL-constrained policy optimization, the PPO versus DPO trade-off — and commit to an answer before checking.
Once you've completed all questions, we'll walk through the results together and resolve any lingering gaps in the alignment pipeline.
Equations, code and original cards
Moment 11 / 11
Summary and Key Takeaways
We close by consolidating preference-based alignment: reward modeling, KL-regularized RLHF, and direct objectives that bypass explicit rewards.
Preference learning matters because scalar rewards are misspecified; pairwise comparisons under a Bradley-Terry model give a lower variance signal for aligning policies with human intent.
We contrasted DPO, KTO, and ORPO: DPO fits a closed-form log-ratio objective, KTO uses prospect-theoretic gains and losses, and ORPO adds an odds-ratio penalty to supervised fine-tuning.
The tradeoff is stability versus expressivity: DPO is simple but sensitive to beta and coverage, KTO handles unpaired labels, while ORPO is cheap yet can distort supervised behavior.
Open problems include reward hacking under distribution shift, preference noise and annotator bias, scalable oversight, calibration and abstention, and evaluation that predicts deployment behavior rather than benchmark rank.
Operationally, freeze data provenance, tune beta or KL weight, monitor gradient norm and KL, red-team, and gate release on held-out human judgments.
The throughline is that alignment is an empirical control problem: choose the loss, reference policy, data, and safeguards so the deployed model remains helpful, honest, and corrigible under shift.
Equations, code and original cards
Preference Alignment: Key Takeaways
• Pairwise preferences under Bradley-Terry outperform hand-designed scalar rewards
• Practice: provenance, beta or KL tuning, gradient and KL monitors, red teams, held-out human eval
MAKE IT YOURS
Explain the change.
References, scope & corrections
Research snapshots in the source material are not a claim of current state of the art. The reference review corrects identified errors; it is not exhaustive certification of every historical statement. Source code snippets are examples, not a tested production training system.