Evaluating Large Language Models Trained on Code

Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, et al.

2021 · arXiv

Evaluating Large Language Models Trained on Code

Problem

Framing

Code LMs were scored with token overlap, not executable correctness, so benchmark gains did not imply working programs. The paper closes this with HumanEval and a pass@kk estimator, then shows code-specialized GPT reaches 28.8% pass@1 and 77.5% pass@100 with reranking on HumanEval.

Currently Used Methods

Foundational

Proposed Method

Architecture

Codex keeps the GPT-3 decoder-only Transformer and changes the data mix: large-scale Python pretraining plus code-focused fine-tuning. The main variants span roughly 85M to 12B non-embedding parameters, with an extra Codex-S stage tuned on correctly implemented standalone functions.

Results plot on page 2: HumanEval pass rate versus non-embedding parameters for GPT-3, Codex, and Codex-S, including reranking curves.

Loss / Objective

Training remains next-token maximum likelihood on code sequences.

L(θ)=t=1Tlogpθ(xtx<t)\mathcal{L}(\theta) = - \sum_{t=1}^{T} \log p_\theta(x_t \mid x_{<t})

Held-out code loss after fine-tuning follows an empirical scaling law:

Ltest(N)(N5.92×107)0.13\mathcal{L}_{\mathrm{test}}(N) \approx \left(\frac{N}{5.92 \times 10^{7}}\right)^{-0.13}

Sampling Rule

The evaluation target is functional success under kk samples, estimated from nn draws with cc correct programs.

pass@k=1(nck)(nk)\mathrm{pass@}k = 1 - \frac{\binom{n-c}{k}}{\binom{n}{k}}

Training Procedure

Evaluation

Datasets

Metrics

Headline results

Ablations

Result plot: pass rate versus number of generated samples under different reranking heuristics, with oracle, mean-logp, back-translation, and random selection.

Method Strengths and Weaknesses

Strengths

Weaknesses

Suggestions from the authors

Links

Prior Papers

Further Papers