AiIntermediate

LLM Evals in Production: Measuring Agent Quality

DeveloperHat Team
18 min read

TL;DR

Ship LLM features with evidence, not vibes: golden sets, offline vs online evals, LLM-as-judge limits, and regression gates in CI — so a prompt change can't silently break production.

The first version of an LLM feature ships on a handful of eyeballed examples: you try ten prompts, the answers look good, you deploy. The second version is where the trouble starts. Somebody tweaks the system prompt, swaps the model for a cheaper one, or changes the retrieval step — and nobody can say whether the feature got better or worse, because "looks good" was never written down. That is the whole case for evals: a repeatable, scored set of examples that turns "did we break it?" into a number you can gate a deploy on.

This article is about evals for LLM features already in production, not about benchmark leaderboards. It covers what to measure, how to build a golden set that actually represents your users, where LLM-as-a-judge helps and where it lies to you, and how to wire the whole thing into CI so a bad prompt change fails the build instead of reaching your users. Tool versions and links are as checked on 23 November 2026 — treat them as a snapshot, because the eval tooling landscape moves fast. The short version up front: start with a small golden set and deterministic checks, add an LLM judge only after you have calibrated it against human labels, and gate deploys on a pass rate you set from a baseline run, not from a number you guessed.

The eval loop: a number you can gate a deploy on Golden set 50–200 real cases Run the system same inputs, new version Score + gate pass rate vs baseline Promote new cases incidents + online traces Ship or block delta, not vibes Production traces feed the set, so the suite learns what your users actually ask.

What evals actually measure

An eval is a test case for behaviour that has no single right answer. Each case has an input, the expected behaviour (a reference answer, a rule, or a rubric), and a scorer that turns the model's output into a pass, a fail, or a number. The five dimensions that matter in production are different enough that they need different scorers:

Correctness — did the output answer the question, or complete the task? For factual questions this can be a deterministic check against a reference answer. For open-ended work it needs a rubric: "the summary names the ticket's root cause and the fix applied" is a checkable claim, even if the wording varies.

Grounding — did the answer stay inside the retrieved context? A RAG system that invents a refund policy your company does not have is wrong in a way no amount of fluency fixes. Faithfulness metrics, such as the ones in Ragas, score whether each claim in the answer is supported by the retrieved passages. Our RAG implementation guide covers the retrieval side of this problem.

Tool use — did the agent call the right tools, in the right order, with valid arguments? An agent that answers from memory instead of calling the lookup tool has failed even if the answer happens to be right. Tool-call correctness is one of the few things in agent evals that is fully deterministic: compare the trace against the expected call sequence.

Latency and cost — how long did it take, and how many tokens did it burn? An eval run that only checks quality will happily bless a change that doubles your per-request cost. Track tokens and wall-clock time per case alongside the quality score.

Safety and policy — did the output stay inside the rules? Refusals, PII leakage, and prompt-injection handling are eval cases too, with the expected behaviour written down in advance rather than judged after the fact.

The mistake is treating these as one score. A single "quality" number hides the trade-off: a model change that improves correctness while doubling cost looks like a win until the bill arrives. Score the dimensions separately and gate on the ones that would actually hurt you.

Offline evals vs online evals

Offline evals run before deployment, on a fixed dataset, in CI. They answer "is this change better than the last release?" and they are the only evals that can block a bad deploy. Online evals run in production, on real traffic: sampled traces scored after the fact, user feedback signals, and monitors on drift. They answer "is the feature still good for the users we have today?"

You need both, and they fail in different ways. Offline evals go stale: the golden set reflects last quarter's users, and a feature that drifts toward new use cases will pass its evals while failing real people. Online evals are noisy: real traffic has no ground truth, so you are scoring against a judge or a heuristic, and a spike in bad scores might be a model regression or might be a new class of user input. The working pattern is a loop: online evals surface the cases the golden set misses, and those cases — labelled, with the expected behaviour written down — get promoted into the offline set. An eval set that never grows from production is a test suite that never learns what your users actually ask.

The sampling question matters more than the scoring question for online evals. Scoring every production trace with an LLM judge is expensive and slow; scoring a random 1% is cheap and usually enough to catch a regression, provided the sample is stratified — a flat random sample of a support bot's traffic will be 90% password resets, and the 2% of refund disputes that actually lose money will barely appear. Sample by intent, by error signal, and by cost, not just uniformly.

Building a golden set

