MSBA-371 · Lesson 4 of 12 · 19 min

Benchmarks and test sets

▶ Video coming soon A video version of this lesson is on the way.

A week after Lena's spreadsheet, Malik arrived with a question from a hiking-club volunteer who also worked in software. The volunteer had read that a new model scored far higher than the old one on a well-known coding benchmark and wanted to know whether TrailCheck should switch. "Does that number mean anything for us?" Malik asked. Priya's answer was the subject of the session: a public benchmark tells you something about a model on someone else's tasks; only your own test set tells you about your agent on your tasks.

The previous lesson defined success criteria and signals for a single task. This lesson is about measuring an agent across many tasks, repeatably, so that changes to instructions, tools, models or setup can be compared. That is what a test set, sometimes called an evaluation set or eval suite, is for.

Public benchmarks

Public benchmarks for coding agents collect real or realistic tasks from open-source projects, run agents against them and score the results, usually with hidden tests that the agent does not see. Well-known examples include the SWE-bench family, which takes issues and their fixing pull requests from open-source Python repositories, and benchmarks that test terminal use, multi-language changes or longer tasks. Model providers and agent products report scores on them, and leaderboards rank the results.

Benchmarks are useful for what they are: a common yardstick that lets you compare models and agent designs on the same tasks. They are poor predictors of how an agent will do in your repository, for several reasons.

Why a public benchmark score is a weak guide to your own results.
LimitWhy it matters for your team
Different codeBenchmark repositories may use other languages, frameworks and conventions than yours
Different task mixYour work may be mostly small fixes, or mostly refactoring, or mostly documentation
Different harnessA score belongs to a model plus the harness, tools and prompts used; your agent uses different ones
ContaminationPublic tasks and their fixes may appear in training data, inflating scores
Different definition of successHidden tests passing is not the same as your reviewers accepting the change
No process measuresMost benchmarks score outcomes, not scope, cost or safety of the route taken

None of this makes benchmarks worthless. A large gap on a reputable benchmark suggests a model is worth trying. But the decision to switch should rest on your own test set, run with your own agent configuration.

What a test set is

A test set for an agent is a fixed collection of tasks, each with a starting state, an instruction and a way to grade the result. Run the agent on every task, grade each result, and you get a score. Change something, run again, and compare. The value of a test set comes from being fixed: if the tasks change between runs, you cannot tell whether the score moved because the agent improved or because the tasks got easier.

A pipeline in four stages from left to right. Source tasks shows closed issues with merged fixes, reverted changes and hand-written tasks. Freeze shows each task as a commit, an instruction and hidden checks. Run shows the agent executing each task several times. Grade shows a table of pass, fail and cost per task, feeding a score and a comparison with the previous run.
Building and running a test set. Tasks come from your own history, are frozen with hidden checks, and are run several times per configuration.

Where tasks come from

The best source of tasks is your own history. A closed issue with a merged fix gives you everything: the starting commit (the parent of the fix), the instruction (the issue text, perhaps tidied), and a way to grade (the tests added by the fix, which the agent does not see, plus the existing tests). This is how most public coding benchmarks are built, and it works the same way for a single repository.

Good tasks also come from failures. A change that was reverted, a bug that reached production, an agent pull request that missed the intent: each can become a task that checks whether the problem now gets handled. Teams also write tasks by hand to cover cases history does not have, such as a request that should be refused or an issue that is deliberately ambiguous and should lead the agent to ask a question rather than guess.

Lena built Tidewater's first set over two Thursdays. She went through the closed issues in TrailCheck, trail-units and the trail-report validator and chose thirty tasks with merged fixes and tests. She added six from failures: the string-comparison date bug from the previous lesson, the four-hundred-line toggle pull request, and four others. She wrote four by hand: two ambiguous issues where the right behaviour was to ask, one that would require editing a workflow file (out of scope, so the right behaviour was to stop) and one that asked for a feature the project had already rejected.

Grading

Each task needs a grader. Graders fall into the same families as the signals in the previous lesson.

Hidden tests are the strongest grader for behaviour. The agent works from the issue; the grader then runs tests the agent never saw. If they pass, the behaviour is right in the ways the tests check. Hidden tests should be kept outside the repository the agent can read, or added only after the agent finishes, so the agent cannot simply read them and code to them.

