Instruction Tuning
What it is
Instruction tuning is a fine-tuning approach where models are trained on diverse (instruction, response) pairs across many tasks. Instead of task-specific fine-tuning, instruction-tuned models learn to follow natural language instructions and generalize to unseen tasks. Models like InstructGPT, GPT-3.5, and Claude employ instruction tuning.
[illustrate: Diverse instruction-response pairs from multiple tasks; model learning to follow arbitrary instructions; few-shot prompting on unseen task]
How it works
-
Data collection:
- Gather diverse instruction-response pairs across many tasks
- Example: “Summarize: [text]” → “[summary]”
- Example: “Translate English to French: [text]” → “[translation]”
- Thousands of tasks, 1000s of examples per task
-
Training:
- Fine-tune pre-trained language model on instruction-response pairs
- Standard next-token prediction loss on response tokens
-
Inference:
- Feed instruction in natural language
- Model generates response following instruction
- Often combined with in-context examples (few-shot)
-
Post-training refinement:
- Optional: RLHF (Reinforcement Learning from Human Feedback) to optimize for human preferences
Example
Training data includes pairs like:
- "Summarize: [article]" → "[summary]"
- "Classify sentiment: [review]" → "[sentiment]"
- "Translate to French: [English text]" → "[French text]"
- "Answer: [question] [context]" → "[answer]"
After instruction-tuning:
- User: "Summarize this: [new article]"
- Model: Follows instruction, generates summary
- User: "How do I make pasta?"
- Model: Follows instruction, provides recipe (even if not explicitly trained on recipes)
Variants and history
BERT fine-tuning pioneered task-specific adaptation. T5 (Raffel et al., 2019) unified tasks via text-to-text format. Instruction-GPT (OpenAI, 2022) applied instruction tuning to GPT-3, dramatically improving usability. FLAN (Wei et al., 2021) showed instruction-tuning improves zero-shot and few-shot generalization. Modern LLMs (GPT-3.5, PaLM, Claude) heavily rely on instruction tuning for instruction-following and safety.
When to use it
Use instruction tuning when:
- You want a single model to handle diverse tasks
- Generalization to new instructions matters
- Natural language task description is available
- Safety and helpfulness are important
- Zero-shot and few-shot performance matter
Instruction tuning requires curating diverse, high-quality instruction-response data. Cost: significant engineering to collect data and tune. Benefit: single flexible model replaces many specialized models.