Why this matters
Without evaluation, every prompt tweak and model upgrade is a guess, and quality regressions reach users silently. Evaluation is what makes AI engineering engineering.
Q21. Your eval stack?
| Level | What | When |
|---|---|---|
| Deterministic | Schema, regex, ranges, routing exact-match, latency bounds | Every PR |
| LLM-as-judge | Rubric grading with reasons, calibrated on human labels | CI, nightly |
| Online | Sampled faithfulness, thumbs, edits, refusals, drift alerts | Continuous |
Q22. QA is worried about non-determinism.
"Make the deterministic parts deterministic and quarantine the rest." Contract tests on schemas; mocked-provider tests for app logic; a small live suite; eval thresholds as CI gates; temperature=0 reduces variance but guarantees nothing. Casebook: a paid, non-deterministic propose step separated from a free, deterministic select step, so rules can be retuned and tested without calling the model again (S4).
Q23. LLM-as-judge pitfalls?
Position bias, verbosity bias, self-preference, drift when the judge changes. Calibrate on human labels, pairwise with order swapping, pin the judge, never the only signal. Treat a model's own confidence or quality score as not ground truth until it tracks real user acceptance.
Q24. How do you build a golden set?
Rights-cleared data with consent recorded per item; dev and private holdout split (holdout never used for tuning); two annotators independently, lint against an annotation guide, measure agreement, adjudicate; set the agreement floor from a calibration round. See S5: build the measurement layer before the feature.
How to do it
- Define the task's success in measurable terms (field accuracy, faithfulness, acceptance rate).
- Collect 50–200 representative cases, including edge cases and adversarial inputs; add real failures as they appear.
- Write deterministic checks first; add a judge only for what code can't check.
- Record a baseline. Every change is compared against it.
- Gate releases: a change ships only if it doesn't regress agreed metrics beyond a threshold.
- Online: sample production traffic for judging and human review; track drift.
eval run: prompt v7 + model X on golden-dev (120 items)
schema valid 120/120 (gate: 100%)
field accuracy 94.2% (baseline 92.5%, gate: ≥ 92%)
faithfulness 0.91 (judge, calibrated κ=0.78 vs humans)
p95 latency 2.8 s (gate: ≤ 3.5 s)
cost per item $0.0042 (baseline $0.0051)
→ PASS; run holdout before release
(The numbers above are an illustrative format, not results from a real system.)
Mutation-testing your metrics
A wrong metric silently ruins every decision built on it. Test your metric code like production code, including mutation testing, so a broken scorer can't report "improvement" (S5).
Common mistakes
- Tuning on the same set you report.
- A single aggregate score that hides regressions in one category.
- Judges that were never compared with human labels.
Check yourself
Why keep a private holdout set?
Repeated tuning against the dev set overfits to it. The holdout, used rarely and never for tuning, gives an honest estimate of real performance.
Name three LLM-as-judge biases and a mitigation for each.
Position bias → swap order in pairwise comparisons. Verbosity bias → rubric that rewards correctness and penalises padding, length-controlled comparisons. Self-preference → use a different model family as judge. Drift → pin the judge version and recalibrate on changes.
Build it
Build an eval harness for your RAG or extraction project with deterministic checks, a calibrated judge on 30 human-labelled items, a baseline file, and a CI job that fails on regression.