advanced34 min studyLesson 69 in Engineering

Language model evaluation

Build reproducible, paired evaluations that separate task success, uncertainty, contamination, judgment bias, and serving cost.

On this page

What you’ll understand

  • Specify an evaluation unit, rubric, sampling policy, and deployment-relevant slices.
  • Calculate paired success differences and interpret sampling uncertainty.
  • Separate benchmark performance from evidence about real deployment behavior.

An evaluation result is a statement about a system, a dataset, and a measurement procedure. It is not a permanent model score. Prompts, retrieval, tools, decoding, output limits, and judge instructions can all change the measured outcome. A useful evaluation therefore begins with a concrete deployment question and records enough of the complete configuration that another engineer can reproduce the comparison and understand what the result does and does not establish.

Define success before collecting a leaderboard number

Choose the unit that matters: a question, conversation, tool workflow, document, or user session. Write criteria for a successful result, including abstention when required information is absent. Multiple-choice accuracy is convenient but may not reflect whether a system can produce a supported explanation or execute a workflow safely. HELM argues for evaluation across several scenarios and metrics, motivating a measurement portfolio rather than one universal quality number. Include latency, cost, robustness, and important task-specific failure categories.

Construct representative slices such as language, context length, rare entity type, difficult tool state, and no-answer questions. Set target population weights before viewing the final comparison; otherwise an apparent aggregate improvement can result from changing the mix. Preserve dataset versions and separate examples used for prompt tuning, model selection, and final testing. A public benchmark can be useful while still being vulnerable to training contamination or repeated indirect tuning, so supplement it with private or newly constructed task evidence where appropriate.

Δ^=1n∑i=1n(bi−ai),ai,bi∈{0,1}\widehat{\Delta}=\frac{1}{n}\sum_{i=1}^{n}(b_i-a_i),\qquad a_i,b_i\in\{0,1\}
Ai and bi are success indicators for two systems on the same evaluation units. Pairing keeps task difficulty aligned; correlated units or repeated samples need an analysis that respects their grouping.↔ Scroll wide equations horizontally.

Pair comparisons and expose uncertainty

Evaluate both systems on the same frozen cases so disagreement counts become visible. If both succeed on easy cases and differ on a few hard ones, an unpaired summary throws away useful structure. A bootstrap should resample the independent evaluation unit, such as whole conversations, not arbitrary turns from the same conversation. For stochastic systems, repeat samples or define the exact single-run policy being estimated. A small difference can have substantial uncertainty despite impressive total accuracies.

Automatic metrics need a validity argument. Exact match can penalize equivalent answers; an embedding score can reward a fluent contradiction. Model-based judges are useful but can prefer their own style, longer answers, or a particular answer position. Randomize order, hide system identity, check against human labels, and measure judge disagreement. TruthfulQA supplies a concrete test of falsehood-related behavior, but success on its question distribution cannot prove universal truthfulness. Match each claim to the evidence actually collected.

SE⁡(Δ^)≈sdn,sd2=1n−1∑i=1n(di−d‾)2\operatorname{SE}(\widehat{\Delta})\approx\frac{s_d}{\sqrt{n}},\qquad s_d^2=\frac{1}{n-1}\sum_{i=1}^{n}(d_i-\overline d)^2
Here di=bi−ai and the approximation assumes independent paired units with adequate sample size. A normal interval is only a rough summary; use an appropriate paired or clustered method for the actual design.↔ Scroll wide equations horizontally.

Freeze the protocol and inspect failure mechanisms

Record model and tokenizer revisions, full prompts, retrieved corpus versions, tool state, decoding parameters, random seeds, timeouts, and grader configuration. Score incomplete, invalid, and timed-out outputs according to a declared policy rather than silently dropping them. Keep resource budgets comparable: one system allowed ten attempts is not directly comparable to another allowed one unless the difference is part of the question. Report both quality and resources so a gain from extra computation is visible.

After testing, inspect error mechanisms and create a new development set. Do not continuously tune against the same final test while still calling it untouched. Distinguish lack of knowledge, missing retrieval, evidence misuse, tool failure, and grader ambiguity. Regression tests should preserve important discovered failures without replacing broader sampling. A credible release decision combines effect size, uncertainty, operational benefit, and unacceptable failures; no single benchmark average resolves every tradeoff.

Read a paired improvement cautiously

On 200 independent tasks, system A succeeds on 160 and system B on 168. Both succeed on 150 tasks. Estimate the paired difference and a rough normal uncertainty interval.

  1. A-only success occurs on 160−150=10 tasks; B-only success occurs on 168−150=18. Both fail on 200−150−10−18=22 tasks. The net gain is eight tasks, or 8/200=0.04.

  2. The differences di are +1 eighteen times, −1 ten times, and zero 172 times. Their sample variance is (28−200×0.04²)/199, approximately 0.1391.

  3. The standard error is sqrt(0.1391/200), approximately 0.0264. A rough 95% normal interval is 0.04 ± 1.96×0.0264, approximately −0.012 to 0.092.

The result

The observed gain is four percentage points, but this rough interval includes zero. That is evidence to gather more data and inspect disagreements, not proof the systems are identical or that B is universally better.

Explore the model

Interactive lab

Interactive lab · probability

Sample size changes a count distribution

Vary p and n to inspect an exact binomial distribution for independent identical Bernoulli trials. It illustrates sampling variation in simple success counts. It does not implement paired differences, clustered bootstrap intervals, grader errors, or correlated user sessions.

Sample size changes a count distributionThese are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Current readings: Mean · np: 5; Variance · np(1−p): 2.5; Total probability: 1. All parameters are adjustable with the labeled controls below.03581000.070.150.220.3Successes kP(X = k)k = 0 · P = 9.77e-4
Exact probabilityHighlighted outcomeMean np
Mean · np
5
Variance · np(1−p)
2.5
Total probability
1
t = 0 s

These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forA measured success count has sampling variation; the uncertainty model must match the actual evaluation design.

Check your understanding

Two systems are tested on the same conversations, each containing ten related turns. What is the most defensible bootstrap unit?

Try it yourself

On 100 paired cases, A-only succeeds on 12 and B-only on 17. Both succeed on 60. Calculate each accuracy and the paired difference, and name one missing piece needed for a deployment decision.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Add shared successes to each system's unique successes; the net difference depends only on disagreements.

Compare with the solution

A succeeds on 72 cases and B on 77, so accuracies are 72% and 77%. The paired difference is (17−12)/100 = 5 percentage points. Deployment still needs uncertainty, representative case selection, important failure slices, and resource or latency consequences; the observed difference alone does not settle those questions.

Take it with you

  • An evaluation score belongs to a complete system and frozen measurement protocol.
  • Pair cases, preserve dependence, and report uncertainty alongside effect size.
  • Benchmark success, judge agreement, and deployment safety are distinct claims.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.