skip to content

Search

← The Language Machines

Part III — The Alignment Era (2021–2023)

Instruction Tuning

FLAN and T0 task mixtures, and self-instruct bootstrapping.

2021–2022 13 min read 7 papers

It is September 2021. GPT-3 has shown that a large enough language model can perform new tasks from a handful of examples pasted into its prompt, but ask it a question directly — zero examples, plain English — and it often continues your text instead of answering it. A Google paper called FLAN proposes a fix that costs less than 2% of pretraining compute: fine-tune the model on dozens of existing NLP datasets, each rewritten as a natural-language instruction, and it learns to follow instructions it has never seen.

Where We Were

The field had two paradigms for getting work out of a pretrained model, and both had a gap in the middle. The first was pretrain-then-finetune: take BERT or T5, fine-tune on a labeled dataset, and get one specialist model per task. It worked, but every new task needed its own training run and its own labeled data. The second was in-context learning, introduced with GPT-3 in May 2020: no gradient updates at all, just demonstrations in the prompt. It generalized, but few-shot prompts consumed context, required careful engineering, and zero-shot performance — the setting closest to how a person actually asks for things — lagged well behind.

The gap had a simple diagnosis. A pretrained language model is trained to continue text, not to satisfy requests. “Summarize this article:” is, to a next-token predictor, just a string that plausibly precedes more strings — sometimes a summary, sometimes another instruction, sometimes a list of similar homework problems. T5 had already unified every task into text-to-text form in October 2019, but its task prefixes were terse codes like “translate English to German:”, learned per task, not natural language a user would type.

An early measurement of the middle path came in April 2021. Natural Instructions (Mishra et al., 2021) collected 61 distinct tasks with their human-authored crowdsourcing instructions and 193k task instances, and showed that models fine-tuned with instructions generalized to unseen tasks 19% better than models trained without them — evidence that instructions themselves, not just task data, carried transferable signal. What was missing was scale, on both axes: bigger models and broader task mixtures.

From few-shot prompting to a bootstrapped instruction-tuning recipe, 2020 to 2023 Two teams name and then out-scale the same idea, and by the end a model writes its own training data. Grey monospace text is the paper's headline number or the month it landed. 2020 GPT-3 few-shot in-context learning only no gradient updates at all 175B, prompted May 2020 2021 Natural Instructions 61 tasks, crowdsourced instructions transfer, +19% 193k task instances April 2021 2021 FLAN, T0 instruction tuning is named and matched at 16x smaller 137B beats GPT-3 on 20/25 Sept, Oct 2021 2022 InstructGPT, Super-NI reward model plus PPO 1616 tasks, expert-written human feedback begins Mar, Apr 2022 2022 Flan-PaLM, ChatGPT 540B, then a shipped product then a model bootstraps data 75.2% MMLU, 100M users Oct, Nov, Dec 2022 2023 Alpaca self-instruct on LLaMA 7B replicates the recipe cheaply under 600 dollars total March 2023 a foundational capability the instruction-tuning win human feedback enters the recipe Card four is the hinge: InstructGPT is where human feedback joins the pipeline, the subject of the next chapter.
InstructGPT is the hinge card: it is where human feedback joins a pipeline that until then had only ever been trained on instructions, not preferences. PNG ↓

The Breakthrough

FLAN: instructions as the training signal. “Finetuned Language Models Are Zero-Shot Learners” (Wei et al., 2021), submitted in September 2021, named the technique instruction tuning and gave it its canonical experiment. The team took LaMDA-PT, a dense decoder-only transformer of 137 billion parameters, and aggregated 62 publicly available text datasets into 12 task clusters — translation, sentiment, natural language inference, summarization, and so on. For each dataset they manually wrote ten unique templates that described the task in natural language (“Is this movie review positive or negative?”), plus up to three inverted variants that turned the task around (from sentiment classification to review generation, say) to keep the model from overfitting to a single format.

The evaluation protocol is what made the claim clean. To test zero-shot performance on natural language inference, they instruction-tuned on every cluster except natural language inference — the model had never seen the task type, only the habit of following instructions. The resulting model, FLAN, beat zero-shot GPT-3 175B on 20 of 25 evaluated datasets, and beat even few-shot GPT-3 on ANLI, RTE, BoolQ, AI2-ARC, OpenbookQA, and StoryCloze. The cost was almost an accounting error: 30k gradient steps with a batch of 8,192 tokens, about 60 hours on a 128-core TPUv3 — under 2% of the pretraining step count.

