HumanEval is a benchmark developed by OpenAI for assessing the code generation capabilities of Large Language Models (LLMs). It comprises 164 hand-written Python programming problems, each with a function signature, docstring, and comprehensive unit tests, designed to evaluate functional correctness. The library uses the `pass@k` metric for evaluation. The current version is 1.0.3, released on July 24, 2023. As a benchmark dataset and evaluation harness, it has an infrequent release cadence, with updates typically driven by new research or significant improvements to the benchmark itself.
pip install human-evalVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates the core workflow: reading HumanEval problems, generating code completions using a placeholder function (which you would replace with your LLM integration), saving these completions to a JSONL file, and finally, instructing how to run the `evaluate_functional_correctness` command-line tool to assess the functional correctness of the generated code.
Users are *strongly encouraged* to run the `evaluate_functional_correctness` tool within a robust security sandbox (e.g., Docker, a dedicated VM, or an isolated environment like Riza). Review `human_eval/execution.py` and uncomment the execution line only after understanding the risks and implementing proper sandboxing.
For optimal results, use instruction-tuned models. If using base models, a post-generation filtering step (`filter_code`) might be necessary to clean up outputs before evaluation.
To mitigate contamination, use time-split datasets, rigorously audit potential overlap sources, and compare `pass@k` scores on fresh, internal tasks.
To speed up evaluation: utilize the `--parallel` flag (e.g., `--parallel $(nproc)`), avoid `--test-details` if only `pass@k` scores are needed (as it runs all tests even after failure), and consider using specialized versions like HumanEval+ Mini for faster checks.
Install the package using pip: 'pip install human-eval'.
Ensure the 'human-eval' package is installed correctly: 'pip install human-eval'.
Verify the installation of 'human-eval' and reinstall if necessary: 'pip install --force-reinstall human-eval'.
Ensure that 'samples.jsonl' is generated and located in the correct directory before running the evaluation command.
Check the integrity of the problem dataset and ensure 'read_problems()' is functioning correctly.
No dependency data recorded yet.