Foundations to Frontier
Tests

Synthetic Data

As high-quality human text runs short, LLM training increasingly uses synthetic data: text generated by models. A strong teacher can write textbook-style explanations, instruction–response pairs, rephrasings of web text, code with unit tests or worked maths solutions. These are often filtered by verifiers (tests, checkers, reward models) and used to pretrain or fine-tune smaller students. Synthetic data transfers knowledge from teacher to student (a form of distillation, E19-5) and can target gaps. But a model's own samples add no new information, and repeatedly training on generated data makes models drift from the real distribution ('model collapse'). This page covers generation, filtering, diversity, verification, mixing with real data, and the collapse risk. In the exercises you sample with temperature, measure diversity and filter by a verifier, then test synthetic data with trigram models on a known source (true perplexity 5.05). A student with 5000 real tokens scored 7.05. Adding 50,000 tokens sampled from a teacher trained on 100,000 real tokens brought it to 5.57, while 50,000 of its own samples made it worse (7.42). Training five generations each only on the previous generation's samples raised perplexity from 5.87 to 8.47; keeping the real data and adding samples limited this to 6.26.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Models writing training data for other models

When there isn’t enough good human-written text, a strong model can write practice material for a weaker one: explanations, questions and answers, code with tests. The weaker model learns a lot from it, because the teacher knows things the student doesn’t. But if a model keeps training on its own writing, generation after generation, errors pile up and it slowly drifts away from real language, like a photocopy of a photocopy. Mixing in real data keeps it grounded. The demo shows how sampling temperature changes what a model writes.

LLM lab
Kept tokens: 10 of 10; entropy 1.57 nats; top probability 0.40. Low temperature or small k/p make output more deterministic; high temperature makes it more diverse.
Why engineers care

Synthetic data is valuable where real data is scarce or sensitive (rare failure modes, classified procedures, edge-case dialogues), but generated examples must be verified against engineering ground truth before training on them.

📝 Quick check (Level 0)
0/3 answered
  1. 1. Synthetic data is text written by…
  2. 2. A student learns most from synthetic data written by…
  3. 3. Training repeatedly on a model's own outputs can cause…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Uses: pretraining data (Phi’s ‘textbooks’, rephrased web text), instruction tuning (Self-Instruct, Alpaca, Evol-Instruct), reasoning traces filtered by correctness (STaR, rejection sampling), code with unit tests, preference pairs for alignment (F7).
  • Generation knobs: prompts with diverse seeds, personas and topics; temperature or top-p for diversity; deduplication of generated items.
  • Verification: keep only examples that pass checks: unit tests, maths answer checkers, schema validation, reward models, or a second model’s judgement. Pass rates drive the cost.
  • Cost: generating costs 2·N_teacher FLOPs per token (10⁶ examples × 500 tokens from a 70B teacher ≈ 7 × 10¹⁹ FLOPs), often small next to pretraining.
  • Risks:
    • errors and biases of the teacher are copied;
    • lack of diversity;
    • benchmark contamination;
    • licence terms;
    • model collapse when generated data replaces real data recursively (Shumailov et al., 2024).
  • Safeguards: keep a floor of real data, accumulate rather than replace, verify, and measure diversity.
📝 Quick check (Level 1)
0/3 answered
  1. 1. Generation FLOPs per token for a 70B teacher:
  2. 2. A common safeguard against collapse:
  3. 3. Self-Instruct generates…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

Synthetic data in code

Exercise 1.

  • Sample with temperature (low temperature concentrates on the mode).
  • Score the diversity of a set of samples.
  • Filter synthetic examples with a verifier.

Practice.

  • Use a strong model with varied prompts and seeds; deduplicate near-identical outputs (F5-2).
  • Verify automatically where possible (tests for code, exact answers for maths, schemas for structured output); spot-check the rest by hand.
  • Decontaminate against evaluation sets, and track which teacher produced each example and under what licence.
  • Mix synthetic with real data, and watch for drops in diversity (distinct n-grams, embedding spread) across rounds.