Checks on constraints grade process and safety: were existing tests modified, were files outside the allowed list changed, did the change add dependencies, did scanning raise new alerts, did the session stay within budget?

Expected behaviour for special tasks covers the hand-written cases: for an ambiguous issue, did the agent ask instead of guess; for an out-of-scope request, did it stop?

Human or model grading covers qualities the others cannot. Keep it to a few clear rubric questions, and calibrate any model judge against human grades on a sample.

One task in Tidewater's test set, described in YAML. The graders section lists hidden tests, constraint checks and the expected behaviour.
# evals/tasks/tc-0142.yml  (stored outside the repository the agent works in)
id: tc-0142
source: issue 142, fixed by pull request 151
repository: tidewater/trailcheck
start_commit: 9f3c2a1        # parent of the fix
instruction: |
  Trail closures imported from the park feed show the wrong end date
  when the closure ends at midnight. Fix the import so the end date
  is the last full day of the closure.
graders:
  hidden_tests: [test/import/closure-dates.test.js]
  constraints:
    tests_modified: none
    allowed_paths: [src/import/**, test/import/**]
    new_dependencies: none
  expected_outcome: fix
tags: [import, dates, small]

Repeat runs and nondeterminism

Agents are not deterministic. The same model with the same instructions on the same task can take a different path each time and sometimes reach a different result. A single run per task therefore mixes the agent's ability with luck. The remedy is to run each task several times and report the rate.

Two summary measures are common. pass@k is the probability that at least one of k attempts succeeds; it describes what you get if a person can look at several attempts and pick the good one. pass^k (read "pass to the k") is the probability that all k attempts succeed; it describes reliability, which matters more when nobody will check every attempt. An agent with a high pass@3 but a low pass^3 is capable but unreliable.

Measures for a test set. Report success and reliability separately, and always report violations and cost alongside them.
MeasureQuestion it answersWhen it matters
Success rate (pass@1)How often does a single attempt succeed?Everyday assignment of one task to one agent
pass@kHow often does at least one of k attempts succeed?When several attempts are generated and a person chooses
pass^kHow often do all k attempts succeed?When the agent runs unattended and must be consistent
Constraint violations per taskHow often does the agent break a rule on the way?Safety and scope, regardless of success
Cost and time per taskWhat does a result cost?Comparing configurations with similar success

How big, and how sure

A test set of forty tasks is small, and small sets give noisy scores. If an agent truly succeeds on about seventy percent of tasks like yours, a run of forty tasks will often score anywhere from about sixty to eighty percent by chance alone. A change that moves the score from twenty-eight to thirty passes out of forty may be noise.

Three habits make small sets more useful. Run each task several times so that each task's rate is steadier. Compare configurations on the same tasks and look at which tasks changed, not just the total: a change that fixes four tasks and breaks two is different from one that fixes two and breaks none. And treat small movements as hints to investigate, not proof.

Lena's first full run used three attempts per task on the forty tasks. The current configuration passed 74 of 120 attempts, a success rate of about 62 percent. Constraint violations appeared in 9 attempts, 6 of them modified existing tests. Of the four hand-written tasks, the agent asked a question on one ambiguous issue out of two and stopped on the workflow-file task in two of three attempts.

Worked problem

Reading a comparison

Malik tried a different model with the same instructions and setup on the same forty tasks, three attempts each. It passed 80 of 120 attempts. Should Tidewater switch?

Show solution
  1. Compare like with like: same tasks, same attempts, same graders. The difference is six passes out of 120, about five percentage points.
  2. Look at which tasks changed. The new model gained on five tasks and lost on two, all small import and date tasks.
  3. Check violations and cost. The new model modified existing tests in 11 attempts against 6, and its sessions cost noticeably more on average.
  4. Conclusion: the gain in success is within the range noise could produce on forty tasks, and the violation rate is worse. Do not switch on this evidence; investigate the test modifications first.

Keeping the set honest

A test set loses value if it is not maintained. Contamination happens when the tasks or their fixes leak into what the agent can see: hidden tests left in the repository, the fixing commit present in the branch, the solution described in an instruction file. Overfitting happens when a team tunes instructions until the test set passes, adding special-case rules that help these forty tasks and nothing else. Staleness happens when the codebase moves on and the tasks no longer reflect the work.

Defences mirror machine-learning practice. Keep graders outside the agent's reach. Keep a hold-out portion of the set that is run only occasionally, to check that improvements on the main set are real. Add new tasks from recent work each month and retire tasks whose code no longer exists, keeping a record so old scores remain interpretable.

From test set to regression suite

Once a test set exists it becomes a regression suite for the agent configuration. Any change to custom instructions, AGENTS.md, custom agents, setup steps, MCP servers or the chosen model can be run against it before it is adopted, just as a code change runs against unit tests before it merges. Because instruction files live in the repository, the comparison can be attached to the pull request that changes them.

Running agents across a whole test set costs money and time, so most teams run a small, fast subset on every change to agent configuration and the full set on a schedule or before a significant change such as a model switch. Seraphine said Skerry's platform team ran a 25-task smoke set on every change to its shared custom agents and a 300-task set weekly, with results posted to the pull request or the team's channel.

Test sets for multi-step and conversational work

Most of Tidewater's tasks were one issue and one pull request, which made grading straightforward. Some agent work is longer: a planning session followed by implementation, or a conversation in which a person answers the agent's questions. These need tasks that script the person's side. A task can include the answers a person would give to the questions the agent is expected to ask, so that the run can continue without a human present, and a grader that checks whether the agent asked at the right moments rather than guessing.

Process graders become more important for longer tasks. Did the agent produce a plan before editing? Did it keep the plan file current? Did it stop when a step failed three times? Foundry's Task Navigation Efficiency evaluator, described in the previous lesson, compares the sequence of tool calls with an expected sequence; the same idea can be applied to any agent by recording expected checkpoints, such as "ran the full test suite before finishing", and checking the session log for them.

Lena added two such tasks to Tidewater's set: one that required a plan to be approved before any change, and one that included a scripted answer to a question about a default value. Both exposed behaviour the single-step tasks could not, including one attempt in which the agent wrote the plan and then began editing without waiting for approval.

Common mistakes

  • MistakeChoosing a model from a public leaderboard alone.

    InsteadUse benchmarks to shortlist, then decide on your own test set with your own agent configuration.

  • MistakeRunning each task once and comparing totals.

    InsteadRun several attempts, compare the same tasks, and look at which tasks changed.

  • MistakeLeaving hidden tests in the repository the agent can read.

    InsteadKeep graders outside the agent's reach or add them after it finishes.

  • MistakeReporting only success rate.

    InsteadReport constraint violations and cost alongside success and reliability.

  • MistakeTuning instructions until the test set passes.

    InsteadKeep a hold-out set and avoid task-specific rules.

Summary and key terms

  • Public benchmarks compare models on shared tasks but predict poorly for your repository.
  • A test set is a fixed collection of tasks, each with a start state, an instruction and graders.
  • Tasks come from closed issues with merged fixes, from failures and from hand-written special cases.
  • Graders include hidden tests, constraint checks, expected behaviour and calibrated human or model judgement.
  • Run tasks several times; report pass@1, pass@k or pass^k, violations and cost.
  • Small sets are noisy; compare the same tasks and look at which changed.
  • Prevent contamination, overfitting and staleness; use the set as a regression suite for agent configuration.
Benchmark
A public, shared set of tasks used to compare models or agents.
Test set
A fixed collection of tasks with graders used to measure an agent repeatably.
Hidden tests
Tests used for grading that the agent does not see while working.
pass@k
The probability that at least one of k attempts succeeds.
pass^k
The probability that all k attempts succeed; a measure of reliability.
Contamination
Leakage of tasks, fixes or graders into what the agent or model can see.
Hold-out set
Tasks kept aside and run rarely to check that improvements generalize.
Regression suite
A test set run on every change to agent configuration to catch regressions.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. Where does a task built from a closed issue get its start state?

    Show answer

    From the parent commit of the merged fix.

  2. Which measure matters most for an agent that runs unattended?

    Show answer

    pass^k, because it measures consistency across attempts.

  3. Why include an out-of-scope task in the test set?

    Show answer

    To check that the agent stops instead of making a change it should not make.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz