Evaluation · Advanced · 15-minute read

How Many Labeled Examples Do You Need to Validate an LLM Judge?

Сколько размеченных примеров нужно для проверки LLM-судьи
Temporary fallback cover; replace in editorial pass.

A judge can look accurate while missing most of the failures that matter. This guide shows how to measure agreement with experts, quantify uncertainty, and design a holdout set that exposes the problem.

Updated November 25, 2026 · Agent Lab Journal

The short answer is: enough examples to estimate performance separately on acceptable and unacceptable cases. A single accuracy number is rarely enough. If 95% of your evaluation set contains acceptable outputs, a judge that always says “pass” can score 95% while detecting none of the failures.

Validation should therefore answer two questions:

Those questions map to true positive rate (TPR) and true negative rate (TNR). The sample size is driven mainly by the precision you need for those two estimates, especially TPR when failures are rare.

The concrete case: a judge for support answers

Suppose a team uses an LLM judge to flag support answers that contain a material factual error. Human reviewers provide the reference labels. The judge returns either fail or pass.

The production stream contains mostly acceptable answers. That distribution is useful for estimating how often the judge raises an alert, but it is a poor way to learn whether the judge catches failures. A random sample from production might contain too few failures to produce a stable TPR.

Instead, create a labeled evaluation set with two deliberate properties:

“Enough” is not one universal number. It depends on the interval width you can tolerate and on the lowest failure-detection rate that would be acceptable.

Start with a two-by-two table

For binary evaluation, compare the judge’s decision with the expert label. The resulting confusion matrix has four cells:

Judge decisions compared with expert labels
Expert: failure Expert: acceptable
Judge: fail True positive (TP) False positive (FP)
Judge: pass False negative (FN) True negative (TN)

Here, “positive” means “failure detected.” Define that direction before labeling anything. Reversing the positive class changes the interpretation of every metric.

The two primary rates are:

TPR = TP / (TP + FN)

TPR is also called sensitivity or recall for the failure class. It answers: among the failures experts found, how many did the judge catch?

TNR = TN / (TN + FP)

TNR is also called specificity. It answers: among the acceptable cases, how many did the judge correctly leave unflagged?

Accuracy is:

accuracy = (TP + TN) / (TP + TN + FP + FN)

Accuracy is not useless, but it depends strongly on the class mix. TPR and TNR do not have that same dependence because each is calculated within one expert-labeled class.

Why imbalance can make a weak judge look good

Imagine 1,000 evaluation items: 950 acceptable and 50 failures. A judge that predicts pass every time gets:

The 95% accuracy sounds strong until the operational question is made explicit: the judge catches no failures. This is the failure mode to guard against when the goal is quality control, release gating, or alerting.

A balanced test set can make comparison easier, but it does not reproduce production prevalence. Keep the sampling design and the intended use separate:

If you change the class proportions for testing, do not present the resulting accuracy as production accuracy.

How many labeled examples do you need?

For a rough planning calculation, treat TPR as a binomial proportion among the expert-labeled failures. If you expect a rate near p and want an approximate 95% margin of error e, the simple normal approximation is:

n ≈ 1.96² × p × (1 − p) / e²

When you do not know p, use 0.5 for a conservative planning estimate. This gives approximately:

Approximate examples per class for a 95% margin of error
Target margin Approximate examples in the class
±10 percentage points 96
±5 percentage points 385
±3 percentage points 1,068

These are planning numbers, not guarantees. The normal approximation can be poor near 0 or 1, and it does not account for correlated examples, ambiguous labels, repeated users, or multiple judge prompts. Use an exact or Wilson interval for planning and reporting.

For a failure-focused validation, the practical rule is simple: plan the number of failure examples from the precision required for TPR, and plan the number of acceptable examples from the precision required for TNR. If failures are rare in production, this usually means oversampling failures for the validation set.

Use a held-out set with enough failures

A reliable split separates development from final validation:

  1. Define the failure policy and expert-labeling rubric.
  2. Collect candidate examples without using the final judge result to select labels.
  3. Reserve a held-out set before tuning the judge prompt, model, thresholds, or parsing rules.
  4. Stratify the held-out set so it contains the planned number of expert-labeled failures and acceptable cases.
  5. Run the final judge configuration once on the held-out set and calculate metrics with confidence intervals.

Do not repeatedly inspect the holdout, change the judge, and report the best result. That turns the holdout into another development set. If the judge must change, create a fresh final holdout or clearly report the iteration.

For expert labels, record at least the item identifier, the expert decision, the judge decision, and the labeling protocol version. Keep private user content out of logs where it is not required for analysis.

Bootstrap confidence intervals, step by step

A bootstrap confidence interval estimates uncertainty by repeatedly resampling the observed labeled items with replacement. For TPR, resample only the expert-labeled failures. For TNR, resample only the expert-labeled acceptable cases. This preserves the denominator for each rate.

The following Python example uses an illustrative dataset. Replace the arrays with your own held-out results; the numbers below are not reported measurements.

import numpy as np

# 1 means the judge flagged a failure, 0 means it passed the item.
# Illustrative data only:
expert_failure_judge = np.array(
    [1, 1, 0, 1, 0, 1, 1, 1, 0, 1]
)

