TL;DR
Bai and colleagues at Anthropic trained chat assistants to be helpful and harmless. They collected people's choices between two replies, trained a preference model on those choices, and used that model as a reward for reinforcement learning with PPO. The trained models scored better than plain language models on most language tests, so making them safer did not cost general skill in their experiments.
Builds on: Reinforcement Learning from Human Feedback (RLHF), Reward Model, Proximal Policy Optimization (PPO), Language Model · Leads to: AI Alignment
Why it mattered
This paper is one of the first detailed public reports of a complete RLHF pipeline applied to a large chat assistant, with the data, the scaling results and the failure modes described. The team released its comparison data as the HH-RLHF dataset on GitHub, so other groups could train and test preference models on the same material. Many later assistant models use the same basic recipe: collect pairwise human judgements, fit a reward model, then optimize a policy against it with a penalty that keeps the policy near its starting point.
The paper also gave a concrete answer to a common worry, the "alignment tax": the idea that making a model safer makes it less capable. In their experiments the smaller models showed the tax, while the 13B and 52B models were better after RLHF on zero-shot NLP tasks and about the same on few-shot tasks.
The problem
By 2022, large language models could continue text fluently, but they did not reliably do what a user wanted. A plain model asked a question might ramble, and asked for something harmful it might comply. Writing rules by hand for every case is not practical, and a fixed dataset of good answers is expensive to make and cannot cover what a user will type.
The paper's question was narrower and testable. Can human preference judgements, which are easy to give ("this reply is better") but hard to write as a rule, be turned into a training signal for a language model that makes it more helpful and more harmless, without damaging its other abilities? The prerequisites are the idea of a Language Model that scores text, the reward model that turns a human choice into a number (Reward Model), and the reinforcement learning loop that uses such a number to change a policy (Reinforcement Learning from Human Feedback (RLHF)).
How it works
The pipeline runs in four stages. Trace one tiny case: a prompt asks "How do I keep a cut clean?", and the model writes two candidate replies, A and B.
- Collect comparisons. A crowdworker chats with the model. At each turn the model shows two replies, and the worker picks the more helpful one (or, in Red Teaming, the more harmful one). Each pick is one comparison: a prompt, two responses and a label. Check: the worker picks A, so the record is prompt, A, B, label A.
- Train a preference model (PM). The PM reads the whole conversation and one response and outputs a single score. Training pushes the score of the chosen response above the score of the rejected one. Check: after training, PM(prompt, A) is higher than PM(prompt, B) on this record.
- Run reinforcement learning. The policy, which is the language model being trained, writes a full reply to each prompt. The PM scores the finished reply, and PPO updates the policy to make high-scoring replies more likely. Check: a reply the PM scores at 2.0 is more likely after the update than before, given the same prompt.
- Keep the policy near its start. A penalty subtracts a measure of how far the policy has moved from its starting model (KL divergence). Without it, the policy can find replies that fool the PM. Check: a reply that gets a high PM score but moves the policy far away is penalized, so the total reward falls.
flowchart LR P[Prompt] --> R[Model writes two replies] R --> H[Crowdworker picks one] H --> M[Train preference model] M --> S[Score new replies] S --> U[PPO update of the policy] U --> R
The paper repeats this loop. Its last stage, called "iterated online" training, refreshes the preference model and the policy about once a week with new comparisons from the newest policy.
The math
Stage 2, the preference model, produces a score for each response. The paper's calibration check uses the logistic form. If two responses have a PM score difference , the predicted probability that the higher-scored one is preferred is
A difference of 0 gives probability one half, and a large positive difference gives a probability close to one. The paper plots measured accuracy against this curve to check that the PM's confidence matches how often humans agree.
Stage 4 in symbols
Stage 4 subtracts a penalty from the PM score. Write for the current policy, for its starting snapshot, and for the KL divergence between them, which measures how much the two output distributions differ. The reward used by PPO is
The paper sets , a very small coefficient, and notes that is typically below 100 during training, so the penalty is usually small.
The main empirical relation in symbols
During the early phase of RL training the paper finds that the PM score gain grows roughly linearly with the square root of the KL divergence:
Here and are fitted constants. The authors call this an approximate pattern seen across their runs. They support it with a heuristic argument from a series expansion, not a formal proof, and they speculate that the relation could give an upper bound on the reward reached for a given KL.
Worked numbers
These small calculations apply the formulas above.
- Calibration. A PM gives reply A a score of 1.5 and reply B a score of 0.5, so . Then . Since is about 0.368, . The model is about 73 percent confident that a crowdworker would prefer A. Equal scores would give 50 percent, which is no information.
- KL penalty. A reply scores 3.0 under the PM, and the policy's KL divergence from its start is 20. With , the penalty is , so the total reward is . A second reply scores 3.2 with KL 100: the penalty is 0.1 and the total is 3.1. The ranking is unchanged here, which fits the small coefficient the paper uses.
- Dataset counts. The static set has 44k helpfulness and 42k red-teaming comparisons in its base part, plus 52k helpfulness and 2k red-teaming from rejection sampling. Helpfulness: 44k + 52k = 96k. Red-teaming: 42k + 2k = 44k. Together 96k + 44k = 140k. Adding the 22k helpfulness comparisons of the online set gives 140k + 22k = 162k.
Results
The paper's main findings, with its own numbers:
- Alignment bonuses. The 13B and 52B RLHF-trained models performed better than the base models at zero-shot NLP evaluations and the same at few-shot evaluations. The paper reports that the larger RLHF models beat base models on every task it summarizes except TriviaQA.
- Coding and summarization. Natural-language RLHF applied to code-finetuned models improved their programming ability on the paper's evaluations. Mixing summarization preference data with the HH data caused no drop in either task, according to the paper.
- PM scaling. PM accuracy followed roughly log-linear trends in dataset size and model size. The paper trained seven models from 13M to 52B parameters, roughly four times larger at each step.
- Calibration. PM accuracy tracked the calibrated curve for the static data.
- Helpfulness and harmlessness. Figure 1 compares helpful-only and helpful-and-harmless models on both helpfulness and harmlessness, using Elo scores and win rates against the 52B context-distilled model.
- Iterated online training. Weekly refreshes over about five weeks improved crowdworker preference for the models. In a controlled comparison with equal-sized datasets, a run trained on a mixture of base, rejection-sampling and online data was preferred over a run trained on the base data alone.
- Robustness. The paper found an approximately linear relation between the square root of the KL divergence and PM score gain. For mixing data, the paper reports that increasing the weight from 1 to 10 reduced helpfulness accuracy by 7.4 percent for the 13M model but only 1.5 percent for the 52B model.
Limits. The results come from one family of models, from crowdworkers working through one interface, and from comparisons where the PM was trained on data generated by 52B models. The authors state that smaller policies were harder to stabilize, and that RLHF improved honesty only somewhat. Two cautions follow from the paper's findings. A higher PM score does not always mean a better reply, because PM calibration falls at high scores. And helpfulness and harmlessness data pull against each other: PMs trained on one kind of data perform far below chance on the other, so mixing the data matters.
Reading guide
- Introduction and Section 1.1: the two datasets, the three data tranches, and the claim that alignment costs little capability. Read with Reinforcement Learning from Human Feedback (RLHF) in mind.
- Section 2, Data collection: the comparison interface and the red-teaming instructions. The idea of a comparison is the one in Reward Model.
- Section 3, Preference modeling: how PMs are trained and checked for calibration. Calibration uses probabilities, as in Bradley–Terry Model.
- Section 4, RLHF: the PPO setup and the KL penalty. Read with Proximal Policy Optimization (PPO) and Kullback–Leibler Divergence.
- Section 5, Competing objectives and specialized skills: the mixing experiments and out-of-distribution detection. The language is that of AI Alignment.
- Section 6 and Section 7: sample dialogues, comparisons with human writers, and limitations. These use the ideas above without new math.
- Appendices: training details and crowdworker information. Read as a reference.
Check yourself
QuestionIn the HH-RLHF pipeline, what does the preference model learn from, and what does it output?Show answer
It learns from crowdworker comparisons, each a prompt with two responses and a choice of the preferred one. For a prompt and a response it outputs a single score, and training pushes the score of the chosen response above the rejected one.
QuestionA PM gives reply A a score of 2.0 and reply B a score of 1.0. What probability does the logistic calibration formula give that A is preferred? Give a number.Show answer
The difference is , so . The model is about 73 percent confident that A is preferred.
QuestionWhy does the paper subtract a KL penalty from the reward during RL?Show answer
Without it, the policy could move far from its starting model to find replies that the PM scores highly but that are not what the PM was trained to reward. The penalty keeps the policy near its start, so the reward model is used only in the region where its scores are reliable.
QuestionA team wants to use the HH idea for a company's assistant, but has only helpfulness data. What risk does the paper identify, and what would you check?Show answer
The paper finds that training on one kind of data alone leaves the other kind poorly served: PMs trained only on helpfulness or only on harmlessness perform far below chance on the other. The team should measure harmlessness directly, for example with red-teaming prompts, before deploying, rather than assume helpfulness training is enough.