
Abstract
We introduce Codex, a GPT language model fine-tuned on publicly available code from GitHub, and study its Python code-writing capabilities. A distinct production version of Codex powers GitHub Copilot. On HumanEval, a new evaluation set we release to measure functional correctness for synthesizing programs from docstrings, our model solves 28.8% of the problems, while GPT-3 solves 0% and GPT-J solves 11.4%. Furthermore, we find that repeated sampling from the model is a surprisingly effective strategy for producing working solutions to difficult prompts. Using this method, we solve 70.2% of our problems with 100 samples per problem. Careful investigation of our model reveals its limitations, including difficulty with docstrings describing long chains of operations and with binding operations to variables. Finally, we discuss the potential broader impacts of deploying powerful code generation technologies, covering safety, security, and economics.
Code Repositories
Benchmarks
| Benchmark | Methodology | Metrics |
|---|---|---|
| code-generation-on-apps | Codex 12B (Raw) | Competition Pass@1: 0.50% Competition Pass@1000: 13.51% Competition Pass@5: 1.00% Competition Pass@any: 13.51% Interview Pass@1: 1.00% Interview Pass@1000: 13.15% Interview Pass@5: 1.73% Interview Pass@any: 13.15% Introductory Pass@1: 5.60% Introductory Pass@1000: 35.20% Introductory Pass@5: 9.20% Introductory Pass@any: 35.20% |
| multi-task-language-understanding-on-bbh-alg | code-davinci-002 175B (CoT) | Average (%): 73.9 |
| multi-task-language-understanding-on-bbh-nlp | code-davinci-002 175B (CoT) | Average (%): 73.5 |
Build AI with AI
From idea to launch — accelerate your AI development with free AI co-coding, out-of-the-box environment and best price of GPUs.