Paper commentary
Fine-Tuning Language Models from Human Preferences
- Problem Tasks judged only by people have no written reward function, so reinforcement learning cannot optimize them directly. Earlier language RL used automatic scores like BLEU and ROUGE, which are weak proxies for what people want.
- Method The authors fit a reward model to human picks among four candidate continuations. They then fine-tune GPT-2 with PPO against that model, under a KL penalty that keeps it close to the pretrained model.
- Results On stylistic continuation with 5,000 human comparisons, the policy was preferred over zero-shot in 86% of comparisons.
Why ask people for the reward
The study starts from tasks whose success only people can judge, so no reward function can be written down before training begins. The authors argue that settings where people state complex goals to AI agents will usually involve natural language, since language is the medium in which value-laden concepts get expressed. Their route is to ask humans to choose between candidate outputs, fit a model of reward to those choices, and then optimize that model.
Most earlier reinforcement learning for language optimized automatic scores such as BLEU and ROUGE, which the authors treat as weak proxies for the real goal. The few studies that used human judgments as rewards covered narrower cases, such as off-policy reward learning for translation or smoothed rewards for dialog.
Pretraining a large generative language model and then fine-tuning it on supervised tasks performs well, and some tasks work with no training at all in the zero-shot setting. The study combines that pretraining route with human preference learning, fine-tuning pretrained models with reinforcement learning rather than supervised learning. The tasks are stylistic continuation, either toward positive sentiment or toward vivid description, and summarization on CNN/Daily Mail and TL;DR, chosen where supervised data is scarce or programmatic rewards are poor.
Turning comparisons into a reward model
Each training example is a context x, four candidate continuations y0 to y3, and the index b of the candidate a labeler selected. Asking for one choice among four candidates, rather than a rating for each, spreads the effort of reading the context over several options.
The reward model r maps a context and a continuation to a real number and is fit to the collected tuples with the following loss. \[ \mathrm{loss}(r)=\mathbb{E}_{(x,\{y_i\}_i,b)\sim S}\left[\log \frac{e^{r(x,y_b)}}{\sum_i e^{r(x,y_i)}}\right] \] Inside the expectation, the term is the log of a softmax over the four reward values, evaluated at the selected option.
As printed, the expression has no leading minus sign, although the paper calls it the loss, so the direction of optimization has to be read from how the paper fits r to it.
The reward model starts from the pretrained language model's final embedding output, with a randomly initialized final linear layer, rather than from the policy. Its scale is normalized so that it has mean 0 and variance 1 over contexts drawn from the data distribution and continuations sampled from the pretrained model, which keeps the reward scale stable across training.
Keeping the policy near the language model
The policy begins as the pretrained model and is fine-tuned with PPO against the reward model. Optimizing the learned reward without a constraint leads the policy to produce incoherent continuations, so the reward used in RL carries a penalty term. \[ R(x,y)=r(x,y)-\beta \log \frac{\pi(y|x)}{\rho(y|x)} \] The penalty's expectation is beta times the KL divergence between the policy and the pretrained model, and beta sets how strongly the policy is pulled back toward the pretrained model.
The penalty acts as an entropy bonus, keeps the policy in the range where the reward model is reliable, and, for the style tasks, encodes coherence and topicality that humans did not judge directly.
Runs with the same fixed beta can end at very different KL values, so for some experiments beta is adjusted during training to hold KL near a chosen target. \[ e_t=\mathrm{clip}\left(\frac{\mathrm{KL}(\pi_t,\rho)-\mathrm{KL}_{\mathrm{target}}}{\mathrm{KL}_{\mathrm{target}}},-0.2,0.2\right) \] \[ \beta_{t+1}=\beta_t(1+K_\beta e_t) \] The relative gap between measured and target KL is clipped to the interval from -0.2 to 0.2, and it scales beta multiplicatively with K_beta set to 0.1.
When KL exceeds its target, e_t is positive and beta grows.
The training loop has four steps: collect samples from the pretrained policy and have humans pick the best of each set, train the reward model on those picks, run PPO on the modified reward, and optionally keep collecting labels and retraining the reward model.
Model and training settings
The pretrained model is a 774M-parameter GPT-2 variant trained on WebText, using a 50,257-token byte pair encoding that keeps capitalization and punctuation. Stylistic continuation adds a supervised fine-tuning stage on BookCorpus before RL, so those runs go from WebText pretraining to BookCorpus fine-tuning to RL.
Sampling uses a temperature T below 1, implemented by dividing the logits by T, so RL at T = 1 corresponds to a lower temperature of the unmodified model. The temperature is T = 0.7 for stylistic continuation and for TL;DR, and T = 0.5 for CNN/Daily Mail.
The reward model is trained with Adam on the comparison loss, with batch size 8 for style tasks and 32 for summarization, and a learning rate of 1.77× 10−5 for both. It is trained for a single epoch to avoid overfitting to the small amount of human data, and dropout is turned off.
The batch size is 1024 for style tasks and 512 for summarization, dropout is off, and the learning rate is 1.41× 10−5 for style tasks and 7.07× 10−6 for summarization.
The supervised baselines train for one epoch with a cosine-decayed learning rate. The initial value was chosen from 8 log-linearly spaced options between 10−4 and 3× 10−4, which is a search, not a single fixed value. A dropout rate of 0.1 worked best, and the checkpoint with the best validation loss was kept. For TL;DR, 30K examples were removed to form the validation set.
Online versus offline labels
Once the trained policy drifts far from the pretrained model, a reward model trained only on pretrained samples is evaluated on a different distribution, which the authors call distributional shift. Online data collection answers this by sampling from the current policy, collecting new human labels, and retraining the reward model during RL fine-tuning.
The number of labels available before each PPO episode follows a schedule defined by the following function. \[ l(n)=N_{0r}+(N_r-N_{0r})\left(1-(1-n/N_\pi)^2\right) \] Here N_pi is the total number of PPO episodes, set to 2M, N_0r is the initial label count, and N_r is the final label count. Because the quadratic term grows fastest early on, most of the new labels are requested in the first part of training.
Before the nth PPO episode, training pauses if fewer than l(n) labels exist, and new requests are sent so that at least 1000 queries stay outstanding with the labelers. The reward model is trained before the first episode and retrained 19 more times at evenly spaced label counts, each time reinitialized on top of the pretrained model and trained for one epoch over the labels collected so far.
Offline collection is the case where the final label count equals the initial count, so no labels are added during RL.
Validation samples are drawn at a constant rate, pairing pretrained-model outputs with policy outputs, and human labels on them estimate how often the current policy beats the pretrained model. Because they are only used to measure the current policy, these validation samples can also be added to the reward training set.
A controlled check with a mock reward
The mock reward r_s is a classifier trained on a balanced, binarized subsample of Amazon reviews, and its score is the log odds that a review is positive. A simulated labeler always picks the continuation with the higher r_s, so the question becomes how many such queries a reward model needs to optimize r_s.
With 20k to 60k queries, the learned reward model lets the policy reach an r_s value close to the one obtained by RL with direct access to r_s. These mock runs use a 124M-parameter model, with the learning-curve figure targeting a KL of 8 nats over 5 seeds.
Since r_s is known, the optimum under a KL constraint has a closed form, which the authors use to compare their policies with the best achievable reward. \[ \pi_{\mathrm{opt}}(y|x)\propto\rho(y|x)\,e^{r_s(x,y)/\beta} \] The authors estimate its reward by sampling many continuations from ρ(y|x) and reweighting them by e^{r_s/β}, which is only feasible at KL values where sampling is practical.
After training on 2M continuations, the policy still has a significant gap from this optimum, though the gap largely closes with more training.
Stylistic continuation with human labels
Contexts are BookCorpus excerpts of 32 to 64 tokens, and the policy generates 24 more tokens at T = 0.7. Sentiment and descriptiveness are the two human-judged targets, and labelers choose the best of four continuations. The KL divergence targets are 6 nats for descriptiveness and 10 nats for sentiment.
With 5k offline samples, the policy was preferred over zero-shot in 88% of sentiment comparisons and 86% of descriptiveness comparisons. The introduction gives the 86% figure for the stylistic continuation results with 5,000 human comparisons. Each of these comparisons used 1024 four-way comparisons, each rated by a majority of three labelers.
Against the mock sentiment reward model, the 5k offline policy was preferred in 77% of sentiment contexts. Offline and online collection were close: the 5k offline policy was preferred in 50% of sentiment comparisons and 48% of descriptiveness comparisons against the 5k online policy. The 5k offline policy compared with the 20k offline policy split 48% and 47% for sentiment and descriptiveness, so extra labels above 5k did not separate the policies.
Performance with 5k, 10k and 20k reward training samples is similar and degrades only below 5k.
Tables 2 and 3 show three random continuations per policy, and they illustrate outputs rather than measure preference; the preference counts above are the measured evidence.
Summarization setup
Articles or Reddit posts are truncated to 500 tokens, a TL;DR suffix is appended, and for CNN/Daily Mail an Article prefix is added before the policy responds with up to 75 tokens. Articles are cut at their last newline so that they consist of whole sentences.
When summaries are sampled for human raters, rejection sampling keeps only summaries with a newline between tokens 55 and 75, which are cut at that newline. RL gives summaries without such a newline a fixed score of -1. The KL coefficient beta is fixed at 0.1 for CNN/Daily Mail and 0.03 for TL;DR.
The compared summarizers are zero-shot, a supervised baseline, lead-3, the RL fine-tuned models with 15k, 30k and 60k labels, an offline 60k model, and a supervised plus RL model. The purely RL fine-tuned models use contexts from the datasets and ignore the reference summaries, while the supervised and supervised plus RL models use both. Lead-3 copies the first three sentences of the context and is truncated at a period in the same way as the generated summaries, so it is occasionally two sentences.
ROUGE results
On TL;DR the 60k online model averages 11.232 R-AVG, below the supervised baseline at 11.877 and lead-3 at 11.751, while supervised plus RL reaches 12.478.
On CNN/Daily Mail the 60k online model averages 28.731 R-AVG, against 31.082 for the supervised baseline, 31.552 for lead-3 and 31.603 for supervised plus RL. The offline 60k model averages 11.105 on TL;DR and 25.576 on CNN/Daily Mail, so the online model is 3 points higher on R-AVG for CNN/DM at 60k labels.
Pure RL fine-tuning scores below the supervised baseline on ROUGE on both datasets, and supervised plus RL is best on R-AVG for both.
Lead-3 has the highest R-1 and R-2 on CNN/Daily Mail, at 40.379 and 17.658, above supervised plus RL at 40.093 and 17.611. The text says only supervised plus RL beats lead-3 on the other measures, but the TL;DR columns show the supervised baseline above lead-3 on R-1 (17.535 against 17.435) and R-AVG (11.877 against 11.751).
The authors state that ROUGE is not the target, since the goal is reward defined by humans. Differences between the online and offline runs are noisy, and the authors note that different training runs vary considerably.
Human preference on summaries
In pairwise comparisons over 1024 articles per pair, each judged by three labelers, the 60k fine-tuned model won 96% of TL;DR contests and 91% of CNN/Daily Mail contests against zero-shot. Against the supervised baseline it won 97% on TL;DR and 80% on CNN/Daily Mail.
Against lead-3 the 60k model won 45% on TL;DR and 40% on CNN/Daily Mail, so lead-3 was preferred on both datasets. Against the human reference summaries it won 96% on TL;DR and 84% on CNN/Daily Mail. The authors call the reference-win rates worrying, since they imply that labelers prefer the model over human ground truth.
Against the 30k model the 60k model won 40% of TL;DR contests and 62% of CNN/Daily Mail contests, and against the 15k model it won 79% and 47%. The authors describe the data-volume trend as less clear for human evaluation than for ROUGE.
Against the offline 60k model the online 60k model won 64% of TL;DR and 65% of CNN/Daily Mail contests. Human labelers also preferred the TL;DR policy trained with online data in 71% of comparisons. The 60k model won 80% of TL;DR and 74% of CNN/Daily Mail contests against the supervised plus 60k fine-tuned model.
The final comparisons were judged by the same Scale labelers used for training, which the authors say shows the policy fits the human reward but not that the labels capture the real goal.
What the summarizers copy
Novelty statistics for n-grams and sentences show that RL fine-tuning raises copying in the models. The 60k RL fine-tuned models copy whole sentences in 71% of TL;DR summaries and 98% of CNN/Daily Mail summaries. Starting RL from the supervised model copies much less, at 6% for TL;DR and 30% for CNN/Daily Mail.
Where the copied region starts varies. The 60k models place the longest common subsequence of bigrams at different positions in the source, so they copy from varying parts of the article.
To test whether the models skip preambles, the authors check how often the first three words of the article become the first three words of the summary. The 60k model does this in 28.3% of TL;DR articles and 77.6% of CNN/Daily Mail articles overall, but only in 0.2% and 1.4% of articles that have a preamble. Zero-shot does so in 1.3% and 10.4% overall, and 0% and 1.0% with a preamble.
Zero-shot also skips preambles, so the data do not show that the reward model itself is responsible for the skipping.
The authors judged accuracy on 30 articles per dataset, counting summaries that make only statements supported by the source. The 60k model was accurate in 26 of 30 TL;DR articles and 29 of 30 CNN/Daily Mail articles, while zero-shot was accurate in 6 of 30 on both datasets. The text gives 90% and 95% for the same two numbers, so both forms are shown here as printed.
The supervised and supervised plus RL models were accurate in 8 and 11 of 30 TL;DR articles and 19 and 20 of 30 CNN/Daily Mail articles.
Limits
Agreement is low: the authors agree with labelers 38% of the time on sentiment and 46% on TL;DR, and the authors agree with each other about 60% of the time on 4-way sentiment and TL;DR comparisons, against 25% for random guessing. Labelers answered 5% of queries five times to estimate agreement.
Sharing parameters between the reward model and the policy did not work despite several attempts, and the authors attribute this to the imbalance between at most 60k reward samples and 2M policy episodes.
A code refactor flipped the sign of the reward and also the sign of the KL penalty, so the policy learned to output sexually explicit text with negative sentiment.
The fully online pipeline was more complicated to build and debug than separate tasks, and labeler quality problems were often found after the affected data had already been used. The authors plan batched data collection as a middle ground, but this setting is untested in the study.
The summarization comparisons come from single training runs, and the authors state that the online and offline gap could partly be noise, since running multiple seeds with humans is expensive. The released code supports only a 124M-parameter model, so the larger models reported here are not covered by the release.
Paper info
- Authors
- Daniel M. Ziegler, Nisan Stiennon, Jeffrey Wu, Tom B. Brown, Alec Radford, Dario Amodei, Paul Christiano, Geoffrey Irving
- Venue
- arXiv · Preprint
- First published
- 2019-9-18
- Added
- 2026-11-12
- Updated
- 2020-1-8
- Version
- v2
- arXiv
- 1909.08593
- Category
- cs.CL · cs.LG · stat.ML
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Daniel M. Ziegler, Nisan Stiennon, Jeffrey Wu, Tom B. Brown, Alec Radford, Dario Amodei, Paul Christiano, Geoffrey Irving (2019). Fine-Tuning Language Models from Human Preferences. arXiv:1909.08593v2. https://arxiv.org/abs/1909.08593v2
BibTeX
@misc{ziegler2019fine,
title = {{Fine-Tuning Language Models from Human Preferences}},
author = {Daniel M. Ziegler and Nisan Stiennon and Jeffrey Wu and Tom B. Brown and Alec Radford and Dario Amodei and Paul Christiano and Geoffrey Irving},
year = {2019},
eprint = {1909.08593},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1909.08593v2}
}