The Problem: Your Model Completes Text, It Doesn't Follow Instructions
Take a raw LLaMA model, fresh out of pre-training. It's an excellent text completer: it has read the entire internet and knows how to predict the next word with impressive accuracy. But tell it "Translate this into English" and it will... sometimes continue your sentence as if writing an article, sometimes rephrase your instruction, sometimes give a correct answer by chance. It's random, because it has never learned to follow instructions.
Instruction tuning (also called SFT, for Supervised Fine-Tuning) fixes this. You show the model thousands of instruction-response pairs until it retains the rule: "when someone asks me a question, I answer, I do not continue the sentence." It is the step that turns a completer into an assistant.
One clarification about where this page sits in the module: instruction tuning describes what you teach the model, not how you teach it. The two combine freely, you can do instruction tuning with LoRA, with QLoRA, or with full fine-tuning, depending on the memory you have.

- Pre-training on a massive corpus: internet, books, code. The model learns the language.
- Instruction tuning on instruction-response pairs. The model learns the role of assistant.
- Alignment on human preferences, via RLHF (Reinforcement Learning from Human Feedback) or DPO (Direct Preference Optimization). The model learns to choose between two equally correct answers.
The difference between steps 2 and 3 is worth stating plainly. At step 2, you show the model one good answer and ask it to imitate it. At step 3, you show it two answers and say which one a human preferred. The first teaches a format, the second a judgement.
The Pioneers: FLAN (2021)
Google launched the movement with FLAN (Finetuned Language Net). The idea was simple: fine-tune a model on more than sixty datasets of natural language processing (NLP) all rewritten as instructions in ordinary language, then see what it can do on tasks it has never seen.
That last point is what counts. The aim is not to improve the model on the training tasks (that would be unremarkable) but on tasks absent from training. This is called zero-shot: no examples given, only the instruction.
Finetuned Language Models Are Zero-Shot Learners (Wei et al., 2021)The result stated in the paper's abstract, and checkable: FLAN, at 137 billion parameters, beats a 175-billion-parameter GPT-3 in zero-shot on 20 of the 25 datasets tested zero-shot, and beats it by a large margin on several of them even when GPT-3 is allowed examples.

