Handbooks  /  Synthetic Data
Handbook~15 min readTrainingworked math + runnable code
The Synthetic Data Handbook

Data a model
writes for itself.

Need ten thousand training examples of a rare edge case? Don't collect them — generate them. LLMs can write their own training and eval data: instruction pairs, reasoning traces, test inputs, paraphrases, on demand, at scale. It's one of the most powerful tools in modern AI — and one of the easiest to misuse. Pour in unfiltered generations and you teach a model its generator's mistakes; recycle a model's own output back into it and the whole distribution quietly caves toward the average. This handbook is about generating data that helps, and the two failure modes that make it hurt.

01

Generate your data

Data is the bottleneck for most AI work — real, labelled examples are scarce, expensive, and often missing exactly where you need them (rare cases, new formats, niche domains). Synthetic data sidesteps that: use a capable model to generate the examples. Ask a strong LLM to write instruction-response pairs, produce step-by-step reasoning traces, invent tricky test inputs, or paraphrase for augmentation — as many as you want, targeted at the exact distribution you're missing.

This powers a lot of modern practice: self-instruct (a model generating its own instruction-tuning data), distillation (a big teacher model labelling data for a small student), reasoning-trace generation (as in STaR), and eval-set creation. It's cheap, fast, and controllable. But generated data has a property real data doesn't: its quality is set by the generator, and generators are imperfect. That single fact drives everything else in this handbook.

The one-sentence version

Generate data with an LLM, but filter hard — effective dataset size is generated count times pass rate — and never recursively train on unfiltered self-output, or the distribution collapses.

02

Quality beats volume

The instinct with synthetic data is to generate more. The reality is that a pile of mediocre examples can make a model worse — training on wrong, repetitive, or off-distribution generations teaches wrong, repetitive, off-distribution behavior. What matters isn't how much you generate; it's how much survives a quality filter.

So the useful quantity is the effective dataset size: generate N examples, keep only the fraction p that pass a quality check, and you have p·N good examples. A filtered set of 300 strong examples routinely beats an unfiltered 1000. This is the lesson of the Phi models: trained on small, ruthlessly-filtered, "textbook-quality" data, they punched far above their parameter count. The filter — a test suite, a judge model, an execution check, a difficulty/diversity score — is not an afterthought; it's the most important part of the pipeline.

03

Model collapse

The subtler danger appears when synthetic data feeds back into the models that made it. Train a model on data generated by models — including its own output — recursively, without enough real data, and you get model collapse: each generation loses a little of the distribution's tails, the rare and unusual, and drifts toward the average.

Each recycle narrows the distribution
Round 0Real data — full diversity, fat tails.
Round 1Train on its generations — rare cases under-sampled, variance shrinks.
Round 2Generations of generations — tails vanish, drift toward the mean.
Round NDistribution collapses — homogeneous, generic, low-variance output.

Mathematically, each round of naive self-training multiplies the distribution's spread by a factor below one, so variance decays geometrically toward zero — the model forgets how to produce anything unusual. This isn't hypothetical: as more of the web becomes model-generated, models risk training on their own exhaust. The defenses are the same ones good pipelines already use — mix in real data to anchor the distribution, filter and deduplicate to preserve diversity, and never train purely on unfiltered recursive generations.

04

The yield & collapse math

Two equations capture the whole tension. First, yield: generate N examples, keep the fraction p that pass the quality filter, and your effective, usable dataset is:

effective size  =  p · N   ⟹   raise p (better filter), not just N (more volume)

A small p can make a giant generation nearly worthless; improving the filter's pass-quality is usually worth more than generating more.

Second, collapse: naive self-training shrinks the distribution's variance by a factor s < 1 each round, so after k rounds the diversity has decayed geometrically:

Vark  =  sk · Var0   (s < 1)   ⟹   Vark0 as k grows

Diversity vanishes exponentially under recursive self-training — which is why real data and filtering must stay in the loop. The runnable version below computes effective size, filters by quality, and watches variance collapse round by round.

RUN IT YOURSELF

Filter, and watch collapse

Synthetic data is two numbers. Yield: generate N examples, keep the fraction p that pass a quality filter, and the effective dataset is p × N — so a better filter beats more volume, and 300 filtered examples beat 1000 unfiltered ones. Collapse: each round of naive self-training pulls the values toward the mean, shrinking variance by a factor each time, so after a few rounds the tails vanish and the distribution homogenizes. Change the pass rate, the filter threshold, or the shrink factor and watch the effective size and the diversity move.

CPython · WebAssembly
05

A safe pipeline

A production synthetic-data pipeline is a generate-then-filter loop with real data in the mix:

StageWhat it does
SeedStart from real examples to anchor the target distribution and style.
GenerateUse a strong teacher model to produce many candidates, with diversity prompts.
FilterScore for correctness, difficulty, and diversity — keep only the good (tests, judge, execution).
DeduplicateRemove near-duplicates so the set stays diverse, not padded.
MixBlend synthetic with real data rather than training purely on generations.

The filter is where the value is — verify with the strongest cheap signal you have (unit tests for code, a judge model for text, execution for math), the same verify-then-keep logic behind STaR's reasoning bootstrapping. And curate for the target: if you need hard examples, filter for difficulty; if you need coverage, filter for diversity. Anchoring on real seeds and mixing real data back in are what keep the distribution honest and stave off collapse. Then evaluate on held-out real data — synthetic data can flatter itself, so the scoreboard must be real.

06

Pitfalls

The quiet killer is distribution narrowing. Even one round of unfiltered self-generation subtly shrinks diversity — the model over-samples its favorite phrasings and under-samples the rare cases — and it compounds. So measure diversity, not just accuracy, and keep real data anchoring the set. A related trap: inheriting the generator's errors and biases. Synthetic data can only be as correct as its generator plus its filter; if the teacher is wrong in a systematic way and the filter can't catch it, the student learns the flaw at scale. Verify against ground truth wherever you can, not just against another model's opinion.

Two more. Evaluating on synthetic data is circular — a model can look great on data drawn from the same generator and fail on real inputs, so hold out real data for the scoreboard. And contamination: generated eval sets can accidentally overlap the training distribution, inflating scores. Used with discipline — strong generator, ruthless filter, real seeds and real evals — synthetic data is a superpower for covering the cases reality won't hand you. Used naively, it's a slow way to teach a model to be average.

Worth knowing

Synthetic data can only be as good as generator + filter. If the generator is systematically wrong and the filter can't detect it, you scale the error — so verify against ground truth (tests, execution, real labels), not just another model's judgment, and always evaluate on held-out real data.

Frequently asked

Quick answers

What is synthetic data?

Training or eval data generated by a model rather than collected from humans — instruction pairs, reasoning traces, test inputs, paraphrases — cheap, scalable, and targetable.

Why filter over volume?

Bad generations teach bad patterns; effective size is generated count × pass rate, so a small filtered set beats a large unfiltered one.

What is model collapse?

Recursive training on model-generated data shrinks diversity round by round — variance decays toward the mean and the distribution homogenizes.

How to generate safely?

Strong generator, ruthless filter (tests/judge/execution), real seeds, deduplicate, mix in real data, and evaluate on held-out real data.

Finished this one? 0 / 99 Handbooks done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.