FLAN's recipe: turn 62 datasets into one instruction-following habit Every arrow is a step Wei et al. took between raw NLP data and a model that follows requests it was never shown. Grey monospace text is the paper's own number for that step. 62 NLP datasets the raw ingredient pool public benchmark data 12 task clusters grouped by task type translation, NLI, summary 10 templates each hand-written natural language plus inverted variants Capped mixture proportional, but capped K = 3,000 per dataset Finetune LaMDA-PT 137B parameter model 30k steps, ~60 hours TPU Evaluate held-out cluster never seen in training genuine zero-shot transfer Beats zero-shot GPT-3 on 20 of 25 datasets under 2% extra compute raw data building the mixture the model and its judgement The held-out cluster is never in the mixture that trains it.
The held-out cluster is the whole experiment: FLAN never trains on the task type it is scored against, so the win is genuine zero-shot transfer, not memorised task data. PNG ↓

The ablations mattered as much as the headline. Performance improved as more task clusters were added. Instructions themselves were load-bearing — fine-tuning on the same data without the natural-language templates generalized far worse. And the benefit was scale-gated: on models of 8B parameters and smaller, instruction tuning actually hurt held-out performance. The paper’s explanation was capacity: “for small-scale models, learning the ∼40 tasks used during instruction tuning fills the entire model capacity, causing these models to perform worse on new tasks.” Only around the 100B scale did the technique reliably pay off — one of the clearest early examples of a scale-dependent behavior of the kind chapter 10 catalogued.

T0: the same idea, 16x smaller. One month later, “Multitask Prompted Training Enables Zero-Shot Task Generalization” (Sanh et al., 2021) — a BigScience collaboration submitted in October 2021 — reached the same destination from a different direction and undercut the scale requirement. T0 was an 11-billion-parameter encoder-decoder initialized from T5+LM, fine-tuned on a mixture built from P3, the Public Pool of Prompts: 2,073 community-written prompt templates covering 177 datasets, contributed by 36 people across 24 institutions. Four task types were held out entirely — natural language inference, coreference resolution, sentence completion, and word sense disambiguation. On these fully unseen tasks T0 matched or exceeded GPT-3, “often outperforming models up to 16x its size.” Where FLAN found instruction tuning only worked at ~100B on a decoder-only model, T0 showed that with an encoder-decoder base and heavy prompt diversity, 11B sufficed. The disagreement was productive: it established that the recipe’s ingredients — base objective, template variety, task count, model scale — could be traded against each other.

Scaling the recipe. The next year turned the recipe into an axis to be scaled like any other. Super-NaturalInstructions (Wang et al., 2022), submitted in April 2022, grew the benchmark to 1,616 tasks across 76 task types with expert-written instructions, and its Tk-Instruct model outperformed InstructGPT by over 9% on the benchmark despite being an order of magnitude smaller. “Scaling Instruction-Finetuned Language Models” (Chung et al., 2022), submitted in October 2022, pushed both axes at once — 1.8K tasks, models up to 540B — and folded in chain-of-thought training data. Flan-PaLM 540B improved on base PaLM by 9.4% on average across its evaluation suite and reached 75.2% on five-shot MMLU; the released Flan-T5 checkpoints made strong instruction-following available at sizes that ran on a single GPU.

Self-Instruct: the model writes its own curriculum. By late 2022 the binding constraint was no longer method but data. Every mixture above was built from academic NLP datasets — classification, extraction, inference — which cover a narrow slice of what people actually ask a model to do, and writing new instruction data by hand is slow and expensive. “Self-Instruct: Aligning Language Models with Self-Generated Instructions” (Wang et al., 2022), submitted in December 2022, closed the loop: use the pretrained model itself to generate the instruction data. Starting from just 175 human-written seed tasks, the pipeline prompts the model with 8 in-context examples (6 human-written, 2 model-generated) to write new instructions, classifies each as a classification or open-ended task, generates matching input-output instances, filters near-duplicates, and recycles survivors into the pool. The run produced roughly 52K instructions with 82K instances. Fine-tuning vanilla GPT-3 on this self-generated data yielded a 33% absolute improvement on Super-NaturalInstructions — approaching the performance of InstructGPT-001, which was trained with private human-written data.

