Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path →
InstructGPT,
explained.
GPT-3 could do almost anything — and reliably do the wrong thing. Ask it a question and it might answer, or ramble, or list more questions, because it was only ever trained to continue text. InstructGPT closed that gap with a deceptively simple idea: don't just show the model more text, show it what humans actually prefer — and teach it to chase that. It's the recipe that turned a raw predictor into an assistant.
Contents 16 sections
The delta The alignment gap The idea: put a human in the loop Step 1 — Supervised fine-tuning Step 2 — The reward model Step 3 — Reinforcement learning with PPO What it doesn't solve Why it still matters How it works The math The evidence Since then Solve it yourself Questions Check yourself Where this sitsWhat changes here: the objective stops being prediction
Rung 1, so the comparison is against the pretrained model it starts from. A language model is trained to predict likely continuations of text, and that is simply not the same task as doing what a user asked. Given an instruction, the most likely continuation in the training corpus might be more instructions, a restatement, or a plausible-sounding evasion. The model is not failing; it is succeeding at a different objective from the one you want. Naming that as an objective mismatch rather than a capability gap is this rung's framing contribution.
The fix is a three-step pipeline, and every rung above modifies exactly one of its steps. One: collect demonstrations of the desired behaviour and fine-tune on them supervised. Two: collect human rankings of several model outputs for the same prompt and train a reward model to predict them. Rankings rather than scores is a deliberate choice — people are consistent when comparing two things and inconsistent when assigning absolute numbers. Three: optimise the model against that reward with PPO, plus a penalty for drifting too far from the step-one model, because a reward model is only accurate near the outputs it was trained on.
The unit to carry up the ladder is the result that made this recipe universal: a 1.3B-parameter InstructGPT was preferred by human evaluators over the 175B GPT-3 model. Same pretraining family, roughly a hundredth of the parameters, better outputs. That is the strongest statement anywhere on this site that post-training is not polish — it is a capability multiplier large enough to substitute for two orders of magnitude of scale.
The alignment gap
GPT-3 was trained on one objective: predict the next word across the internet. That makes it astonishingly capable and subtly misaligned. Its goal is "what text is likely to come next," which is not the same as "what would be helpful, honest, and safe to say." The two often coincide — and often don't.
So raw GPT-3 would answer a question with another question (a plausible continuation), invent citations, ignore an instruction it found less likely, or happily produce toxic text if the prompt leaned that way. The model wasn't broken; it was doing exactly what it was trained to do. The problem was that next-word prediction is a proxy for helpfulness, not the thing itself. InstructGPT's question: how do you train for the thing itself, when "helpful" has no loss function?
The idea: put a human in the loop
You can't write down a formula for "a good answer." But a person can look at two answers and say which is better. InstructGPT's insight is to turn that human judgment into a training signal — a technique called reinforcement learning from human feedback, or RLHF.
The plan has three stages: first teach the model the general shape of good answers from human demonstrations; then distill thousands of human comparisons into a reward model that can score any answer; then let the language model practice against that reward, improving toward what people prefer. Humans can't rank every output the model will ever produce — so you train a model to imitate their taste, and optimize against that.
Step 1 — Supervised fine-tuning
Start simple. Collect a set of real prompts (many from the OpenAI API), and have human labelers write the ideal response to each. Then fine-tune GPT-3 on these prompt→response pairs with ordinary supervised learning. This is SFT: the model learns, by imitation, the general format and manner of a helpful answer — follow the instruction, stay on topic, be direct.
SFT alone already makes a big difference. But it has a ceiling: it can only imitate the specific demonstrations written, and writing demonstrations is slow and expensive. Worse, for any prompt there are many good answers and the model has no way to learn which is better — imitation treats every demonstration as equally correct. To go further, you need a signal about preference, not just a single target.
Step 2 — The reward model
Ranking is cheaper than writing. So instead of asking labelers to author perfect answers, InstructGPT shows them several answers the SFT model generated for the same prompt and asks them to rank them best to worst. These comparisons are the raw material of alignment.
A separate reward model — itself a Transformer — is then trained to predict those human preferences: given a prompt and a candidate answer, output a single scalar "how much a human would like this." Trained on enough comparisons, it becomes a stand-in for human judgment that can score any answer instantly, at scale, without a person in the loop. It's how you compress "human taste" into something an optimizer can chase.
People are inconsistent at assigning absolute scores ("is this a 7 or an 8?") but reliable at relative judgments ("A is better than B"). Building the reward model from pairwise comparisons plays to what humans are actually good at.
The objective that turns "A beats B" into a scalar reward is Bradley-Terry. Model the probability a human prefers answer A as a sigmoid of the reward gap, then train the reward model to maximize the probability of the human's actual choice:
That single formula is the heart of RLHF — and the same loss DPO later optimizes directly, skipping the RL.
It's simpler than it looks: push the winner's reward up and the loser's down until the gaps reproduce the rankings. Trained on enough pairs, the scalar it outputs is a model of human taste — and the runnable version below recovers a full ranking from comparisons alone, no scores ever shown.
Step 3 — Reinforcement learning with PPO
Now the model can practice. Treat the language model as a policy: it takes a prompt, generates an answer, and the reward model scores it. Using PPO (Proximal Policy Optimization), the policy is nudged to produce answers the reward model rates highly. Over many rounds, the model drifts toward outputs humans prefer — more helpful, more on-instruction, less toxic.
There's a crucial safety belt. If you let the policy optimize the reward model freely, it will find degenerate outputs that game the score — reward hacking — and drift into gibberish the reward model happens to like. So a KL-divergence penalty tethers the policy to the original SFT model, punishing it for straying too far. The result is aligned, but still fluent and sane.
What it doesn't solve
InstructGPT is aligned — but aligned to whom? The preferences come from a small pool of contractors following OpenAI's guidelines. "Helpful and harmless" is defined by that specific group, and the paper is candid that this is not a neutral, universal standard. Scale the method and you scale one set of values.
It also doesn't cure hallucination — the model still states falsehoods confidently, just less often. A determined user can still jailbreak it into harmful output. And the reward model is a leaky proxy: optimize hard enough and the policy learns to please the reward model rather than actual humans. RLHF made models dramatically more useful without making them truthful or safe by construction — those remain open problems.
Why it still matters
InstructGPT is the missing half of the modern assistant. GPT-3 supplied the raw capability; InstructGPT supplied the alignment that made that capability usable by ordinary people typing ordinary requests. A few months after this paper, the same recipe — SFT, reward model, PPO — wrapped in a chat interface, became ChatGPT.
RLHF is now the default finishing step for frontier models, and the ideas here seeded a whole research line: reward modeling, preference optimization, and lighter-weight successors like DPO that skip the separate reward model entirely. If GPT-3 proved a big model is a powerful engine, InstructGPT proved that human preference is the steering wheel — and that steering can matter more than horsepower.
GPT-3 (capability) → InstructGPT (align with RLHF) → ChatGPT (chat interface). This paper is the middle link — the one that made the other two add up to a product hundreds of millions of people use.
How InstructGPT was trained, step by step
InstructGPT starts from GPT-3 checkpoints at three sizes, 1.3B, 6B and 175B parameters, and from real prompts that early customers sent to the OpenAI API. About 40 contractors, hired through Upwork and Scale AI and screened for how well they spotted potentially harmful outputs, wrote the demonstrations and the rankings. Everything downstream inherits their judgment, and the paper reports how often they agreed with each other: about 73% of the time.
- Build the prompt set. API prompts were deduplicated, filtered for personal information and split by user ID, so no customer appears in both training and evaluation. Because the API at first received few instruction-style prompts, labelers also wrote three kinds of their own: plain tasks, few-shot prompts with several query and response pairs, and prompts based on use cases described in API waitlist applications.
- Supervised fine-tuning on demonstrations. Labelers wrote the desired output for about 13k training prompts. GPT-3 was fine-tuned on them for 16 epochs with cosine learning-rate decay and residual dropout of 0.2. Validation loss began to overfit after one epoch, but more epochs kept improving reward-model scores and human ratings, so the checkpoint was chosen by reward-model score rather than by loss.
- Collect rankings, not scores. For about 33k prompts, labelers ranked between K = 4 and K = 9 model outputs from best to worst. One ranking implies K(K − 1)/2 pairwise comparisons, from 6 to 36 per prompt.
- Train a 6B reward model. The reward model is a 6B SFT model whose unembedding layer is replaced by a head that outputs one scalar. All comparisons from one prompt form a single batch element: each output needs one forward pass instead of one per pair, and shuffling the correlated pairs into a flat dataset made the model overfit within one pass. A 175B reward model trained unstably, so every PPO run used the 6B one. Because the loss only sees reward differences, a bias was added so labeler demonstrations average a reward of 0 before RL.
- Optimize with PPO in a bandit setting. An episode is one prompt from about 31k API prompts and one sampled response; the reward model scores the full response and the episode ends. A per-token KL penalty against the SFT model is subtracted, the value function is initialized from the reward model, and training ran for 256k episodes in batches of 512 with a PPO clip ratio of 0.2 and a KL coefficient of β = 0.02.
- Mix in pretraining gradients (PPO-ptx). Plain PPO made the model worse on several public NLP benchmarks. PPO-ptx adds a language-modeling term on pretraining text, eight pretraining examples per RL episode, weighted by γ = 27.8. The models the paper calls InstructGPT are the PPO-ptx ones.
- Evaluate on held-out customers. Labelers compared outputs on prompts from customers absent from training, rated overall quality on a 1–7 scale and flagged specific failures such as made-up facts or ignored constraints. A separate group of held-out labelers, who wrote no training data, repeated the comparisons.
Four networks in training, one at inference
The PPO step keeps four networks busy: the policy and the value network, both being trained, plus a frozen SFT copy for the KL term and the frozen reward model. Only the policy ships. At inference InstructGPT is an ordinary language model that samples a response; the reward model and the PPO machinery leave nothing behind except the weights they shaped.
The reward-model loss and the PPO-ptx objective
The reward model is trained on every pair from a ranking at once:
The policy then maximizes:
C(K, 2)— the number of pairs in one ranking; dividing by it gives every prompt equal weight however many outputs were ranked.rθ(x, y)— the 6B reward model's scalar for prompt x and response y; with the logisticσ, each pair is a Bradley–Terry comparison.β · log(π^RL / π^SFT)— the KL penalty, applied per token; β = 0.02.γ · E[log π^RL(x)]— ordinary language-modeling likelihood on pretraining text; γ = 27.8. With γ = 0 the paper calls the model PPO, with γ > 0 PPO-ptx.
At the extremes: β → 0 lets the policy chase the reward model's mistakes, while a very large β pins it to the SFT model and nothing is learned. A very large γ turns training back into language modeling. The chosen γ greatly reduced the benchmark regressions without lowering labeler preference scores.
What InstructGPT measured, and what it found
The main metric was how often labelers preferred a model's output over the 175B SFT model's, on prompts from customers held out of training. Baselines were GPT-3, GPT-3 with a carefully written few-shot prompt, and 175B GPT-3 fine-tuned on the public FLAN and T0 instruction collections. Public benchmarks covered truthfulness, toxicity, bias and standard NLP tasks.
| Comparison or benchmark | Result |
|---|---|
| 175B InstructGPT vs 175B GPT-3 | preferred 85 ± 3% of the time |
| 175B InstructGPT vs few-shot 175B GPT-3 | preferred 71 ± 4% |
| 175B InstructGPT vs GPT-3 tuned on FLAN, on T0 | preferred 78 ± 4%, 79 ± 4% |
| 1.3B InstructGPT vs 175B GPT-3 | 1.3B preferred, with over 100× fewer parameters |
| Made-up facts on closed-domain tasks | about 21%, against 41% for GPT-3 |
| Toxicity when prompted to be respectful | about 25% fewer toxic outputs |
| Bias (Winogender, CrowS-Pairs) | no significant improvement |
On TruthfulQA the introduction reports truthful and informative answers about twice as often as GPT-3; the results discussion calls the gain small but significant, and the 1.3B PPO-ptx model was slightly worse than GPT-3 of its size. Held-out labelers preferred InstructGPT at about the same rate as the labelers who produced training data, and reward models trained on some labeler groups predicted a held-out group's preferences only slightly less accurately.
The negative results matter as much. Plain PPO regressed on SQuAD, DROP, HellaSwag and WMT 2015 French-to-English translation; PPO-ptx greatly reduced that alignment tax and beat GPT-3 on HellaSwag, but still trailed on DROP, SQuADv2 and translation. Without the respectful prompt the toxicity advantage disappeared, and when explicitly asked for toxic text, InstructGPT produced much more of it than GPT-3. It had learned to follow instructions, including bad ones.
What the authors admit, and what happened next
Three admissions, all of which became research areas. The alignment tax: the aligned model gets worse on some academic benchmarks than the base model, and the paper reports this rather than selecting metrics that hide it. Whose preferences: the model is aligned to the preferences of a small group of contractors and a handful of researchers' guidelines, which the paper states plainly — "aligned" is a relation to a specific group, not a property. And reward over-optimisation: push hard enough against a learned reward and you find its errors rather than the behaviour it was meant to encode, which is what the drift penalty exists to contain.
The pipeline's operational cost is also real and under-stated at the time: step three holds four models in play at once, and reinforcement learning on a language model is delicate to keep stable.
How it held up: the three steps became the industry default within a year, and the fact that a chat assistant feels like a different kind of artefact from a language model is this paper's doing. Every rung above is an attack on one of its three steps — rungs 2 and 3 on where the data comes from, rungs 4 and 5 on the cost of the gradient step, rungs 6 and 7 on the optimiser, rungs 8 and 9 on what the reward measures. The admission that has aged most importantly is the second one, because it reframes alignment as a question about whose values are being encoded — which is what the next rung makes explicit and auditable.
Train a reward model from preferences
Step 2 is the crux of RLHF, and it's small enough to run. This trains a real reward model with the Bradley-Terry objective: eight answers with a hidden quality, a pile of "A beats B" human judgments, and a scalar reward per answer learned by gradient descent — the model is never shown a score. Watch the loss fall and the learned rewards line up with the true ranking it was never told. This is exactly how human taste gets compressed into a number an optimizer can chase.
Write the body of pref. Everything else in the file is
already written; this is the function the paper is about. Press ▶ Run to check it against
the 5 assertions below — they start red.
- The preference model is a monotonic sigmoid of the reward gap
- Equal rewards give a coin-flip preference
- Training reduces the Bradley-Terry loss
- The learned reward ranks the truly-best answer on top
- The model reproduces the human ranking with high accuracy
Questions people ask about InstructGPT
What is the PPO-ptx objective in InstructGPT?
PPO-ptx is the objective InstructGPT's final models were trained with, and it has three parts. The first is the reward model's score for a sampled response. The second subtracts beta times the log-ratio between the policy and the supervised fine-tuned model, a per-token KL penalty that keeps the policy near the outputs the reward model was trained on; the paper used beta of 0.02. The third, the ptx term, adds gamma times the ordinary language-modeling log-likelihood of pretraining text, with gamma of 27.8 and eight pretraining examples per RL episode. Setting gamma to zero gives plain PPO, which regressed on benchmarks such as SQuAD, DROP and HellaSwag. Mixing the pretraining gradient back in greatly reduced those regressions without lowering labeler preference scores.
How was the InstructGPT reward model trained?
The reward model starts from a 6B supervised fine-tuned GPT-3 with its final unembedding layer replaced by a head that outputs a single number. For about 33k prompts, labelers ranked between four and nine model outputs, and each ranking was expanded into every pairwise comparison it implies. The loss is the negative log of a sigmoid of the reward difference between the preferred and the rejected output, averaged over all pairs from that prompt. All pairs from one prompt are processed as a single batch element, which needs only one forward pass per output and avoided the overfitting the authors saw when pairs were shuffled independently. A 175B reward model was tried but trained unstably, so all reinforcement learning used the 6B one.
Why did InstructGPT ask labelers to rank 4 to 9 outputs instead of comparing two?
Ranking is a cheap way to collect many comparisons. A labeler who orders K outputs has implicitly judged K times K minus 1, divided by 2, pairs, so ranking 9 outputs yields 36 comparisons for the cost of reading 9 answers once. Reading the outputs is the expensive part of labeling, so this multiplies the training signal per hour of human time. The catch is that pairs from the same ranking are highly correlated, since they share a prompt and one labeler's judgment. Treated as independent examples, they made the reward model overfit within a single pass over the data, which is why InstructGPT trains on all pairs from one prompt together as a single batch element.
What is the alignment tax in InstructGPT, and how was it reduced?
The alignment tax is the drop in performance on standard NLP benchmarks that came with aligning the model to human preferences. After plain PPO training, the model got worse than GPT-3 on SQuAD, DROP, HellaSwag and WMT 2015 French-to-English translation, even as labelers preferred its outputs. The fix was PPO-ptx: mixing gradients from the original pretraining objective into the reinforcement-learning updates. That greatly reduced the regressions without lowering preference scores, and it even pushed the model above GPT-3 on HellaSwag, although gaps remained on DROP, SQuADv2 and translation. The concern behind the term is practical: if alignment visibly costs capability, developers have a reason to skip it.
How did InstructGPT compare with GPT-3 fine-tuned on FLAN and T0?
The authors fine-tuned 175B GPT-3 on two public instruction collections, FLAN and T0, to test whether academic NLP tasks could stand in for real user prompts. Both improved on plain GPT-3 but fell short of the supervised model trained on labeler demonstrations, and labelers preferred 175B InstructGPT over the FLAN model 78% of the time and over the T0 model 79% of the time, each with a margin of about 4 points. The paper's explanation is a distribution mismatch: public datasets concentrate on tasks that are easy to score automatically, such as classification and short-answer question answering, while real API traffic is mostly open-ended generation and brainstorming. Training on what users actually ask mattered more than training on many tasks.
Did InstructGPT make GPT-3 more truthful and less toxic?
Partly. On closed-domain tasks such as summarization, InstructGPT made up information about half as often as GPT-3, roughly 21% against 41%. On TruthfulQA it gave more truthful and informative answers, although the paper calls the gain small, and the 1.3B model did slightly worse than GPT-3 of the same size. Toxicity fell by about 25% only when the prompt asked the model to be respectful; without that instruction the advantage vanished, and when asked to be toxic, InstructGPT complied more readily than GPT-3. On the Winogender and CrowS-Pairs bias benchmarks there was no significant improvement. The model became better at following instructions, which helps when the instruction is good and hurts when it is not.
4 questions to test what you just read
Work each one out before you open it — a number, a prediction or a reason, not a definition. Producing the answer is what makes it stick. Your progress is kept on this device.
A labeler ranks K = 6 outputs for one prompt. How many comparisons does that give the reward model, and how many reward-model forward passes does InstructGPT's batching need for them?
Show answer
15 comparisons, since C(6, 2) = 6 · 5 / 2 = 15. Because all pairs from one prompt are a single batch element, each of the 6 outputs is scored once and the 15 pairwise losses reuse those scores: 6 forward passes, instead of 30 if every pair were processed separately.
If you set β = 0 and γ = 0 in the PPO-ptx objective, which two failures would you predict?
Show answer
With β = 0 nothing ties the policy to the SFT model, so it drifts toward outputs the 6B reward model overrates. That model was only trained on outputs near the SFT distribution, so this is reward hacking. With γ = 0 the pretraining term is gone too, so the benchmark regressions (the alignment tax) go uncorrected. The paper's β = 0.02 and γ = 27.8 exist to prevent exactly these two failures.
The reward-model loss only sees differences between two rewards. Why shift the trained model so that labeler demonstrations average a reward of 0 before RL?
Show answer
Adding a constant to every reward leaves σ(rw − rl) unchanged, so after training, the reward model's absolute level is arbitrary. PPO, however, consumes absolute rewards: they are combined with the KL penalty, and the value network has to predict them. Normalizing fixes the arbitrary offset to a meaningful zero, roughly the quality of a labeler demonstration, so rewards and value estimates start on a known scale.
InstructGPT produced about 25% fewer toxic outputs when asked to be respectful, but more toxic text than GPT-3 when asked to be toxic. Why do both results follow from the same training?
Show answer
During training, labelers were told to prioritize helpfulness to the user, so the reward model learned to reward faithful instruction-following and the policy learned to follow instructions better. A respectful instruction is followed more faithfully, and so is a toxic one. Refusing a harmful request needs a training signal for harmlessness, which this objective did not emphasize.
Teaching a base model to follow
A pre-trained model completes text; it does not take instructions. Nine papers on getting from one to the other, from RLHF to a loss with no reward model in it.
Explore the topic
See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.
More Paper Breakdowns
- Attention Is All You NeedThe paper that introduced the Transformer — the architecture underneath GPT, BERT, Claude, and Gemini. Self-attention, Query/Key/Value, multi-head attention, positional encoding, and the real BLEU results, explained in depth with analogies and animated visuals, not just equations.Read →
- BERTThe paper that made "pre-train once, fine-tune anywhere" the default for NLP. Bidirectional context, masked language modeling, next-sentence prediction, the [CLS]/[SEP] tokens, and the GLUE sweep — explained with analogies, not just equations.Read →
- Chain-of-Thought PromptingShow a model a few worked examples with their reasoning and it starts solving problems it used to fail. Why reasoning emerges only at scale, the GSM8K jump, zero-shot "Let's think step by step", and how CoT seeded modern reasoning models.Read →
- LoRAThe paper that made fine-tuning affordable. Freeze the giant pretrained model and train two tiny low-rank matrices instead — up to 10,000x fewer trainable parameters, no extra inference latency, and swappable per-task adapters. The road to QLoRA and PEFT.Read →
- Direct Preference OptimizationRLHF without the RL. Align a model to human preference pairs with one simple classification-style loss — no separate reward model, no unstable reinforcement learning. Why "your LM is secretly a reward model", and how DPO became the default alignment method.Read →
- ChinchillaThe compute-optimal scaling law that said models were too big. Parameters and training tokens should scale together — ~20 tokens per parameter — so a 70B model trained on 1.4T tokens beat the 280B giants. Why every model since trains on trillions of tokens.Read →