To build LLM evals that actually predict production behaviour: sample 100–300 real inputs from your own traffic, have a domain expert label what "correct" means for each, and grade outputs with the cheapest grader that agrees with that expert: code first, a calibrated LLM judge second, humans for the rest. Run the suite on every prompt, model or retrieval change in CI, and compare candidates on paired results with confidence intervals, not on a single average. Public leaderboards tell you which models are worth testing. They do not tell you which one wins on your task.
That is the whole method. The rest of this post is how to do each step without fooling yourself.
Scope: this post covers single-turn and short-chain LLM features: extraction, classification, drafting, summarisation, support replies. Multi-step agents and retrieval pipelines have their own failure surfaces; we cover those separately in our posts on evaluating agents with trajectory evals and evaluating RAG in production. If your feature is document extraction, measuring LLM document extraction accuracy goes deeper on field-level evals and confidence routing. For what goes wrong once agents ship, see Agent failure modes in production: loops, drift, tool misuse and recovery.
01Why public leaderboards don't predict your results
A leaderboard score is a measurement of one model, on one distribution, with one prompt and one scaffold, graded one way. Your product changes all four. There are three specific reasons the number doesn't transfer.
1. Distribution mismatch. MMLU-style knowledge questions, competition maths and Python puzzles look nothing like "extract the cancellation clause from this 40-page supplier contract and return it as JSON". Model rankings reorder across task types. The only distribution that matters is yours.
2. Contamination. Public benchmarks leak into training data. When Scale AI built GSM1k, a fresh set of grade-school maths problems matched to GSM8k in difficulty, they observed accuracy drops of up to 8% for some model families, and a positive relationship (Spearman's r² = 0.36) between how likely a model was to generate GSM8k examples verbatim and how much worse it did on the unseen set. The same paper notes most frontier models showed little sign of overfitting. The lesson isn't "benchmarks are fake"; it's that a public test set is a depreciating asset, and you can't tell from the outside how far it has depreciated for a given model.
3. Selective disclosure on preference arenas. The Leaderboard Illusion (Singh et al., 2025) analysed Chatbot Arena (since renamed LMArena, and now simply Arena) and found undisclosed private testing let a handful of providers test many variants and publish only the best (the authors identify 27 private variants tested by Meta ahead of the Llama 4 release), and that Google and OpenAI had received an estimated 19.2% and 20.4% of all arena data respectively. At the time of writing, Arena's leaderboard policy still allows providers to test multiple anonymous variants before a public release. Human preference on open-ended chat is also a different objective from "did the invoice total parse correctly".
What leaderboards are good for: building a shortlist. Pick three or four candidates from them, then let your own eval decide.
02What eval-driven development looks like in practice
Eval-driven development is test-driven development with a probabilistic system under test. The loop:
real traffic ──► sample + label ──► golden set (versioned)
▲ │
│ ▼
production ◄── ship if gate passes ◄── run suite on change
monitoring │
│ ▼
└──── new failure found ──► add case ──┘Three rules make it work:
- Write the eval before the fix. When someone reports a bad output, the first commit is a failing test case, not a prompt tweak. Otherwise you fix one case and silently break five.
- Every change goes through the suite. Prompt edits, model version bumps, temperature changes, retrieval tweaks, tool schema changes. A provider's "minor" model update is a change.
- Look at the data. Aggregate scores hide everything interesting. Someone senior should read 20–50 raw outputs per week. Hamel Husain's guide makes this point better than anyone: error analysis on real traces comes before metrics, not after. If you don't yet capture those traces, start with tracing LLM apps using the OpenTelemetry GenAI conventions.
You probably don't need a commercial eval platform on day one. A JSONL file in the repo, a 200-line Python harness, and a CI job will carry you a long way. Buy tooling when the bottleneck becomes collaboration on labelling or trace review, not before.
03How to build a golden dataset from real traffic
A golden set is a versioned collection of inputs, each paired with either a reference output or a precise statement of what a correct output must and must not contain. It is the single most valuable asset in your AI stack and the one most teams under-invest in.
Start from production, not from imagination
Synthetic test cases written by engineers cluster around the cases engineers think of. Real users don't. If you have traffic, sample it. If you don't yet (pre-launch), have domain experts write inputs in the voice of real users, then replace them with real traffic within the first few weeks.
A sampling plan that works:
| Stratum | Share of set | How to find it |
|---|---|---|
| Representative traffic | ~50% | Uniform random sample over the last 30–90 days |
| Known failures | ~20% | Thumbs-down, escalations, support tickets, incidents |
| Hard and long-tail inputs | ~15% | Longest inputs, rare languages, unusual formats, top-percentile token counts |
| Adversarial and safety | ~10% | Prompt injection attempts, PII bait, off-topic requests |
| Must-refuse / must-escalate | ~5% | Cases where the right answer is "I can't do that" |
These proportions are our starting heuristic, not a law. Adjust them once you see where failures concentrate.
Before anything leaves production, scrub it. Traces contain customer data. Redact PII deterministically (and test the redactor), record the source trace ID so you can go back, and agree retention with whoever owns data protection. An eval set is a dataset like any other: it needs an owner, an access policy and a deletion path.
Label with one domain expert, not a committee
The person who decides what "good" means should be the person who'd be embarrassed if the product got it wrong: the senior support lead, the in-house lawyer, the clinician. One accountable labeller produces more consistent labels than five occasional ones. Bring in a second labeller on a sample to measure agreement, not to vote.
Expect your criteria to move as you label. Shankar et al. called this criteria drift: "users need criteria to grade outputs, but grading outputs helps users define criteria." Plan for two passes. Label the first 50, rewrite the rubric, then re-label those 50 before continuing.
Prefer binary, specific criteria
"Rate helpfulness 1–10" produces noise. "Does the reply state the correct refund window for the customer's plan? PASS/FAIL" produces signal. Break a vague quality into the three to six specific things that actually make an answer wrong, and grade each as pass/fail. Binary labels are faster to produce, easier to agree on, and make judge calibration straightforward (below).
How many examples do you need?
Enough that the difference you care about is bigger than the noise. For a pass rate p on n independent cases, the standard error is √(p(1−p)/n). Worked through at p = 0.85:
| n | Standard error | Approx. 95% interval |
|---|---|---|
| 100 | 3.6 pp | ±7.0 pp |
| 200 | 2.5 pp | ±4.9 pp |
| 500 | 1.6 pp | ±3.1 pp |
| 1,000 | 1.1 pp | ±2.2 pp |
So with 200 cases, an 85% vs 88% comparison is inside the noise if you compare the two averages independently. Two things rescue you. First, compare models paired on the same cases (covered below), which is far more sensitive than comparing averages. Second, keep a small, curated set of must-pass cases where any single failure blocks a release, regardless of statistics.
Our default: 150–300 cases to start, growing to 500–1,000 as the product matures, plus a must-pass list of 20–50.
04Code-based graders vs LLM-as-judge vs human review
Use the cheapest grader that agrees with your expert. In order:
| Grader | Good for | Cost per case | Failure modes |
|---|---|---|---|
| Code (exact match, regex, JSON schema, unit tests, SQL execution, numeric tolerance) | Structured outputs, extraction, classification, code generation, format rules, latency and cost limits | ~zero | Brittle on paraphrase; rewards format over substance if that's all you check |
| LLM judge (reference-based or rubric-based, binary verdict) | Faithfulness to a reference, tone, policy compliance, "does it mention X" on free text | One model call | Position, verbosity and self-preference bias; drifts when the judge model changes; confidently wrong on domain detail |
| Human expert | Defining ground truth, calibrating judges, high-stakes or novel domains, final sign-off on big changes | Minutes of expert time | Slow, expensive, inconsistent between people and over time |
Push as much as you can into code. A surprising amount of "quality" is checkable: the JSON parses, the required fields are present, the cited clause number exists in the source, the SQL returns the expected rows (the core check in text-to-SQL that gets the numbers right), the reply is under 120 words, the answer contains no URL that isn't on the allow-list. A typical mature suite we'd expect to see is mostly code assertions with a handful of judged criteria on top, but measure your own mix rather than adopting ours.
A minimal harness
This is deliberately framework-free so the moving parts are visible. call_model is whatever client you already use.
# evals/harness.py
import json, re, hashlib
from dataclasses import dataclass
from pathlib import Path
from typing import Callable
@dataclass
class Case:
id: str
input: dict
reference: dict | None
criteria: list[str] # names of graders to apply
tags: list[str]
must_pass: bool = False
def load_cases(path: str) -> list[Case]:
return [Case(**json.loads(l)) for l in Path(path).read_text().splitlines() if l.strip()]
# --- code graders: return True/False ---------------------------------------
def valid_json(case, output: str) -> bool:
try:
json.loads(output); return True
except json.JSONDecodeError:
return False
def refund_window_correct(case, output: str) -> bool:
expected = case.reference["refund_days"]
m = re.search(r"\b(\d{1,3})\s*(?:calendar\s+)?days?\b", output)
return bool(m) and int(m.group(1)) == expected
def under_word_limit(case, output: str, limit: int = 120) -> bool:
return len(output.split()) <= limit
GRADERS: dict[str, Callable] = {
"valid_json": valid_json,
"refund_window_correct": refund_window_correct,
"under_word_limit": under_word_limit,
# judged criteria are registered in judge.py
}
def run(cases: list[Case], generate: Callable[[dict], str]) -> list[dict]:
rows = []
for c in cases:
out = generate(c.input)
results = {name: bool(GRADERS[name](c, out)) for name in c.criteria}
rows.append({
"id": c.id, "tags": c.tags, "must_pass": c.must_pass,
"output_sha": hashlib.sha256(out.encode()).hexdigest()[:12],
"results": results, "passed": all(results.values()),
"output": out,
})
return rowsStore every raw output alongside its scores. When a number moves, you will want to read what changed, and you can't re-generate yesterday's output from a non-deterministic model.
Writing an LLM judge that you can trust
Rules we follow:
- One criterion per judge call. A judge asked to assess five things at once does all five badly.
- Binary verdict, reasoning first. Ask for a short justification, then
PASSorFAIL. No 1–10 scales. - Give it the reference when you have one. "Is this consistent with the reference answer?" is a far easier task than "is this correct?"
- Use a different model family from the one under test, where practical. Zheng et al. identified position, verbosity and self-enhancement bias in LLM judges; using the same model to generate and grade invites the last one.
- For pairwise comparisons, run both orders. Position bias is well documented (Wang et al., 2023, Large Language Models are not Fair Evaluators); count a win only if it survives the swap, otherwise call it a tie.
- Pin the judge model version and temperature 0, and treat a judge change exactly like a product change: recalibrate before trusting the numbers.
# evals/judge.py
import json
from harness import GRADERS
JUDGE_MODEL = "judge-provider/model-id@2026-xx-xx" # pin an exact version
PROMPT = """You are grading one specific criterion for a customer-support reply.
Criterion: {criterion}
Customer message:
<input>{input}</input>
Reference facts (ground truth):
<reference>{reference}</reference>
Reply to grade:
<reply>{output}</reply>
Think briefly about whether the reply meets the criterion. Only the criterion matters;
ignore style, length and anything not covered by it.
Respond with JSON only: {{"reasoning": "<one or two sentences>", "verdict": "PASS" | "FAIL"}}"""
def make_judge(criterion_text: str, call_model):
def grade(case, output: str) -> bool:
raw = call_model(
model=JUDGE_MODEL, temperature=0,
prompt=PROMPT.format(criterion=criterion_text,
input=json.dumps(case.input),
reference=json.dumps(case.reference),
output=output))
try:
return json.loads(raw)["verdict"] == "PASS"
except (json.JSONDecodeError, KeyError):
return False # unparseable judge output counts as a fail; log and inspect
return grade
def register(call_model):
GRADERS["no_invented_policy"] = make_judge(
"The reply does not state any policy, price, deadline or entitlement that is "
"absent from or contradicts the reference facts.", call_model)
GRADERS["escalates_when_required"] = make_judge(
"If the reference facts say escalation_required=true, the reply tells the customer "
"a human will follow up and does not attempt to resolve the issue itself.", call_model)05How to calibrate an LLM judge against human labels
An uncalibrated judge is a random number generator with good grammar. Calibration means measuring how often the judge agrees with your expert, on cases the judge has never been tuned against, and correcting for its error rate.
Step 1: split your human-labelled data. For each judged criterion you need human PASS/FAIL labels. Split them into a small train set (examples you may put in the judge prompt as few-shot), a dev set (to iterate the judge prompt against), and a held-out test set you look at once. This is the approach Hamel Husain and Shreya Shankar describe in their evals FAQ (10–20% train, 40–45% dev, the rest held out for one final test), and it's standard ML hygiene: if you tune the judge prompt on the same cases you measure it on, you'll overestimate its accuracy.
Step 2: measure TPR and TNR, not accuracy. If 90% of outputs pass, a judge that always says PASS is 90% accurate and useless. Measure:
- TPR (true positive rate): of the outputs the human passed, what fraction did the judge pass?
- TNR (true negative rate): of the outputs the human failed, what fraction did the judge fail?
You need enough human failures to estimate TNR: deliberately oversample known-bad outputs into the calibration set. Cohen's kappa is a useful single summary if you need one; sklearn. computes it.
Step 3: correct the observed pass rate. Once you know the judge's error rates, you can estimate the true pass rate from the judge's observed pass rate with the Rogan–Gladen correction:
true_pass ≈ (observed_pass + TNR − 1) / (TPR + TNR − 1)Worked example. Your judge reports 80% passing. On the held-out test set it had TPR = 0.92 and TNR = 0.85. Then:
(0.80 + 0.85 − 1) / (0.92 + 0.85 − 1) = 0.65 / 0.77 ≈ 0.844The judge is under-reporting quality here because it is harsher than your expert on good outputs more often than it is lenient on bad ones. The correction is unstable when TPR + TNR is close to 1. A judge that bad shouldn't be in your suite at all.
Step 4: set an acceptance bar. Our default before a judge is allowed to gate releases: TPR ≥ 0.90 and TNR ≥ 0.80 on at least 30 held-out human failures and 30 held-out human passes, re-measured whenever the judge model, judge prompt, or product prompt changes materially. Those thresholds are our opinion, not an industry standard. For criteria where a missed failure is expensive (medical, financial, legal), raise the TNR bar and keep a human in the loop.
# evals/calibrate.py
from sklearn.metrics import cohen_kappa_score
def calibrate(human: list[bool], judge: list[bool]) -> dict:
tp = sum(h and j for h, j in zip(human, judge))
tn = sum((not h) and (not j) for h, j in zip(human, judge))
pos = sum(human); neg = len(human) - pos
tpr, tnr = tp / pos, tn / neg
return {"tpr": round(tpr, 3), "tnr": round(tnr, 3),
"kappa": round(cohen_kappa_score(human, judge), 3),
"n_pos": pos, "n_neg": neg,
"gate_ok": tpr >= 0.90 and tnr >= 0.80 and pos >= 30 and neg >= 30}
def corrected_pass_rate(observed: float, tpr: float, tnr: float) -> float:
denom = tpr + tnr - 1
if denom <= 0.2:
raise ValueError("Judge too close to chance to correct reliably")
return min(1.0, max(0.0, (observed + tnr - 1) / denom))06How to compare models on your own tasks
When a new model ships, the question isn't "is it better?" It's "is it better on our cases, by enough to justify the switch, at a cost and latency we accept?"
Compare paired, not averaged
Run both candidates on the same cases. For binary pass/fail, what matters is the discordant cases: where A passed and B failed (b), and where B passed and A failed (c). Cases both pass or both fail tell you nothing about which is better. McNemar's exact test is a binomial test on those discordant counts:
# evals/compare.py
from scipy.stats import binomtest
def paired_compare(a: dict[str, bool], b: dict[str, bool]) -> dict:
ids = a.keys() & b.keys()
a_only = sum(a[i] and not b[i] for i in ids)
b_only = sum(b[i] and not a[i] for i in ids)
n_disc = a_only + b_only
p = binomtest(b_only, n_disc, 0.5).pvalue if n_disc else 1.0
return {"n": len(ids), "a_only": a_only, "b_only": b_only, "p_value": round(p, 4),
"a_rate": sum(a[i] for i in ids) / len(ids),
"b_rate": sum(b[i] for i in ids) / len(ids)}Illustrative example: on 300 cases, model B passes 12 that A fails, and A passes 3 that B fails. B is ahead by 9 cases (3 pp). With 15 discordant pairs, the two-sided exact test gives p ≈ 0.035: a real, if small, improvement. Compared as independent averages at around 85%, a 3 pp gap on 300 cases would sit inside the noise. Pairing is what makes small suites usable.
Account for non-determinism
Even at temperature 0, many hosted models aren't bit-for-bit deterministic (Thinking Machines, Defeating Nondeterminism in LLM Inference, September 2025). Run each case k times (3 is a reasonable default for comparisons, 1 for routine CI) and track per-case pass rate. Cases that flip between runs are flaky; flag them, read them, and either tighten the criterion or accept that the task is genuinely ambiguous. A model that passes a case 3/3 is more valuable than one that passes it 2/3, even at the same average.
Report the whole picture
A model-comparison report we'd accept looks like this:
| Metric | Current (A) | Candidate (B) | Notes |
|---|---|---|---|
| Overall pass rate (paired) | 85.0% | 88.0% | p ≈ 0.035, 15 discordant |
| Must-pass cases | 50/50 | 49/50 | Blocks until the one regression is understood |
| Per-tag: billing | 91% | 94% | |
| Per-tag: escalation | 96% | 88% | Regression: investigate |
| Flaky cases (k=3) | 7 | 4 | |
| p95 latency | – | – | From your own load test |
| Cost per 1k requests | – | – | Worked from your token counts × list price |
(Figures illustrative.) Notice the overall win hides a regression on escalation. That's the normal case, not the exception, and it is why per-tag breakdowns and must-pass lists exist.
Prompts are not portable between models. A fair comparison gives each candidate a reasonable prompt-tuning budget on the dev split, then scores on the held-out split. Comparing your incumbent's heavily tuned prompt against a new model's first attempt will usually favour the incumbent.
07Running LLM regression tests in CI
The suite earns its keep when it runs automatically. A setup we'd recommend:
- On every pull request that touches prompts, model config, tools or retrieval: run the must-pass set plus a stratified sample (100–200 cases), k=1. Fast enough to keep PRs moving.
- Nightly, and before any release: the full set, k=3, with judges. Post the diff against the last release.
- On upstream model changes: if you call a floating alias (
latest), you are shipping whatever the provider shipped. Pin dated model versions and treat an upgrade as a PR.
Off-the-shelf frameworks
You don't have to build the harness yourself. Two we'd consider first:
- Promptfoo: YAML-driven, with deterministic assertions (
is-json,contains,regex,javascript,python,cost,latency) and model-graded ones (llm-rubric,g-eval,select-best,factuality). It has a GitHub Action that posts before/after comparisons to PRs. On 9 March 2026 Promptfoo announced that it had agreed to be acquired by OpenAI; the repository states it "remains open source and MIT licensed". - Inspect: Python-first, from the UK AI Security Institute and Meridian Labs. Strong for anything that grows towards agentic or multi-step tasks;
Task(dataset=...with an, solver=... , scorer=... ) inspect evalCLI.
A promptfoo config that mirrors the harness above:
# promptfooconfig.yaml
prompts:
- file://prompts/support_reply.txt
providers:
- id: openai:<pinned-model-id> # incumbent
- id: anthropic:messages:<pinned-model-id> # candidate
defaultTest:
assert:
- type: javascript
value: "output.split(/\\s+/).length <= 120"
metric: format
- type: llm-rubric
provider:
id: openai:<pinned-judge-model-id>
config:
temperature: 0
value: >-
The reply does not state any policy, price, deadline or entitlement that is
absent from or contradicts the reference facts: {{reference_facts}}
metric: no_invented_policy
# every test in this file must set vars.reference_facts
tests: file://evals/golden/support.yamlProvider ids take the form openai:<model> or anthropic: (providers), and the per-assertion provider override is documented under llm-rubric.
Whichever framework you pick, write your own small gate script over its JSON output. Framework defaults for "pass" are rarely the policy you actually want.
# evals/gate.py — exit non-zero to block the merge
import json, sys
from compare import paired_compare
base = json.load(open(sys.argv[1])) # {case_id: {"passed": bool, "must_pass": bool, "tags": [...]}}
cand = json.load(open(sys.argv[2]))
failures = []
for cid, r in cand.items():
if r["must_pass"] and not r["passed"]:
failures.append(f"must-pass regression: {cid}")
res = paired_compare({k: v["passed"] for k, v in base.items()},
{k: v["passed"] for k, v in cand.items()})
if res["a_only"] > res["b_only"] and res["p_value"] < 0.10:
failures.append(f"significant overall regression: {res}")
for tag in {t for r in cand.values() for t in r["tags"]}:
ids = [k for k, v in cand.items() if tag in v["tags"] and k in base]
if len(ids) < 20:
continue
drop = (sum(base[i]["passed"] for i in ids) - sum(cand[i]["passed"] for i in ids)) / len(ids)
if drop > 0.05:
failures.append(f"tag '{tag}' dropped {drop:.0%} on {len(ids)} cases")
print("\n".join(failures) or "gate passed")
sys.exit(1 if failures else 0)Note the asymmetric threshold: we block on a regression at p < 0.10 but would want stronger evidence before claiming an improvement. False alarms cost a re-run; missed regressions cost customers.
What evals cost to run
Work it out rather than guessing. Per full run:
judge_calls = cases × judged_criteria × k
judge_cost = judge_calls × (in_tokens × in_price + out_tokens × out_price)Illustrative, with stated assumptions: 500 cases, 2 judged criteria, k = 3 gives 3,000 judge calls. Assume 1,500 input and 150 output tokens per call, at a hypothetical $3 per million input and $15 per million output tokens. That's 3,000 × (0.0045 + 0.00225) = $20.25 per full run, plus the cost of generating the outputs under test. Nightly, that is roughly $600 a month in judge calls. Check your provider's current price list and plug in your own token counts. Batch APIs and prompt caching on the fixed judge instructions can cut this substantially where your provider offers them; our post on LLM cost engineering with prompt caching, model routing and batching covers both.
08Reference: an eval suite spec you can copy
This is the asset we wish we'd had the first time. It's a single specification covering the case schema, grader choice, judge acceptance and release gating. Put it in your repo as evals/ and argue about it in code review.
1. Golden case schema (JSONL, one case per line)
{
"id": "sup-0412",
"source": {"trace_id": "tr_9f2c...", "sampled_at": "2026-02-26", "stratum": "known_failure"},
"input": {"customer_message": "...", "plan": "pro_annual", "locale": "en-GB"},
"reference": {"refund_days": 30, "escalation_required": false,
"must_mention": ["30 days"], "must_not_mention": ["store credit"]},
"criteria": ["refund_window_correct", "no_invented_policy", "under_word_limit"],
"tags": ["billing", "refund"],
"must_pass": true,
"labelled_by": "support-lead",
"label_version": 3,
"pii_redacted": true
}2. Grader selection matrix
| If the criterion is… | Use | Example |
|---|---|---|
| A format or schema rule | Code | Valid JSON, required keys, word limit |
| A fact with one right answer | Code (normalised compare) | Refund days, invoice total ± 0.01 |
| Executable | Code (run it) | Generated SQL returns expected rows; generated code passes tests |
| Presence/absence of a known string or entity | Code first; judge if paraphrase is common | "Mentions the 30-day window" |
| Consistency with a reference | Calibrated LLM judge | "No policy not in the reference facts" |
| Tone, policy or style against a written rubric | Calibrated LLM judge, binary | "Doesn't blame the customer" |
| Domain correctness without a reference | Human expert | Clinical, legal, novel financial advice |
| Comparing two outputs holistically | Pairwise judge, both orders, ties allowed | Model A vs B release check |
3. Judge acceptance checklist
- One criterion per judge; binary verdict; reasoning before verdict
- Judge model version pinned; temperature 0
- Judge from a different model family to the system under test (or documented reason why not)
- Few-shot examples drawn only from the train split
- ≥ 30 human PASS and ≥ 30 human FAIL in the held-out test split
- TPR ≥ 0.90, TNR ≥ 0.80 on held-out test (raise TNR for high-stakes criteria)
- Recalibrated after any change to judge model, judge prompt, or the product prompt it grades
- Unparseable judge output treated as FAIL and logged
4. Release gating policy
| Check | PR (sample, k=1) | Release (full, k=3) |
|---|---|---|
| Any must-pass case fails | Block | Block |
| Overall paired regression, p < 0.10 | Warn | Block |
| Any tag (n ≥ 20) drops > 5 pp | Warn | Block, unless signed off by tag owner |
| Flaky case count rises > 50% | – | Investigate before release |
| Judge calibration older than last judge/prompt change | Warn | Block |
| p95 latency or cost per request exceeds budget | Warn | Block |
5. Maintenance cadence
- Weekly: a named person reads 20–50 production traces and the week's failed eval cases; new failure modes become cases.
- Monthly: re-sample 50 fresh production inputs into the set; retire cases that no longer reflect the product.
- Quarterly: re-label a 10% sample to check for label drift; re-run judge calibration from scratch.
- Never: let the golden set leak into prompt few-shots or fine-tuning data. Keep a hash list of eval inputs and check training data against it. Contamination isn't only a public-benchmark problem.
09Where evals cross into the rest of the stack
Evals look like an AI problem, but most of the hard parts belong to other layers. The golden set is a governed dataset with PII, retention and lineage questions: that's the data layer. The adversarial stratum overlaps directly with security testing; our post on securing AI agents: prompt injection, tool permissions and least privilege covers the threats those cases should encode. The CI gate is ordinary DevOps, and a model upgrade should move through the same release process as any other dependency bump, ideally behind feature flags and progressive delivery so a bad switch can be rolled back. And the decision to switch models, or to self-host an open-weight one, is only defensible if you have numbers on your own tasks. Teams that keep these in separate silos tend to end up with an eval suite nobody trusts and a model choice nobody can justify.
10Common failure modes in LLM eval programmes
- Optimising the judge, not the product. When the judged score climbs and user complaints don't fall, your judge has drifted from your users. Recalibrate against fresh human labels.
- A golden set that never changes. Six months on, it describes the product you had, not the one you have. Sample new traffic monthly.
- Too many vague criteria. Twelve 1–5 scales averaged into a "quality score" can't tell you what broke. Fewer, binary, specific.
- Testing only the happy path. If the set contains no must-refuse or must-escalate cases, you'll find out about those in production.
- One run per comparison. A single run of a non-deterministic system is an anecdote.
- Floating model aliases. You will regress without changing a line of code, and your eval history will be meaningless.
- Engineers labelling domain cases. Fine for format; wrong for whether the legal advice is right.
11FAQ
How many test cases do I need to start an LLM eval? Start with 100–300 real, expert-labelled cases plus 20–50 must-pass cases. At 200 cases an independent pass-rate estimate is roughly ±5 percentage points at 95% confidence, but paired comparisons between two models on the same cases detect much smaller differences. Grow to 500–1,000 as the product matures.
Can I use the same model as both generator and judge? You can, but you shouldn't by default. Self-enhancement bias is documented in the LLM-as-judge literature. Use a different model family where practical, and in all cases calibrate the judge against human labels before letting it gate releases.
Should LLM judges use a 1–10 score or pass/fail? Pass/fail, one criterion per call. Numeric scales are harder for humans to label consistently, harder to calibrate, and averaging them hides which aspect failed.
Are synthetic test cases useful? Yes, for coverage of rare or adversarial inputs you haven't seen yet, and for bootstrapping before launch. They shouldn't be the majority of the set. Real traffic contains the inputs nobody thought to write.
How often should I re-run evals? On every PR touching prompts, model config, tools or retrieval (a sample), nightly and before every release (the full suite), and whenever you change a pinned model version. Re-calibrate judges whenever the judge or the prompt it grades changes.
Do I need a commercial eval platform? Not to begin with. A versioned JSONL golden set, a small harness and a CI gate cover most teams for months. Adopt a platform when trace review and collaborative labelling become the bottleneck, and make sure you can export your data out of it.