Benchmarks · Coding & software engineering

HumanEval

also: Codex HumanEval

Can a model write a correct, working Python function from a natural-language docstring alone?

OpenAIReleased 7 July 2021Saturated

HumanEval asks a narrow, precise question: given nothing but a function signature and an English description of what it should do, can a model write Python code that actually works? OpenAI introduced it alongside Codex in 2021 as a deliberate departure from earlier code-generation tests, which typically scored output by how closely it resembled a reference solution. HumanEval instead ran the generated code against hidden unit tests — a program either passed or it didn’t, regardless of how it got there.

The original 164-problem set was small by later standards but demanding in 2021: Codex solved 28.8% of problems on a single attempt, and the paper’s finding that sampling 100 attempts and keeping any passing one lifted that to 70.2% shaped how code models were evaluated for years afterward. As general-purpose language models absorbed more code in pretraining, HumanEval scores climbed fast — Claude 2 reached 71.2% in mid-2023, and Claude 3 Opus reported 84.9% less than a year later.

That trajectory is also why HumanEval’s usefulness declined. Its 164 problems and reference solutions have been public and widely mirrored since 2021, making contamination — models having effectively seen the answers during training — a standing concern once scores pushed into the 90s. The benchmark still appears in release reports as a familiar reference point, but the field’s attention has shifted to larger, harder or more contamination-resistant tests of coding ability, from MBPP and BigCodeBench to LiveCodeBench and SWE-bench.

The set

164 hand-written programming problems, each a function signature plus an English docstring describing the task. A solution is scored not by resembling a reference answer but by whether it passes a held-out set of unit tests — the pass@k metric reports the chance that at least one of k sampled completions passes.

Example

Problem HumanEval/0, verbatim: 'def has_close_elements(numbers: List[float], threshold: float) -> bool: Check if in given list of numbers, are any two numbers closer to each other than given threshold. >>> has_close_elements([1.0, 2.0, 3.0], 0.5) False >>> has_close_elements([1.0, 2.8, 3.0, 4.0, 5.0, 2.0], 0.3) True' — the model must generate the function body, graded only by unit tests hidden from it.github.com

Where it stands

Frontier models now report scores in the low-to-high 90s; because the problems and solutions have circulated on the open web for years, the field treats HumanEval as likely present in pretraining data and largely superseded by harder, contamination-resistant successors such as LiveCodeBench and SWE-bench.

How the top score changed hands

  1. July 2021Codex (12B)28.8% pass@1 / 70.2% pass@100Zero-shot single-attempt rate; the 100-sample figure showed repeated sampling could recover far more solutions than a single attempt suggested.
  2. July 2023Claude 271.2%Up from 56.0% for Claude 1.3.
  3. March 2024Claude 3 Opus84.9%

In the timeline · 16 entries

More coding & software engineering benchmarks