An eval is only as good as its dataset. A set of easy, repetitive examples will report 95% while users struggle; a set nobody can explain will start arguments instead of ending them. This lesson covers where good eval cases come from, how to write expected answers and grading guidance that two people would apply the same way, when synthetic data helps and when it lies, slicing a dataset so averages do not hide failures, keeping a held-out set so you do not overfit your prompts, and versioning it all like code.
- Source eval cases from production, experts and known failures
- Write targets and grading guidance that are unambiguous and checkable
- Use synthetic data to fill gaps without letting it dominate
- Slice datasets by intent, difficulty and risk, and report per slice
- Keep development and held-out splits and version the dataset
Where good cases come from
- Production traffic: real user inputs (sampled, with personal data removed) are the single best source, because they show how people actually phrase things.
- Support tickets and complaints: failures users cared enough to report.
- Domain experts: the cases they know are tricky, ambiguous or high-stakes.
- Your own failure analysis: every bad output found in testing becomes a case.
- Adversarial cases: prompt injection attempts, out-of-scope requests, requests that must be refused.
- Synthetic generation: to fill gaps you cannot get real data for yet, covered below.
Start small and real: 30 to 100 carefully chosen cases beat 5,000 generated ones you have never read. Grow the set continuously, especially from production failures.
Targets and grading guidance
For each case, record what a good output looks like in a form a scorer can use. That might be an exact answer, a set of facts the answer must contain, a forbidden behaviour, the tool that should be called, or a rubric for a judge. If two careful people would grade the same output differently using your guidance, the guidance is not finished.
{
"id": "ref-017",
"input": "My blender arrived cracked, can I return it after 40 days?",
"target": "Explains the 30-day window and offers escalation for damaged items",
"must_include": [
"30 days",
"damaged"
],
"must_not": [
"guarantee"
],
"slice": {
"intent": "refund",
"difficulty": "hard",
"source": "ticket"
}
}- Write labelling guidelines with examples of pass and fail for borderline cases.
- For judgement-heavy cases, have two people label a sample independently and measure how often they agree; low agreement means the task or the guidance is unclear.
- Record the reason for tricky labels, so future you remembers why.
Synthetic data: useful, with care
Models can generate eval inputs quickly: paraphrases of real questions, edge cases for a rare intent, translations, long documents. Synthetic data is useful for coverage, especially before launch, but it has predictable flaws: it is often cleaner and more uniform than real input, it inherits the generator's blind spots, and if the same model family generates and answers, results can be flattering.
- Seed generation with real examples and explicit variation instructions (tone, length, typos, missing information).
- Read and filter generated cases; discard the unrealistic ones.
- Label synthetic cases as such in metadata and report their scores separately.
- Replace synthetic cases with real ones as production data arrives.
Slices: averages hide failures
A 90% average can hide a 40% score on the slice that matters most, such as refund requests, non-English users or long documents. Tag every case with slice metadata (intent, difficulty, language, length, source, risk) and always report scores per slice as well as overall. Make sure high-risk slices have enough cases to be measured at all.
import json
from collections import defaultdict
by_slice = defaultdict(list)
for line in open("results.jsonl"):
r = json.loads(line)
by_slice[r["slice"]["intent"]].append(r["passed"])
for intent, outcomes in sorted(by_slice.items()):
print(f"{intent:12} {sum(outcomes) / len(outcomes):6.1%} (n={len(outcomes)})")Splits, contamination and versioning
If you tune prompts against the same cases you report, you will overfit: the prompt learns the dataset, not the task. Keep a development set you iterate on freely and a held-out test set you run rarely, for decisions such as releases and model swaps. When scores on the two diverge, you are overfitting.
- Contamination: public examples may be in a model's training data; prefer private, recent cases for decisions.
- Leakage: do not put eval answers into few-shot examples or retrieval indexes the system can see.
- Versioning: keep datasets in Git (or a data versioning tool) with a changelog; record the dataset version with every result.
- Privacy: strip or pseudonymise personal data before cases enter the dataset.