After SFT a model follows instructions, but its answers are not always the ones people prefer. Preference optimization aligns it using comparisons: RLHF trains a reward model and optimizes with PPO, while DPO reduces the pipeline to a classification-style loss on preference pairs.
A reward model scores a prompt-and-response pair with one number, trained on pairwise comparisons; RLHF, rejection sampling and best-of-n all use it. This page derives the Bradley–Terry loss, measures the accuracy ceiling set by label noise, and reproduces overoptimization in simulation.
Policy gradients, baselines, GAE, PPO clipping and the KL penalty are the toolkit behind RLHF and reasoning RL. This page measures each on a toy task small enough to enumerate exactly: how baselines cut variance, why clipping is not a trust region, and where the KL belongs.
A map of the pipeline from data preparation, pretraining, SFT and preference alignment to evaluation and release, with the public data scale of each stage, plus a 0.86M-parameter byte-level GPT that trains on a laptop CPU to test data mixture, resuming and leakage.
Llama 2 introduced 7B, 13B and 70B base and chat models trained on 2T tokens. Its lasting value is the unusually detailed account of SFT, reward models, rejection sampling, PPO and safety evaluation.
DPO replaces 'reward model plus PPO' with one classification-style loss: given only preference pairs and a frozen reference model, it optimizes the same KL-constrained objective as RLHF. This post checks the derivation, runs a toy world for the frontier and training dynamics, and covers limits.
Constitutional AI swaps human harmlessness labels for a written list of principles: a model critiques and revises its own answers, then ranks answer pairs under those principles (RLAIF). It explains the method, rechecks the paper's numbers and re-runs the labeling step at small scale.
OpenAI's 2022 InstructGPT paper: supervised fine-tuning on about 13,000 human demonstrations, a reward model trained on human rankings of about 33,000 prompts, then PPO. A 1.3B InstructGPT beat the 175B GPT-3 in labeler evaluations. This breakdown checks the data, loss and results, and their limits.
OpenAI ran the full RLHF pipeline on Reddit TL;DR summaries: collect human pairwise comparisons, train a reward model, then optimize the policy with KL-penalized PPO. A 1.3B human-feedback model beat a supervised model 10 times larger. Code checks the KL optimum and over-optimization.
PPO makes policy gradients reusable: a clipped probability-ratio objective allows several minibatch epochs on one batch of data, with TRPO-like stability from first-order optimization only. A CartPole experiment compares no clipping with epsilon 0.1, 0.2 and 0.3, 8 seeds each.