按年被提到
20212021 · 9 次2026
软件工程与 AI 编程›代码生成与程序合成·arXiv:2107.03374 · cs.LG

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, Alex Ray, Raul Puri 等 58 人 · 2021

Codex 与 HumanEval:用 GitHub 代码微调 GPT,重复采样大幅提高解题率

开始阅读 ↗PDFalphaXiv 讨论
被提及 · 14 人首次 2021-07-08 · 最近 2025-04-23
14不同的人
16活跃月份
22讨论串
4,703被引(OpenAlex)

论文介绍 Codex,一个在 GitHub 公开代码上微调的 GPT 模型,其生产版本驱动了 GitHub Copilot,并研究它写 Python 的能力。作者发布了新评测集 HumanEval,用来衡量根据 docstring 合成程序的功能正确性:Codex 解出 28.8% 的题目,GPT-3 为 0%,GPT-J 为 11.4%。每题采样 100 次可解出 70.2%,说明重复采样是产出可用解的有效策略。论文也分析了模型的局限(如长操作链与变量绑定),并讨论了安全、安保与经济方面的影响。

HN 为什么提它

评论者主要用它查证 Copilot 背后 Codex 的数字:HumanEval 上 28.8%、采样 100 次后约 70%,以及它由 GPT-3 家族微调而来;也有人质疑评测集可能已被训练数据污染。

奠基之作难度 3 / 5约 60 分钟有时效性
读之前最好知道
1GPT 类语言模型
2代码生成与单元测试评估
3采样与 temperature
4Python 编程

学习路径

读这篇之前,按顺序读书架上的 7 篇 · 参考文献来自 OpenAlex,顺序和要点由 Claude Code 排出

先补 Transformer 与缩放的基础和训练语料,再看早期代码生成与程序合成工作,最后读 Codex 与 HumanEval。

  1. 1
    Attention Is All You Need注意力就是你所需要的一切 · 2017

    Codex 是 GPT 系的自回归 Transformer

    读解码器端的自注意力与因果掩码,跳过翻译实验

  2. 2
    Scaling Laws for Neural Language Models神经语言模型的缩放定律 · 2020

    Codex 的模型规模与采样次数的分析,延续缩放定律的思路

    读损失随参数、数据、算力的幂律关系

  3. 3
    The Pile: An 800GB Dataset of Diverse Text for Language ModelingThe Pile:用于语言建模的 800GB 多样化文本数据集 · 2020

    对比模型 GPT-J 的训练语料,含代码相关子集

    读语料构成,特别是 GitHub 等代码来源,理解代码数据从哪来

  4. 4

    早期神经代码生成,把自然语言描述映射成代码的路线

    读指针式拷贝与生成相结合的思路,看神经代码生成早期做法

  5. 5
    DeepCoder: Learning to Write ProgramsDeepCoder:学习编写程序 · 2016

    基于输入输出示例的神经程序合成,是 Codex 之前的一条路线

    读用网络预测程序性质来指导搜索,对比 Codex 直接生成代码

  6. 6

    无监督的程序语言翻译,也是用语言模型处理代码的先例

    读无监督预训练在代码上的用法,以及它如何评估功能正确性

  7. 7

    同期的编程能力评测基准,对照 HumanEval 的评测设计

    读题目来源与用测试用例判断正确性的做法,对比 HumanEval

  8. 8
    Evaluating Large Language Models Trained on Code评估在代码上训练的大语言模型 · 2021 · 就是这篇

    目标论文:Codex 与 HumanEval

    读HumanEval 的 pass@k 指标,以及重复采样提高解题率的结果

HN 书评

推荐在前,同类按时间 · 每篇最多保留 20 条,统计用全部提及
批评godelski · 2023-05

“So to answer your question, yes, the evaluation dataset is spoiled.”

Replit's new Code LLM: Open Source, 77% smaller than Codex, trained in 1 week原评论 ↗
批评godelski · 2023-10

“So we take from this that the problems are simple and leet code style and that they have verified that the data is not in the training set by the simple nature of simply writing the code from scratch.”

质疑 HumanEval 题目简单,靠从零写代码来证明无训练集污染并不充分
Show HN: Phind Model beats GPT-4 at coding, with GPT-3.5 speed and 16k context原评论 ↗
批评godelski · 2024-02

