Concepts / Seed Examples and Self-Instruct

Seed Examples and Self-Instruct

Each instruction-finetuning example has an instruction and a response, and AI can synthesize either half or both.

  • Programming

Why Hand-Writing Every Pair Is Slow

Instruction finetuning teaches a model to follow directions by showing it many examples. Each example pairs a request with an answer. Building a large collection of these pairs entirely by hand is slow, so practitioners often ask an AI model to help produce them. The useful question is therefore not whether AI should be involved at all, but which parts of each pair it should produce.

What do you think happens?

Suppose you ask an AI model for a large number of instructions but give it no structure, such as a topic list. What do you expect the set of instructions to look like?

  • Spread evenly across every part of the intended use case

  • Cluster around a few themes and leave large parts of the use case unrepresented

  • Contain exactly one instruction per topic in the use case

Reveal answer
Answer:

Cluster around a few themes and leave large parts of the use case unrepresented

The source warns that unstructured generation tends to cluster around a few themes. Imposing structure before generating is the remedy.

Splitting One Example Into Two Halves

A single training example always has two parts: an instruction, which is the request, and a response, which is the answer. Because there are two parts, there are several ways to assign the work between people and AI. AI can be used to synthesize the instructions, the responses, or both. A team could let AI draft the requests while people write the answers. The reverse arrangement is also possible, with people writing the requests and AI producing the answers. Both halves can also be generated by AI.

InstructionAI-generatedInstructionHuman-writtenResponseHuman-writtenResponseAI-generated
Within one training example, which piece is written by a human and which is synthesized by the AI? The two columns show two possible arrangements of the same two-part example.

Read the diagram column by column. In the first arrangement, the model drafts the requests and a person supplies the answers. In the second, the roles are reversed. Neither arrangement is inherently correct; the source frames the choice as a question of which half each party should produce for a given dataset.

Why Unstructured Requests Cluster

The main risk when generating instructions is coverage. If an AI model is simply asked for instructions with no structure, the results may cluster around a few themes. Large parts of the intended use case can then go unrepresented, even though the dataset looks large. The remedy is to impose structure before generating anything, so that coverage is planned rather than hoped for.

Expanding Topics Into Instructions

A common starting point is a list of topics, keywords, or instruction types that the dataset should contain. Templates can play the same role. For each item on that list, you generate a chosen number of instructions. Coverage then becomes a matter of counting: every topic receives its share. Once instructions exist, each one needs a response, and you can generate one or more responses per instruction. Generating more than one response gives the dataset alternative answers to the same request.

Topic listtopics, keywords, orinstruction typesInstructions pertopica set number for each itemResponses perinstructionone or more eachInstruction-responsepairsthe training datasetexpand each topicanswer each instructioncollect
How one topic branches out into many instructions, and where each stage feeds the next. Each topic yields a chosen number of instructions, and each instruction yields one or more responses.

The topic list does not have to be written by a person. Both the topic list and the templates can be generated by AI. A practitioner can ask a model for a broad set of subjects, review them, and then use that reviewed list as the skeleton for instruction generation. Human review sits between the AI-generated list and the generation step that depends on it.

Tracing Growth From Topics and Seeds

Two real datasets show the two patterns. UltraChat is a multi-turn dialogue dataset that started from topics. Its authors first asked ChatGPT to generate 30 topics about various aspects of daily life, including technology, food and drink, fashion, nature, education, finance, and travel. For each topic, they asked the model to produce 30 to 50 subtopics. The same model then generated instructions and corresponding responses for those subtopics. The pipeline moved from broad topics, to narrower subtopics, to the instruction-response pairs themselves.

Alpaca shows the other pattern, which starts from examples rather than topics. Stanford researchers began with 175 instruction-response examples taken from the Self-Instruct seed dataset. Those seed examples were written to cover a diverse and interesting range of uses. The Alpaca authors then used a GPT-3 model, text-davinci-003, to generate 52,000 instruction-response pairs that mirrored the seed examples. Each generated example follows the pattern of a seed example, so the seed set sets the style and the range that the generated set inherits.

175 seed examplesfrom the Self-Instruct seeddataset52,000 generatedpairsmirroring the seed examplestext-davinci-003 generates pairs
The Alpaca pattern: a small hand-curated seed set is used to produce a much larger set of generated instruction-response pairs. The source gives the start and end counts for this step.

Notice the scale change. The starting set holds 175 items, and the output holds 52,000. The source does not describe the intermediate counts, so the lesson to take from it is the direction of the process: a small, carefully chosen set of seed items steers the generation of a much larger set.

Mistakes When Generating Instruction Data

  • Common mistake

    Asking for instructions with no structure and assuming the dataset covers the use case

    What it looks like

    Requesting a large batch of requests with a single open prompt and no topic list

    Why it fails

    Results may cluster around a few themes, leaving large parts of the use case unrepresented.

    Do this instead

    Build a topic list, keywords, or instruction types first, then generate a set number of instructions for each item.

  • Common mistake

    Treating the AI-or-human decision as all-or-nothing

    Why it fails

    A single training example has two parts, and AI can synthesize the instruction, the response, or both.

    Do this instead

    Decide separately for the instruction and the response which party produces it.

  • Common mistake

    Assuming the topic list must be written entirely by a person

    Why it fails

    The source states that both the topic list and the templates can be generated by AI.

    Do this instead

    Generate a broad list with AI, then review it before using it as the skeleton for instruction generation.

  • Common mistake

    Producing only one response per instruction when alternative answers are useful

Practice: Plan a Dataset Expansion

MEDIUM

You want an instruction-finetuning dataset for a cooking assistant. Using the topic-first pattern, write a short plan: name three topics you would seed the list with, state how many instructions you would generate per topic, and say how many responses you would generate per instruction. Then decide whether a person or the AI should write the responses, and justify the choice in one sentence.

Hints
  • The topic list can be a starting point, with each topic receiving a set number of instructions.
  • Remember that one instruction can have one or more responses, so the response count is a separate decision.
  • Think about which half of the pair benefits most from human judgment in your own plan.

Key Takeaways

  • Each instruction-finetuning example has an instruction and a response, and AI can synthesize either half or both.
  • Unstructured generation tends to cluster around a few themes, so coverage is best planned with a topic list or templates and a set number of instructions per item.
  • Topic lists and templates can themselves be AI-generated, then reviewed by a person before they drive instruction generation.
  • Datasets can grow from topics, as in UltraChat, or from seed examples, as in Alpaca, which expanded 175 seed examples into 52,000 generated pairs.

Related concepts

More concepts starting with S