← All writing

How I’d Set Up LLM Evals in Production: Test the Judge Before You Trust the Score

· Muaaz Ahmad

Your eval dashboard says 85% of answers pass. What it actually says is that a model, reading your outputs, thought 85% passed.

If that judge lets one in three bad answers through, your real pass rate could be closer to 78%. You would ship a regression and the dashboard would stay green.

The step that's easiest to skip: testing the tester. This post is how I'd set up evals for an LLM feature in production, with the judge treated as a component that needs its own tests. Tooling facts below were checked on 29 October 2026.

The production eval loop: production traces feed error analysis, which produces code checks and a validated LLM judge, which gate CI on a regression suite; failures found in production flow back into the dataset.

1. Start with error analysis, not metrics

The most common mistake is picking metrics before looking at data. "Helpfulness" and "coherence" scores from a generic library tell you nothing about why your support bot fails.

Do this instead:

  1. Pull 50 to 100 real traces (inputs, retrieved context, tool calls, output).
  2. Read each one and write a one-line note on what went wrong, if anything.
  3. Group the notes into named failure modes: "cites a policy that doesn't exist", "calls refund without checking order status", "answers in English when the user wrote Arabic".
  4. Count them. The top three become your first evals.

Anthropic's agent-evals guide (January 2026) recommends starting with 20 to 50 tasks drawn from real failures, and ends with one instruction: read the transcripts. Small sets are enough early on, because early changes move the numbers a lot.

Takeaway: if you can't name your top three failure modes from memory, you aren't ready to automate anything.

2. Code checks before judges

Anything a function can check, a function should check. Code graders are fast, free, deterministic and never drift.

Failure modeGrader
Output isn't valid JSON / schemajsonschema.validate
Cited doc ID not in retrieved setset membership
Wrong tool, or tool called with bad argsassert on the trace's tool calls
Leaked PII or internal URLregex
Over latency or token budgetthreshold on trace metadata
Factual claim is supported by contextLLM judge
Tone fits the brand and the user's emotionLLM judge

A useful pattern is a cheap code pre-screen before the judge: if the JSON is broken, there is no point paying a model to grade the content.

Takeaway: go down your failure-mode list and mark each one "code" or "judge". Aim for most of them to be code.

3. One binary judge per failure mode

For what's left, write narrow judges. Three rules:

  • Binary, not 1 to 10. "Does the answer state anything not supported by the context? PASS/FAIL" is checkable. "Rate faithfulness 1 to 10" invites drift, and nobody can agree what a 6 means.
  • One judge per failure mode. A single "overall quality" judge mixes criteria and hides which one regressed. Anthropic's guide also recommends isolated judges per dimension and an explicit "Unknown" option.
  • Critique first, verdict last. Ask for a short reason before the label. It gives you something to debug when the judge is wrong.

A template you can adapt:

You are checking ONE thing: whether the ANSWER makes any claim
that is not supported by the CONTEXT.

CONTEXT:
{context}

ANSWER:
{answer}

Rules:
- Paraphrase of the context is supported.
- General knowledge not in the context counts as unsupported.
- If you cannot tell, answer UNKNOWN.

Return JSON: {"reason": "<one sentence>", "verdict": "PASS" | "FAIL" | "UNKNOWN"}

Known judge biases are well documented: the MT-Bench study (Zheng et al.) found strong judges reach over 80% agreement with humans, about the human-to-human level, but also showed position, verbosity and self-preference bias. Binary, single-answer grading avoids the worst of the position problem, because there is nothing to compare against.

4. Validate the judge like a classifier