import random
seeds = ["hydraulic leak", "sensor drift", "software reset", "bird strike"]
prompts = [f"Write a short maintenance log entry about a {random.choice(seeds)} and the corrective action." for _ in range(1000)]
# outputs = teacher.generate(prompts, temperature=0.9, top_p=0.95)
# keep = [o for o in dedup(outputs) if schema_ok(o) and not in_eval_set(o)]
🐍 Exercise 1: sampling, diversity and verification
Sample with temperature, score diversity and keep only verified synthetic examples.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Code synthetic data is best verified by…
  2. 2. Synthetic data must be decontaminated against…
  3. 3. Across rounds of generation, watch…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Information view. A student trained on samples from a teacher learns (an approximation of) the teacher’s distribution. If the teacher was trained on more or better data, that distribution is closer to the truth, so the student gains. A model’s own samples carry no information beyond the model itself: training on them re-estimates the same distribution with extra sampling noise.

Why recursion degrades. Each generation fits a finite sample from the previous model, adding estimation error and the model’s systematic biases. With smoothing, mass spreads to implausible events (blurring); with truncated sampling (low temperature, top-p), rare events disappear (tail loss). Either way the distribution drifts, and errors compound without real data to anchor them (Shumailov et al., 2024).

Accumulating helps. Keeping the original real data in every round bounds the drift: Gerstgrasser and colleagues (2024) showed accumulating real and synthetic data avoids collapse in settings where replacing it does not.

📝 Quick check (Level 3)
0/3 answered
  1. 1. A model's own samples carry…
  2. 2. With truncated sampling, recursive training loses…
  3. 3. Accumulating real data each round…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

When does synthetic data help, and when does it hurt?

History.

  • Y. Wang et al., “Self-Instruct” (ACL 2023).
  • S. Gunasekar et al., “Textbooks are all you need” (2023), Phi-1.
  • I. Shumailov et al., “AI models collapse when trained on recursively generated data” (Nature, 2024).
  • M. Gerstgrasser et al., “Is model collapse inevitable?” (2024).

Exercise 2.

  • Source: the language-like trigram source from F1-2 (V = 50; true perplexity on test text 5.05).
  • Models: vectorised Kneser–Ney trigram models.
  • Part 1: a student with 5000 real tokens, alone or with 50,000 synthetic tokens, sampled from a teacher (trained on 100,000 real tokens) or from the student itself.
  • Part 2: generation 0 trains on 20,000 real tokens; each later generation trains on 20,000 tokens sampled from the previous model, either replacing the data or adding to it (accumulating).
student training data test perplexity
5000 real tokens 7.05
+ 50,000 teacher-generated tokens 5.57
+ 50,000 self-generated tokens 7.42
(teacher itself) 5.28
generation 0 1 2 3 4 5
replace (samples only) 5.87 6.48 7.03 7.50 7.99 8.47
accumulate (real + samples) 5.87 6.02 6.12 6.18 6.22 6.26
  • Teacher data transfers knowledge: the student nearly reaches the teacher (5.57 against 5.28) with only 5000 real tokens.
  • Self-generated data hurts: it repeats the student’s own errors as if they were facts.
  • Recursive training collapses steadily: each generation inherits the previous one’s errors plus fresh sampling noise; perplexity rises 44% in five generations.
  • Accumulating anchors the model: drift is about six times smaller.
  • How the collapse looks here: the number of distinct trigrams in the training data rose across replaced generations (2979 → 3504), because the smoothed model spreads probability to trigrams the source rarely uses (blurring). With truncated sampling the opposite (tail loss) is typical; both are drift away from the real distribution.
  • Seed 1: student 7.26 → 5.62 (teacher data), 7.71 (self); replace 5.90 → 8.55; accumulate 5.90 → 6.22.
🐍 Exercise 2 (research): when does synthetic data help, and when does it hurt?
Train trigram models with teacher-generated and self-generated synthetic data, and over five generations of replacing or accumulating generated data.

Synthetic data in AI, robotics and aerospace

  • Rare scenarios: generating plausible but verified fault reports and dialogues for under-represented failure modes.
  • Code and procedures: synthetic tasks with automatic checks for flight-software assistants.
  • Simulation: physics simulators are the original synthetic-data engine for robotics; the same anchoring-to-reality lesson applies.
  • Design lesson: synthetic data helps when it brings new information and is verified; always keep real data in the loop.

References

  1. Y. Wang et al. (2023). “Self-Instruct: aligning language models with self-generated instructions.” Proc. ACL.
  2. S. Gunasekar et al. (2023). “Textbooks are all you need.” arXiv:2306.11644.
  3. I. Shumailov et al. (2024). “AI models collapse when trained on recursively generated data.” Nature 631.
  4. M. Gerstgrasser et al. (2024). “Is model collapse inevitable? Breaking the curse of recursion by accumulating real and synthetic data.” arXiv:2404.01413.