What happens when a retrieval-augmented generation system gives a confident, well-written answer that is completely wrong? Nothing, unless someone tests for it. That is the problem synthetic test data is trying to solve, and it is harder to get right than most teams expect.
Retrieval-augmented generation, or RAG, pairs a search step with a language model. The model retrieves passages from a document collection and writes an answer grounded in them. The architecture dates to a 2020 paper by Patrick Lewis and colleagues that combined a dense retriever with a sequence-to-sequence generator. Testing such a system means testing two moving parts at once, and real user questions are usually scarce, private, or both. So teams generate their own.
Why Teams Generate Their Own Test Questions
Public benchmarks exist. BEIR covers retrieval quality across many domains, and other suites probe RAG robustness. But none of them test a specific company’s corpus, with its internal jargon, its outdated PDFs, and its one spreadsheet where the column headers lie. A system can score well on a general benchmark and still fail on the question a real employee asks on a Monday morning.
That gap is the whole reason synthetic test data shows up in RAG projects. The idea is straightforward: take the document corpus, use a language model to write question-answer pairs from it, and use those pairs as an evaluation set. No annotation budget, no waiting for real queries to accumulate, no exposing customer questions to a third party.
The practice is a common pattern among practitioners rather than a formalized standard. There is no ISO or IEEE specification that defines what a valid RAG synthetic test set looks like. That freedom is useful and also dangerous, because a badly built test set produces confident, reassuring, and meaningless scores.
The Two Halves of a RAG Evaluation

