TL;DR
Evals stop being a notebook the day a prompt change ships a regression. How to build the harness, version the dataset, and gate deploys on eval scores — without turning the gate into theater.
Every serious LLM project eventually hits the same wall: someone changes one word in a prompt, or swaps one model checkpoint for another, and nobody can say whether the output got better or worse. The first time it happens, the team runs a few prompts by hand and squints. The second time, it becomes a spreadsheet. The third time, it becomes an incident, because the change that nobody measured shipped to production and the regression was discovered by a customer. Eval infrastructure is the answer to that wall: a harness that runs the same cases against every change, a dataset that is versioned like code, and a gate that stops a deploy when the score moves the wrong way.
The short version: build the harness before you need it, with a runner that is separate from the model and a recorder that keeps every sample. Version the golden dataset like code, and promote cases from production traces instead of inventing them. Score with deterministic checks wherever an exact answer exists, and use a calibrated judge only where it does not. Gate deploys on the score against a baseline, in warn mode first, and block only on the evals that have earned it. Our guide to running evals in production covers what to measure and how to interpret the results; this guide is the infrastructure underneath it — the harness, the dataset, and the gate.
Why evals are infrastructure, not a notebook
A notebook eval is a script somebody runs when they remember to, against a model version that is whatever the notebook says, scored by an eyeball. It catches nothing, because the moment it matters — the pull request that changes the system prompt, the model upgrade that lands on a Friday — nobody runs it, and if they did, there would be no baseline to compare against. The difference between a notebook and infrastructure is not the scoring logic. It is reproducibility: the same cases, the same prompt template, the same scorer, the same model version, run the same way, every time, with the result stored where it can be compared to the last run.
Three properties make an eval runnable as infrastructure. First, the model is behind an interface — a completion function — so the harness does not care whether the model is an API endpoint, a local checkpoint, or a different provider's model. Swapping the model is a configuration change, not a rewrite of the eval. Second, every run is recorded: the input, the output, the score, and the version of every layer that produced it. A score without the log behind it is a rumour; the log is what lets you answer "which cases regressed, and what changed" instead of "the number went down." Third, the dataset is a versioned artifact. A golden set that changes without a commit is a test suite that changes without a pull request, and a test suite that changes silently cannot catch a regression, because the regression and the test moved together.
The shape of the work is small at first and that is the trap. A team with one prompt and fifty cases can run evals from a script, and it works, until the day there are three prompts, two models, and four hundred cases, and the script has become a snowball of flags and special cases. The harness is worth building when the evals outgrow one person's memory — which is earlier than most teams think, usually the second prompt.
The harness: runner, completion function, recorder
The harness has three pieces, and keeping them separate is the design. The runner takes a set of cases and a model, executes them, and aggregates the scores. The completion function is the only part that knows how to call a model — it takes an input and returns a response, and it hides whether that response came from an API, a local server, or a stub. The recorder writes every event — input, output, score, timing — into a log, usually one JSON object per line, that can be replayed later. That separation is the whole architecture: the eval is the cases and the scorer, the harness is the plumbing, and the model is interchangeable.
The most widely used open-source shape of this is OpenAI Evals, the framework behind the company's own model evaluations. An eval is defined by a YAML registry entry that names a class, a dataset, and grading criteria, and the oaieval command runs it against any model the completion function can reach. The built-in eval classes cover the common grading shapes: Match and FuzzyMatch for checking the output against an expected string, and ModelGradedQA for letting another model judge an open-ended answer. The framework is not limited to OpenAI models — the completion function is a protocol, and any model that implements it can be evaluated. For academic benchmarks, the other standard is EleutherAI's lm-eval-harness, which ships with hundreds of built-in tasks and is the engine behind the Open LLM Leaderboard. Most mature teams use both: the harness for their own domain evals, and lm-eval-harness for baseline comparisons against published benchmarks.
A minimal eval definition, in the OpenAI Evals registry format, shows how little is needed to start:
# evals/registry/evals/my-support-eval.yaml
my-support-eval:
id: my-support-eval.v1
metrics: [accuracy]
my-support-eval.v1:
class: evals.elsuite.basic.match:Match
args:
samples_jsonl: my-support-eval/samples.jsonlOne file names the eval, one file holds the cases, and the runner does the rest. The discipline is in what the file does not show: the version suffix on the id, which is how the dataset and the eval evolve without silently changing what an old run measured. When the cases change, the version changes, and the old runs stay comparable to the old version.
The recorder matters more than it looks. The per-sample log is the artifact that turns a failed gate into a debuggable event: it shows which cases regressed, what the model actually output, and what the scorer saw. Without it, a gate that blocks a deploy produces a number and a shrug, and the team learns to override the gate rather than fix the regression. Store the log with the run, keep it queryable, and make the first thing a developer sees after a blocked deploy the list of failing cases, not the aggregate score.
The dataset: a golden set that earns its name
The dataset is the part of the system that decides whether the evals mean anything, and it is the part teams underinvest in most. A golden set is a collection of cases — an input, an expected output or a grading rule, and metadata about where the case came from — that represents the behaviour the team actually cares about. The cases should come from production, not from imagination. The best source is the trace log: real inputs the system received, with the outputs that were accepted, or the outputs that were corrected. A case invented in a meeting room tests the team's imagination; a case promoted from a trace tests the system's behaviour.
Version the dataset like code, because it is code. A case added, removed, or edited should go through a pull request with a reason, and the dataset should carry a version that the harness records with every run. Two common versioning shapes work: keep the cases in Git as JSONL files, which is simple and reviewable and breaks down somewhere past a few thousand cases; or keep them in a store built for data versioning, such as DVC or LakeFS, which adds branching and diffing for datasets at the cost of another system to operate. Either is better than the third shape, which is a spreadsheet on somebody's laptop that nobody else can reproduce.
Contamination is the failure mode to design against from the start. If the cases in the golden set also appear in the model's training data, or in the prompt's few-shot examples, the score measures memorisation, not capability. Keep the golden set out of training data, keep it out of the prompt, and keep a held-out slice that the team never looks at during development — the slice that is only run before a release. The held-out slice is the honest number; the development slice is the number the team optimised, and optimising against the test is the oldest failure in evaluation.
Two more dataset disciplines, both cheap. First, scrub personally identifiable information before a trace becomes a case: a golden set that contains customer data is a data breach waiting for a repository leak, and the scrubbing belongs in the promotion pipeline, not in a developer's memory. Second, tag every case with its source — trace, human-written, synthetic — and its difficulty, so a regression can be traced to a class of cases rather than a single number. A score that drops by two points is uninformative; a score that drops by two points entirely on the cases promoted from last month's support tickets is a diagnosis.
Scorers: deterministic first, judges second
Scoring is where most eval systems go wrong, because the easiest scorer to write is a model asked to judge, and the easiest scorer to trust is the one that checks an exact answer. The rule is simple: use a deterministic scorer wherever an exact answer exists, and use a judge only where it does not.
Deterministic scorers are cheap, fast, and reproducible. Exact match, substring match, regular expressions, JSON schema validation, unit tests for generated code, and execution checks for generated SQL or tool calls — all of these return the same score on the same output every time, cost nothing to run, and fail loudly when the output format drifts. For code generation, running the generated code against a test suite is a far better scorer than asking a model whether the code looks right. For retrieval, checking whether the expected document appears in the returned set is a better scorer than asking a model whether the answer is supported. The deterministic scorer is the default, and every case that can be scored this way should be.
The LLM-as-judge scorer is for the cases where no exact answer exists: open-ended summaries, tone, helpfulness, whether a refusal was appropriate. A judge is a model given a rubric and asked to grade, and it has three failure modes that have to be managed. It is inconsistent — the same output can score differently across runs, so the judge's temperature should be zero and the rubric should be as specific as the team can write it. It is biased — judges prefer longer answers, prefer their own model's style, and prefer the answer listed first — so the rubric should name the bias explicitly, and the team should measure agreement between the judge and a human on a sample of cases before trusting the judge at all. And it is expensive — every scored case is another model call, roughly doubling the token cost of the eval, and the cost grows with the dataset. The calibration step is the discipline: take a few dozen cases, have a human grade them, have the judge grade them, and measure the agreement. If the agreement is low, the rubric is wrong, not the model — rewrite the rubric, not the judge. A judge that has never been calibrated against human grades is a coin flip with a latency budget.
There is a third scorer shape that teams reach for too late: the human review. Some cases are too subtle for a deterministic check and too important for a judge, and the right answer is a queue of cases that a human grades on a regular cadence. The human queue is not a fallback; it is the calibration set for the judge, and the source of the cases that the judge gets wrong. Treat it as infrastructure — a scheduled review, with a fixed sample size, and a record of the grades — and it stays useful. Treat it as an ad-hoc favour and it stops happening the week it is needed most.
The CI gate: block, warn, or watch
The gate is where eval infrastructure earns its keep or becomes theater, and the difference is in how it is introduced. A gate that blocks deploys on the first day, on thresholds nobody has seen in practice, will be overridden within a week — and an overridden gate is worse than no gate, because it teaches the team that the evals are an obstacle rather than a signal. The rollout is the same discipline as any other guardrail: warn first, block later, and only on the evals that have earned it.
Start with the gate in warn mode, reporting the score on every pull request without blocking it. The team watches for two weeks and learns three things: what the normal score range is, how noisy the score is run to run, and which evals actually move when a real regression lands. A score that fluctuates by three points between identical runs is a score that cannot gate a deploy at a two-point threshold; the threshold has to be wider than the noise, or the eval has to be made deterministic. The warn phase is where that gets discovered, for free.
Then block on a small number of evals — the ones where a regression is a genuine incident. A support agent that starts giving wrong refund amounts, a code assistant that starts producing code that fails its tests, a summariser that starts dropping the caveat that changes the meaning: these are blockable because the correct response to a regression is "do not ship this." The test for whether an eval is ready to block is simple: run it in warn mode for two weeks, read every failure, and block it only when every failure was a real regression and every real regression had an owner who could fix it. If the failures are noise, the eval is not ready — the team has a measurement problem, not an enforcement problem.
The gate itself belongs in CI, and it is a short pipeline: check out the model configuration and the dataset version, run the harness against the candidate, compare the score to the baseline from the last release, and fail the build if the regression exceeds the threshold. A GitHub Actions shape of the gate looks like this:
# .github/workflows/evals.yml
name: evals
on:
pull_request:
paths: ['prompts/**', 'src/llm/**', 'evals/**']
jobs:
eval-gate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run golden-set evals
run: |
pip install evals
oaieval gpt-5 my-support-eval --record_path ./results/run.jsonl
- name: Compare against baseline
run: python scripts/eval_gate.py --results ./results/run.jsonl --baseline ./evals/baseline.json --max-regression 0.02Two details matter. The workflow triggers only when the prompt, the model code, or the evals change — running the full eval suite on every commit is a cost with no signal. And the comparison is against a stored baseline, not an absolute threshold: a score of 0.87 means nothing on its own, but a score of 0.87 against a baseline of 0.91 is a regression worth stopping for, and a score of 0.87 against a baseline of 0.84 is an improvement worth shipping. The baseline is the memory of the system; without it, the gate is guessing.
Eval-driven deployment is the next step past the gate: the deploy does not just pass a threshold, it compares the candidate against the current production version on the same cases, and rolls forward only if the candidate is not worse. The comparison should be paired — the same cases, the same scorer, the same harness — because an unpaired comparison confounds the model change with everything else that moved. And the gate should never be the only check: a deploy that passes evals can still be wrong in ways no eval covers, which is why the gate is paired with canary traffic and with online evals on the live stream.
Online evals: the gate after the gate
Offline evals measure the model against the past. Online evals measure it against the present: a stratified sample of live production traces, run through the same scorers, watched for drift. The sample should be stratified, not random — oversample the cases the team cares about, the long tail, the new intents, the failures — because a random sample of production traffic is mostly the easy cases, and the easy cases are not where regressions hide. The drift watch is the signal: a score that slides over weeks, on the same cases, is a model or a data distribution changing under the team, and it is the earliest warning that the golden set needs refreshing.
The loop closes when online evals feed the golden set. A production trace that the model got wrong, or that a human had to correct, is the most valuable case in the system — it is a real failure, on real input, with a known correct output. Promote it into the golden set, scrubbed and tagged, and the next deploy is tested against the failure that actually happened. That is the difference between a dataset that ages and a dataset that learns: the one that is fed by production gets better every month, and the one that is written once gets staler every month. The promotion pipeline needs a human in it — someone who decides which traces become cases — because an automatic promotion of every failure also promotes the noise, and a golden set full of noise is a test suite nobody trusts.
Recommendation
For a team starting from nothing, the order of work is: pick the harness first — OpenAI Evals for domain evals, lm-eval-harness for benchmarks — and get one eval running in CI in warn mode, even if the dataset is fifty cases written by hand. Build the golden set from production traces from the start, versioned in Git, with a held-out slice the team never develops against. Score deterministically wherever an exact answer exists, and calibrate the judge against human grades before trusting it anywhere else. Gate deploys on the score against a stored baseline, in warn mode for two weeks, and block only on the evals where a regression is a genuine incident. Then close the loop: sample live traffic, watch for drift, and promote the real failures into the golden set.
Architecture Decision
Decision: Build eval infrastructure as a separate harness with a versioned golden dataset and a CI gate that compares against a stored baseline: OpenAI Evals for domain evals and lm-eval-harness for benchmarks, deterministic scorers by default with a calibrated judge only where no exact answer exists, a two-week warn phase before any eval blocks a deploy, and online evals on a stratified sample of live traces feeding cases back into the golden set.
Context: The team ships an LLM-powered product where prompt changes and model upgrades land several times a week, and the last two regressions were discovered by customers, not by the team. The evals currently live in a notebook that one engineer runs when they remember to. Our guide to running evals in production covers what to measure; this decision is the infrastructure that makes the measurement repeatable, comparable, and enforced.
Options considered: (1) The layered model above. (2) Keep the notebook and add a checklist — cheapest, and it works until the second engineer needs to run it, or the first engineer is on leave, at which point the evals simply do not happen. (3) Buy a hosted eval platform — fastest to value, and the right choice for a team that wants dashboards and tracing without building them, but it ties the dataset and the results to a vendor, and the per-token pricing grows with the dataset. (4) Build the harness but skip the CI gate — the evals run, the scores are recorded, and nothing stops a bad deploy, which is the current failure mode with better graphs. (5) Gate on an absolute threshold instead of a baseline — simpler to explain, but a threshold without a baseline cannot tell an improvement from a regression, and it punishes the team for a dataset that got harder.
Why this one: The layered model separates the pieces that change at different rates: the harness rarely changes, the dataset changes with every release, the scorers change as the team learns what can be checked deterministically, and the gate changes as evals earn the right to block. The baseline comparison is what makes the gate honest — a regression is a movement, not a number — and the warn-first rollout is what makes the gate survivable. The online-eval loop is what keeps the dataset from going stale, which is the failure mode that kills every eval system eventually.
What it costs you: A harness to maintain, a dataset to curate, and a gate to tune — which is a permanent tax on the team's time, and the tax grows with the number of evals. The judge's cost is real: every scored case is another model call, and a dataset of thousands of cases with a judge scorer is a meaningful line in the model bill. The gate adds minutes to every pull request that touches a prompt, and the team has to accept that as the price of not shipping regressions. And the calibration work — human grades, agreement measurement, rubric rewrites — is skilled work that nobody wants to do and everybody needs.
When to reverse it: On a product with one prompt, one model, and a handful of cases, the whole model is overhead — a script and a human review are enough, and the ceremony can wait until the second prompt arrives. Reverse toward a hosted platform if the team is small enough that maintaining the harness is the bottleneck: the vendor's dashboard is worth the lock-in when the alternative is evals that do not run. Reverse the blocking posture, not the eval, when the gate fires on noise: the eval was not ready, or the threshold was tighter than the noise, and warn mode is the honest answer until one of those changes. And reverse the judge entirely if the calibration never converges — a judge that disagrees with humans is not a scorer, it is a random number generator with an API key.
When NOT to build eval infrastructure
The model is not free, and there are situations where the honest answer is simpler. Do not build a harness for a prototype that will be rewritten next month — a notebook and a human review are enough, and the harness is work that gets thrown away with the prototype. Do not gate a deploy on an eval that has never run in warn mode; a gate without an observation phase is how a routine Tuesday becomes a blocked release, and the postmortem will note that the threshold had never been seen in practice. Do not use a judge scorer for a case a deterministic check can answer — the judge is slower, more expensive, less reproducible, and wrong in ways that are harder to debug. Do not let the golden set become a monument: a dataset that nobody updates is a test suite that measures last year's product, and a score that stays flat while the product changes is a score that is lying. And do not treat the eval score as the product: the score is a proxy for whether the system helps its users, and a team that optimises the score instead of the behaviour will eventually ship a system that scores beautifully and helps nobody. Our RAG implementation guide shows the same discipline applied to retrieval — the evals are only as good as the cases, and the cases are only as good as their source.
The test for whether the infrastructure is worth it is one question: if a prompt change shipped a regression right now, would the gate stop it — and would anyone be able to say which cases broke? If the answer is "it would be blocked, and the log would show the failing cases," then the model is running. If the answer is "we would find out from a customer," then the model pays for itself the first time a deploy is stopped in CI instead of discovered in an incident review. The goal was never to make the evals clever. It is to make the regression boring: a case is written once, versioned like code, scored the same way every time, compared against the last release, and enforced only when the team has seen what it catches. One harness, one dataset, one gate — and a log behind every number, so the score is never a rumour. That is the whole discipline, and it is enough.
Why This Matters
Understanding the business and technical context helps you make informed decisions rather than blindly following patterns.
Trade-offs to Consider
Every architectural decision involves trade-offs. Consider your specific requirements, team expertise, and scale when evaluating options.
When NOT to Use This
Knowing when a solution doesn't apply is as valuable as knowing when it does. Consider alternatives for your specific situation.
Decision Framework
Use this framework to evaluate whether this approach is right for your use case based on your specific constraints and requirements.