Then came FLAN-T5 and FLAN-PaLM, trained on more than 1,800 tasks, with several different phrasings for each. The principle: the more varied the instructions seen during training, the better the model adapts to a new one. Like a student who has worked through very different kinds of exercise and can improvise on exam day.
In parallel, the T0 project, run by the open BigScience consortium, did the same thing collaboratively: the instruction phrasings were written by researchers around the world rather than one team.
The Open-Source Revolution: Alpaca and Self-Instruct (2023)
Stanford had a simple idea: have a more powerful model generate the training data. Starting from 175 hand-written examples, they asked text-davinci-003 (OpenAI's GPT-3.5-generation model) to produce 52,000 more, then fine-tuned LLaMA-7B on those.
The cost Stanford reported: under $500 to generate the data and under $100 for the fine-tuning. Under $600 in total, against the millions spent pre-training the base model.

This technique is called Self-Instruct: give a powerful model a few starting examples and it manufactures thousands more. It is data distillation, the large model's know-how passes into the small one through the examples it writes, with no human annotating anything. An experienced teacher writes the exercises that will train the student.
The result set off a wave: Vicuna, WizardLM and dozens of other open models started rivaling commercial assistants, at trivial cost.
OpenHermes: Quality Above All
OpenHermes 2.5 gathers about a million examples, with two deliberate choices:
- multiple sources (general text, code, mathematics, logical reasoning) rather than one;
- filtering that removes poorly phrased, inconsistent or repetitive examples.
The lesson: raw volume is not what counts, diversity and cleanliness are. The next section returns to this with numbers.
Data Format: The Conversational Standard
{
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain photosynthesis."},
{"role": "assistant", "content": "Photosynthesis is..."}
]
}
This three-role format is what nearly every training library uses. The system role sets general behaviour, user carries the question, assistant the expected answer.
Careful not to conflate two levels. This message structure is a logical representation; to be fed to the model it has to be flattened into plain text, with markers signalling where each turn starts and ends. Those markers differ from model to model: some use special tags like <|im_start|>, others brackets. This is the model's chat template, and it belongs to the model, not to the data format.
Task Diversity: The Real Secret
A good instruction tuning dataset doesn't just contain Q&A. It covers a broad spectrum:
- Open-ended questions: "Explain...", "Describe...", "Compare..."
- Structured tasks: "Translate...", "Summarize...", "Extract the entities from..."
- Reasoning: "Solve this problem...", "Analyze the pros and cons..."
- Creativity: "Write a poem about...", "Invent a story where..."
- Code: "Implement...", "Debug this code...", "Optimize this function..."
- Multi-turn: complete conversations with evolving context
This diversity is crucial. A model trained only on factual Q&A will be bad at creativity. A model trained only on code will be weird in conversation.
The LIMA paper (Meta, 2023) showed that a model fine-tuned on 1,000 carefully chosen examples rivals models trained on hundreds of thousands of ordinary ones. Its title states the thesis: Less Is More for Alignment.
AlpaGasus pushed the same way, filtering Alpaca's 52,000 examples down to the 9,000 best-rated by a judge model, and getting a better model than the full 52,000 gave.
That is a ratio of 1 to 6, which is not trivial: five examples out of six in a well-known dataset contributed nothing, or hurt. The practical conclusion: spend the annotation budget on sorting, not on volume.
Instruction Tuning Best Practices
1. Respect the Model's Chat Template
Every model expects the exact turn markers it was trained with, and those differ between families. A wrong template produces a model that mixes instructions and answers, the most common and most silent mistake, since training runs to completion without ever flagging anything wrong. Use the template shipped with the model; do not rewrite it.
2. Learn Only on the Answer
The model is trained to predict the next word, and the loss (the measure of its error) is computed over every predicted word. It must be computed only on the words of the answer, masked over those of the instruction.
Why? Because otherwise the model is also being trained to invent questions, which nobody needs, and part of its learning capacity goes there. The detail is technical; the effect on quality is large.
3. Aim for Detailed and Structured Responses
The model imitates the style of the responses it sees. Short, sloppy responses produce a sloppy assistant. Well-structured responses, with clear paragraphs and examples, produce a helpful assistant.
4. Diversify Seriously
Don't fine-tune only on factual questions. Vary the domains, response formats, and difficulty levels. The more varied situations the model sees, the better it generalizes.
Data produced by a powerful model inherits its leanings: its style, its turns of phrase, its refusals. The student model cannot surpass its teacher on those dimensions, since it has never seen anything else.
Worse: train on synthetic data, then use the resulting model to generate new data, and repeat, quality degrades with every round. This is model collapse, and the image is a photocopy of a photocopy: each pass loses some of the original's variety, and nothing ever restores it.
The remedy is simple: always mix human-annotated data into synthetic data.
Key Datasets to Know
| Dataset | Size | Source | Strengths |
|---|---|---|---|
| OpenHermes 2.5 | ~1M | GPT-4 + multi | Quality, diversity |
| Dolly-15K | 15K | Human | Free license |
| OASST1/2 | ~160K | Crowdsourcing | Multilingual, multi-turn |
| UltraChat | 1.5M | GPT-3.5/4 | Volume |
| SlimOrca | 518K | Orca filtering | Filtered quality |
The Impact: The Industry Standard Pipeline
Every serious model today follows the same three-step chain: pre-training, instruction tuning, alignment. Instruction tuning is its decisive moment, the one that separates a model that knows things from a model that can help.
The rest of the module covers the third step: RLHF in practice for the tooling, DPO in practice for the variant without reinforcement learning, and Post-fine-tuning evaluation to check any of it worked.
In short. Instruction tuning turns a text completer into an assistant. Without it, the model is an encyclopedia that cannot hold a conversation. And the field's most solid lesson fits in one sentence: a thousand sorted examples beat a hundred thousand scraped ones.
1. In the three-step chain of a modern model, what distinguishes instruction tuning (step 2) from alignment (step 3)?
2. The LIMA paper fine-tunes a model on just 1,000 carefully chosen examples. What lesson does the page draw from that result and from AlpaGasus?
3. Why does the page recommend always mixing human-annotated data into synthetic data?
4. A team fine-tunes a model using its own turn markers instead of the chat template shipped with the model. What should it expect, according to the page?