Before generating anything, it helps to be clear about what is being measured. RAG evaluation splits into retrieval quality and generation quality, and synthetic data has to serve both.
| What is measured | Typical metrics | What synthetic data must supply |
|---|---|---|
| Retrieval | Recall@k, MRR, nDCG | Questions whose answers live in known passages |
| Generation | Faithfulness, answer relevance, context relevance | Questions with reference answers and the right context |
| Robustness | Behavior on unanswerable or ambiguous queries | Adversarial and distractor questions |
| Safety | Refusal quality, leakage | Probes designed to trigger bad behavior |
The RAGAS framework, introduced in a 2023 paper by Es and colleagues, formalized reference-free metrics along these lines. Its usefulness for synthetic testing is that it scores answers without requiring a perfect human-written gold answer for every case, which lowers the cost of building large evaluation sets. The catch is that reference-free metrics still need a judge, and judges have opinions.
How Synthetic Question Generation Works in Practice
The basic pipeline is short enough to describe in a paragraph, and every step hides a trap.
- Chunk the corpus into retrievable passages, using the same chunking the production system uses.
- Sample passages, ideally weighted toward the documents users actually ask about.
- Prompt a language model to write a question that the passage answers, plus the answer itself.
- Filter the output for duplicates, trivial questions, and questions answerable without retrieval.
- Score candidate answers with an LLM judge or human spot checks.
- Freeze the set and version it alongside the system.
Step one is where many teams quietly break their own evaluation. If the test set is chunked differently from production, retrieval scores become fiction. If the chunks are too small, generated questions become lookup exercises. If they are too large, a single chunk answers everything and recall looks perfect.
Step three is where the deeper problem lives. A question written directly from a retrieved chunk tends to reuse the chunk’s vocabulary. The system then finds the chunk by lexical overlap and scores well, not because it reasons but because the words match. Practitioners report this inflation repeatedly, though it is a caution rather than a documented finding with a single definitive study behind it. The fix is to generate questions from document summaries, from multi-hop combinations, or from user personas rather than from the exact passage being tested.
Making Synthetic Questions Resemble Real Ones
The most common mistake is treating generated questions as a substitute for understanding what users actually ask. They are a proxy, and proxies drift.
A more honest approach mixes sources. Pull real anonymized queries where they exist. Generate paraphrases of those queries to widen coverage. Generate fresh questions only for document areas with no query coverage at all. Then label each question with its origin so failures can be traced back to a source type.
Practical tips that hold up:
- Write questions in the user’s voice. Internal users say “the Q3 number” and “that vendor thing,” not “the third-quarter revenue figure for the supplier.”
- Include unanswerable questions. A RAG system that never says “I don’t know” is not safe, and a test set with no unanswerable items cannot detect that.
- Add distractor documents. Insert near-duplicate passages that contradict the correct one and check whether the system picks the right source.
- Test multi-document questions. Many real questions need two passages combined, and single-chunk generation never produces them.
- Keep a held-out human-written set. Even fifty carefully written questions will tell you whether the synthetic set is measuring the right thing.
That last point matters more than its size suggests. A small human set acts as a calibration check on the synthetic one. If synthetic scores climb while human scores stay flat, the synthetic set has probably been gamed by the system or has drifted from reality.
Scoring With LLM Judges Without Fooling Yourself
Most synthetic RAG test sets are scored by a strong model acting as a judge. The approach is viable, and a 2023 study by Zheng and colleagues on LLM-as-a-judge with MT-Bench and Chatbot Arena documented both its promise and its known biases: position bias, verbosity bias, and self-enhancement bias.
Self-enhancement is the one that quietly ruins evaluations. If the same model family generates the test questions and judges the answers, scores tend to inflate. The mitigation is separation: one model generates, a different model judges, and the system under test is a third thing. Where budget allows, a human reviews a random sample of judged items to estimate the judge’s error rate.
A few habits that separate useful judge setups from theater:
- Pin the judge version. A silent model upgrade changes your scores and your history.
- Score with a rubric, not a vibe. Ask for faithfulness, completeness, and citation correctness separately.
- Log judge reasoning. When a score looks wrong, the reasoning is the only way to find out why.
- Re-run a fixed subset after every judge change. Treat the judge as part of the system under test.
There is also a security dimension that synthetic sets are well suited to probe. Retrieved content can carry injected instructions, and a test set built from real documents can include hostile passages on purpose. Teams working through this often borrow structure from a write-up on testing for indirect prompt injection in retrieved content, which walks through how poisoned documents reach the model and what to assert about the response.
Where Synthetic Data Quietly Fails
Three failure modes deserve naming.
Leakage. If questions are generated from the same chunk that will be retrieved, the test measures string matching. Fix by generating from summaries or from a different document that references the same fact.
Contamination. If the corpus overlaps with the model’s training data, the model may answer from memory rather than retrieval. The test then passes without the retrieval step working at all. Check by running the system with retrieval disabled and seeing which questions still get answered correctly.
Privacy assumptions. Synthetic data is often pitched as a way to reduce personal-data exposure, but regulators have not agreed that synthetic data is automatically anonymous. The European Data Protection Board’s work on AI models and anonymity treats the question as context-dependent, which means a synthetic set derived from customer documents still needs a legal review before it leaves the building.
There are adjacent operational risks too. If the evaluation pipeline pulls data across cloud regions, transfer costs can creep up unnoticed, and a structured approach to tracking cloud data transfer costs helps keep the test infrastructure from becoming a line item nobody planned for. (Separating tenant data in an enterprise assistant)
Fitting Synthetic Test Data Into the Delivery Process
A test set that runs once is a report. A test set that runs on every change is a safety net. The difference is plumbing.
Treat the synthetic set like code. Version it, review changes to it, and run it in continuous integration against a fixed corpus snapshot. When the corpus changes, regenerate deliberately rather than silently, and keep the old set to detect regressions. Store the retrieved context alongside each result so a failure can be reproduced without guessing.
For teams building agentic RAG systems that take actions, the evaluation bar rises. A pattern for testing AI agents before granting write access covers how to gate permissions behind evidence that the agent behaves, which is a natural extension of question-answer testing into tool use.
Two more integration points are worth planning for. First, if the RAG system runs on accelerated hardware, driver and library changes can shift outputs, so a compatibility check belongs in the pipeline; a guide to testing accelerator software compatibility explains how to isolate those variables. Second, when the corpus lives in a managed database, the test environment needs a way to restore a known state, and a walkthrough of building a recovery drill for a managed database covers the mechanics. (NIST Artificial Intelligence overview)
A Realistic Scorecard
No single number should decide whether a RAG system ships. A workable scorecard looks like this:
| Dimension | Question it answers | Target |
|---|---|---|
| Retrieval recall | Did the right passage appear? | High and stable |
| Faithfulness | Is the answer supported by context? | Very high |
| Refusal accuracy | Does it decline when it should? | High |
| Robustness | Does it survive distractors and injection? | No regressions |
| Latency and cost | Is it usable? | Within budget |
Synthetic data fills this scorecard cheaply. It does not fill it truthfully on its own. The honest position is that synthetic test data is a strong first pass, a good regression detector, and a poor substitute for a small, carefully built human set. (A clearer way to track cloud data transfer costs)
Conclusion
Synthetic test data gives RAG teams something they rarely have otherwise: a large, repeatable, corpus-specific evaluation set that costs little to build and can run on every commit. Used well, it catches retrieval regressions, exposes refusal failures, and makes prompt changes measurable instead of anecdotal.
Used badly, it produces a number that goes up while quality goes down. The difference is not the generator model. It is whether the team separates generation from judging, keeps questions away from the chunks they test, includes unanswerable and adversarial cases, and calibrates everything against a small human-written set. Build the synthetic set, but build the calibration set first. It is the cheapest insurance in the whole pipeline.
What is RAG synthetic test data?
It is a set of question-answer pairs, and sometimes adversarial or unanswerable questions, generated by a language model from a document corpus and used to evaluate a retrieval-augmented generation system. It substitutes for human annotation when real user queries are scarce, private, or expensive to collect.
Is synthetic test data as good as real user questions?
No, and treating it as equivalent is the most common mistake. Synthetic questions tend to be cleaner and more literal than real ones, and they can be too easy when generated directly from the passage being tested. They work best as a fast regression signal layered under a smaller set of real or carefully human-written questions.
How many synthetic questions do I need?
Enough to cover each document area and each failure type you care about, which usually means a few hundred rather than a few thousand. Coverage beats volume. A thousand near-duplicate questions about the same policy document tell you less than two hundred spread across the corpus, including unanswerable cases and multi-document questions.
Can I use the same model to generate questions and judge answers?
You can, but scores will likely be inflated by self-enhancement bias, a documented weakness of LLM-as-a-judge setups. Separate the generator, the judge, and the system under test wherever possible, pin the judge version, and have a human review a random sample of judged items to estimate the judge’s error rate.
How do I stop synthetic questions from leaking the answer?
Generate questions from document summaries, from a different document that references the same fact, or from user personas rather than from the exact chunk being retrieved. Then test for leakage directly: run the system with retrieval switched off and see which questions still get answered correctly. Those are the ones measuring memory, not retrieval.
Is synthetic data automatically anonymous under privacy law?
No. Regulators have not accepted that synthetic data is anonymous by default, and the assessment depends on context, including how the data was generated and whether individuals could still be identified. Any synthetic set derived from customer documents should go through legal review before it is shared or moved outside its original environment.