This is the step most teams skip. Your judge is a binary classifier, so measure it like one.

  1. A domain expert labels about 100 traces per failure mode, roughly 50 PASS and 50 FAIL, even if production is skewed. (Hamel Husain's validate-evaluator procedure suggests this, and warns that below 60 labels the intervals get wide.)
  2. Split: about 15% for few-shot examples in the prompt, 40 to 45% dev, 40 to 45% held-out test.
  3. Iterate on the prompt against dev until TPR and TNR are both above 90%. TPR is "of the truly good answers, how many did the judge pass". TNR is "of the truly bad answers, how many did it fail".
  4. Run once on test. Those are the numbers you report.

Then correct the production pass rate for the judge's known error (the Rogan-Gladen estimator) and report a range, not a point:

import numpy as np

def corrected_rate(p_obs, tpr, tnr):
    """True pass rate, given the judge's observed pass rate and its TPR/TNR."""
    d = tpr + tnr - 1
    if d < 0.1:
        raise ValueError("judge is close to random; fix it before trusting it")
    return float(np.clip((p_obs + tnr - 1) / d, 0, 1))

def bootstrap_ci(human, judge, prod_verdicts, n=2000, seed=0):
    """human, judge: 1/0 labels on the test set. prod_verdicts: judge 1/0 on prod."""
    rng = np.random.default_rng(seed)
    h, j, p = map(np.asarray, (human, judge, prod_verdicts))
    est = []
    for _ in range(n):
        i = rng.integers(0, len(h), len(h))
        hs, js = h[i], j[i]
        tpr = (js[hs == 1] == 1).mean()
        tnr = (js[hs == 0] == 0).mean()
        if np.isnan(tpr) or np.isnan(tnr):   # resample missed a class
            continue
        try:
            est.append(corrected_rate(rng.choice(p, len(p)).mean(), tpr, tnr))
        except ValueError:
            continue
    return np.percentile(est, [2.5, 97.5])

Illustrative numbers: a lenient judge with TPR 0.98 and TNR 0.60 reports an 85% pass rate. Corrected, that's (0.85 + 0.60 − 1) / 0.58 ≈ 78%. Same outputs, a seven-point gap, all from the judge.

Don't assume three judges are three times the evidence. A September 2026 paper from UCF ("Agreement Overstates Evidence") found three frontier judges from different providers hit 91 to 93% accuracy on RewardBench but had an average error correlation of 0.56, failing together about 7.7 times as often as independence would predict. A panel helps less than it looks. Validate the aggregated verdict on trusted labels, the same way you validate a single judge.

Takeaway: for every judge, write down its test-set TPR, TNR and label count next to the score it produces. A score without those is a rumour.

5. Two suites, and the right metric for each

Split your offline dataset into two suites with different jobs:

  • Regression suite: cases you already pass. It should sit near 100% and gates every PR (prompt change, model swap, retriever change). Langfuse's experiment-action for GitHub Actions, for example, fails the run when a score drops below your threshold.
  • Capability suite: cases you don't pass yet. A low score is fine. It's your roadmap. When a capability case passes reliably, move it into regression.

For anything customer-facing, run each case several times. pass@k ("at least one of k runs succeeds") flatters you. pass^k ("all k runs succeed") is what the user feels. Anthropic's example: 75% per-trial success over three trials is only about 42% pass^3 (0.75³).

6. Close the loop online

Offline sets go stale. In production:

  • Run code checks on every trace. They're free.
  • Run judges on a sample of traces (Langfuse's guide uses 5% as an example) to control cost.
  • Send judge FAILs and user signals (thumbs down, rephrased question, retry) to an annotation queue.
  • Every confirmed failure becomes a new dataset case. That's how the regression suite grows from real traffic instead of your imagination.

A timely one: if you run Langfuse Cloud, trace-level LLM-as-a-judge evaluators stop producing results at the v4 cutover on 16 November 2026. Migrate to observation-level evaluators before then, or your online scores will quietly flatline.

The checklist

  • Read 50 to 100 real traces and named the top 3 failure modes
  • Every failure mode marked "code" or "judge"
  • One binary judge per remaining mode, with reason + UNKNOWN
  • ~100 expert labels per judge, split into few-shot / dev / test
  • TPR and TNR above 90% on held-out test, written next to the score
  • Production pass rate reported corrected, with a 95% interval
  • Regression suite gating CI; capability suite tracked separately
  • pass^k for customer-facing flows
  • Sampled online judges feeding an annotation queue
  • Langfuse Cloud users: trace-level evaluators migrated before 16 Nov

An eval is only as honest as its judge. Test the judge first, then trust the score.

Sources

Originally published on Substack.

Newsletter

Get the next post by email

Production AI engineering, three times a week. Free, on Substack.

Need this built for real?

I take systems like this into production. Email me or download the CV.