A golden set is a list of inputs with expected behaviour, and its quality decides everything downstream. Fifty well-chosen cases beat five hundred generated ones, because the eval can only measure what the cases cover. Build it from three sources, in this order:

  • Real production traces. Take actual user inputs, strip PII, and write down what a good answer looks like. These are the only cases guaranteed to represent your users, and they are the ones your team will argue about — which is the point. The argument is where the expected behaviour gets defined.
  • Failure cases from incidents. Every bug report, every support escalation, every "the bot said something wrong" ticket becomes a case with the correct behaviour attached. This is the fastest way to make the eval set cover the failures that actually cost you.
  • Adversarial cases, written by hand. Edge cases a user will hit eventually: ambiguous questions, multi-part requests, questions with a false premise, requests that should be refused. A dozen hand-written adversarial cases catch more regressions than a hundred synthetic ones.
  • Each case needs more than an input. Record the expected output or rubric, the tools the agent should call, and — for RAG — the documents that should be retrieved. A case without an expected behaviour is a vibe check, not an eval. And keep the set small enough to run in minutes: if the eval suite takes an hour, nobody runs it before merging, and it stops being a gate.

    # A golden-set case is data, not prose: input, expected behaviour, scorer.
    # Keep cases in a versioned file (JSON/JSONL) so a change to the set is a
    # reviewable diff, exactly like a change to a test file.
    golden_case = {
        "id": "refund-policy-014",
        "input": "Can I return the headphones I bought 45 days ago?",
        "expected": {
            "answer_must_mention": ["30-day return window", "store credit after 30 days"],
            "answer_must_not_claim": ["full refund after 30 days"],
            "tools": ["lookup_order", "get_return_policy"],
        },
        "scorers": ["contains_required_phrases", "no_forbidden_claims", "tool_sequence_match"],
    }

    The eval stack — every layer is versioned, every layer is reviewable Traces & logs — production inputs, PII stripped Golden set — versioned JSONL, expected behaviour per case Scorers — deterministic first, calibrated judge second CI gate — fails the build on a regression, not on a guess Online evals — stratified sample of live traces, drift watch A scorer that is not calibrated against human labels is a guess with a dashboard.

    LLM-as-judge: useful, and lying to you in specific ways

    When the expected behaviour cannot be reduced to a string match — a summary, a draft email, a plan — the practical scorer is another LLM reading the output against a rubric. This works better than most engineers expect and worse than most vendors claim. The evidence for the optimistic side is real: the MT-Bench paper (arXiv:2306.05685) found that strong LLM judges such as GPT-4 agree with human preferences over 80% of the time on preference tasks — roughly the same level of agreement as between human raters. That is a genuine result, and it is why LLM-as-judge is the default scorer for open-ended output.

    The pessimistic side is that the judge's errors are systematic, not random, and a systematic error in the scorer becomes a systematic error in what you ship. The documented biases:

  • Self-preference. A judge tends to prefer outputs from its own model family, and outputs in the style it was trained to produce. A GPT judge rating a GPT candidate is grading its own homework.
  • Verbosity bias. Longer answers score higher than shorter ones, even when the extra words add nothing. A change that makes answers more verbose will look like an improvement.
  • Position bias. When the judge compares two outputs, the one shown first wins more often than it should. Swap the order and the verdict flips on a meaningful fraction of cases.
  • Rubric drift. A judge given a vague rubric invents its own standard, and that standard changes with the model version. A judge model upgrade is a scorer change, and it can move your pass rate without any change to the system under test.
  • None of this means "don't use an LLM judge." It means calibrate it the way you would calibrate any instrument: score a few hundred outputs with humans first, measure the judge's agreement with those labels, and only trust the judge on the kinds of cases where it agrees with humans at least as well as humans agree with each other. Re-run the calibration when you change the judge model, the rubric, or the task — and never let the judge score outputs from the same model without a second, independent check on a sample. The judge is a measuring instrument with a known error rate, not an oracle.

    The tooling landscape, as of November 2026

    You do not need to build the harness yourself. The tooling has settled into four shapes, and the right one depends on what you already run:

    ToolShapeBest forVersion checked
    LangSmithHosted platform: datasets, evaluators, online evals on tracesTeams already on LangChain/LangGraph; trace-linked evalsDocs current, 23 Nov 2026
    RagasPython library: RAG metrics (faithfulness, answer relevancy, context precision)Scoring groundedness of a RAG pipeline0.4.4
    DeepEvalPython framework: unit-test-style evals, 15+ metrics, CI integrationTreating evals like pytest for LLM apps4.3.4
    PromptfooCLI + config files: red-teaming, prompt regression, provider comparisonPrompt and model A/B comparisons, security probes0.126.0
    OpenAI EvalsPlatform evals + evals APITeams on OpenAI models wanting managed eval runsDocs current, 23 Nov 2026

    The framework matters less than the discipline: versioned datasets, deterministic scorers where possible, a pinned judge model, and a baseline run recorded before the first gate is enforced. A team that buys LangSmith and never writes a golden set has bought a dashboard, not an eval practice. A team with a JSONL file, a ten-line scorer, and a CI step that fails the build on a regression has the practice, and can swap the tooling later without losing it. If you are choosing between tools, pick the one your team will actually run every day — the eval suite that runs is worth more than the eval suite with the better metrics catalogue.

    A minimal harness is smaller than people expect. The pattern below is the shape most teams end up with, whatever framework wraps it: run each case, score it with a deterministic check first, fall back to a judge only for the open-ended part, and record everything.

    # Minimal eval harness: deterministic checks first, judge only where needed.
    # The judge runs at temperature 0 against a pinned model version, and the
    # rubric is a string in the repo — a change to the rubric is a code review.
    import json
    
    def score_case(case, output, tools_called):
        results = {}
        for phrase in case["expected"]["answer_must_mention"]:
            results[f"mentions:{phrase}"] = phrase.lower() in output.lower()
        for claim in case["expected"]["answer_must_not_claim"]:
            results[f"avoids:{claim}"] = claim.lower() not in output.lower()
        results["tools_correct"] = tools_called == case["expected"]["tools"]
        return results
    
    # Judge call (pseudo-code): one rubric, temperature 0, pinned model.
    # judge_verdict = llm_judge(
    #     model="gpt-5-mini-2026-01-01", temperature=0,
    #     rubric="Score 1-5: does the answer resolve the user's request completely?",
    #     output=output,
    # )

    Regression gates in CI

    An eval that nobody has to look at is a dashboard. An eval that blocks a merge is a quality gate, and the difference is a threshold with a baseline behind it. The practical setup:

  • Baseline first. Run the suite against the current production version and record the pass rate per dimension. That number — not a round 90% — is your threshold, with a small margin for judge noise.
  • Gate on deltas, not absolutes. A prompt change that drops correctness from 87% to 81% fails the build; a change that holds at 87% passes, even if 87% is not a number you would brag about. Absolute thresholds punish teams for inheriting a mediocre baseline and reward them for gaming the metric.
  • Pin the judge and the temperature. The judge model version and temperature 0 are part of the test configuration. An unpinned judge that silently upgrades is a scorer change disguised as a system change, and it will move your numbers for reasons nobody can explain.
  • Sample, don't exhaust. A golden set of 200 cases with a judge call each is a few dollars and a few minutes. A set of 5,000 is a CI bill and a reason to skip the gate. Keep the gated suite fast and run the full set nightly.
  • Treat judge flakiness like test flakiness. Re-run a failing eval once before declaring a regression; if the same case flips between runs at temperature 0, the rubric is ambiguous, not the system — fix the rubric.
  • The failure mode to avoid is the gate that cries wolf. If the eval fails on every other PR for reasons nobody understands, the team will disable it within a month, and the next real regression will ship unopposed. A gate that fails rarely, with a diff that shows exactly which cases broke, is a gate that survives.

    The recommendation

    Pick the scorer by what the behaviour is, not by what is fashionable What are you scoring? start from the behaviour Checkable claim tool call, format, fact Open-ended quality summary, draft, plan Production reality drift, new behaviour Deterministic check exact, cheap, no noise Calibrated LLM judge pinned model, temp 0 Online evals + humans stratified sample Every judge call you replace with a deterministic check removes noise and cost.

    ApproachBest forCostWhat it costs you
    Deterministic checks onlyTool calls, formats, factual claims, refusalsNear zeroCannot score open-ended quality at all
    LLM-as-judge, calibratedSummaries, drafts, plans, toneJudge tokens per caseCalibration work, systematic bias, judge drift
    Human review, sampledThe cases the judge gets wrong; new failure modesExpensive per caseDoes not scale; sampling must be stratified
    Online evals on tracesDrift, new user behaviour, production realityJudge tokens on a sampleNo ground truth; noisy signal
    No evalsNothing in productionZero now, everything laterSilent regressions, unmeasurable changes

    The default architecture that follows from the table: a golden set of 50–200 production-derived cases, scored deterministically where the behaviour is checkable and by a calibrated LLM judge where it is not, run in CI on every change to prompts, models, or retrieval, with online evals on a stratified sample of production traces feeding new cases back into the set. Human review covers the sample the judge disagrees with and the failure cases from incidents. That is the whole practice; everything else is tooling.

    Architecture Decision

    >

    Decision: Gate every prompt, model, and retrieval change on an offline eval suite — a versioned golden set of 50–200 production-derived cases, deterministic scorers where behaviour is checkable, a calibrated LLM judge (pinned model, temperature 0) where it is not — plus stratified online evals on production traces that feed new cases back into the set.

    >

    Context: A product team ships an LLM support assistant to paying customers. The assistant answers from a knowledge base, calls order-lookup tools, and drafts replies a human agent sends. Prompt and model changes ship weekly, and the team has already had one incident where a prompt tweak made the assistant invent refund terms. There is no way today to tell whether a change helped or hurt.

    >

    Options considered: (a) No evals — ship on eyeballed examples and user complaints. (b) Deterministic checks only — exact-match and regex scorers. (c) LLM-as-judge on everything, uncalibrated. (d) Golden set with deterministic checks plus a calibrated judge, gated in CI, with online evals feeding the set.

    >

    Why this one: Option (a) is the current state and it already produced an incident nobody could measure. Option (b) cannot score the open-ended half of the product — summaries and drafted replies — so it would bless changes that degrade the parts users notice most. Option (c) is the most dangerous of all: an uncalibrated judge with systematic biases becomes a machine for shipping confident regressions, and nobody would know the scorer was wrong. Option (d) is the only one that measures what users actually experience and blocks a bad change before it ships.

    >

    What it costs you: The golden set has to be built and maintained — a few hours to seed from production traces, then a steady trickle of cases from incidents and online evals. Judge calls cost tokens on every CI run, and the calibration against human labels has to be re-run when the judge model or the rubric changes. The gate will occasionally block a change that is actually fine, and somebody has to investigate those.

    >

    When to reverse it: When the product is a prototype with no users — evals on a system nobody uses measure nothing, and the time is better spent finding users. When the golden set stops reflecting production traffic and the team will not maintain it — a stale eval suite is worse than none, because it gives false confidence. When judge agreement with humans drops below the human-human agreement level on calibration — stop trusting the judge and fall back to deterministic checks plus human review until the rubric or the judge is fixed.

    When not to use evals

    Do not build an eval suite for a prototype with no users. Evals measure a system against the behaviour its users need; a prototype's users do not exist yet, and the cases you write will encode guesses that the first real users will invalidate. Spend the time finding users instead, and start the golden set from their first real traces.

    Do not let the eval suite become the product. A team that spends a month building a bespoke eval platform before writing its first golden set has the order backwards — the platform serves the cases, and fifty cases in a JSONL file with a ten-line scorer are a working eval practice today. Buy or build the platform after the practice exists and the pain is concrete.

    Do not eval what you can test deterministically. If the behaviour is "the agent must call lookup_order before answering a refund question," that is a unit test on the trace, not a judge call. Every judge call you replace with a deterministic check is a source of noise and cost removed from the suite.

    And do not treat the eval score as the product's quality. The score measures the golden set, and the golden set is a sample of behaviour you thought to write down. The users will always find the case you did not write. That is why online evals and incident-driven cases are part of the practice, not an afterthought — the suite is a living document, and the day it stops growing is the day it starts lying. For the surrounding practice, our guides to verifying AI agent actions and MCP servers in production cover the runtime checks that evals complement, and our MLOps best practices guide covers the deployment discipline the gate plugs into.

    What to do next

    This week: pull fifty real traces from production, strip the PII, and write the expected behaviour for each one. Score them by hand first — the act of writing down "good" is the valuable part, and it will surface disagreements about what the feature is supposed to do. Then write the ten-line scorer, run it against the current production version, and record the baseline. Next week, add the judge for the open-ended cases, calibrate it against a few hundred human labels, and wire the suite into CI as a gate on prompt and model changes. The first time it blocks a bad change, it has paid for itself.

    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.

    Share this articleShare on XShare on LinkedIn

    Keep the decision frameworks coming

    One practical architecture guide a week — patterns, trade-offs, and when not to use them. No spam, unsubscribe anytime.