← AI Evaluation Engineer
18 min

Building Test Sets & Golden Data

Where cases come from, how many you need, how to label them and how to avoid leaks.

Lesson 3 of 10
0 done
In plain English

A test set is the most valuable thing an evaluation engineer builds. Build it from real usage, expert input and past failures. Cover typical, hard, edge, risk and negative cases. Keep a hidden final set, avoid leaks, and refresh the set every quarter.

Golden data
Cases with answers that experts have checked.
Negative case
A case where the right reply is that the answer is not known.
Leak
Test answers reaching the model, which inflates the score.
Picture it
Where test cases come from
Real usage
The best source
Domain experts
Typical and tricky cases
Past failures
Every bug becomes a case
Written scenarios
Test one rule
Reviewed synthetic cases
Widen coverage

A test set is the most valuable thing an evaluation engineer builds. A weak test set gives false comfort. A strong one catches problems before customers do. This lesson shows where cases come from, how many you need, how to label them and how to avoid the common traps.

Where cases come from

  • Real usage: logs of real questions, with privacy rules applied. This is the best source.
  • Domain experts: ask them for typical, tricky and rare cases.
  • Past failures: every bug and complaint becomes a case.
  • Written scenarios: cases you design to test a rule, such as a refund above the limit.
  • Synthetic cases: examples made by a model, then reviewed by a person. Useful to widen coverage, but check them.

Cover the whole range

A test set must look like real use, including the hard parts. If it holds only easy cases, the score will mislead you. Aim for a mix.

coverage-plan.md
TYPICAL CASES      The everyday questions that make up most of the traffic
HARD CASES         Ambiguous, multi-part, or needing several documents
EDGE CASES         Very short, very long, typos, other languages, odd formats
RISK CASES         Should refuse, should escalate, private data, hostile input
NEGATIVE CASES     The answer is not in the documents, so the right reply is "I don't know"
RECENT CASES       New products, new rules, new wording

For each group, note how many cases and why that many.

How many cases

There is no magic number. A small set of 30 to 50 carefully chosen cases is enough to start, and much better than nothing. Aim for 100 to 300 for the main tasks as the product grows. What matters more is that the cases are real and varied. A small set gives noisy scores, so look at the differences case by case, not only at the total.

Labeling: the right answers

  • Ask domain experts to write or approve the right answer, or to mark the key facts that must appear.
  • For open answers, write a short list of must-have points instead of one exact text.
  • Use two reviewers on hard cases, and settle disagreements by discussion.
  • Record who labeled each case and when, so you can trace and update it.

Keep a hidden set

Split your cases into two groups. Use the development set while you tune prompts and settings. Keep the final set untouched, and use it only to confirm a release. If you tune on every case, your score will look better than the real quality.

Beware of leaks

  • Do not put test cases into prompts as examples. The model will look good because it has seen the answers.
  • Check that test cases are not in any training or fine-tuning data you control.
  • Keep private data out of the set, or mask it, following your privacy rules.

Keep it alive

A test set goes stale. Products change, rules change and users change. Review it every quarter. Remove cases that no longer apply. Add new ones from live traffic. Version the set, so you can compare scores over time.

⚠A test set built only from your own imagination will miss what real users do. Pull from real usage as early as you can.
Key takeaways
  • ✓Build the set from real usage, expert input, past failures and written scenarios. Review any synthetic cases by hand.
  • ✓Cover typical, hard, edge, risk, negative and recent cases. Start with 30 to 50, and grow.
  • ✓Label with experts, use must-have points for open answers and record who labeled what.
  • ✓Keep a hidden final set, avoid leaks, and refresh the set every quarter.
Hands-on exercise

Build a starter test set

  1. Choose an AI task and write the coverage plan with at least five groups.
  2. Create 30 cases across the groups. Include at least five negative cases.
  3. Write the must-have points or right answer for each case.
  4. Split them into 20 development cases and 10 hidden cases. Write where each came from.
Check yourself
Q1Why keep a hidden test set?show answer

If you tune on every case, the score looks better than reality. A hidden set gives an honest check before release.

Q2What is a negative case?show answer

A case where the answer is not in the documents, so the right reply is that the system does not know or hands over to a person.

Q3Why is putting test cases in the prompt a leak?show answer

The model has then seen the answers, so the score is inflated and tells you nothing about unseen cases.

← Defining Quality & Writing RubricsAutomatic Checks & Metrics →
0 / 10 finished0%