Interview's MateAI Engineering
Interview's Mate

AI Engineering

LLMs, RAG, agents & evals

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
AI Engineering topics
Lesson 74/ 160
04. Evals

Synthetic Test Data

Generate diverse eval cases with models, then filter and validate carefully.

IntermediateSynthetic Cases · Diversity3 quiz questions
Practice Generative AI Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidHands-onQuiz (3)Practice

In plain words

You ask an AI to invent lots of realistic test questions (and answers), then check a sample by hand to make sure they're good.

Think of it like…

Crash-test dummies and simulators: they let you test thousands of scenarios cheaply, including dangerous ones, but you still validate against real road data because the simulator may miss how real drivers behave.

Where you’ve seen it

For a new HR-policy assistant with no traffic, the team defines generation dimensions: 4 intents (leave, benefits, payroll, conduct) × 5 personas (new hire, manager, contractor, remote employee, non-native speaker) × 3 difficulty levels = 60 combinations, and asks an LLM for 8 questions per combination grounded in the actual policy documents: 480 candidates. Embedding deduplication (cosine similarity above 0.92) removes 90, leaving 390; an LLM validity filter (answerable from the policy, one clear intent) removes 40, leaving 350. A human reviews a random 70 and finds 9 flawed (12.9%), mostly questions answerable by common sense; they tighten the generator prompt, regenerate, and keep 330 usable cases, tagged "synthetic" so results can be reported separately from the 120 real tickets collected after launch.

Words you’ll hear

Generation dimensions
Attributes (intent, persona, difficulty, language) combined to force diverse cases.
Deduplication
Removing near-identical cases using embedding similarity or n-gram overlap.
Evolving / complicating
Rewriting a simple question to be multi-hop, ambiguous, longer or adversarial.
Synthetic-to-real gap
Differences between generated and real user inputs that make scores unrepresentative.

Visual diagram

Loading interactive diagram

Theory & deep dive

Generating useful data

Don't just ask "give me 100 test questions": results cluster around the same easy phrasings. Use structured generation: enumerate dimensions (intent, persona, difficulty, language, input length, tone), generate for each combination, and ground questions in real documents or schemas so answers can be checked (the generator also writes the reference answer and the supporting passage). Add evolution steps: make a question multi-hop, add irrelevant detail, remove key information to test clarification, translate it, or rewrite it with typos and slang. Create adversarial cases (prompt injections, requests for forbidden actions) with templates and attack catalogues.

For agents and chat, simulate users with personas, goals and constraints ("impatient customer who wants a refund, only has an order number") and let a user-simulator model converse with the system; record the transcript and check the outcome. Use a different, strong model for generation than for the system under test where possible, to avoid inflated scores from shared style and knowledge, and set a higher temperature (or vary seeds) for diversity.

A generation prompt skeleton

"Given this policy excerpt, write 8 questions an employee in the role of [persona] might ask about [intent] at [difficulty] level, in their own words (varied length, some informal). For each give: the question, the reference answer quoting the excerpt, and the excerpt id. Do not reuse phrasing from the excerpt."

Key takeaway: Structure by dimensions, ground in real documents, evolve and attack, and use a different model for generation.

Quality control and limits

Filter aggressively. Deduplicate with embeddings or MinHash, drop cases the generator couldn't ground, and use an LLM or rule filters to check that each case is answerable, has one clear intent, and that the reference answer is supported by the cited passage. Then audit by humans: review a random sample (50 to 100), measure the defect rate, fix the generator prompt and repeat. Compare difficulty with real data: if every model passes 98% of synthetic cases while real traffic shows 80%, the synthetic set is too easy; adding evolution steps and hard negatives raises it.

Keep the provenance (generator model, prompt version, date, source document) and tag synthetic cases so reports show real and synthetic results separately, and weight decisions toward real traffic once you have it. Synthetic data can't replicate genuine user messiness, hidden needs or unusual intents, may leak generator biases (and the generator's knowledge) into evaluation, and may contaminate training if the same data is used for fine-tuning and evaluation. Treat it as scaffolding that you gradually replace with sampled production cases.

Too easy

The system scores 97% on the 330 synthetic cases but 81% on 120 real tickets. After adding multi-hop and missing-information evolutions, synthetic scores fall to 86%, closer to what real traffic shows, so the set becomes a more useful regression guard.

Key takeaway: Filter, dedupe, audit with humans, compare difficulty with real data, and tag provenance.

How it works, step by step

Step 1 of 4
Eval design

1. Define dimensions and sources

Choose intents, personas, difficulty and languages, and gather the real documents to ground questions.

4 × 5 × 3 = 60 combinations
Key numbers at this step
Ground
in real documents

When to use it & trade-offs

What it is

Synthetic test data means using an LLM (plus templates and rules) to generate evaluation inputs and, where possible, expected outputs instead of collecting them all by hand: questions generated from your documents, simulated users with personas and goals, paraphrases and typo variants, multilingual versions and adversarial attacks. It's a way to bootstrap an eval set before you have traffic and to scale coverage of edge cases. Its weaknesses are homogeneity, unrealistic difficulty and label errors, so it needs structured generation, filtering and deduplication, and human review of a sample.

Why it matters: New products have no production logs, domain experts are expensive, and failure modes such as injections, long inputs or unusual phrasings are rare in real data. Synthetic data fills those gaps quickly and cheaply. Used carelessly, though, it produces easy, repetitive questions that every model aces, giving false confidence; used well, it extends (never replaces) the real-traffic cases in your golden set.

When to reach for it

  • Bootstrapping evals before launch
  • Covering rare edge cases and adversarial scenarios
  • Simulating users for agent testing

When to avoid or be careful

  • Asking for 100 questions in one unstructured prompt
  • Reporting synthetic and real results as one number
  • Using the same data for training and evaluation

Sources of test data

Synthetic data from an LLM
Best for: Bootstrapping and edge-case coverage

Strengths: Fast, cheap, scalable, controllable.

Watch out: Can be easy, repetitive or mislabelled.

Real production samples
Best for: Representative evaluation

Strengths: True distribution and phrasing.

Watch out: Needs traffic, privacy handling and labeling.

Expert-written cases
Best for: Policy, safety and subtle domain cases

Strengths: High precision.

Watch out: Slow and costly.

Interview signals & numbers to know

When this topic comes up

  • “We have no data yet”
  • “Generate test questions from our documents”
  • “Our evals are too easy”
  • User simulators
  • Evolved and adversarial prompts

Benchmarks & rules of thumb

480 → 330 -
candidates to usable cases after filtering and audit
12.9% -
defect rate found in the human sample
97% vs 81% -
synthetic vs real score revealing an easy set

Common mistakes & follow-ups

Common interview mistakes

  • Trusting generated reference answers without checking them.
  • Using the system-under-test model to generate its own test set.
  • Never replacing synthetic cases with real production samples.

Likely interviewer follow-ups

  • How would you create an eval set for a new product with no traffic?
  • How do you make synthetic data diverse and hard enough?
  • What are the risks of synthetic test data?
Interview tip: Mention dimension-based generation, dedupe and a human audit rate. It signals you treat synthetic data as engineered data, not free text.
Loading hands-on exercise

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Synthetic Test Data with generative AI interview Q&A and hands-on practice.

Open Generative AI Q&A →Tech Learn Q&A
Previous topic
Human Labeling
Next topic
Tracing