AI Systems Reference/Evaluation & Quality

Offline & Online Evaluations

Golden datasets, regression suites, A/B tests on prompts and models, and when offline metrics lie about production quality.

4/5Overview: 35m

Why offline eval is necessary but insufficient

LLMs are non-deterministic — you cannot unit-test "correctness" with fixed assertions alone. Offline evals (golden datasets + scorers) catch regressions before deploy. Online evals (A/B tests, production metrics) catch what lab sets miss: real user phrasing, drift, adversarial usage.

Offline evaluation harness

Golden dataset → Pipeline (prompt v3, model X) → Scorer → Pass/fail + score
ComponentBest practice
Dataset100–500 cases minimum; stratified by intent, edge, adversarial
ScorersMix: exact match, regex, LLM-as-judge, human rubric
CI gateBlock deploy if score drops > 2% vs baseline
VersioningPin dataset + prompt + model in eval run metadata

Tools: Braintrust, Langfuse, custom pytest + JSON fixtures.

LLM-as-judge pitfalls

Cheap but dangerous:

  • Judge favors verbose answers
  • Position bias (prefers first option)
  • Correlated errors (same model family)

Mitigate: chain-of-thought rubric, swap answer order, calibrate against human labels monthly.

Online evaluation

MethodMeasuresCost
A/B testBusiness + quality metrics on live trafficRisk to cohort B
Shadow trafficNew pipeline, don't show output2× inference cost
Implicit signalsThumbs, copy rate, task completionNoisy
Human review sampleGold-standard quality$$$, slow

Ship prompt changes canary → ramp with online quality dashboard — same as feature flags.

What to measure

Product-dependent, but common:

  • Task success rate (did user accomplish goal?)
  • Citation accuracy (RAG products)
  • Edit distance (user changed answer before sending)
  • Escalation rate (bot → human)

Avoid optimizing only perplexity or automated scores users don't feel.

Eval-driven development workflow

  1. Define failure cases from production incidents → add to golden set
  2. Fix prompt/pipeline → offline score improves
  3. Canary deploy → online metrics confirm
  4. Weekly eval report for stakeholders

Eugene Yan: evaluators are products, not one-off scripts.

Regression when vendor updates model

gpt-4o-2024-08-06gpt-4o-2024-11-20 can shift behavior silently.

  • Run full golden set on version change
  • Pin versions in production config
  • Subscribe to vendor changelogs

Interview framing

"How do you test an LLM feature?"

  1. Offline golden set with CI gate
  2. Online canary with rollback triggers
  3. Human review for high-stakes paths
  4. Continuous harvest of production failures into dataset

Senior signal: Admit offline/online divergence — "our lab set under-represents multilingual queries; we supplement with stratified online sampling."

Link forward

AI System Observability instruments the metrics that feed online eval loops.

Further Reading

Hands-On Tasks (Optional)

Design drills and architecture sketches — gateway SLOs, eval gates, rollout plans. Assumes AI Engineering fundamentals are already in place.

  • Build a 20-case golden eval set

    For one feature: 10 happy path, 5 edge cases, 5 adversarial. Define pass criteria (exact match, semantic similarity threshold, human rubric). Run against two model tiers and compare.

    30m