Skip to content
Back to the collection

Evaluating Large Language Models Trained on Code

Mark Chen, Jerry Tworek, Heewoo Jun

Show all 58 authors

Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, Alex Ray, Raul Puri, Gretchen Krueger, Michael Petrov, Heidy Khlaaf, Girish Sastry, Pamela Mishkin, Brooke Chan, Scott Gray, Nick Ryder, Mikhail Pavlov, Alethea Power, Lukasz Kaiser, Mohammad Bavarian, Clemens Winter, Philippe Tillet, Felipe Petroski Such, Dave Cummings, Matthias Plappert, Fotios Chantzis, Elizabeth Barnes, Ariel Herbert-Voss, William Hebgen Guss, Alex Nichol, Alex Paino, Nikolas Tezak, Jie Tang, Igor Babuschkin, Suchir Balaji, Shantanu Jain, William Saunders, Christopher Hesse, Andrew N. Carr, Jan Leike, Josh Achiam, Vedant Misra, Evan Morikawa, Alec Radford, Matthew Knight, Miles Brundage, Mira Murati, Katie Mayer, Peter Welinder, Bob McGrew, Dario Amodei, Sam McCandlish, Ilya Sutskever, Wojciech Zaremba

2021 · arXiv

Read the paper
HN score
0
Mentions
17
Readers
9
Months
14
What’s in a score?

From the 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.

Metadata: arXiv. Abstracts retain their original authors’ rights.

In the conversation

Original HN comments, with labels from simple text rules. A label describes the whole comment and may miss context or irony. Read the discussion to make up your own mind. About the labels

17 selected excerpts · 17 total mentions

