# HumanEval (2021)

> 164 hand-written Python problems graded by unit tests.

Page: https://mralbu.github.io/ai-datasets/d/humaneval

## Key facts

- Category: LLMs
- Task: Code generation (write a Python function from its docstring)
- Creators: Mark Chen et al. (OpenAI)
- Size: 164 problems
- Splits: test 164
- Input: A function signature and docstring with examples
- Labels: Unit tests the model never sees (about 7.7 per problem)
- License: MIT
- Paper: [Evaluating Large Language Models Trained on Code](https://arxiv.org/abs/2107.03374)
- Homepage: https://github.com/openai/human-eval
- Hugging Face: [openai/openai_humaneval](https://huggingface.co/datasets/openai/openai_humaneval)
- Sampled at Hub revision 7dce6050a7d6d172f3cc5c32aa97f52fa1a2e544 (2026-11-07)

## Why it matters

Introduced with Codex, it made "can the model write working code?" a single, automatically checked number. The fine-tuned 12B Codex solved 28.8% on the first try while GPT-3 solved none. Frontier models now score above 90%, and coding evaluation has moved to larger, repository-level tasks.

## Worth knowing

- Problems were written by hand so they would not already be on GitHub, the models' training data.
- It introduced pass@k, the chance that at least one of k sampled solutions passes all tests, with an unbiased estimator.
- HumanEval+ (2023) added about 80× more tests and found that many previously "passing" solutions were wrong.

## Get the data

```bash
# pip install -U huggingface_hub
hf download openai/openai_humaneval --repo-type dataset \
  --local-dir humaneval
```

```python
from datasets import load_dataset   # pip install datasets

ds = load_dataset("openai/openai_humaneval", "openai_humaneval")
print(ds)
```

```python
import polars as pl

df = pl.read_parquet("hf://datasets/openai/openai_humaneval@~parquet/openai_humaneval/test/*.parquet")
print(df.shape)
```

## Related datasets

- [MBPP](https://huggingface.co/datasets/google-research-datasets/mbpp): 2021, ~1,000 crowd-sourced basic Python problems
- [HumanEval+](https://huggingface.co/datasets/evalplus/humanevalplus): 2023, much stronger tests
- [SWE-bench](https://huggingface.co/datasets/princeton-nlp/SWE-bench): 2023, real GitHub issues in real repositories (on this site: https://mralbu.github.io/ai-datasets/d/swe-bench)

## Landmark papers

- [Is Your Code Generated by ChatGPT Really Correct? (EvalPlus)](https://arxiv.org/abs/2305.01210) (2023)

## Papers on this site that use it

- [Codex (2021)](https://mralbu.github.io/ai-datasets/p/codex.md): A GPT model fine-tuned on GitHub code, and HumanEval, the benchmark that grades generated programs by running their unit tests.
- [Helpful and harmless (2022)](https://mralbu.github.io/ai-datasets/p/helpful-harmless.md): Anthropic's RLHF assistant, and the public preference data on helpfulness and harmlessness that much of open alignment research has trained on since.
- [LLaMA (2023)](https://mralbu.github.io/ai-datasets/p/llama.md): Smaller models trained longer on public data alone, matching models many times their size, with the weights given to researchers.
- [Muon (2025)](https://mralbu.github.io/ai-datasets/p/muon.md): Shows that Muon, which orthogonalizes each weight matrix's update, trains large language models with about half the compute AdamW needs.
- [SWE-RL (2025)](https://mralbu.github.io/ai-datasets/p/swe-rl.md): Trained an open model to fix GitHub issues with reinforcement learning on public pull requests, rewarding patches by how closely they match the real fix.
