AI Datasets
Esc

    ↑↓ move↵ open/ search from any page

    Catalog / LLMs

    HumanEval (2021)

    164 hand-written Python problems graded by unit tests.

    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.

    Get the data

    # pip install -U huggingface_hub
    hf download openai/openai_humaneval --repo-type dataset \
      --local-dir humaneval
    Year
    2021
    Creators
    Mark Chen et al. (OpenAI)
    Task
    Code generation (write a Python function from its docstring)
    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 · on this site

    Samples

    Showing 2 of 12 sampled rows(from 164 in the test split)
    HumanEval/18

    The prompt the model sees:

    def how_many_times(string: str, substring: str) -> int:
        """ Find how many times a given substring can be found in the original string. Count overlaping cases.
        >>> how_many_times('', 'a')
        0
        >>> how_many_times('aaa', 'a')
        3
        >>> how_many_times('aaaa', 'aa')
        3
        """
    Reference solution
        times = 0
    
        for i in range(len(string) - len(substring) + 1):
            if string[i:i+len(substring)] == substring:
                times += 1
    
        return times
    Unit tests (not shown to the model)
    METADATA = {
        'author': 'jt',
        'dataset': 'test'
    }
    
    
    def check(candidate):
        assert candidate('', 'x') == 0
        assert candidate('xyxyxyx', 'x') == 4
        assert candidate('cacacacac', 'cac') == 4
        assert candidate('john doe', 'john') == 1
    HumanEval/59

    The prompt the model sees:

    def largest_prime_factor(n: int):
        """Return the largest prime factor of n. Assume n > 1 and is not a prime.
        >>> largest_prime_factor(13195)
        29
        >>> largest_prime_factor(2048)
        2
        """
    Reference solution
        def is_prime(k):
            if k < 2:
                return False
            for i in range(2, k - 1):
                if k % i == 0:
                    return False
            return True
        largest = 1
        for j in range(2, n + 1):
            if n % j == 0 and is_prime(j):
                largest = max(largest, j)
        return largest
    Unit tests (not shown to the model)
    METADATA = {}
    
    
    def check(candidate):
        assert candidate(15) == 5
        assert candidate(27) == 3
        assert candidate(63) == 7
        assert candidate(330) == 11
        assert candidate(13195) == 29
    What one record actually looks like (raw JSON, row 18)
    {
      "canonical_solution": "    times = 0\n\n    for i in range(len(string) - len(substring) + 1):\n        if string[i:i+len(substring)] == substring:\n            times += 1\n\n    return times\n",
      "entry_point": "how_many_times",
      "prompt": "\n\ndef how_many_times(string: str, substring: str) -> int:\n    \"\"\" Find how many times a given substring can be found in the original string. Count overlaping cases.\n    >>> how_many_times('', 'a')\n    0\n    >>> how_many_times('aaa', 'a')\n    3\n    >>> how_many_times('aaaa', 'aa')\n    3\n    \"\"\"\n",
      "task_id": "HumanEval/18",
      "test": "\n\nMETADATA = {\n    'author': 'jt',\n    'dataset': 'test'\n}\n\n\ndef check(candidate):\n    assert candidate('', 'x') == 0\n    assert candidate('xyxyxyx', 'x') == 4\n    assert candidate('cacacacac', 'cac') == 4\n    assert candidate('john doe', 'john') == 1\n"
    }

    Media fields point at a local copy; on Hugging Face they are bytes in a Parquet file.

    Sampled 2026-11-07 from openai/openai_humaneval at revision 7dce605

    Worth knowing

    Related datasets

    Landmark papers