# 1 means the judge correctly left an acceptable item unflagged.
expert_ok_judge = np.array(
    [1, 1, 1, 0, 1, 1, 1, 1, 0, 1]
)

def bootstrap_rate(values, iterations=20_000, seed=7):
    rng = np.random.default_rng(seed)
    values = np.asarray(values, dtype=float)

    draws = rng.integers(
        0, len(values), size=(iterations, len(values))
    )
    samples = values[draws]
    rates = samples.mean(axis=1)

    estimate = values.mean()
    lower, upper = np.quantile(rates, [0.025, 0.975])
    return estimate, lower, upper

tpr = bootstrap_rate(expert_failure_judge)
tnr = bootstrap_rate(expert_ok_judge)

print("TPR:", tpr)
print("TNR:", tnr)

The output contains a point estimate and percentile interval for each rate. With only ten examples in each class, the intervals will usually be wide. That is expected: the code quantifies uncertainty; it does not create information that the sample does not contain.

For a larger evaluation, compute the cells directly:

def confusion_counts(expert, judge):
    expert = np.asarray(expert)
    judge = np.asarray(judge)

    tp = np.sum((expert == 1) & (judge == 1))
    fn = np.sum((expert == 1) & (judge == 0))
    tn = np.sum((expert == 0) & (judge == 0))
    fp = np.sum((expert == 0) & (judge == 1))

    return {"tp": tp, "fn": fn, "tn": tn, "fp": fp}

def rates_from_counts(counts):
    failure_total = counts["tp"] + counts["fn"]
    acceptable_total = counts["tn"] + counts["fp"]

    return {
        "tpr": counts["tp"] / failure_total
            if failure_total else float("nan"),
        "tnr": counts["tn"] / acceptable_total
            if acceptable_total else float("nan"),
    }

Bootstrap the whole evaluation when items are paired

When each item has both an expert label and a judge decision, resample complete item rows if you need a joint view of the evaluation. Do not independently shuffle expert labels and judge decisions; that destroys the pairing.

def bootstrap_rates(expert, judge, iterations=20_000, seed=7):
    rng = np.random.default_rng(seed)
    expert = np.asarray(expert)
    judge = np.asarray(judge)

    indices = rng.integers(
        0, len(expert), size=(iterations, len(expert))
    )

    tprs = []
    tnrs = []

    for row in indices:
        e = expert[row]
        j = judge[row]

        failure = e == 1
        acceptable = e == 0

        tpr = np.mean(j[failure] == 1) if failure.any() else np.nan
        tnr = np.mean(j[acceptable] == 0) if acceptable.any() else np.nan

        tprs.append(tpr)
        tnrs.append(tnr)

    def interval(values):
        values = np.asarray(values)
        values = values[~np.isnan(values)]
        return np.mean(values), *np.quantile(values, [0.025, 0.975])

    return {
        "tpr": interval(tprs),
        "tnr": interval(tnrs),
    }

For small samples or rates close to the boundaries, compare bootstrap results with a Wilson or exact binomial interval. If the methods disagree materially, report that sensitivity rather than selecting the most flattering interval.

Verification checklist

Before trusting the result, verify the analysis mechanically:

A small independent script can recompute the confusion matrix from the raw export. Compare its counts with the dashboard or notebook before writing conclusions. This catches common errors such as inverted labels, dropped rows, and percentages calculated with the wrong denominator.

Failure cases to expect

Too few failures

If the holdout has ten failures, one missed item changes TPR by ten percentage points. A high observed TPR can therefore coexist with substantial uncertainty. Add failures to the validation sample or weaken the precision claim.

Expert disagreement

If experts disagree often, the target is not a single unquestionable label. Define an adjudication rule, measure inter-rater agreement, or represent uncertainty in the reference label. A judge cannot be fairly evaluated against a target that has not been specified.

Label leakage

The judge may see metadata, reference answers, or rubric text that would not be available in production. Test the exact input boundary used at runtime. Leakage can inflate both TPR and TNR.

Correlated examples

Ten examples from one conversation or one template are not equivalent to ten independent cases. Grouped or clustered data can make ordinary intervals too narrow. Split by the relevant unit, such as user, conversation, document, or task family, when that unit creates dependence.

Metric drift after deployment

A judge can agree with experts on one task family and fail on another. Report results by important slice, not only as one pooled number. If a slice has too few examples, mark the estimate as uncertain rather than hiding it in the aggregate.

What to report

A reproducible validation report should state:

For the main question—whether the judge agrees with experts—the minimum useful result is usually a confusion matrix plus TPR and TNR intervals. Accuracy can be included, but it should not replace those measurements.

Bottom line

There is no single sample size that validates every LLM judge. Start with the uncertainty you can accept. Plan enough expert-labeled failures to estimate TPR, enough acceptable examples to estimate TNR, and keep a final holdout untouched during tuning.

If your data is imbalanced, a strong accuracy score may say more about the data distribution than about the judge. A failure-rich held-out set, explicit class definitions, and bootstrap intervals make that weakness visible.

Continue with the evaluation guides or look up terms in the glossary.

We publish what works for us—and implement the same solutions for your business. We design AI automation, Telegram bots, chats, and AI agents for real-world processes. Discuss your project →