Self-Instruct: the model writes its own training data, then filters itself A tiny human seed set grows into 52K instructions through a loop the model runs on itself, exiting only through a similarity filter. Grey monospace text is the paper's count or method for that step. 175 seed tasks written by humans the only manual step Task pool grows every iteration shared list of tasks LM generates 8 in-context examples 6 human, 2 model-written Classify, instantiate input-first or output-first matches the task type ROUGE-L filter reject near-duplicates max overlap below 0.7 survivors re-enter the pool 52K instructions 82K total instances the finished dataset Finetune GPT-3 vanilla, no RLHF trained on the self-set +33 points absolute, on Super-NI nears InstructGPT-001 the human-provided seed the pool and its output a generation or training step the filter's judgement The loop never stops on its own: every survivor of the ROUGE-L filter re-enters the pool it came from.
The only human step is the 175 seed tasks; everything after that is the model generating, judging and filtering its own curriculum. PNG ↓

The Mathematics

Instruction tuning changes no architecture and no loss function — it changes what the familiar next-token objective is computed over. Each training example is a source instance xx with target yy, drawn from task tt and rendered through an instruction template ItI_t; the model is trained to produce the target given the instruction-wrapped input:

L(θ)=− Et∼p(t)  E(x,y)∼Dt∑k=1∣y∣log⁡pθ ⁣(yk∣It(x), y<k)\mathcal{L}(\theta) = -\,\mathbb{E}_{t \sim p(t)}\; \mathbb{E}_{(x,y) \sim D_t} \sum_{k=1}^{|y|} \log p_\theta\!\left(y_k \mid I_t(x),\, y_{<k}\right)
SymbolMeaning
θ\thetaModel parameters being fine-tuned
t, p(t)t,\ p(t)A task and the mixture distribution over tasks
DtD_tThe labeled dataset for task tt
It(x)I_t(x)Input xx rendered through one of task tt‘s instruction templates
yk, y<ky_k,\ y_{<k}The kk-th target token and the target tokens before it

The mixture p(t)p(t) is where the engineering lives. Datasets range from hundreds of examples to millions, and sampling proportionally would let the giants drown the rest. FLAN adopted T5’s examples-proportional mixing with a hard cap — it limited training examples per dataset to 30k and used a mixing-rate maximum of 3,000, so that “a dataset does not receive additional sampling weight for examples in excess of 3,000”:

p(t)=min⁡(∣Dt∣, K)∑t′min⁡(∣Dt′∣, K)p(t) = \frac{\min\left(|D_t|,\, K\right)}{\sum_{t'} \min\left(|D_{t'}|,\, K\right)}
SymbolMeaning
p(t)p(t)Probability of drawing the next example from task tt
∣Dt∣\lvert D_t \rvertNumber of training examples in task tt‘s dataset
KKMixing-rate cap, 3,000 in FLAN
t′t'Index running over all tasks in the mixture

Self-Instruct adds one more piece of machinery: a diversity filter on the generated pool. A candidate instruction InewI_{\text{new}} joins the task pool P\mathcal{P} only if it is sufficiently unlike everything already there:

max⁡I∈P ROUGEL(Inew, I)<0.7\max_{I \in \mathcal{P}} \ \mathrm{ROUGEL}\left(I_{\text{new}},\, I\right) < 0.7

What It Enabled

The immediate effect was a new column in every model comparison: not “which tasks was it fine-tuned on?” but “does it follow instructions?” The before/after is stark when laid out:

Pretrain-then-finetune (2018–2020)Prompted GPT-3 (2020–2021)Instruction-tuned (2021–)
Models per taskOne specialist eachOne generalistOne generalist
New task costLabeled data + training runPrompt engineering + demonstrationsA plain-English request
Zero-shot usabilityNone — wrong output spaceWeak, format-sensitiveStrong on unseen tasks
Extra training computePer task, repeatedlyZeroUnder 2% of pretraining, once
Data requirementThousands of labels per taskHandful of examples per promptOne shared task mixture

The lineage of instruction-tuned models through 2023 traces the recipe’s three scaling knobs — tasks, model size, and data source:

ModelDateBaseParamsInstruction dataHeadline result
FLAN (Wei et al., 2021)Sep 2021LaMDA-PT137B62 datasets, 12 clusters, hand templatesBeats zero-shot GPT-3 on 20 of 25 tasks
T0 (Sanh et al., 2021)Oct 2021T5+LM11BP3: 2,073 prompts, 177 datasetsOutperforms models up to 16x its size
Tk-Instruct (Wang et al., 2022)Apr 2022T511B1,616 tasks, expert instructionsBeats InstructGPT by 9%+ on Super-NI
Flan-PaLM (Chung et al., 2022)Oct 2022PaLM540B1.8K tasks incl. chain-of-thought75.2% five-shot MMLU
Self-Instruct GPT-3 (Wang et al., 2022)Dec 2022GPT-3175B52K self-generated instructions+33 points absolute on Super-NI
Alpaca (Taori et al., 2023)Mar 2023LLaMA7B52K demos from text-davinci-003Rough parity with its teacher, under 600 dollars

