Evaluation Systems
Golden sets, LLM-as-judge, statistical power, and CI gates — building the measurement infrastructure without which every AI change is a guess.
#Why this is infrastructure
Software has a clean feedback loop: write a test, it passes or fails, you know. AI systems have no such thing. Outputs are open-ended, correctness is often a judgment call, and the same input can produce different outputs.
The consequence is that without deliberate evaluation infrastructure, teams ship on vibes — someone tries ten prompts, feels the new version is better, deploys. Sometimes it is. Regressions ship regularly and are discovered weeks later, if at all.
THE THINGS YOU CANNOT ANSWER WITHOUT EVALS
· is the new prompt better than the old one?
· did upgrading the model break anything?
· is the cheaper model good enough for this step?
· which of these three retrieval changes helped?
· has quality drifted over the last three months?
· is this failure a regression or has it always failed?Every one of those is a routine question, and every one is unanswerable by inspection.
#The layers
Start at the top. Deterministic assertions are cheap and catch more than expected: is the output valid JSON, does it cite a source that exists, is it under the length limit, does it avoid banned phrases, did the tool call have valid arguments. These are ordinary tests, they run in CI, and they catch a large fraction of real regressions.
#Golden sets
A golden set is a fixed collection of inputs paired with known-good outputs — the AI equivalent of a test suite, and the backbone of offline evaluation, meaning evaluation you run before shipping rather than on live traffic.
Where the cases come from, in rough order of value:
- Production failures. Every bug becomes a permanent test case. This is the highest-value source by a wide margin, and it makes the suite grow in exactly the directions that matter.
- Real traffic samples, stratified so rare-but-important categories are represented rather than swamped by the common case.
- Edge cases by construction — empty input, adversarial input, extremely long input, wrong language, ambiguous requests.
- Synthetic generation for coverage, clearly labelled as such and always human-reviewed before entering the set.
#LLM-as-judge
For open-ended output there is no exact match to check, so a model grades it. This is what makes evaluation scale, and it needs to be treated as a measurement instrument that requires calibration.
THREE FORMS
POINTWISE "Rate this answer 1-5 for helpfulness"
✗ scores drift between runs and versions
✗ clusters around 4; poor discrimination
PAIRWISE "Which answer is better, A or B?"
✓ much more reliable — relative judgments
are easier than absolute ones
✓ directly answers "did my change help?"
✗ O(n²) comparisons if you want a full ranking
REFERENCE "Does this answer contain the key facts
from the reference?"
✓ most reliable of the three
✗ needs a reference answer per casePairwise is the default for comparing two systems, because that's the actual question and relative judgments are substantially more consistent than absolute ones.
The biases that will distort your results if unhandled:
| Bias | Effect | Mitigation |
|---|---|---|
| Position | Prefers whichever answer is shown first | Run both orders, average |
| Verbosity | Prefers longer answers regardless of quality | Length-control the rubric; check length correlation |
| Self-preference | Prefers output from the same model family | Judge with a different model than the one being tested |
| Style over substance | Prefers confident, well-formatted, wrong answers | Rubric must require factual grounding explicitly |
#Statistical power
The question "is 78% better than 74%?" has a statistical answer, and ignoring it means shipping noise. The formula below uses four terms: δ is the smallest difference you want to detect; σ² is the variance of a single case's score (how much it swings between pass and fail); 80% power means that when a real difference of size δ exists, you detect it 80% of the time; and α = 0.05 means a 5% chance of declaring a difference that isn't really there.
Two practical consequences:
- Pair your comparisons. Run both systems on the same cases and compare them case by case. A hard case is hard for both systems, so per-case comparison cancels difficulty out instead of letting it add noise — and that cuts the required sample size substantially.
- State the minimum detectable effect alongside every result. "System B scored 3 points higher on 120 cases" should be reported as "3 points, which is within noise for this sample size."
#Evaluation in CI
Offline evals belong in the pipeline, gating changes the way tests do.
ON EVERY PULL REQUEST touching prompts, models, or retrieval:
1. deterministic assertions ~30 s must pass
2. golden set, small (100 cases) ~3 min no category
regression > 5%
3. judge comparison vs main ~5 min win rate ≥ 45%
(not 50 — an equally
good change can score
below 50 by chance)
4. cost and latency check ~1 min within 20% of main
NIGHTLY:
· full golden set (2,000 cases)
· full judge evaluation
· per-category breakdown, tracked over time
Anything that fails posts the specific failing cases as
a diff in the PR — not a score, the actual outputs.Two design points that determine whether this gets used or disabled:
- Cache aggressively. Re-running 2,000 model calls per commit is slow and expensive. Key results on
(input, model version, prompt version)— most PRs change one component and most results are reusable. - Show diffs, not scores. "Score dropped from 0.81 to 0.78" is unactionable. "These 12 cases regressed, here are the before/after outputs" is a review.
#Online evaluation
Offline evals measure a proxy — a golden set and a judge are stand-ins for what users actually want. Only production, with real users doing real tasks, measures the thing itself.
- A/B test by user, not by request, so each person sees one consistent version and outcomes like "did they come back next week" can be attributed to it. Run long enough for slow metrics like that one.
- Instrument implicit feedback — did they copy the code, accept the suggestion, resolve the ticket, avoid escalating? Available on every interaction and usually more informative than thumbs.
- Sample production traffic into the judge continuously, so quality is a live time series rather than a per-release snapshot.
- Route production failures back into the golden set automatically. This closes the loop and is the mechanism by which the suite gets better at the things you actually get wrong.
#Evaluating retrieval and agents separately
From retrieval architecture: measure recall@k independently, or you cannot tell a retrieval failure from a generation failure.
For agents, evaluate the trajectory as well as the outcome: task success on verifiable criteria, step count versus optimal, tool selection accuracy, and recovery rate after a tool failure. An agent that reaches the right answer in 40 steps is worse than one that takes 6, and outcome-only evaluation cannot see the difference.
#Check yourself
Why is evaluation infrastructure, not an afterthought?Show answer
Name the evaluation layers.Show answer
Where should golden cases come from?Show answer
Pointwise, pairwise or reference judging?Show answer
What judge biases must you control?Show answer
When can a judge be trusted?Show answer
How many cases do you need?Show answer
What makes an eval CI gate usable?Show answer
#What to carry forward
- Without evals you ship on vibes, and regressions go unnoticed for weeks.
- Five layers: assertions, golden set, judge, human, online. Start with assertions — they're cheap and catch a lot.
- Production failures are the best source of golden cases. Route them back automatically.
- Pairwise judging beats pointwise. Validate the judge against humans before trusting it.
- Compute your minimum detectable effect. A 3-point gain on 100 cases is noise.
- Gate CI on category regressions and show diffs, not aggregate scores.
- Evaluate retrieval and agent trajectories separately from final answers.