imenani
Neutral mention · rule
They fix the temperature at T=0.6 for all k for all models, even though their own Figure 10 shows that RL model benefits from higher temperatures. I would buy the overall claim much more if they swept of temperature parameter for each k and model like they did in the Codex paper [1]. [1] https://arxiv.org/abs/2107.03374
moyix
Neutral mention · rule
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: > Users might be more inclined to accept the Codex answer under the assumption that the package it suggests is the one with which Codex will be more helpful. As a result, certain players might become more entrenched in the package market and Codex might not be aware of new packages developed after the training data was originally gathered. Further, for already existing packages, the model may make suggestions for deprecated methods. This could increase open-source developers’ incentive to maintain backward compatibility, which could pose challenges given that open-source projects are often under-resourced (Eghbal, 2020; Trinkenreich et al., 2021). https://arxiv.org/pdf/2107.03374 (Appendix H.4)
godelski
Neutral mention · rule
Does anyone know how much spoilage are in these datasets? Common crawl has a lot of websites in it, including Reddit and Stack*. I'm certain there are lots of questions in those datasets and we want to differentiate recall from problem solving (often confused). I have a deep distrust when using large datasets like this 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. It's really hard to sanitize datasets of this size and deduplication is a much harder task than many realize. https://arxiv.org/abs/2107.03374 https://arxiv.org/abs/2303.09540
swyx
Neutral mention · rule
i highlighted this last night which seems to be making the rounds - https://twitter.com/swyx/status/1699369076529971545 Alec's CV (https://www.linkedin.com/in/alecradford/) seems to be: - 2011-2016 BSc Eng from Olin College - 2013+ started a data/AI consultancy as a sophomore that turned into a vague startup/product? - 2015 first paper on GANs coauthored with soumith https://arxiv.org/pdf/1511.06434.pdf%C3 - 2016 first GAN paper under openai email https://proceedings.neurips.cc/paper_files/paper/2016/file/8... - 2017 the generative reviews paper mentioend in the Wired article, with Ilya https://arxiv.org/pdf/1704.01444.pdf - 2017 coauthor on PPO paper (precursor to…
Read the full comment
instructgpt/rlhf) https://arxiv.org/pdf/1707.06347.pdf). - 2018 lead author on GPT1 https://www.mikecaptain.com/resources/pdf/GPT-1.pdf - 2019 lead author on GPT2 https://insightcivic.s3.us-east-1.amazonaws.com/language-mod... blog https://openai.com/research/better-language-models - 2019 coauthor on RLHF https://arxiv.org/pdf/1909.08593.pdf) - 2020 coauthor on gpt3 https://arxiv.org/abs/2005.14165 - 2020 coauthor on scaling laws https://arxiv.org/pdf/2001.08361.pdf%E4%B8%AD%E5%BE%97%E5%88... - 2021 coauthor on DallE http://proceedings.mlr.press/v139/ramesh21a/ramesh21a.pdf - 2021 coauthor on Codex https://arxiv.org/pdf/2107.03374.pdf?trk=public_post_comment... - 2023 lead author on Whisper https://proceedings.mlr.press/v202/radford23a/radford23a.pdf name a more successful 7 year CS career post undergrad... Update: FYI openai just announced a "developer day" in Nov - somehow not blessed by the HN gods https://news.ycombinator.com/item?id=37408234
YeGoblynQueenne
Neutral mention · rule
>> - Image descriptions eg. Be My Eyes: https://www.bemyeyes.com/ Not working yet. From the website: Starting today, you can register for the waitlist in the Be My Eyes app. >> - Customer service chat triage. More specifically? Which company is currently using LLMs for this purpose? >> - helping students learn- eg khan academy, tutor Lily Helping them learn, but what? Per wikipedia: Statements made in certain mathematics and physics videos have been questioned for their technical accuracy.[43] Sounds like using LLMs will just generate more garbage teaching material. >> - Helping create and debug software. If you don’t think is happening then you’re either living under a…
Read the full comment
rock or just close to believe people are lying about how they’ve used it? Oh, absolutely. People are absolutely lying to themselves. OpenAI's and DeepMind's systematic testing of their code-geneator LLMs make it very clear that those systems produce incorrect code the majority of the time. The best results reported are 28.8% for Codex (in perpetual preprint: https://arxiv.org/abs/2107.03374) and 29.6% for AlphaCode (preprint: https://arxiv.org/abs/2203.07814 Science, paywalled: https://www.science.org/doi/10.1126/science.abq1158) and the latter is with their special 10@k metric which basically means the LLM gets 10 guesses. I have definitely observed people convince themselves online that CoPilot or ChatGPT even is helping them "improve their productivity" or some such. It is obvious that they are fooling themselves, badly. If you push them, they immediately say "oh yeah, it makes mistakes, but I can correct them" etc. So they just feel like it's useful, even when it's just making them do more work. In fact, that's exactly like homeopathic self-delusions: people use it because it makes them feel better, not because it has any measurable benefit. Btw: >> ... you’re either living under a rock ... Stop being a jerk.
BeefWellington
Neutral mention · rule
> Well probably no, they didn't pick and choose at all, they just "chose" everyone who put code online with a license. Which is a legal statement of ownership by each of those people, and implies legal liability as well. What you're describing is a choice. They chose which people to believe, with zero vetting. > The point is that with ML training data, such a vast quantity is required that it's unreasonable to expect humans to be able to research and guarantee the legal provenance of it all. I'm not sure what you're presenting here is actually true. A key part of ML training is the training part. Other domains require a pass/fail classification of the model's output (see…
Read the full comment
image identification, speech recognition, etc.) so why is source code any different? The idea that "it's too much data" is absolutely a cop-out and absurd, especially for a company sitting on ~$100B in cash reserves. Your argument kind of demonstrates the underlying point here: They took the cheapest/easiest option and it's harmed the product. > A crawler simply believes that licenses, which are legally binding statements, are made by actual owners, rather than being fraud. It does seem reasonable to address the issue with takedowns, however. Yes, and to reiterate, they chose this method. They were not obligated to do this, they were not forced to pick this way of doing things, and given the complete lack of transparency it's a large leap of faith to assume that their training data simply looked at LICENSE files to determine which licenses were present. For what it's worth, it doesn't seem that that's what OpenAI did when they trained the model initially in their paper[1]: Our training dataset was collected in May 2020 from 54 mil- lion public software repositories hosted on GitHub, contain- ing 179 GB of unique Python files under 1 MB. We filtered out files which were likely auto-generated, had average line length greater than 100, had maximum line length greater than 1000, or contained a small percentage of alphanumeric characters. After filtering, our final dataset totaled 159 GB. I have not seen anything concrete about any further training after that, largely because it isn't transparent. [1]: https://arxiv.org/pdf/2107.03374.pdf
Voloskaya
Neutral mention · rule
> I know that at least on most common performance benchmarks these claims are measurably false What "these claims" are you referring to? It seems you are taking issue with only one specific claim of my comment, namely than GPT-3 6B is better quality than GPT-J 6B. Evaluations run by Eulether folks are available here [1] and I have the opposite subjective experience from you. But even assuming I'm wrong, that doesn't change at all the substance of what I am saying: If you need better quality than GPT-J, then GPT-3 (DaVicing, 175B) is your only option. And if you care about latency, last time I checked (6 months ago) OpenAI was miles ahead. > in particular code generation…
Read the full comment
for 6B is very clearly a strength of GPT-J even above the 275B GPT-3. Note on that: ~8% of GPT-J training data is GitHub code, that's not the case for GPT-3 hence the difference. But OpenAI has a separate model avaiable in their API called Codex that is specifically tailored for code generation (also the model behind GH copilot) and that is much much better than GPT-J: Even the 300M params version of Codex outperforms it [2], and the API gives you access to a 12B version. I'm not trying to sell you OpenAI's API though, it has indeed pretty severe limitations, I'm only saying there are real reasons that people might want to use it contrary to what the comment I was replying to was saying, and just replicating what they do isn't exactly a walk in the park. [1]: https://arankomatsuzaki.wordpress.com/2021/06/04/gpt-j/ [2]: https://arxiv.org/pdf/2107.03374.pdf
arthur2e5
Neutral mention · rule
GitHub Copilot is literally GPT adapted for code. The paper on OpenAI Codex, the stuff powering Copilot, makes it very clear in the abstract. https://arxiv.org/abs/2107.03374 Either you call both AI or you call neither AI. (A previous version of the comment stated that it was tuned from GPT-3. This is incorrect; the simpler GPT was used for faster convergence.)
lstmemery
Neutral mention · rule
I have to disagree with you here. In the Codex paper[1], they have two datasets that Codex got correct about 3% of the time. These are interview and code competition questions. From the paper: "Indeed, a strong student who completes an introductory computer science course is expected to be able to solve a larger fraction of problems than Codex-12B." This suggests to me that Codex really doesn't understand anything about the language beyond syntax. I have no doubt that future systems will improve on this benchmark, but they will likely take advantage of the AST and could use unit tests in a RL-like reward function. [1] https://arxiv.org/abs/2107.03374
godelski
Neutral mention · rule
What data did you use to train and how do you evaluate your model for overfitting? I ask due to the issues with the HumanEval dataset. ------------- For those that are unfamiliar with the issues, allow me to elaborate. You can find the dataset in the parent's link or here[0] and you can find the paper here[1]. I'll quote from the paper. First is page 2 right above the github link and second is page 4 section 2.2 (note, this paper has 58 authors... 58) > To accurately benchmark our model, we create a dataset of 164 original programming problems with unit tests. These problems assess language comprehension, algorithms, and simple mathematics, with some comparable to simple…
Read the full comment
software interview questions. > It is important for these tasks to be hand-written, since our models are trained on a large fraction of GitHub, which already contains solutions to problems from a variety of sources. For example, there are more than ten public repositories containing solutions to Codeforces problems, which make up part of the recently proposed APPS dataset 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. If you aren't laughing now, you should be. So let's look and see if there are in fact samples of code that are exact or near to those in the test set that exist in public githubs prior to May 2020, their cutoff date. Now let's look at some of the test questions and see if we can find them on github. Github search is total garbage so I'm going to pull results from the last time I looked (search my comment history "godelski human eval") I apologize in advance for formatting. HumanEval/4: Prompt: from typing import List def mean_absolute_deviation(numbers: List[float]) -> float: """ For a given list of input numbers, calculate Mean Absolute Deviation around the mean of this dataset. Mean Absolute Deviation is the average absolute difference between each element and a centerpoint (mean in this case): MAD = average | x - x_mean | >>> mean_absolute_deviation([1.0, 2.0, 3.0, 4.0]) 1.0 """ canonical_solution: mean = sum(numbers) / len(numbers) return sum(abs(x - mean) for x in numbers) / len(numbers) Found on Github[2], commit date Oct 5, 2019: if reduction == "median": return np.median(scores) mean = sum(scores) / len(scores) if reduction == "mean": return mean return sum(abs(x - mean) for x in scores) / len(scores) A solution that is functionally equivalent. Swap numbers and scores and remove the if statement. This constitutes a near collision and ML models will preform very well on near collisions. If you look at the testing method for the evaluation you will also see that this code will pass the test. Thus our LLM can very easily simply copy paste this code and pass no problem. I'm not saying that's what happened, but that we cannot rule this out. What actually happened is an open question and we're far from ready as a community to call LLMs fuzzy copy machines. I also have this search query marked which still seems to be working[3] but you'll have to manually check the date. You can repeat this process for many examples in the HumanEval dataset. Or simply look the human eval dataset questions and answers and ask yourself "Have I written those exact lines of code?" The answer is probably. But note here, that overfitting is perfectly okay in certain circumstances. But HumanEval simply measures how good a LLM is at solving short leetcode style questions. It does not measure a LLMs ability to write code and certainly not write non-leetcode. It may very well do so, but this benchmark does not measure such things. This still can provide utility to people and these LLMs still learn a lot more than what HumanEval tests. My issue is with the metric and claims as to what the results indicate rather than the product itself. There is also the danger of chasing benchmarks like these as you will not be able to disentangle overfitting from desired training outcomes. I am not critiquing OP's network nor the work they did to create this. I'll explicitly state here, well done OP. This took a lot of hard work and you should feel very proud. I hope this question and context does not come off as pejorative nor overly cynical. I think your work is without a doubt, something to be proud of and useful to our community. This is a warning to all HN readers to help avoid snakeoil (I expect every ML person to already know this), scrutinize your metrics and know exactly what they measure. I mean precisely, there are no metrics that measure abstract things like "image quality", "performance in language", "code generation performance" and so on. Generative models are exceptionally difficult to determine what model is better and we are unfortunately at a point where many of our metrics (remember: metrics are proxies or more abstract goals. Metrics are models. All models are wrong, just some are more wrong than others) and you must do far more investigation to come to an even fuzzy answer to this question. Nuance is necessary. [0] https://huggingface.co/datasets/openai_humaneval [1]https://arxiv.org/abs/2107.03374 [2] https://github.com/danielwatson6/hate-speech-project/blob/8e... [3] https://github.com/search?q=abs%28x+-+mean%29+for+language%3...
swyx
Neutral mention · rule
> given only one chance to solve it my understanding is that there are 2 usages of the pass@ {number} syntax. the HumanEval/Codex paper interprets the {number} as number of attempts[0]. however language modelers seem to use it to denote the number of few shot example demonstrations given in the context. these are starkly different and i wish the syntax wasnt overloaded --- [0] https://arxiv.org/pdf/2107.03374.pdf > Kulal et al. (2019) evaluate functional correctness using the pass@k metric, where k code samples are generated per problem, a problem is considered solved if any sample passes the unit tests, and the total fraction of problems solved is reported.
godelski
Neutral mention · rule
My favorite line from the HumanEval paper[0] > It is important for these tasks to be hand-written, since our models are trained on a large fraction of GitHub, which already contains solutions to problems from a variety of sources. So to answer your question, yes, the evaluation dataset is spoiled. You can find such unique and never before seen docstrings like > For a given list of input numbers calculate the Mean Absolute Deviation around the mean of this dataset. Mean Absolute Deviation is the absolute difference between each element and a centerpoint (mean in this case)[1] And here's a repo I found that is 8 years old[2]. But how about a more recent one that is even…
Read the full comment
closer?[3] There's plenty more examples[4] (does anyone know how actually limit the date to prior to 2021? `pushed:<2021` doesn't work nor does using the `created` keyword. Date searching doesn't seem to work well). In essence, we can still use this evaluation method to determine how good our model is at doing fuzzy searching. Which, mind you, is still a useful thing. But I would be careful in concluding that this means the model is good at generalizing arbitrary descriptions of code or novel pieces of code. That said, one may be able to argue that not many lines of code are actually that novel. Still, we need to be careful about our conclusions and understand the limitations of our metrics (something I am currently deeply troubled by) [0] https://arxiv.org/abs/2107.03374 [1] https://github.com/openai/code-align-evals-data/blob/97446d9... [2] https://github.com/bertomartin/stat4701/blob/ec2b64f629cbbf6... [3] https://github.com/danielwatson6/hate-speech-project/blob/64... [4] https://github.com/search?q=abs%28x+-+mean%29+for+language%3...
YeGoblynQueenne
Neutral mention · rule
Where is this claim from? The Codex paper claims 28.8% on OpenAI's novel dataset: 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%. https://arxiv.org/abs/2107.03374 The numbers I quote (5-7%) are on the APPS dataset, reported by SalesForce: https://arxiv.org/abs/2207.01780 (Recently shared on HN). Note that there is no standard dataset like ImageNet or MNIST in program synthesis so it's not correct to speak of a "benchmark". LLM code generators in particular tend to be evaluated on whatever dataset their creators thought best demonstrates their system's capabilities.
YeGoblynQueenne
Neutral mention · rule
Generating entire functions has been possible for a long time before Copilot. The discipline that studies algorithms that generate code or programs is called Program Synthesis. For a recent review see Gulwani et al: Program Synthesis https://www.semanticscholar.org/paper/Program-Synthesis-Gulw... Copilot and similar systems (like DeepMind's AlphaCode) are a step backwards compared with earlier systems most of which are capable of not only generating code, but generating correct programs, where correctness is measured with respect to a specification, which can be complete or incomplete (as in input/output examples etc). Systems like Copilot instead use a large language…
Read the full comment
model to generate code by completing an initial "prompt" and have no way to control what kind of code is generated or whether it does what the programmer expects it to do. The task of checking correctness is left to the user. The result is code that may or may not contain bugs to an extent difficult to predict beforehand. Specifically about Copilot, it's based on Codex, a large language model that's a variant of GPT-3 fine-tuned on all of github. In formal testing, OpenAI found that Codex could generate the correct program about 30% of the time, which is pretty low: Evaluating Large Language Models Trained on Code https://arxiv.org/abs/2107.03374 Interestingly, if Codex was allowed 100 "guesses", the correct program was in there 75% of the time, instead. But that only goes to show that these kinds of systems are code firehoses without any ability to tell a correct program from garbage.
YeGoblynQueenne
Neutral mention · rule
Well, they do say very clearly that they "solve" problems by program synthesis and what they describe is perfectly legit program synthesis. To clarify, program synthesis (or automatic programming) is the task of generating programs from specifications. There are two kinds of program synthesis: deductive program synthesis, from a complete specification of the target program; and inductive program synthesis, or program induction, from an incomplete specification (such as sets of program inputs and outputs, or traces). An example of deductive program synthesis is the generation of low-level code from a high-level language by a compiler. What the paper describes is a kind of…
Read the full comment
deductive program synthesis from a complete specification in natural lanaguage. I suspect the true contribution of the work is the demonstration of using natural language as a complete specification, where earlier work generally only demonstrated the use of natural language as incomplete specification (for example, comments describing intent rather than implementation) and the combination of natural language with code; as in the original Codex work [Edit: actually, now that I look again, the codex paper also has examples of comments that fully specify the target program, e.g. in Figure 2: https://arxiv.org/abs/2107.03374; so the work above is typically incremental]. On the other hand it's clear to me that the training has made the model memorise answers and all the work in prompt engineering, described under "Workflow" serves to find the right prompts to retrieve the desired memorisations, much like one must fire just the right SQL query to get back the right data. Certainly interesting to see in action and useful for everyday work, but far from "solving" anything in the gradniose way that it is announced by the authors (e.g. "These astounding results..." in section "Conclusion", etc).
YeGoblynQueenne
Neutral mention · rule
>> This is also something I'm curious about regarding Copilot. I mentioned that "GitHub Copilot has a list of possible solutions to code completions, so I wonder if it’s just luck that the suggested solution was the correct one". 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. On the other hand, when the best-of-100 solution was chosen according to the probability assigned to it by the model it scored 45% [1]. So it's kiind of luck. Basically, Copilot has no way to tell whether it's giving you a right or wrong answer,…
Read the full comment
other than to select the answer with the highest probability according to its training set which usually means the most common answer in its training set. So the probability that the answer you get is the "right" answer depends on the probability that the right anwser is the most common answer to the problem you give it. If that makes sense? __________ [1] https://arxiv.org/abs/2107.03374 See Figure 1.
moyix
Neutral mention · rule
Yes, they mention this in the Codex paper [1]: > Since Codex is evaluated on natural language prompts, we hypothesized that it would be beneficial to fine-tune from the GPT-3 (Brown et al., 2020) model family, which already contains strong natural language representations. Surprisingly, we did not observe improvements when starting from a pre-trained language model, possibly because the finetuning dataset is so large. Nevertheless, models fine-tuned from GPT converge more quickly, so we apply this strategy for all subsequent experiments. It's not completely clear exactly what relationship the Codex models and Copilot have to one another, but given that the Copilot model is internally named "Cushman" (going by the API URL), which is the same name as the faster of OpenAI's two Codex models, they're probably trained the same way. [1] https://arxiv.org/pdf/2107.03374.pdf

Keep following the thread.

More in Language models

More from the same topics.