Three downstream threads matter most. First, instruction tuning became the first stage of the modern alignment pipeline. InstructGPT, submitted in March 2022, begins with exactly this kind of supervised fine-tuning on instruction-response demonstrations before adding a reward model and reinforcement learning — the subject of chapter 13 on RLHF — and that pipeline is what shipped as ChatGPT in November 2022 (chapter 14). In retrospect, FLAN and T0 built the layer that makes a language model usable; RLHF built the layer that makes it preferable.

Second, Self-Instruct made instruction data cheap, which made capable chat models reproducible. When Meta released LLaMA in February 2023, Stanford’s Alpaca (March 2023) fine-tuned the 7B model on 52K instruction-following demonstrations “generated in the style of self-instruct using text-davinci-003” — under 500 dollars of API calls for the data, about 3 hours on 8 A100s for the fine-tune, under 600 dollars total, though restricted to non-commercial use. In a blind pairwise evaluation Alpaca won 90 comparisons to its teacher’s 89. A capability that had been a frontier-lab exclusive in early 2022 became a weekend project, igniting the open-model explosion covered in chapter 14. The same move — training on a stronger model’s outputs — is a form of knowledge distillation, and synthetic instruction data became a load-bearing part of the answer to the data question.

Third, the task-mixture mindset persisted even after chat data replaced academic datasets: every modern post-training run is still a weighted mixture of capabilities — reasoning, coding, safety, multilinguality — governed by exactly the capped-sampling arithmetic above.

Two lineages both end up inside ChatGPT and the open models Natural Instructions seeds FLAN and T0, which feed Flan-PaLM and InstructGPT's SFT stage; Self-Instruct seeds Alpaca and the open-model explosion. Grey monospace text is the paper's headline number or date. Natural Instructions 61 tasks, 2021 instructions transfer FLAN 137B names instruction tuning beats GPT-3 zero-shot T0 11B encoder-decoder, P3 prompts matches models 16x larger Flan-PaLM 1800 tasks, incl. CoT 75.2% five-shot MMLU SFT stage of InstructGPT demonstrations, March 2022 ChatGPT ships the recipe November 2022 Self-Instruct December 2022 52K self-generated tasks Alpaca on LLaMA 7B under 600 dollars Open-model explosion 2023 llama.cpp, Mistral, more Synthetic training data becomes a standard tool standard in post-training a foundational seed an instruction-tuning or open-model win the stage that opens onto RLHF FLAN's SFT stage and Self-Instruct's synthetic data are the two techniques that made post-training effective and cheap.
Both lineages converge on the same destination by different routes: one scales hand-built task mixtures into a shipped product, the other makes instruction data cheap enough for anyone to replicate it. PNG ↓

Key Papers

PaperAuthorsYearLinkWhy it matters
Cross-Task Generalization via Natural Language Crowdsourcing InstructionsMishra et al.2021arXiv:2104.08773Natural Instructions: 61 tasks, first measured evidence that instructions transfer across tasks
Finetuned Language Models Are Zero-Shot LearnersWei et al.2021arXiv:2109.01652FLAN: named instruction tuning; 137B model beats zero-shot GPT-3 on 20 of 25 tasks
Multitask Prompted Training Enables Zero-Shot Task GeneralizationSanh et al.2021arXiv:2110.08207T0: 11B encoder-decoder with 2,073 community prompts matches models 16x larger
Super-NaturalInstructions: Generalization via Declarative Instructions on 1600+ NLP TasksWang et al.2022arXiv:2204.07705Scaled the benchmark to 1,616 tasks; Tk-Instruct beat InstructGPT at a tenth the size
Scaling Instruction-Finetuned Language ModelsChung et al.2022arXiv:2210.11416Flan-PaLM: 1.8K tasks plus chain-of-thought data; 75.2% MMLU; released Flan-T5
Self-Instruct: Aligning Language Models with Self-Generated InstructionsWang et al.2022arXiv:2212.10560Bootstrapped 52K instructions from 175 seeds; made instruction data nearly free
Alpaca: A Strong, Replicable Instruction-Following ModelTaori et al.2023Stanford CRFMSelf-Instruct-style data on LLaMA 7B for under 600 dollars; opened the floodgates

PM Lens

Papers referenced