Instruction Tuning Datasets: Building FLAN & Alpaca-Style Data
From next-token prediction to following instructions
A base language model, pre-trained purely to predict the next token over a huge text corpus, is good at continuing text plausibly — but plausible continuation is not the same as being helpful. Ask a raw base model "Explain photosynthesis to a 10-year-old" and it might just as easily continue with more similar-looking questions as actually answer the one you asked, because nothing in next-token prediction specifically rewards following an instruction. Instruction tuning is the fine-tuning step that closes this gap: training the model on a dataset of (instruction, response) pairs so it learns the general pattern of "when given a task description, produce a response that actually does that task," rather than just continuing text in a stylistically similar way.
The quality of this transformation depends almost entirely on the quality of the instruction dataset — which is why, since 2021, a huge amount of NLP research effort has gone specifically into how these datasets get built.
FLAN: converting existing NLP tasks into instructions
FLAN (Finetuned Language Net), from Google, took a specific approach: rather than writing brand-new instructions, it converted dozens of existing, well-established NLP benchmark datasets (translation, summarization, sentiment classification, question answering, and many more) into a shared instruction-following format, by writing multiple natural-language templates for each task. A sentiment classification example that was traditionally just (text, label) gets reformatted as something like "Does the following review express a positive or negative sentiment? [review text]" with the label as the expected response.
The key finding from FLAN was that the diversity of task types mattered more than the volume of examples per task — fine-tuning on a large number of distinct task categories, each phrased multiple different ways, produced much stronger generalization to brand-new, unseen instructions than fine-tuning on fewer tasks with more examples each. This is strong evidence that instruction tuning teaches a general skill ("follow the instruction, whatever it is") rather than memorizing task-specific patterns.
Alpaca: generating instructions with a model, not humans
Writing thousands of diverse, high-quality (instruction, response) pairs by hand is expensive. Alpaca, from Stanford, popularized a different and much cheaper approach: use a strong existing LLM (in Alpaca's case, GPT-3.5-level models) to *generate* a large synthetic instruction dataset, starting from a small seed set of human-written examples. The process, following the earlier "Self-Instruct" method, works roughly as follows: sample a handful of seed instructions, prompt a strong model to generate new, similar-but-different instructions along with model-written responses, filter out low-quality or near-duplicate results, and add the survivors back into the pool to seed the next round.
This let Alpaca produce 52,000 instruction-response pairs for a fraction of the cost of human annotation, and fine-tuning a smaller open model on this synthetic dataset produced surprisingly strong instruction-following behavior — demonstrating that a capable "teacher" model's generations can be distilled into a smaller "student" model's instruction-following ability, a technique now widely used across the open-model ecosystem.
Note
Where data quality problems actually bite
Low-quality instruction data manifests in specific, identifiable failure modes. Inconsistent response style (some responses are terse, some rambling, some overly hedged) teaches the model an unstable notion of what a "good" response looks like, producing inconsistent output quality. Sycophantic or unnecessarily agreeable responses in the training data (a very common artifact of using another LLM to generate responses) teach the model to prioritize sounding agreeable over being correct. Near-duplicate instructions with inconsistent responses — the same underlying question phrased two different ways, answered two different ways in the training set — create contradictory training signal, as the model is implicitly told two incompatible things are both correct.
This is also why heavy filtering and deduplication is such a large fraction of the actual engineering effort in building these datasets: the generation step (using a model or templates to produce raw candidates) is often the easy part; curating that raw output down to a clean, consistent, genuinely diverse set is where most of the quality comes from.
FLAN vs. Alpaca-style instruction datasets
| Aspect | FLAN | Alpaca-style (Self-Instruct) |
|---|---|---|
| Instruction source | Reformatted existing NLP benchmark tasks | LLM-generated from a small human seed set |
| Response source | Existing benchmark gold labels | LLM-generated |
| Human effort | Writing instruction templates per task | Writing ~100-200 seed examples, then filtering |
| Diversity driver | Breadth of underlying benchmark tasks | Generative diversity of the teacher model |
| Main risk | Templates still resemble benchmark format, not natural use | Inherits teacher model's biases, errors, sycophancy |
| Cost to scale | Limited by number of existing benchmarks | Cheap to scale, limited by filtering quality |
Note
What's next
Instruction tuning teaches a model to follow instructions, but it doesn't by itself teach the model which of several valid-looking responses humans actually prefer — that's the job of reinforcement learning from human feedback (RLHF), layered on top. The next lesson covers a specific failure mode of that process: reward hacking, where a model learns to exploit its reward model rather than genuinely improve.
I build these systems professionally.
Whether it's a RAG pipeline, analytics migration, or AI workflow — let's talk.