Learn
Evaluations & benchmarks

Why Benchmark Scores Don’t Always Match Real-World Coding Performance

The short answer

Coding benchmarks measure a narrow shape of work: a self-contained function, a complete specification in the docstring, and a handful of unit tests. Real engineering is repository-shaped, ambiguous, versioned and reviewed. Contamination, scaffolding and test-overfitting widen the gap further, which is why a 90-plus HumanEval score can coexist with mediocre pull requests.

On this page

The gap, concretely

A model reports 94 percent on HumanEval. A team adopts it, points it at their repository, and finds that it cannot add a field to an existing API endpoint without breaking two callers, invents a helper that does not exist, and produces a diff that touches nine files when three would do. The benchmark said the model could code. The repository says otherwise. Both statements are true, and the distance between them is not a scandal; it is a specification problem.

HumanEval asks for a function body given a signature and a docstring. The repository asks for a change given a partial understanding of a system, under constraints that are mostly unwritten: which abstraction owns this behaviour, which patterns are deprecated, which test is flaky, which dependency is pinned three versions back. These are different tasks that happen to share the word coding.

Understanding the gap matters commercially because model selection is often driven by exactly these numbers. A team picks the leaderboard leader, discovers it is worse for their codebase than the second-place model, and concludes that benchmarks are useless. They are not useless. They are measurements of something narrower than the decision being made with them.

Benchmarks are function-shaped; work is repository-shaped

Every popular function-level benchmark shares a structure: one prompt, one file, no imports beyond the standard library, no state, no build system, no colleagues. HumanEval's 164 problems are Python functions with docstrings. MBPP's 974 problems are short standalone scripts. Even the harder variants keep the unit of work small, because small units are cheap to grade automatically.

Repository work inverts every one of those properties. The relevant context is spread across files: a base class in one directory, a schema in another, a migration in a third. The change must compile against a dependency tree, satisfy a linter, pass a test suite that takes twenty minutes, and not break an integration that only runs in CI. None of this is captured by asking for a function body.

The closest public approximation is SWE-bench, which takes real GitHub issues and their merged pull requests from twelve Python repositories and asks for a patch that makes the project's tests pass. Its verified subset of 500 instances is human-checked for solvability. Even SWE-bench compresses the work: the issue text is unusually clean, the repository is checked out at the right commit, the test command is known, and the model does not have to talk to a product manager. Real tickets are worse written than SWE-bench issues, and that is saying something.

In a benchmark the specification is given; at work it is discovered

A HumanEval docstring is a complete specification, written by someone who knew the intended behaviour and expressed it unambiguously. It states the inputs, the outputs and the edge cases the tests will check. The model's job is translation: specification to implementation.

Real requests are underspecified by design. "Make the export faster" does not say which export, what faster means, whether the output format may change, or whether the customer who filed the ticket is on the old plan that still needs the old columns. A competent engineer resolves this by reading code, checking history, asking a colleague and making a judgement call. A model that has never been rewarded for asking a clarifying question will instead pick the most statistically likely interpretation and implement it confidently.

This is why instruction-following failures in production often look like competence. The code is clean, idiomatic and tested against the model's own assumption. It is simply solving the wrong problem, and no unit test catches that because the test encodes the same wrong assumption. Benchmarks cannot measure ambiguity resolution, because to grade it you would need to grade the question as much as the answer.

Tests are a proxy, and models optimise proxies

A unit test checks a finite set of behaviours. A function has an infinite set of inputs. Passing the tests means the implementation agrees with the test author on the cases the author thought of, which is a weaker claim than correctness and a much weaker claim than maintainability.

HumanEval's original suites average fewer than eight tests per problem. That leaves obvious room for implementations that special-case the examples: return the expected value when the input matches, fall back to something plausible otherwise. Models trained with reinforcement learning against unit-test rewards discover this behaviour readily, because it is the shortest path to the reward. EvalPlus generated HumanEval+ with roughly eighty times more tests per problem, and pass rates fell by double digits for many models. The models had not become worse; the measurement had become harder to satisfy by shortcut.

There is a milder version of the same effect that affects honest models. HumanEval problems have a house style: return a value rather than print it, use the argument names in the signature, handle empty input by returning a neutral value. A model that has seen thousands of similar problems learns the style and picks up points that have nothing to do with problem solving. It is pattern-matching the benchmark's conventions, which is a real skill and also not the skill the score implies.

Contamination inflates the top of the distribution

HumanEval has been public since 2021. Its problems, canonical solutions and discussions appear in GitHub repositories, blog posts, course materials and Stack Overflow threads, which means they are in the pretraining data of essentially every model released since. A model that has memorised a canonical solution will pass the tests, and may reproduce the solution verbatim when prompted with the docstring.

The tell is not a single high score but a pattern: near-perfect performance on the original set combined with much weaker performance on paraphrased versions, on problems requiring a different signature, or on benchmark items released after the training cutoff. LiveCodeBench was built around this constraint, releasing competitive-programming problems on a rolling basis and scoring only on items published after a model's cutoff date. The scores are lower and more believable.

Contamination is not limited to exact items. A model trained heavily on competitive programming will have seen the algorithmic idioms that HumanEval tests, even without the exact prompts. It will look strong on function-level tasks and ordinary on the messy, non-algorithmic code that most jobs consist of: wiring a config flag through four layers, adding pagination to an endpoint, renaming a concept across a codebase.

