HumanEval
HumanEval is a benchmark of 164 hand-written Python programming problems, released by OpenAI in 2021, that scores AI-generated code by whether it passes unit tests.
HumanEval was introduced in July 2021 in OpenAI's paper Evaluating Large Language Models Trained on Code, the paper that presented Codex, a GPT model fine-tuned on public code from GitHub; a production version of Codex powered GitHub Copilot. The authors wrote 164 original programming problems by hand, because their model had been trained on so much of GitHub that it might already have seen solutions to existing puzzles. Each gives a Python function signature and a docstring describing what the function should do, and the model must write the body. The problems test language comprehension, algorithms and simple mathematics, and some resemble basic software interview questions.
The key idea was to check functional correctness. Earlier code benchmarks often scored generated code by how closely it matched a reference solution, which penalises correct code written differently. HumanEval instead runs the code against unit tests. The paper also popularised the pass@k metric, first used by Sumith Kulal and colleagues in 2019: the chance that at least one of k generated attempts passes all the tests. Pass@1 is the score for a single attempt.
At release, Codex solved 28.8 per cent of the problems on the first try, GPT-3 solved none and the open GPT-J model solved 11.4 per cent. Allowed 100 attempts per problem, Codex solved 70.2 per cent, an early demonstration that sampling many answers and checking them can raise performance sharply. Because running model-written code is risky, the official evaluation code warns that it executes untrusted code and should only be run in a secure sandbox.
The design also has limits. The problems are short, self-contained and in Python only. They have been public on GitHub since 2021, so later models may have seen them during training. And writing a small function from a clear description is far from fixing bugs in a large, real codebase.
In practice, a HumanEval score says a model can write short, well-specified Python functions. It is useful history and a quick sanity check, but it says little about how a model will perform as a coding assistant on your own software.
It is a set of 164 hand-written Python problems released by OpenAI in 2021. A model is given a function signature and description, writes the code, and is scored by whether the code passes the problem's unit tests. Pass@1 is the share of problems a model solves with a single attempt. More generally, pass@k is the probability that at least one of k attempts passes all tests. The HumanEval paper introduced an unbiased way to estimate it from a larger number of samples. It remains a quick check of basic code generation, but it is small, Python-only and public since 2021, so contamination is possible and top models leave little room to separate. Benchmarks based on real software repositories are better guides to practical coding ability. Codex was trained on a large share of public GitHub code, which already contains solutions to many well-known programming exercises. Writing new problems by hand reduced the chance that the model had simply memorised the answers.Common questions
What is the HumanEval benchmark?
What does pass@1 mean?
Is HumanEval still a useful benchmark?
Why were the HumanEval problems written by hand?
Search for "HumanEval pass@k", "Codex paper 2021" or "code generation benchmarks" to understand the benchmark and its successors. The original paper on arXiv and OpenAI's GitHub repository are the primary sources. For comparisons between current models, look for evaluations that also report results on benchmarks built from real repositories, and be cautious with HumanEval scores reported without the number of attempts allowed.Finding more
Working out what this means for your business?
Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.