Evaluation Fundamentals: Offline & Online
Published
Your bar: explain why evaluation — not the model — is the real moat, draw the line between offline eval (a fixed dataset, repeatable, run before you ship) and online eval (live traffic, A/B and shadow, measured after you ship), and walk the loop that turns a production failure into a permanent regression test. By the end you can answer the question every AI team eventually faces: how do you know a change made the system better instead of just different? 1
The whole discipline reduces to four moves. Each chip is one of them:
You can’t improve what you can’t measure
score offline against a fixed golden set before you ship
score online on live traffic after you ship
feed every failure back into the golden set
Why Evaluation Is the Moat
The model is a commodity — your competitor can call the same API. What you can’t copy is a curated dataset of what good means for your task and a measured baseline of how well you hit it. You cannot improve what you cannot measure. 2
Vibes don’t aggregate — they collapse at scale
Is Evaluation = systematically scoring an AI system’s outputs against defined success criteria, so a change becomes a measured before/after instead of a guess. You evaluate the system, not just the model.
Why it exists Every prompt, model, retrieval, or tool change can silently help or hurt. Without a score you can’t tell which, can’t compare to last week, and can’t prove progress.
Like (world) A thermometer for a fever. You don’t argue about whether the patient “feels warm” — you read a number, treat, and read it again to see if the treatment worked.
Like (code) A regression test suite. Code without tests “works on my machine”; a green suite is the contract that a refactor didn’t break behavior. Eval is that contract for AI.
✗ “Our model is great, so the product is great — the model is the moat.”
✓ The model is a commodity anyone can call. The moat is your dataset of what “good” means for your task plus a measured baseline — that’s what a competitor can’t copy.
✓ Vibes work at 5 examples and collapse at scale. A 3% regression you’d never spot by eye is thousands of bad answers in production. (illustrative)
📥 Memory rule: You cannot improve what you cannot measure. The model is a commodity; the eval is the moat.
Memory check
- Why is the model NOT the moat? → anyone can call the same API; the curated dataset of what's "good" for your task is the asset they can't copy
- What does a score buy you that eyeballing doesn't? → a before/after diff — you can prove a change helped or blocked a regression, and it scales past what a human can read
- What do you evaluate — the model or the system? → the whole system (prompt + retrieval + tools + model), because any of those can move quality
M1 — Your team ships LLM changes on “looks good to me.” Convince them evaluation is worth
building.
Hit these points: you cannot improve what you cannot measure — without a score, every prompt or model change is a coin flip you can’t compare to the last one → vibes don’t aggregate: a reviewer eyeballs 5 outputs, a system serves millions, and “looks good” hides a small regression that’s thousands of bad answers → evaluation is the moat because the model is a commodity everyone can call; the asset is your dataset of what good looks like for your task → the minimum viable eval is a golden set of ~50 cases plus one grader plus a baseline number to diff against → the payoff: every change becomes a measured before/after, and CI can block a regression the way it blocks a failing unit test.
Offline Evaluation
Offline eval scores the system against a fixed dataset — the golden set — before you ship. Same inputs every run, so it’s reproducible, runs in CI, and gates the merge. It’s the integration test suite for AI behavior. 3
The harness: dataset → runner → grader → report
Three ways to score a case
| Grader | How it works | Use it when |
|---|---|---|
| Programmatic | Deterministic check: exact-match, regex, JSON schema, tool succeeded | Output is structured or has one right answer — cheapest, most reliable |
| LLM-as-judge | An LLM scores / compares outputs against a rubric | Open-ended quality at scale — cheap, but biased; calibrate first |
| Human | A person applies a rubric | Gold labels & audits — the trusted source, but slow and costly |
Golden set vs benchmark — don’t confuse them
| Dimension | Golden set (yours) | Benchmark (public) |
|---|---|---|
| Purpose | Is the system right for your task? | Compare models against each other |
| Data | Private, curated, your real inputs | Shared, public (MT-Bench, HELM) |
| Trust | High — you hand-checked it | Rots: contamination, saturation |
| Role | Gates your ship | Shortlists candidate models |
Is Offline eval = scoring the system against a fixed golden set before shipping. Reproducible, gated in CI. A golden set is a versioned set of (input, expected / acceptance-criteria) cases, changed only by deliberate review.
Why it exists You need a repeatable, pre-ship signal that a change helped or hurt — one you can re-run on every commit and block a merge on, exactly like a unit test.
Like (world) A drug trial against a fixed cohort: same patients, same protocol, run again after each formulation change so the only variable is the change itself.
Like (code) Snapshot / golden-file tests: a curated set of fixtures with expected outputs; CI fails the build when the new output diverges from the approved snapshot.
✗ “A bigger golden set is always better — dump in every log line.”
✓ Small and hand-checked beats large and noisy. The golden set is fixtures: representative, labeled, versioned, changed only by review — not a raw traffic dump.
✗ “We scored high on the public benchmark, so we’re good.”
✓ Benchmarks measure a generic task and rot via contamination (test data leaked into training = memorization, not skill). A private golden set predicts your production.
📥 Memory rule: Offline = fixed dataset, repeatable, pre-ship, gates the merge. Build the harness once; diff every change vs the baseline.
Memory check
- What makes offline eval reproducible? → a fixed dataset — same inputs every run, so the only variable is your change
- What are the four parts of an eval harness? → dataset + runner + grader + report; you diff the report against a baseline
- Golden set vs benchmark? → golden = your private curated fixtures that gate your ship; benchmark = shared public data to compare models, and it rots
M2 — Walk me through building an offline eval for a support assistant from scratch.
Hit these points: define success criteria per task before writing cases — what’s a pass, what’s a fail, in measurable terms → collect a golden set of real, representative inputs paired with expected outputs or acceptance criteria; keep it small, hand-checked, versioned like test fixtures → pick a grader per case: exact-match / programmatic where structured, LLM-as-judge where open-ended, humans for the gold labels → run the harness (dataset → runner → grader → report) → establish a baseline number, then every change is a diff vs that baseline → wire it into CI so it gates the merge → name the limit: a fixed dataset can’t catch what you didn’t think to put in it — which is why you also need online eval.
Online Evaluation & Closing the Loop
Offline only measures the distribution you captured. Online eval measures quality on live traffic after you ship — in two shapes: A/B (real users see the variant, you compare outcomes) and shadow (run the new system in parallel, discard its output, zero user risk). 4
Shadow vs A/B — safety vs signal
LLM-as-judge — a cheap sensor you must calibrate
Offline ↔ online — complementary, not rivals
| Dimension | Offline | Online |
|---|---|---|
| Data | Fixed golden set | Live production traffic |
| When | Before ship (gates the merge) | After ship (measures reality) |
| Repeatable? | Yes — same inputs every run | No — traffic drifts constantly |
| Blind spot | Only what you put in the set | Can’t gate a deploy that hasn’t happened |
Is Online eval = measuring quality on live traffic after shipping. A/B splits real users between old and new and compares outcomes; shadow runs the new system in parallel and discards its output.
Why it exists A fixed dataset can’t cover what you never imagined. Real traffic drifts and surfaces failure classes the golden set missed — online is the only honest signal of production quality.
Like (world) Crash-test dummies (offline, repeatable lab) vs real-world accident data (online, messy but true). You need both: the lab to gate the design, the road to find what the lab missed.
Like (code) Tests in CI (offline) vs production observability / canary releases (online). Green CI lets you deploy; metrics and canaries tell you it actually worked under load.
✗ “Offline eval is green, so we’re done — ship and move on.”
✓ Green offline + unhappy users = a coverage gap, not a broken eval. Add online signals and fold the failing live cases back into the golden set.
✗ “The LLM judge scored the new prompt higher, so it’s better. Ship it.”
✓ An uncalibrated judge has biases (position, verbosity, self-preference). Measure its agreement with humans first; otherwise it ships regressions confidently.
📥 Memory rule: Offline gates the ship; online proves it worked. Feed every production failure back into the golden set — the loop closes.
Memory check
- Shadow vs A/B in one line each? → shadow = run new in parallel, discard output, zero user risk; A/B = split real users, they see the variant, you get an outcome signal
- Why must you calibrate an LLM judge? → it has position / verbosity / self-preference bias; measure its agreement with human labels before trusting it to gate
- How does the loop close? → harvest failing live cases, label them, fold them into the golden set so the next offline run catches that class
M3 — Offline eval is green but users complain after you ship. What happened and what do you add?
Hit these points: offline eval only measures the distribution you captured in the golden set — real traffic drifts and hits inputs you never fixtured → green offline + unhappy users = a coverage gap, not a broken eval → add online evaluation: A/B split real users between old and new and compare outcomes, or run the new system in shadow (same traffic, output discarded) to compare safely with zero user risk → instrument production signals: thumbs-down, regenerate-rate, escalation-to-human, task completion → close the loop: harvest the failing live cases, label them, fold them into the golden set so the next offline run catches that class → the two are complementary — offline is repeatable and pre-ship, online is real and post-ship.
M3 — Your LLM-as-judge gives a new prompt a higher score, so you ship. The judge was wrong. How do you prevent this?
Hit these points: an LLM judge is itself a model with biases — position (favors the first option), verbosity (favors longer answers), self-preference (favors its own family’s text) → never trust a judge you haven’t calibrated: measure its agreement against a human-labeled slice before letting it gate anything → a strong judge can reach roughly human-level agreement on some tasks, but that’s dataset-dependent and must be re-verified → mitigations: randomize option order, force a rubric / chain-of-thought, use a different model family as judge, anchor with reference answers → treat the judge as a cheap noisy sensor that scales human judgment, never a replacement for the gold labels it was calibrated against.
Retrieval-specific eval: RAG pipelines need their own metrics (faithfulness, context precision/recall). The retrieval-eval deep dive lives in Context Engineering · Lesson 6 — Retrieval Evaluation & Observability. This track generalizes evaluation to whole AI systems and agents.
Retrieval practice — test the three modules
Q1. The strongest argument that evaluation, not the model, is the moat is that…
Q2. What makes <em>offline</em> evaluation reproducible enough to gate a merge in CI?
Q3. The defining difference between a <em>shadow</em> deployment and an <em>A/B</em> test is that…
Q4. Before letting an LLM-as-judge gate a ship decision, you must first…
Q5. Offline eval is green but production users complain. The right next step is to…
Interview — pick your bar
Answer out loud in ~60s, then reveal. Core = recall · Senior = trade-offs & failure modes · Staff = synthesis under ambiguity · System Design = open design round (a different axis, not a harder level).
Why is evaluation called the real moat for an AI product?
What is the difference between offline and online evaluation?
What is a golden set and how is it different from a benchmark?
What are the three ways to score an eval case, and when do you use each?
Offline eval passes but production users complain. Diagnose.
When do you use shadow deployment vs an A/B test for online evaluation?
Your LLM-as-judge prefers the new prompt. Should you trust it? Argue both sides.
A teammate wants to grow the golden set by dumping in every production log line. Push back.
Map the full eval loop end to end: from a failing user report to a regression test that protects against it.
One eval system, three forces — speed, trust, coverage — that pull against each other. How do you reason about the trade-offs?
"We hit 90% on the public benchmark, so we don't need our own eval." Tear this apart as a system design.
- Clarify scope: what's the task, what's the cost of a wrong answer vs a missed answer, is there ground truth, who can label?
- Define success criteria per task first — measurable pass/fail, not "good."
- Build a small, versioned golden set of real, representative (input, expected) cases, hand-labeled by humans.
- Choose graders: programmatic where structured, calibrated LLM-as-judge where open-ended, human for gold labels and audits.
- Stand up the harness (dataset + runner + grader + report), set a baseline, and wire offline regression eval into CI to gate the merge.
- Ship behind shadow first (no user risk), then A/B to measure real lift; instrument production signals (thumbs-down, regenerate, escalation, task success).
- Close the loop: route live failures back into the golden set; name risks — benchmark contamination, judge bias, coverage gaps — and measure the loop, not just the model.
Design an evaluation strategy for a new LLM feature, from zero to a CI gate plus production monitoring.
A leader says "just use the public leaderboard score to pick our model." Tear this apart and propose what you'd do instead.
These notes reflect my current understanding and are updated as I learn, build, and discover better explanations.