Skip to content

Instruction tuning: teaching a model to follow tasks it hasn't seen

How FLAN-style instruction tuning and T0-style prompted multitask training turn a text predictor into a model that follows instructions, why the task mixture and templates matter, and how to test it honestly.

Advanced ~12 min8 steps

What runs in CodeSplash

You will be able to

  • Describe the data instruction tuning trains on and the loss it minimizes
  • Explain why the mixture of tasks and their weights shape the result
  • Explain template sensitivity and how T0-style training uses many templates per task
  • Design a held-out evaluation on unseen task families and unseen templates

Read first

01

From predicting text to following instructions

Read

A pretrained language model continues text. Ask it "Translate to French: cheese" and it may continue with another instruction. Instruction tuningInstruction tuningFine-tune a language model on many tasks written as instructions with answers, so it follows new instructions. fine-tunes it on many tasks rewritten as an instruction, an input and the expected answer, with the usual next-token loss on the answer only.

After enough different tasks, the model follows instructions for tasks it never trained on. That generalization across tasks, not skill on the training tasks, is the goal.

02

The mixture is a design choice

Read

FLAN-style training draws examples from many datasets at once. Each task gets a sampling weight, so the overall loss is a weighted average of the task losses. Large datasets are usually capped so they don't drown out small ones.

In the reference's example, three tasks with weights summing to one and losses near one give a mixture loss of 1.06. Change the weights and the same model gets a different loss, and a different training signal: which tasks dominate decides what the model gets good at.

03

Templates matter

Read

The same task can be worded many ways: "Is this review positive?", "Review: … Sentiment:", "Would the writer recommend it?". Models can be surprisingly sensitive to the wording.

T0-style prompted multitask training writes each dataset with many templates and trains on all of them. In the reference's example, the loss for the right answer under three templates averages 0.550 but spans 0.693 from best to worst template. That spread is the template sensitivity; a single template hides it.

04

Testing it honestly

Read

An instruction-tuned model is only as good as the tasks it was not trained on:

  • hold out whole task families (say, every natural-language-inference dataset), not only rows;
  • score each held-out task under several templates and report the spread;
  • check the held-out benchmarks for overlap with the training mixture.

CodeSplash doesn't instruction-tune models; this lesson is explained here. The local models behind Label with AI and the LLM classifier are instruction-tuned, which is why a plain-language label description works at all. Their sensitivity to wording is why CodeSplash lets you compare prompts on rows you've labeled yourself.

05

Predict: one template

Predict

Predict first

A paper reports an instruction-tuned model's zero-shot accuracy on a held-out task using one prompt template. What does the number measure?

It measures the model's skill at the taskIt measures the model's skill at the task under that one wording
Reveal

The skill under that wording. Another template can move the score substantially. Ask for the spread across several templates before comparing models.

06

What runs here

Read
07

Check: instruction tuning

Checkpoint

Check yourself

What does FLAN-style instruction tuning train on?

Show the answer

Answer: a

Instruction tuning is supervised fine-tuning on instruction-formatted tasks. Rankings and reward models belong to preference tuning.

Check yourself

One dataset in the mixture is 100 times larger than the rest. What does capping its share do?

Show the answer

Answer: a

With proportional sampling, the big dataset would supply almost every example. Capping rebalances the mixture's weights.

Check yourself

Which evaluation tests generalization to new tasks?

Show the answer

Answer: b

Held-out rows of a trained task test memory of that task. Held-out families test following new instructions.

Check yourself

Why does T0-style training write each dataset with many templates?

Show the answer

Answer: a

Training on many phrasings makes the model less dependent on any one, though sensitivity rarely disappears.

Check yourself

Two models score 71% and 69% on a held-out task, each under one template. Across ten templates, each model's accuracy spans about 10 points. What can you say?

Show the answer

Answer: b

A gap smaller than the wording effect isn't evidence. Compare across the same templates, paired.

08

Recap

Recap
  • Instruction tuning fine-tunes on many tasks phrased as instructions; the goal is following unseen ones.
  • The task mixture and its weights decide what the model gets good at.
  • Templates matter: train on many, and evaluate under many, on held-out task families.
  • CodeSplash uses instruction-tuned models but doesn't train them; this is explained here.

Concepts in this lesson