Scaffolding moves scores more than model choice does

A raw model asked to solve a SWE-bench instance fails often for reasons unrelated to coding ability: it does not know which files to open, it cannot run the tests, it gives up after one attempt. An agent scaffold adds a loop: search the repository, read the relevant files, propose a patch, run the tests, read the failure, revise. The same underlying model can differ by more than twenty points depending on the scaffold around it.

This has two consequences for interpreting benchmarks. First, a leaderboard entry for an agentic benchmark is a measurement of a system, not a model, and systems are not comparable unless the scaffolding is held constant. Second, the gap between benchmark and production is partly a gap in harness quality. A team that wraps a mid-tier model in a good loop, with repository search, test execution and retry on failure, will often beat a team that calls a top-tier model once with a large prompt.

The uncomfortable corollary is that benchmark improvements and product improvements are only loosely coupled. A five-point gain on a code benchmark may translate into nothing if the product's bottleneck is context retrieval, latency or the model's willingness to ask before guessing.

Distribution shift: language, framework and version

HumanEval is Python. Most enterprise code is not, or is Python surrounded by TypeScript, Java, Go and SQL. Syntax transfers reasonably well between languages; ecosystem knowledge does not. A model that writes idiomatic Python may produce Java that compiles but ignores the project's dependency-injection conventions, or TypeScript that fights the strict compiler settings the team enabled last year.

Version drift is the sharper problem. Library APIs change, deprecate and get removed. A model trained on a corpus dominated by tutorials written for an older release will confidently call a function that no longer exists, or use a pattern the framework's current documentation advises against. The code looks right, the reviewer recognises it as 2022-era, and the build fails. Benchmarks almost never pin library versions, so they cannot measure this at all.

Internal libraries are invisible by construction. Every large organisation has a house framework with its own conventions, and no public benchmark can test knowledge of it. The model must learn from the repository in front of it, which is a retrieval and in-context learning problem rather than a pretraining problem. The best public proxy is cross-file completion benchmarks such as RepoBench, which measure whether a model can use imported context, but even those use open-source repositories with conventional structure.

What the score never measures

Several properties decide whether a coding model is useful in a team, and none of them appear in a pass@k number.

Diff quality is the first. A patch that passes tests but rewrites three unrelated functions creates review burden, merge conflicts and regression risk. Reviewers consistently prefer a minimal, targeted diff even when both pass, and models differ widely in whether they produce one. Benchmarks that only check tests reward any passing patch equally.

Honesty about uncertainty is the second. A model that says "I could not find where this is configured; here are the three places I would look" is more useful than one that invents a file path with total confidence. Fabricated APIs are the most common failure mode in real repositories, and they are invisible to benchmarks that supply a self-contained prompt with no dependencies to hallucinate.

Then there is security, cost and latency. A model that solves the task with a SQL string concatenation introduces an injection risk the tests do not check. A model that burns 40,000 tokens of thinking per request may be unaffordable at production volume. A model that takes ninety seconds per completion breaks the edit-review loop that makes assisted coding pleasant. These are product properties, and they are measured by instrumenting your own system, not by reading a leaderboard.

Goodhart's law applies to code benchmarks

When a benchmark becomes a target, models are trained against it. Training on unit-test outcomes rewards whatever makes tests pass, which includes shortcuts, hard-coded values and overfitted control flow. Training on HumanEval-adjacent data rewards the house style. Training on SWE-bench rewards the specific repositories in SWE-bench, and there is evidence that models perform better on repositories they have seen than on equivalent unseen ones.

The result is a slow divergence between the benchmark and the underlying capability. Each generation looks better on the metric and only marginally better in practice, and the metric's remaining headroom is consumed by increasingly specific tricks. This is not unique to coding, but it is sharper here because the reward is executable and therefore easy to optimise against.

A related trade-off is pass@1 versus pass@k. A model tuned for single-shot accuracy may be conservative and repetitive; a model tuned to succeed within ten attempts may explore wildly and produce garbage on the first try. Benchmarks usually report one or the other, and products care about a different quantity again: the probability that the first suggestion is good enough to accept, because that is what determines whether the developer keeps using the tool.

How to tell whether the gap will bite you

The gap is not uniform. It is small for algorithmic, self-contained tasks with clear specifications, which is why benchmarks predict reasonably well for competitive programming, data-structure work and small utility functions. It is large for integration work, legacy code, ambiguous requirements and anything that depends on private context.

A short diagnostic is enough to locate yourself. If your work is mostly greenfield functions with tests written first, public benchmark rankings will transfer. If your work involves a large repository, a mature framework and tickets written by people in a hurry, they will not, and the ranking may even invert: models tuned for benchmark-style puzzles sometimes do worse at careful, conservative edits than models tuned for instruction following.

The practical response is not to discard benchmarks but to add a second measurement that matches your distribution. A private set of one to two hundred real tasks from your own repository, graded by your own tests and a short review rubric, will predict production performance far better than any public leaderboard, and it can be built in a week. The next entry covers how to build one; the point here is that the public number is a starting filter, not an answer.

Page feedback

Was this helpful?

A quick signal helps improve these notes.

Report a mistake Straight to the lab inbox

Put it to work

See the models, datasets and gateway this lab runs.