Contents

Foundation Model Engineering

Manuscript updated (UTC) · Chapter source on GitHub · Cite this chapter (RIS)

On this page

17.1 Academic Benchmarks

A code generator answers the same problem twenty times. Ten answers pass the tests. If you draw nine of the twenty, what is the chance that they all fail? It is small enough for a chart to round the success rate to 100%, yet ten different groups of nine contain only failures. Choosing the unit of measurement makes the difference between an almost certain event and a guarantee. Work through the draw.

Frontier Benchmark Map

Choose a benchmark by the kind of mistake you want to expose. MMLU asks multiple-choice questions across academic subjects [1]. HumanEval runs tests on generated functions [2]. SWE-bench starts from a repository and an issue, then checks a proposed change [4]. Passing a function test and resolving a repository issue require different evidence.

Task familyExampleWhat to check before comparing scores
Knowledge and reasoningMMLU, GPQAIdentical questions, option order, prompts and scoring rules
MathGSM8K, MATHCalculator access, handling of equivalent expressions and units
CodeHumanEval, MBPP, SWE-benchTest revision, available files, execution environment and attempt budget
Long contextRetrieve and synthesize distant evidencePosition of the evidence and whether it survived truncation
Agents and toolsWebArena, operating-system tasksStarting state, permissions, side effects and retry budget
SafetyCases written for a particular policyThreat model, rubric and severity of each error

Report which tools and scaffold ran with the model. If a patching agent gains points after receiving a search tool, the measured improvement belongs to that system configuration. HELM illustrates how one protocol can report several metrics, including accuracy and efficiency, across scenarios [3].

Multimodal Evaluation

Suppose a question asks which train leaves a station at 09:40. Keep the question fixed and swap two rows of the timetable image. Does the answer follow the edited image? Try removing the image as a control. These runs help separate the use of visual evidence from a guess that happens to fit the wording.

Record image resolution, tiling, crop order, OCR, compression and any accessibility or language variants. For video, record sampled frames and whether the audio track was available. Check the rendered input when the grader flags a wrong answer. An unreadable timetable calls for a different fix from a legible timetable interpreted incorrectly. Respect media licenses and retention limits when keeping those inputs.

Metric Design

Multiple Choice and Short Answers

Choose whether the system generates an option label or scores the option strings by log probability. Save the prompt and option tokens in either case. Permuting the displayed options and remapping the answer key can expose a preference for the first position. Specify how abstentions affect accuracy and report coverage if the system can decline to answer.

Generated Answers

A grader expecting 0.5 kg might reject 500 g. Decide in advance whether unit conversion is permitted and how much numerical error is acceptable. Version the extractor, the equivalence rules, any judge prompt, and citation or format requirements. Inspect disagreements between graders on a sample that includes malformed outputs and different languages.

Code and Agents

HumanEval counts generated programs that pass the task’s tests [2]. For task ii, let nin_i be the number generated, cic_i the number that pass and kk the number drawn, with 1≤k≤ni1\leq k\leq n_i. Each subset of kk indices from that task is equally likely. The only draws without a pass consist entirely of the ni−cin_i-c_i failures. With TT equally weighted tasks, the estimate is

p^i(k)=1−(ni−cik)(nik),pass@k^=1T∑i=1Tp^i(k).\widehat p_i(k)=1-\frac{\binom{n_i-c_i}{k}}{\binom{n_i}{k}}, \qquad \widehat{\mathrm{pass@}k}=\frac{1}{T}\sum_{i=1}^{T}\widehat p_i(k).

A binomial coefficient counts subsets and is zero when fewer than kk items are available. The first expression is exact for the observed pool. When the answers for each problem are independently sampled from the same decoding configuration, it is also an unbiased estimate of the chance that at least one of kk fresh answers passes. A system sending only one answer to a user must still select it. Evaluate the selector and charge for the entire generation and verification budget.

Can nine attempts still all fail?

In the opening example, there are 167,960 ways to draw nine of the twenty answers. To draw nine failures, leave out one of the ten failures. That gives ten all-failure draws, or about 0.00595% of the total. Move kk to 10 in the experiment. Exactly one all-failure draw remains. Move it to 11 and that last possibility disappears.

Chance of at least one passing answer

For one problem, c of n answers passed the tests. Select k of those answers uniformly without replacement.

pass@150.0%
pass@9>99.9%
Chance all fail0.00595%
pass@k as the number drawn increases10 of 20 answers pass. At k=9, pass@9 is >99.9%. The chance all fail is 0.00595%.0%50%100%11020Answers drawn k

The pool contains 10 failures, enough to fill a draw of 9 without a pass.

Average across problems before reporting the benchmark. Suppose every one of four programs passes on problem A, while all four fail on problem B. At k=2k=2 the two estimates are 1 and 0, so the average is 50%. Pool all eight programs first and the same formula gives 78.6%. That pool includes pairs in which the two programs answer different problems.

from fractions import Fraction
from math import comb

def pass_at_k(n, c, k):
    if not (0 <= c <= n and 1 <= k <= n):
        raise ValueError("Expected 0 <= c <= n and 1 <= k <= n")
    return 1 - Fraction(comb(n - c, k), comb(n, k))

assert 1 - pass_at_k(20, 10, 9) == Fraction(10, 167960)
assert 1 - pass_at_k(20, 10, 10) == Fraction(1, 184756)
assert pass_at_k(20, 10, 11) == 1

tasks = [(4, 4), (4, 0)]
task_mean = sum(pass_at_k(n, c, 2) for n, c in tasks) / len(tasks)
pooled = pass_at_k(8, 4, 2)
print(task_mean, pooled)  # 1/2 11/14

For agents, define the success condition in the environment. If the task is to book one appointment, inspect the resulting calendar after any retries. Include duplicate bookings, timeouts, and exhausted budgets in the scoring rules.

Statistical Comparison

Use a fixed evaluation harness and run both systems on the same problems. Store paired outcomes so that an improvement on one case and a regression on another remain visible. A confidence interval for their difference should respect the sampling unit. If one support ticket has five paraphrases, resample whole tickets. Many generations on a single prompt provide more information about that prompt, while the number of independent tasks stays the same.

Before looking at the results, set the minimum useful gain, rules for ties and multiple comparisons, and a sample-size rationale. Report uncertainty and the number of tasks for each important domain, language, safety or tool-use slice. Repeat stochastic runs when decoding variability is part of the question.

Contamination and Dynamic Tests

Protect questions, answers, grading rubrics, neighboring examples and teacher-generated variants. Check the final rendered and tokenized training corpus against this registry. Fresh questions reduce direct exposure, but an old solution template or a log of previous evaluations may disclose how to answer them. Keep a dated private set alongside stable anchors for comparing runs over time. Contamination checks in §17.4

Practical Benchmark Checklist

Before using a score for a release, check whether another engineer could reconstruct it.

  • Pin the model artifact, test and harness revisions, task split and evaluation date.
  • Save the system prompt, few-shot examples, templates, tool access and context limits.
  • Record the sampling configuration, nn, kk, token and time budgets, dependencies, execution environment and retry policy.
  • Keep raw outputs, failures, timeouts, grader decisions and their denominators. Declare the treatment of missing observations.
  • Report paired uncertainty, slice counts, contamination checks, latency, cost and error rate. Compare the candidates again on protected cases drawn from your own application.

Quizzes

Quiz 1: Ten of twenty programs fail. Why does drawing ten give a different guarantee from drawing eleven? All ten failures can fill one draw of ten. A draw of eleven must contain at least one passing answer from this pool.

Quiz 2: Why did combining two problems into a single pool raise pass@2 from 50% to 78.6%? The combined pool admits pairs from different problems. A passing solution for the easy problem can mask a failure on the hard one. A user gets two attempts on the same problem.

Quiz 3: A model answers correctly after the timetable image is removed. Which follow-up checks whether it used the image? Edit a relevant entry while keeping the wording fixed and check whether its answer changes accordingly. Compare the results on both images and the text-only control.

Quiz 4: Two agents see five paraphrases of each support ticket. What should a paired bootstrap resample? Resample tickets, retaining their paraphrases and both agents’ outcomes together. Treating each paraphrase as a new independent ticket exaggerates the effective sample size.

References

  1. Hendrycks, D., et al. (2021). Measuring Massive Multitask Language Understanding. Paper.
  2. Chen, M., et al. (2021). Evaluating Large Language Models Trained on Code. §2.1, Functional Correctness.
  3. Liang, P., et al. (2022). Holistic Evaluation of Language Models. Paper.
  4. Jimenez, C. E., et al. (2024). SWE-bench: Can Language Models Resolve Real-World GitHub Issues? Paper.