“given a common one with 60 authors assumed writing leet code style programs by hand would mean they wouldn't appear in the training data (github) and didn't even bother to check.”

DeepSeekMath 7B achieved 51.7% on MATH benchmark原评论 ↗
引用lstmemery · 2021-08

“In the Codex paper[1], they have two datasets that Codex got correct about 3% of the time.”

引用论文:Codex 在两个数据集上只答对约 3%
OpenAI Codex原评论 ↗
引用arthur2e5 · 2021-09

“The paper on OpenAI Codex, the stuff powering Copilot, makes it very clear in the abstract. Evaluating Large Language Models Trained on Code”

指出摘要已说明驱动 Copilot 的 Codex 是针对代码的 GPT
GitHub Copilot Generated Insecure Code in 40% of Circumstances During Experiment原评论 ↗
引用moyix · 2021-09

“Yes, they mention this in the Codex paper [1]:”

引用论文说明 Codex 由 GPT-3 系列微调而来
Z3 approach to discover that “q_rsqrt” is in Copilot's slur list原评论 ↗
看全部 17 条 →
引用YeGoblynQueenne · 2021-12

“The Codex model on which Copilot is based had about 30% accuracy on the first solution to a coding problem, but 70% when it was allowed to generate 100 solutions and choose the one that passed unit tests.”

引用 Codex 数据:首次生成约 30%,生成 100 个并用单测筛选可达 70%
Solving Advent of Code Puzzles with GitHub Copilot: Day 1原评论 ↗
引用Voloskaya · 2021-12

“Even the 300M params version of Codex outperforms it [2], and the API gives you access to a 12B version.”

指出 300M 的 Codex 也胜过 GPT-J,API 还提供 12B 版本
GPT-3 APIs are now in public beta原评论 ↗
引用YeGoblynQueenne · 2022-01

“in Figure 2: Evaluating Large Language Models Trained on Code; so the work above is typically”

引用图 2 的 Codex 例子,注释完整说明了目标程序
A neural network solves and generates mathematics problems by program synthesis原评论 ↗
引用YeGoblynQueenne · 2022-07

“In formal testing, OpenAI found that Codex could generate the correct program about 30% of the time, which is pretty low:”

引用 OpenAI 测试:Codex 约 30% 生成正确,认为偏低
ML code generation vs. coding by hand: what we think programming will look like原评论 ↗
引用YeGoblynQueenne · 2022-08

“The Codex paper claims 28.8% on OpenAI's novel dataset:”

引用论文称 Codex 在 OpenAI 新数据集上为 28.8%
AlphaFold won’t revolutionise drug discovery原评论 ↗
引用BeefWellington · 2022-10

“characters. After filtering, our final dataset totaled 159 GB.”

引用 Codex 训练数据过滤细节,最终数据集 159 GB
GitHub Copilot, with “public code” blocked, emits my copyrighted code原评论 ↗
引用YeGoblynQueenne · 2023-07

“The best results reported are 28.8% for Codex (in perpetual preprint: Evaluating Large Language Models Trained on Code)”

引用 Codex 报告的最好结果 28.8%,说明 LLM 代码常出错
GPT-Migrate converts repos from one lang/framework to another原评论 ↗
引用swyx · 2023-09

“as number of attempts[0]”

引用 HumanEval 的 pass@k,k 指采样尝试次数
Refact LLM: New 1.6B code model reaches 32% HumanEval and is SOTA for the size原评论 ↗
引用swyx · 2023-09

“2021 coauthor on Codex Evaluating Large Language Models Trained on Code”

在简历里列出自己 2021 年合著的 Codex 论文
What OpenAI Really Wants原评论 ↗
引用moyix · 2025-02

“One thing that is interesting is that this was anticipated by the OpenAI Codex paper (which led to GitHub Copilot) all the way back in 2021:”

指出 Codex 论文早在 2021 年就预见了这个问题
AI is stifling new tech adoption?原评论 ↗
引用imenani · 2025-04

“like they did in the Codex paper [1]”

拿它举例:按 k 和模型扫描采样温度
Does RL Incentivize Reasoning in LLMs Beyond the Base Model?原评论 ↗
被提交为 story · 3 次