Build Your Own Training Dataset with Synthetic Data
You have a task and no labeled data. Hiring annotators costs thousands, and your logs are a mess. The move the entire industry now uses: don't collect the dataset — generate it. A bigger model writes thousands of training examples for your exact task, you filter the good ones, and you train on those. This is the companion tutorial to Train Your Own AI, Episode 2 — every step below follows current, verifiable tooling.
Why synthetic data works: distillation, not magic
A frontier model already knows your domain. When it writes an instruction and a correct answer, it compresses that knowledge into a concrete example. Train a smaller model on ten thousand of those examples and the knowledge transfers. This is distillation, and it has receipts: in 2023, Stanford's Alpaca project generated 52,000 instruction pairs with GPT-3.5 and fine-tuned a small open model on them for a few hundred dollars, producing a genuinely capable instruction-following model with no human annotation farm.
The catch is the word "well-generated." Garbage examples train garbage models, and synthetic garbage scales faster than human garbage. So the pipeline below is really a quality pipeline: generate a lot, keep a little.
The pipeline: five stages
- 1. Seeds — a small set of hand-written examples that define your task.
- 2. Generate — a capable model expands seeds into thousands of new examples.
- 3. Evolve — push easy examples to become harder ones (models learn most from challenging examples).
- 4. Filter — throw away the duplicates and the junk, usually a third to half of everything generated.
- 5. Review — a human eyeballs a sample before anything touches the trainer.
Skip evolving and your dataset is too easy. Skip filtering and you train on noise. Skip review and you won't know which one you got.
Stage 1: seeds — the only part you write by hand
Start with 20 to 50 instructions that nail your task. (The original Self-Instruct paper from 2022 used 175.) Each seed should be specific, answerable, and representative of the real work:
"Classify this ticket as billing, technical, or account access.
Explain your reasoning in one sentence."
"Summarize this changelog entry for a non-technical user
in under 40 words."
Diversity matters more than volume: cover easy cases, edge cases, and the output formats you care about. Seeds are the DNA of your dataset — everything downstream inherits their style, their difficulty, and their blind spots.
Stages 2 and 3: generate and evolve
Feed seeds to a capable generator model with a prompt like: "Here are example instructions. Generate ten new, distinct instructions that are practical, specific, and not similar to the examples." Run it warm — temperature around 0.7 to 0.8 — because you want variety, not the model's safest answer. Two good generator options: an API model for the highest quality, or an open 8B-class model running locally on the same rented 4090-class GPU from episode one, which keeps the whole pipeline in-house and cheap.
Then evolve. Evol-Instruct (the 2023 WizardLM technique) takes each generated instruction and asks the model to make it harder: add a constraint, demand multi-step reasoning, combine two intents into one. Evolve each seed several times and you get a curriculum running from easy to genuinely difficult.
The tool that ties this together is distilabel, Hugging Face's open synthetic-data framework. Install it and wire three building blocks — a seed loader, a generation task, an LLM backend (vLLM, an inference endpoint, or llama.cpp):
pip install distilabel
from distilabel.pipeline import Pipeline
from distilabel.steps import LoadDataFromDicts
from distilabel.steps.tasks import TextGeneration, UltraFeedback
from distilabel.models import InferenceEndpointsLLM
llm = InferenceEndpointsLLM(
model_id="meta-llama/Meta-Llama-3.1-8B-Instruct")
with Pipeline(name="synthetic-sft") as pipeline:
seeds = LoadDataFromDicts(
data=[{"instruction": s} for s in seed_instructions])
generate = TextGeneration(llm=llm) # temperature ~0.7-0.8
judge = UltraFeedback(llm=llm) # LLM-as-judge filter
seeds >> generate >> judge
distiset = pipeline.run()
Stages 4 and 5: filter and review — throw away half
Plan to discard a third to half of everything generated. First, deduplicate: generators repeat themselves, so drop near-duplicates by text similarity. Second, LLM-as-judge: a capable model scores every pair for correctness, clarity, and whether the answer actually follows the instruction — the UltraFeedback step in the pipeline above. Keep the high scorers.
This isn't theory. The Argilla team took a popular open preference dataset, filtered out half of it with AI feedback, and the model trained on the smaller, cleaner half performed better. Less data, better data, better model.
Then human review. Synthetic datasets carry the generator's biases and its confident mistakes, and no automated filter catches all of them. Load a sample into a review tool — distilabel pushes straight into Argilla for this — and read at least a hundred examples yourself. Same rule as episode one: if you wouldn't show an example to a new hire as the right answer, don't train on it.
Format, train, and three pitfalls
Convert your keepers into instruction / input / output triples and wrap every one in your model's chat template, exactly as in episode one. Then the data drops straight into the Unsloth and SFTTrainer code from last week — nothing about training changes, only the data source did:
dataset = Dataset.from_list([
{"text": tokenizer.apply_chat_template(row["messages"],
tokenize=False)}
for row in keepers
])
# then: FastLanguageModel + SFTTrainer, exactly as in Ep 1
Three pitfalls:
- Model collapse. Training on raw, unfiltered model outputs — then generating the next dataset with that model — degrades quality every generation. Filtered, reviewed synthetic data is an asset; unfiltered synthetic sludge is a liability.
- Garbage amplification. A generator writes with total confidence, including when it's wrong. The judge step and human review exist to catch confident mistakes — don't skip them to save time.
- Eval contamination. Hold out a test set of real examples, ideally human-written, and never let synthetic generation near it. If your test set leaks into training, your eval numbers are fiction.
What it costs, and what's next
Twenty seeds in, a few thousand quality examples out, and a fine-tune that costs the same rented GPU as episode one. When you're ready to train, check the FlopSource directory for the cheapest 4090-class box today — prices move daily.
Next in the series: quantization — exporting your fine-tune to GGUF so it runs in Ollama on your laptop.
Find the cheapest GPU for your next run
Live pricing, hardware specs, and availability across 30 GPU clouds, neoclouds, and bare-metal providers.
Open the Directory