Competition-Level Code Generation with AlphaCode
Paper · 2022 · Yujia Li, David Choi, Junyoung Chung et al.
Summary
A programming contest gives competitors a problem to solve and leaves them to work out the algorithm. The statement specifies which inputs a program will receive, what it must output, and how much time and memory it can use. The examples illustrate the rules. The judge keeps the harder tests hidden. AlphaCode takes the same kind of statement and produces complete programs. The paper asks how often it can solve newly published contest problems under a small submission budget, a setting where earlier code generators had reported solve rates around 1-5% on existing benchmarks.
The authors first train an encoder-decoder Transformer on selected public GitHub code, then adapt it to contest problems with CodeContests, a dataset they built and released. For a new problem, AlphaCode draws a large pool of candidate programs in C and Python. It runs them on the statement’s examples and discards failures. A separate generator supplies additional inputs on which to compare the surviving programs. AlphaCode groups candidates that produce the same outputs on those inputs and selects submissions across the groups. This gives the judge a chance to see several different approaches within a budget of at most 10 submissions per problem.
CodeContests keeps training data earlier than the validation and test problems and adds checks to catch incorrect programs that would otherwise pass. The paper reports estimated false-positive rates of 30-60% for earlier benchmarks and 4% for the final CodeContests dataset. On CodeContests validation, the largest individual generator with clustering solves 34. For 2% of the problems, as many as one million samples per problem, with the submission cap still in effect. The authors also reconstruct participation in 10 Codeforces contests that each drew more than 5,000 competitors. The contest judge evaluated AlphaCode’s submissions after each event, and the authors used simulated timing to place the system on the original scoreboards. Its average placement was in the top 54.3%, close to the median participant. Its estimated rating of 1238 exceeded the ratings of 72% of users who had competed in the preceding 6 months.
The results depend on what AlphaCode generates and what it chooses to submit. Drawing more programs helps when execution results guide selection. Randomly choosing a small number from the whole pool gains little from more sampling. The authors found no evidence of copied core logic in their inspection of successful programs, and changes that obscured important parts of a statement made problems harder to solve. They also found that continued training could improve the solve rate while worsening validation loss. Taken together, these experiments show why the paper evaluates the whole procedure, from reading a statement to spending a limited number of attempts at the judge.
Deep dive: Competition-Level Code Generation with AlphaCode
AlphaCode generates complete programs for coding contests, tests and groups its candidates, and reaches roughly the median rank on Codeforces. · about 46 minutes to read
The problem and its context
From a statement to a working program
The job begins with reading. A contestant may meet the problem as a story about people, objects or operations. Somewhere in that story are the rules that determine the answer. The input specification establishes how those rules apply to the data the program will receive. The output specification says what the program must print, sometimes allowing several valid answers. The examples help connect these parts of the statement. A useful reading has to recover enough detail from all of them to make the exercise computationally precise.
The contestant then has to discover a procedure that works at the required scale. An input bound can make an otherwise sensible approach impractical. A program can correctly handle every example and still do too much work on a large case. A short program can also take the wrong branch on a boundary case, or read the input incorrectly even though its central algorithm is sound. The contest treats these as concrete failures. The program is run under specified resource limits and earns credit only when the judge accepts it.
The paper illustrates this process with Backspace, a Codeforces problem rated 1500. It asks whether one phrase can be turned into another by pressing backspace in place of some keystrokes. The public example demonstrates the transformation. The implementation shown by the authors starts from the ends of the phrases. When the letters match, it moves on to the preceding letters. When they differ, the effect of substituting a backspace determines how far it must move through the source phrase. Finishing the match tells the program what to report. The example makes the difference between the statement and the implementation concrete. The statement presents the effects of a keystroke, and the code uses those effects to decide what to inspect and in which order. The judge’s illustrated hidden case is considerably longer than the public example.
A contestant can run the examples repeatedly before paying for an official attempt. After submission, the judge gives a verdict, with limited information about the reason for failure. Time and incorrect attempts can affect the score. This division between local experiments and official submissions allows the authors to pose a specific question about automated reasoning. A system can explore many possible programs using the evidence in the statement. It must then pick a handful to face stronger checks it has never seen. Creating a solution somewhere in a large pool and getting it accepted under contest rules are distinct achievements.
What prior synthesis systems were asked to do
The paper places AlphaCode in program synthesis, the study of producing programs from specifications. A specification can consist of formal constraints, example inputs and outputs, or a description in ordinary language. In deductive synthesis, a theorem prover works with constraints and a program is derived from a proof. A sketch-based system starts with some of the program already supplied and fills gaps. FlashFill demonstrates another arrangement, in which examples guide the synthesis of spreadsheet string operations. Each arrangement gives the search a particular structure by specifying the behavior, restricting the language or supplying part of the implementation. Program Synthesis · FlashFill
Learning methods widened the range of information that could guide the search. The authors describe work that translated text into syntactic trees before producing source code, generated parts of programs from mixed natural-language and structured descriptions, or learned which regions of a program search space to examine. Other work used learned systems to produce sketches or convert pseudocode. Code completion offered a different starting point. An editor could draw on syntax, existing code or a developer’s history to propose what should come next in a program already being written. The unfinished program itself supplied context for the next step.
These starting points matter because program text gives awkward feedback during search. A small edit can change the answer without producing a syntax error. Two working programs for the same task can share little of their source text. A fragment resembling part of a correct solution may prove useless once the rest of the code is considered. Matching a reference at the level of tokens or syntax can therefore reward a program that still gets the answer wrong, and penalize a working implementation with a different structure. The paper describes the move toward execution-based evaluation and benchmarks as code generation improved enough to produce complete answers worth running.
The immediate precedent was the application of large text generators to source code. The paper connects work on fluent text prediction to subsequent efforts in code retrieval, translation and generation. Codex, the closest earlier system in the authors’ account, could complete Python functions from a signature and documentation. The work by Austin and colleagues also showed that adapting a generator to a collection of programming tasks could improve performance on similar tasks. These experiments gave evidence that code could be generated from instructions and checked by running it. A contest asks the generator to take on more of the work that precedes implementation. GPT-3 · Codex · Program Synthesis with Large Language Models
The authors illustrate the change in task format with lengths. In their dataset, the median statement contains 1,628 characters and the median solution contains 606. In HumanEval, the corresponding medians are 396 and 148.5 characters. Length is a rough description of the difference. A function prompt can tell the programmer which operation to implement and provide the interface through which it will be tested. A contest problem typically requires the competitor to infer a method and then assemble a program that reads the specified input, implements the method and emits a judgeable answer. The authors also point out that a hand-written function task can have a solution already available in a large training collection if it asks for a familiar routine.
Earlier collections made contest-style evaluation possible. Description2Code paired problems from programming sites with human solutions. CodeNet provided solutions in a wider range of languages, included failed submissions and recorded additional information about the problems and programs. APPS brought together coding problems across difficulty levels and evaluated transformers on them. The authors identify a concern that applies to using any such collection for judging full programs. A test suite assembled from available data may miss the cases that distinguish an algorithm with the right behavior from a superficially convincing answer. The weakness becomes more consequential when a generator offers many chances to find something that happens to pass. APPS
Large-scale sampling had precedents as well. The authors cite earlier programming studies in which drawing several answers to the same problem made it more likely that one would work. They also discuss research on math word problems that used majority voting and trained verifiers to choose among generated answers. A verifier estimates whether an answer is correct and can use that estimate to reorder the candidates. The contest setup gives AlphaCode a different signal to exploit. A program can execute the examples and supply an observable result before it reaches the judge. The question becomes how to use that behavior when there are many more plausible candidates than official attempts. Training Verifiers to Solve Math Word Problems
The method, step by step
What happens to a new problem
AlphaCode starts its work on a new problem by generating independently written programs from the statement. It can ask for different languages and vary hints about the likely approach. It runs each program against the public examples. Candidates that get through this check are run on another set of inputs, this time to see which programs behave alike. The system can submit representatives from different groups even when it has no definitive way to tell which group contains a correct answer. The hidden judge makes that decision.
This procedure depends on prior training and on a benchmark that keeps the roles of its tests clear. GitHub supplies examples of source code. CodeContests supplies statements, submissions and recorded outcomes. Public examples can disqualify candidates during search. Newly generated inputs let the system compare survivors with one another. The evaluation suite determines whether the selected programs pass. Those jobs call for different kinds of information, even though each involves running programs.
From training data to judged contest submissions
The steps in order.
Assembling the training and evaluation data
The authors worked from a snapshot taken on July 14, 2021, of a selection of public GitHub repositories. The corpus spans several programming languages, including C, Python, Java and Rust. The team excludes files larger than 1MB and files with lines longer than 1000 characters. These rules aim to reduce automatically generated material. It also removes file duplicates while disregarding whitespace. The resulting pretraining corpus contains 715.1 GB of code. This stage gives the generator examples of implementation before the more specialized instruction in reading and solving contest problems.
For that specialized stage, the authors combine newly collected Codeforces data with material from Description2Code and CodeNet. The latter collections contribute only to the training split. Both validation and test draw exclusively on new Codeforces problems. Each available problem record can bring together the full statement, example tests, tests released through judging records and human submissions. The scraped submissions include both successful and unsuccessful attempts in C, Python and Java. Problem tags suggest approaches that may apply, and difficulty ratings describe how challenging a problem is. The actual tags and ratings become available after a contest.
The dates determine eligibility before the problems are used for evaluation. Training material had to be public by 2021/07/14. The validation window runs from 2021/07/15 to 2021/09/20, and the paper describes the test problems as appearing after 2021/09/21. The cutoff applies to both the broad pretraining corpus and the contest material used for adaptation. A public solution written after a contest might be readily searchable, but its publication date keeps it out of training for an evaluation on that contest. The design leaves room to learn from earlier problems, just as a competitor can study older contests.
Combining sources also requires cleaning. When statements match after whitespace is disregarded, the authors merge their submissions. They remove duplicate submissions using the same principle. They adapt C programs for their compiler and execution environment, using formatting and expansion of definitions to make the material more consistent. If the normalization fails, they retain the original. They then run Python and C submissions against the collected tests. The cleaning first drops submissions that pass nothing, then discards tests on which fewer than 10% of the remaining submissions print anything, and finally removes submissions that pass fewer than 10% of the tests left. Unsuccessful submissions can still remain, and their labels become part of training.
Making hidden tests strong enough to judge the output
CodeContests can only collect the tests available through the platform. Codeforces withholds the full contents of cases whose inputs are longer than roughly 400 characters. Longer cases matter because they can expose a program that has the right idea for small inputs but runs too slowly at contest scale. Even for short cases, a collection can have weak coverage if most tests exercise the same behavior. The number of tests is therefore only one part of what makes a problem suitable for evaluation.
The authors add tests by editing existing inputs. A mutation can change a bit, move an integer up or down, or alter characters in a string. The output for the old input may cease to apply, so each proposed input goes through a reference check. The authors run 30 accepted human solutions on it and retain the proposal when they all produce the same output. They use that agreement to label the new case. They allow up to 10 CPU hours or 200 generated tests for a problem. For 6.3% of problems, the process falls short of producing the full 200, an outcome the authors attribute to complex input formats.
Validation and test problems face an additional requirement. They must have at least 5 hidden or generated cases, whose expected answers must include at least 2 different outputs. The output requirement directly addresses a possible weakness in tests of a decision problem. A program that always prints the same answer could pass a suite whose cases all have that answer. Requiring distinct outcomes makes that shortcut insufficient for every retained problem.
The local judge executes each submission with time and memory limits and applies a permissive output comparison. Case and whitespace differences are ignored. It treats floating-point results as equivalent when their difference is below the specified tolerance.
10⁻⁵
The base is 10, and the superscript −5 is its negative exponent. The value is the threshold for the absolute numerical difference between the produced floating-point number and the expected number. The paper’s rule requires that difference to be strictly smaller than the threshold.
For problems that may have several valid answers, the judge looks for disagreement among known correct human submissions. The heuristic flags a problem if any test produces at least 5 distinct outputs or if 2 outputs each appear across multiple correct submissions. It then uses the most common human answer as the comparison output. This supplies a determinate benchmark verdict, with consequences for valid alternatives that the authors examine. The resulting public dataset is CodeContests. Its evaluation tests and the examples available during generation have separate roles.
Encoding the statement and generating code
The generator treats the statement and solution as sequences. The encoder builds a representation of the statement. The decoder uses that representation to generate the program incrementally. The authors describe the relationship with a conditional probability.
p(Y | X)
Here, X is the problem description supplied to the encoder, including any metadata prefix. Y is a possible solution program. The symbol p denotes the probability assigned by the generator, and the vertical bar means “given.” The expression describes how likely the generator considers a particular program when it receives a particular statement. During generation it chooses successive code tokens in light of both the encoded statement and the code already produced. An end-of-code token tells it when to stop.
The shared vocabulary comes from a SentencePiece subword tokenizer, which turns text into units the network can process. Its vocabulary of 8,000 tokens is learned from a mix of GitHub and CodeContests material. The mixture accommodates both the source languages used for code and the text used for statements. The encoder can attend in both directions across its input, so information near the start of the story can be interpreted in light of a formal rule later on. The decoder generates in order because future code has yet to be written.
The two parts have different dimensions. The authors observed that descriptions are twice as long as human solutions on average, so the encoder accepts 1536 tokens and the decoder accepts 768. The encoder is shallow and the decoder is deep. This lets the authors allocate different amounts of computation to the work of reading and writing. They trained variants at scales including 300M, 1B, 3B, 9B and 41B parameters. The two largest use model parallelism, which lets the work of an individual network span devices. The authors implemented training in JAX and Haiku and used TPUv4 accelerators with bfloat16 precision.
Generation speed also shapes the attention mechanism. During decoding, attention consults cached information about earlier tokens. In ordinary multi-head attention, different heads maintain their own keys and values, which respectively help identify relevant positions and supply information from them. AlphaCode uses multi-query attention. It retains distinct queries while sharing key and value heads within an attention block. The resulting reduction in cache traffic and memory use allows bigger batches of programs to be generated together. The decision matters because the system uses new draws as a substantial part of its search.
Learning code before learning the contest task
During GitHub pretraining the authors choose a split point uniformly within a file. The encoder gets the text before that point and the decoder learns to predict the continuation. The decoder’s standard next-token loss rewards assigning probability to the actual next unit of source code. The encoder also gets a masked prediction task. Some input tokens are hidden and the network learns to recover them from context. The authors found this additional objective important for building useful encoder representations. BERT
The 1B pretraining run uses a batch size of 256. The authors generally allocate more training to bigger networks, although resource limits lead them to stop training the 41B version early relative to the other scales. They use AdamW with weight decay of 0.1. The decay regularizes the parameters as the optimizer updates them. The schedule starts with a warmup over 1,000 steps, and global gradient clipping keeps updates from being driven by very large gradients. Scaling laws
In fine-tuning, the source and target have a clearer relationship than the two pieces of an arbitrary GitHub file. The encoder reads a CodeContests problem and the decoder learns from a corresponding human submission. The authors keep the decoder’s next-token task and the encoder’s masked prediction task. They then modify how token probabilities are calculated and how much weight individual tokens receive during an update. They also add information about the human submission, so that an unsuccessful implementation can provide a training example with a different label from a successful one.
Shaping the distribution during fine-tuning
Tempering changes the distribution used to calculate the next-token loss. Before converting the decoder’s scores into probabilities, the authors divide them by a temperature.
softmax(z / T)
In this expression, z is the vector of raw scores, or logits, for the possible next tokens. T is a scalar temperature that divides every entry in z. The softmax operation turns the scaled scores into probabilities by exponentiating them and normalizing across the vocabulary. A division by a temperature below 1 magnifies differences among the scores at this stage. The authors use T of 0.2 during training, so the distribution entering the loss is sharper than the one obtained directly from the logits.
The distribution used for generation can then be adjusted independently. The paper describes the trained generator’s untempered distribution as smoother as a consequence of tempering during fine-tuning. A separate sampling temperature, T′, divides the logits before choices are drawn at inference. The authors tune T′ on validation and use 0.12 when training includes tempering alone and 0.25 when it includes tempering and GOLD. The training temperature changes what the optimizer sees. The sampling temperature changes how far the generator explores the alternatives it has learned to assign probability to.
The correctness label creates another training signal. For value conditioning, the input prefix identifies the attached human submission as correct or incorrect. This allows the generator to learn from a collection that includes both kinds of submissions. When it draws a program for a new problem, the prefix requests a correct solution. The request is a condition on generation. Evidence that the particular program works comes from execution.
Value prediction adds a separate classification task during training. A small transformer reads the final token representations before they are projected to next-token scores and predicts the correctness label. This asks the shared representations to carry information about quality as well as about likely continuations. The auxiliary classifier is used during training only. AlphaCode’s final selection procedure draws its evidence from program behavior.
The motivation for GOLD is that a single statement admits many good programs. Standard maximum likelihood rewards assigning probability to the actual tokens in all of the demonstrated answers. The contest score depends on finding a usable solution within the attempt budget. The authors adapt GOLD, an offline reinforcement-learning method, to emphasize learning from solution tokens that the generator already considers relatively plausible. Their initial expression for the weighted gradient is:
∇ℒ_GOLD(θ) = −Σₛ Pθ(s) · ∇ log Pθ(s)
The symbol θ denotes the trainable parameters. The left-hand side, ∇ℒ_GOLD(θ), is the gradient supplied by the GOLD objective with respect to those parameters. The symbol Σₛ sums over the token occurrences s in the solution. Pθ(s) is the probability assigned to the demonstrated next token given the statement and preceding solution tokens. The log is the logarithm, and ∇ log Pθ(s) is its gradient with respect to θ. The dot multiplies this gradient by the probability weight. The minus sign gives the direction associated with minimizing a negative log-likelihood loss. The probability outside the gradient acts as the weight on that token’s contribution.
Direct probability weighting can make the training unstable, so the authors replace the multiplier with a softened weight that has a lower bound.
max(Pθ(s)^α, β)
As in the preceding formula, Pθ(s) is the next-token probability under parameters θ for the demonstrated token s. The caret with α denotes raising that probability to a power. The exponent α is 1/2. The value β is 0.05 and sets a floor. The function max selects the larger of its two arguments. A token can receive less influence because the generator considers it unlikely, while the floor preserves some influence even when the computed power is very small.
The researchers also have to choose which probability distribution supplies the GOLD weights. At the beginning of adaptation, applying the fine-tuning temperature to a generator that has never trained with tempering produces weights that favor a narrow set of tokens too strongly. Later, using the raw distribution would make the weights too similar as that distribution becomes smoother. The authors insert a short phase that uses tempering alone. Once the distribution has adjusted, they introduce GOLD and use tempered probabilities for both the loss and the weights. This sequence gives the transition its own training phase rather than forcing the initial and final weighting rules into a single step.
Drawing candidates with different behaviors
AlphaCode can draw many programs in parallel on the same statement. The authors allocate half the draws to Python and half to C. They add the requested language, a difficulty rating and algorithm tags to the front of the statement. During inference, the rating is drawn uniformly from 800 through 3500 at 100-point intervals, and the tag combination is drawn uniformly from the 50 most frequent combinations. These are invented settings for generation, since the actual difficulty and categories are unavailable to contestants when the problems appear.
A tag can pull the generator toward a particular kind of solution. Varying it can therefore change the distribution of programs before any code is executed. Temperature produces variation at the level of token choices. The authors use sampling from the temperature-adjusted distribution for their main contest experiments. They also study top-k sampling, which restricts each choice to a set of high-probability tokens, and nucleus sampling, which uses the most likely tokens whose combined probabilities reach a threshold. Those choices affect how much access the generator has to less probable continuations across a large number of draws.
The example filter gives the search its first direct check. Each candidate is run against the inputs that appear in the statement, and the outputs have to match those expected by the local judge. Failure can reflect a syntax error, a bad interpretation of the input or an algorithm that returns the wrong answer. Passing gives the program a place in the pool for further consideration. The scale of generation means that a very selective filter can still leave many more programs than the system can afford to submit.
Selecting submissions by executing the survivors
For the next step, the authors train a separate input generator with the same architecture and the same starting GitHub checkpoint. It learns to produce test inputs from contest descriptions, using example, hidden and generated inputs from training problems. On a new statement it supplies fresh inputs for the surviving candidates. The programs’ outputs can then be compared across those inputs. The method only needs observations that distinguish behaviors, so the new inputs come without trusted answer labels.
That purpose is different from the earlier test augmentation. When building CodeContests, the authors have accepted human solutions available to establish consensus answers for mutated inputs. For a new problem presented to AlphaCode, reference programs would reveal information unavailable to a participant. The learned input generator enables a comparison without them. A malformed input may still separate two programs in practice, although their differing behavior on it can be irrelevant to the original problem. The authors use 50 inputs and consider up to 8192 candidate programs in the reported clustering setup.
Each cluster contains programs whose outputs agree on the same input set. AlphaCode considers larger clusters earlier and initially chooses a single representative from each. The authors suggest that many correct implementations will make the same predictions on useful inputs, while incorrect implementations can disagree in many ways. A prominent cluster can therefore be a reasonable place to try a representative. Its size can also reflect a common mistake. Spreading attempts among clusters helps preserve alternatives. If the system reaches the end of the cluster order before using the available attempts, it goes back through the order and chooses programs it has yet to submit.
Measuring search and selection separately
The authors introduce a metric with a generation budget and a submission budget.
n@k
The variable k is the number of programs the system is allowed to draw for each problem. The variable n is the maximum number of those programs it may have judged. The at sign joins the submission budget to the sampling budget. The metric reports the percentage of problems for which at least one submitted program passes the full evaluation. In the contest-like version, n is 10. Selection can use evidence available during the contest, including the examples. The hidden checks are reserved for the verdict.
pass@k = k@k
Here, pass@k is the percentage of problems with an accepted program anywhere in a pool of k draws. The expression k@k uses that same k in both budget positions, and the equality sign states that judging every program yields the same measure. At a fixed sampling budget, this is an upper bound for submission-limited selection. When the two measures diverge, usable programs exist in the pools for some problems without reaching the judge through the selection procedure.
Repeated draws from the same trained generator can produce substantially different pools. To estimate the usual submission-limited metric, the authors generate a pool of size K, with K at least as large as k. They take S subsets of size k without replacement within each subset, compute solve rates for the submission budget n and average across the subsets. The same large pool can provide subsets for several sampling budgets. This helps estimate the expected effect of sampling without confusing the desired budget with the much larger pool from which the estimate is made.
Clustering requires another approach because changing a pool requires recomputing the groups. The authors ordinarily evaluate clustering on five subsamples per generator and budget. For the build-up ablation they also repeat fine-tuning from a shared pretraining checkpoint. They resample across those runs and the program samples to quantify uncertainty, using the 2.5th and 97.5th percentiles of their bootstrap estimates for a 95% interval. The expensive 9B and 41B clustering results use one trained network at each scale. Accordingly, repeated sampling gives a view of variation in generation and selection while only the repeated fine-tuning comparisons directly examine variation between training runs.
Experiments and results
Held-out problems in CodeContests
CodeContests has 117 validation problems and 165 test problems. The validation problems provide a place to choose settings and compare versions of AlphaCode. The later test problems provide a check on the resulting system. The test set includes the problems from the contests used in the Codeforces experiment with an exception for a problem that lacked the required 5 tests. It also contains other problems. Success in the local test set and success in the contest reconstruction therefore have partly overlapping subject matter, with different judging and scoring procedures.
The 41B generator with clustering reaches 34. The score on the CodeContests validation set was 2%, with each problem capped at one million samples and 10 submissions. At the lower budget of one hundred thousand samples per problem, the reported solve rates are 31.8% on validation and 29.6% on test. The authors report that the 41B version consistently outperforms the 9B version in these comparisons and that clustering improves performance. They attribute the difference between validation and test to differences in the problems collected in the respective time windows and to some overfitting. The values are percentages of problems accepted by the local judge within the submission budget.
The appendix separately reports a validation result for an ensemble that pools equal numbers of programs from the 41B and 9B generators before selection. With 1 million samples per problem in total, the ensemble improves when clustering follows filtering. Its small advantage over the individual generators on validation motivated its use in the contest simulation. On the test set the ensemble did no better than the larger individual generator.
CodeContests validation solve rate for the ensemble at 1 million samples and 10 submissions per problem
Grouping the filtered programs improves the ensemble’s solve rate at a fixed sampling budget.
The numbers
| System or setting | solve rate % |
|---|---|
| 41B and 9B ensemble with example filtering | 32 |
| 41B and 9B ensemble with example filtering and clustering (this paper) | 35.5 |
The ensemble experiment and the individual result answer related questions. The individual result shows what the larger generator can achieve with clustering. The ensemble holds a particular mixture of candidate sources fixed and changes how the candidates reach the judge. Its behavior on test also shows how a validation preference between two strong configurations can reverse when the problem set changes.
Placement in Codeforces contests
The authors take every Codeforces contest from 2021/12/01 to 2021/12/28 with more than 5,000 participants. There are 10 such events. The system for this experiment is the clustered 41B and 9B ensemble. Candidate generation and example filtering were organized as a simulation of live participation using 3750 TPUv4 and 3750 TPUv4i chips. The authors send the selected programs to the actual Codeforces judge after the contests and calculate where the accepted submissions would have placed on the original scoreboards.
Submission timing matters because a pool takes time to accumulate and the contest rewards earlier accepted solutions. The simulation groups submissions at three points. A point can be reached when sufficient contest time has elapsed or when enough programs have passed the public examples. It uses a common two-hour duration when computing these triggers and adds 120 seconds for clustering. Earlier incorrect attempts count towards the penalty. The authors also calculate bounds using minimum and maximum possible time penalties to show the effect of the timing assumptions on placement. Programs that appeared obviously wrong under a quick manual check were recorded as unsuccessful without being sent to the platform.
For the repeated evaluations, the authors retain the original programs, shuffle their order, generate different clustering inputs and change the random seed used in choosing representatives. The capped rankings are averaged across the evaluations. With a limit of 10 submissions per problem, AlphaCode places in the top 54.3% on average and uses 2.4 submissions per solved problem. The later runs also explore more attempts while retaining the contest’s penalties for failures. In that setting AlphaCode places in the top 48.8% and uses 28.8 submissions per solved problem. The paper reports diminishing returns from the extra attempts. Most of the accepted problems are easier ones, although the system also solves a problem rated 1800.
The authors estimate a Codeforces rating by replaying the chronological sequence of placements with their implementation of the rating procedure. They checked that calculation against ratings of other participants and report differences of less than 15 points. The estimated AlphaCode rating is 1238. It falls in the top 28% of accounts that had entered a contest in the previous 6 months. The average event placement and the rating percentile use different comparison populations. The authors suggest that stronger competitors may enter more regularly, which could explain why the event fields give AlphaCode a lower relative standing than the broader pool of recently active accounts.
What the acceptance audit measures
An acceptance audit asks a different question from a solve-rate experiment. It starts with programs the benchmark has already accepted and checks whether that acceptance was deserved. For the paper’s audit, the authors select 50 problems that their 1B generator solved and manually inspect one accepted program per selected problem. They use validation problems for APPS and CodeContests. The pools used to find those programs contain 10,000 draws per APPS problem, 200 per HumanEval problem and 1,000,000 per CodeContests problem. The audit estimates the share of inspected acceptances that correspond to incorrect programs. Those percentages have accepted programs as their denominator, while a solve rate has problems as its denominator.
CodeContests validation false-positive rate in the manual acceptance audit
Adding generated tests and excluding poorly covered problems reduces erroneous acceptances.
The numbers
| System or setting | false-positive rate % |
|---|---|
| Raw CodeContests | 62 |
| CodeContests after test augmentation and coverage screening (this paper) | 4 |
The raw version shows how much the team’s conclusions could depend on the judging data. The stronger version reduces the share of incorrect solutions that slip through the suite. Earlier benchmarks have audited rates in the 30-60% range reported in the introduction, under their respective sampling setups. Because the pools and problems differ, the comparison describes how the benchmarks behaved under this audit. A separate failure is accepting an algorithm that returns the right answers but would be inefficient on more demanding inputs. The paper calls these slow positives. They remain a substantial issue for CodeContests even after output correctness improves.
Comparisons on APPS and HumanEval
APPS has 10,000 problems, divided equally between training and test. AlphaCode’s authors train the comparison system on the APPS training split following GitHub pretraining. They avoid training on CodeContests for this experiment because its training problems overlap the APPS test set. They also leave out clustering, tag and rating conditioning, and both training features concerning submission correctness. They extract public examples from the descriptions for filtering. Some problems have fewer examples than the earlier protocol assumes, and the extraction produced none for less than 2% of test problems.
This APPS setup uses nucleus sampling at a temperature of 0. To match the Codex 12B comparison, the chosen settings were 25 and a per-test time limit of 3 seconds. The AlphaCode results are averaged across 3 fine-tuning runs. Published baselines include GPT-Neo adapted to APPS and Codex tested with a single demonstration. The paper reports that the 1B AlphaCode variant exceeds GPT-Neo at every stated difficulty level. It also exceeds Codex 12B on interview and competition problems. Increasing AlphaCode’s sampling budget improves its reported results even with parts of the contest pipeline omitted. Differences in test quality, training data, available selection features and adaptation to the problem distribution all matter when interpreting the comparison.
The HumanEval experiment addresses the strength of the authors’ decoder-only baseline. This version is pretrained on the Python subset of GitHub and evaluated without fine-tuning. Its reported pass rates use 1000 samples and select the best nucleus sampling result among the temperatures tested for each comparison. In most settings its solve rates are within about 1-3% of a comparable Codex version, and it performs better than GPT-Neo and GPT-J in comparable settings. The authors report weaker HumanEval performance for their encoder-decoder versions. Their proposed explanation is that a contest dataset gives the encoder and decoder a natural division between statement and solution, while a file of pretraining code can be split into two parts without such a division. The decoder-only architecture also receives a prediction loss over more of that code. The HumanEval comparison checks the baseline and gives context for why the contest architecture suits a different workload.
What the ablations show
Sampling makes a difference when candidates can be selected
The paper plots solve rate as the sampling budget changes. For both the submission-limited result and pass@k, solve rate grows approximately linearly against the logarithm of the number of draws over the reported range. The limited-submission curve bends down somewhat at large budgets. This means that a system can continue improving even while the number of official attempts stays fixed. It also means that preserving a similar gain at higher budgets requires rapidly growing numbers of samples. The authors describe the costs of continuing that process as prohibitive.
The comparison between selection methods shows why a larger pool can help. Choosing a handful at random from the unfiltered pool gives a nearly flat solve-rate curve. Running the public examples and choosing randomly from the survivors makes the curve rise. Clustering those survivors before choosing raises it further. Allowing the judge to inspect the whole pool produces a substantially higher upper bound. This ordering identifies two places where search can lose a problem. A correct program can fail to appear within the drawn pool, or it can appear without being among the submissions. Increasing the number of draws addresses the first problem and increases the value of solving the second.
The filter is selective across the whole pool. In aggregate, fewer than 1% of samples meet the public examples, including samples that could fail earlier because of syntax. Survival varies widely across problems. On problems that AlphaCode ultimately solves, the fraction of programs passing examples is roughly twice as high, and it is still small. With one million samples per problem, the 41B generator finds at least one public-example passer for over 90% of validation problems. This figure counts problems with any survivor and can be high even if individual draws are usually discarded. It also leaves ample scope for the hidden tests to distinguish example fit from general correctness.
The authors vary the number of generated inputs and the cap on how many programs reach clustering. Increasing those quantities beyond the chosen settings did not keep improving performance. A plausible reason lies in what the generated inputs provide. They can expose different output patterns, but some confuse the grouping by being malformed or insufficiently discriminating. The comparison establishes that this imperfect clustering procedure improves selection in the tested range. The gap to judging the entire pool leaves the amount of further improvement an open empirical question.
Training capacity, architecture and data change the search
Larger generators generally reach higher solve rates at the same sampling budget. Their curves also tend to be steeper when plotted against the logarithm of that budget. The authors argue that better sample quality can reduce the number of programs needed to reach a target solve rate. They also vary training compute. Solve rate grows approximately linearly with its logarithm when the authors choose network sizes close to the best ones for each compute allocation they studied. Each plotted choice couples a training budget with a network size, so the observed relationship describes a sequence of such configurations.
At inference a larger network spends more computation on each program it draws. A smaller one can therefore offer more programs for the same budget. The results show that the larger networks eventually win at comparable sampling compute, where the quality of their programs outweighs the extra cost per draw. At lower budgets that tradeoff can favor a smaller configuration. The experiment establishes that training resources and inference resources can both improve the outcome while acting on different parts of the process.
The authors compare the 1B encoder-decoder with multi-query attention against an encoder-decoder with conventional multi-head attention and a decoder-only alternative. The multi-head comparator follows the same pretraining and fine-tuning procedure. The decoder-only comparator gets the same training compute, with a longer decoder sequence of 2304 tokens. Under that budget it processes 50% more tokens that contribute to the training loss than the encoder-decoder versions. The authors report that their architecture draws programs substantially faster while maintaining similar solve rates. The practical benefit is throughput. A speedup allows more of the search within a fixed amount of accelerator time, even where candidate quality at a given sample count is similar.
The corpus comparison holds the 1B scale constant and varies pretraining. Training directly on CodeContests performs worse than starting from a pretrained generator. The full GitHub corpus gives better results than a Python-only corpus or MassiveText, which consists predominantly of natural language and includes some GitHub code. The Python-only variant also uses only Python during adaptation and generation, so the result measures the full effect of that narrower setup. It combines the consequences of training on fewer languages with the consequences of drawing candidates in a single language.
The authors also reduce or increase the available fine-tuning material in two different ways. They change how many distinct problems the generator sees, and they change how many human solutions it receives per problem. Both help as they increase in the reported early 1B experiment. Adding problems has the larger effect. Extra submissions for an existing statement show more implementations of a known task. Extra problems add variation in what the statement asks the program to do. The learning curves indicate that both kinds of variation contribute within the range studied.
Which additions help, and under what conditions
The build-up comparison starts with a fine-tuned 1B encoder-decoder that already uses multi-query attention and a standard next-token objective. The authors add enhancements in sequence and measure the resulting solve rate. They fine-tune and sample at least 3 times from the same pretrained checkpoint for each training setting in this comparison. The paper reports that the endpoints of the build-up improve the validation solve rate from 15.2% to 24.1% with 100k samples and at most 10 submissions per problem.
CodeContests validation solve rate at the endpoints of the 1B build-up at 10@100k
The combined additions improve the solve rate over the base configuration.
The numbers
| System or setting | solve rate % |
|---|---|
| Base fine-tuned encoder-decoder | 15.2 |
| Full AlphaCode configuration in the build-up (this paper) | 24.1 |
A build-up measures each newly added change against settings that already contain the earlier changes. That is relevant to a system whose components interact. Tempering changes the distribution that GOLD uses, and a change that encourages diversity can give the filter or clusterer different material to work with. The effect of a component depends on its context in the sequence and on the number of programs drawn. The endpoints show what the combined configuration achieves under the reported budget. They cannot establish how each change would perform alone or in every possible combination.
The authors compare basic temperature sampling to sampling that restricts the available choices. Lower temperatures generally work better when the number of draws is small. Higher temperatures become more useful with bigger pools, although performance is fairly tolerant across a range. For the combination of GOLD and tempering, 0.25 works across the budgets tested. Neither top-k sampling nor nucleus sampling outperforms ordinary temperature sampling in the reported sweeps. The nucleus experiments improve as the retained probability mass approaches 1.0, where the behavior approaches sampling from the whole distribution. These comparisons are consistent with allowing the generator to pursue less probable continuations when the budget is broad enough to test many of them.
The ensemble comparisons explore another route to variety. AlphaCode can pool programs from independently trained generators and run the same selection procedure on the mixture. When the components have broadly similar performance, the authors find that this can help. When their performance differs substantially, allocating some of the pool to the weaker source tends to bring down the result relative to the stronger individual run. In this experiment diversity has to be purchased out of the same budget that could otherwise be used for more draws from the stronger source. The mixed validation and test results for the contest ensemble give an example of how small that advantage can be.
How the metadata changes the programs
To study problem tags, the authors compare drawing a fresh tag combination for each program, reusing a randomly chosen combination for a whole problem and supplying the actual tags as an experimental condition. The actual tags help relative to reusing random ones. Fresh random tags for each sample work best among the tested schemes. These conditions distinguish the effect of receiving a good hint from the effect of sampling many different hints. The result favors varying the hints throughout the search.
An individual validation problem shows how different the samples can become. In Gregor and Cryptography, the task is to find two permitted divisors that give the same remainder when applied to a given prime. The paper explains that a simple property of the prime yields a direct answer. The authors compare prompts that suggest brute force and number theory. In the reported comparison over 2048 samples, the number-theory prompt yields 29 successful programs, compared with 9 under brute force. The authors count 12 solutions that avoid a search loop under the number-theory tag and 3 under the brute-force tag, apart from loops used to read input. The programs furnish evidence that the words in the prefix can steer the implementation as well as change the total success rate.
Difficulty conditioning has a related effect. Requesting an easier rating generally works better than requesting a harder one in the overall validation comparison, and sampling ratings uniformly performs competitively with the fixed choices. When the authors group problems by actual difficulty, the harder problems benefit relatively more from prompts suggesting higher difficulty. The tendency is weaker or reversed on easier problems. The authors also raise the possibility that prompting for easy solutions can favor algorithms that only appear adequate because weak tests fail to expose their cost.
Correctness conditioning has different effects on the two metrics. Asking for an incorrect program hurts the submission-limited result, while pass@k does not show the same deterioration. The authors suggest that the resulting pool may contain more wrong programs that still pass the examples, making selection harder without destroying the pool’s capacity to contain a correct answer. Removing the correctness field hurts both metrics in the comparisons, though the decreases are insignificant. The experiment connects the training label to the practical quality of the pool presented to the selector.
How much information the statement supplies
The authors modify statements at inference and keep the trained generator fixed. Some changes preserve the underlying problem. Others obscure it, remove part of its specification or substitute a different task. Most such comparisons use 10@1024. Some focused examples instead count the share of programs that solve the problem. This distinction matters because a pool containing more good programs can be easier to select from even when both pools already contain some successful programs.
For Mocha and Math, the original rules describe operations on intervals in a sequence and ask for an optimum. The simplified statement gives away the crucial reduction to taking the bitwise AND across the sequence. In the reported comparison, the base 1B version goes from 12% to 55% correct samples for this problem. The result comes from a selected example within a small simplification study. It shows how much of the difficulty can reside in discovering what computation the story implies. Once the simplification supplies that computation, the remaining task is primarily to implement it.
The Cherry experiment varies the contents of a simplified statement. One version changes the requested optimization, another asks a related task with a different choice of elements, and another leaves out the function to be optimized. The study also compares symbolic and verbal formulations of the intended algorithm and introduces irrelevant narrative. Changes to the task or its definition impair success on the intended problem. Natural-language descriptions of the algorithm remain usable, and added narrative was tolerable in this example. The authors suggest that familiarity with verbose contest statements may help explain the response to more expansive wording.
The variable-renaming experiment contrasts consistent substitutions with inconsistent ones. With consistent renaming, every occurrence of a name is updated together. Inconsistent substitution can sever the connection between a quantity where it is introduced and where it is used. The 300M generator is mostly insensitive to both kinds of change. With increasing scale, consistent changes become less disruptive, while introducing inconsistent names has a stronger effect. The pattern is consistent with larger networks making more use of the relations between the variables. Successful programs on some corrupted prompts show that other cues in the statement can still be informative.
The word-level experiments reach a similar conclusion through different perturbations. Substituting synonyms from a paraphrase resource induces little degradation. Replacing some specific type words with more generic ones produces no substantial difference. Typographical errors become more damaging as their number grows, and larger amounts of word deletion or rearrangement reduce success. The section-removal experiment gives the largest role to the input and output specification, followed by the problem description, with the smallest effect from removing the examples from the prompt. Reordering the sections has little effect. The experiment on removing text measures its value as input to generation. The comparisons of sample selection measure the separate value of running programs on the examples. PPDB
Whether the generated solutions reproduce training code
The temporal split makes the direct reuse of a recently published answer harder. The authors test a particular form of reuse by taking one submitted solution from each training problem and evaluating those programs on validation problems. With a random problem split this baseline solves 4.1% of validation problems. With the temporal split it solves 0%. The authors also compare a 1B generator pretrained on GitHub at 13k draws per problem. It achieves 0.8% on the random validation split and 0% on the temporal split at that budget. These controls show how both direct reuse and pretraining alone fare under the particular validation conditions.
The authors then examine copying of program fragments. For accepted generated and human validation solutions, they find the longest exact string shared with the training corpus after ignoring whitespace. The comparison includes 50 C and 50 Python solutions in the analysis of 16 selected validation problems with enough solutions available. The distributions resemble each other. The generated solutions have a slightly higher mean longest match, while the human distribution has more very long matches. In the comparison with CodeContests, approximately 3% of human solutions and fewer than 1% of generated solutions share a substring longer than 600 characters with the training data.
Long matches commonly concern how to read input or set up ordinary data structures. The authors give the example of a Python input utility whose length is 805 and which appears in 1.66% of the human Python solutions. They also inspect 50 generated solutions by repeatedly extracting their longest remaining matches with the fine-tuning data. This provides a way to look for copying distributed across a program rather than only in its single longest block. The authors report finding familiar utility code and no evidence of duplicated core logic in that inspection.
What improves when the loss worsens
The authors examine the code itself as well as its acceptance. Most Python samples are syntactically valid in their checks, and a smaller share of C samples compile. For correct Python programs, they measure the effect of removing unused imports, functions and classes through formatting and syntax-tree analysis. They find roughly as much removable code in generated solutions as in human ones. The analysis helps characterize the kinds of programs AlphaCode emits, including ordinary traces of the way competitive programmers write code.
Accepted programs are also unevenly distributed across problem types. In validation comparisons at 10@10k, relative strengths include bitmasks, sorting, mathematics and greedy problems. Dynamic programming and constructive algorithms are harder for the system. As scale increases, solve rates generally rise across the problem tags. The difficulty comparisons separately show that acceptance becomes much less frequent as ratings increase. Tags and ratings are therefore useful for describing where the aggregate solve rate comes from, even though the actual values are withheld from AlphaCode during search.
An early 1B fine-tuning run provides a test of the metric used to track learning. After around 50k steps, the loss on held-out reference solutions begins to increase while the training loss continues to fall. The validation solve rate at 10@1024 keeps improving well beyond that point. The two measures reward different things. Token loss depends on how much probability goes to the particular programs in the validation data. The solve rate depends on whether the system can generate and select any program that works. The authors hypothesize that training may concentrate probability on more typical successful approaches while reducing probability on rarer examples. The measured divergence establishes that loss and task performance can move in opposite directions. The proposed change in probability allocation is an explanation to investigate.
Limitations
Limits the authors identify
The authors distinguish generating wrong answers that pass the available tests from generating inefficient programs whose answers are semantically right. CodeContests improves substantially on the first problem. In the discussion of difficulty buckets, the paper cites a 46% rate in connection with slow positives and describes weak coverage of long inputs as particularly important for harder problems. Some high solve rates in difficult buckets may reflect this weakness as well as small numbers of problems. An implementation that happens to finish within the limit on the local inputs can still be a poor fit for the largest permitted inputs in the original contest.
Some verdicts also depend on the local checker’s approximation of each problem’s output rules. The checker is permissive about formatting. The manual audit did not find bad acceptances attributable to the formatting policy, although that audit covers a sample. By the authors’ heuristic, about 1/4 of the validation problems allow multiple outputs. Using the most common one as the reference can reject a valid program that chooses a different answer. The authors tried allowing any output found in human solutions and observed more false positives. Interactive tasks are another mismatch. The local checker does not explicitly reproduce the dialogue in which future inputs depend on the program’s earlier outputs, allowing errors in either direction.
The Codeforces evaluation uses the actual contest judge and retrospectively simulates participation. For problems with multiple outputs, the authors replace some public example outputs with the consensus answer from human solutions for the purpose of filtering. They describe this as a slight advantage and say the changed examples affected approximately five solved problems. Some events also have a phase in which contestants can challenge one another’s submissions. The simulation does not fully capture that phase. The authors judge its omission a small effect in this experiment. Their placements depend on computed submission times, and the rating is an estimate reconstructed from those placements.
The repeat runs on Codeforces share their trained generators and their original program pools. They vary the order in which candidates arrive and what happens during clustering. This captures consequences of the selection procedure and leaves the variation from independent training and fresh sampling mostly unmeasured. The authors describe the latter as expensive to study. Their largest individual generator was stopped earlier than planned, and most large-scale clustering evidence likewise comes from one trained generator at each size.
Cost also limits what could be tested. The authors describe training and sampling as requiring hundreds of petaFLOPS days and report rapidly rising sampling costs for further improvements. Accurate solve-rate measurement is itself expensive when it requires generating and judging extensive candidate pools. Validation loss offers a cheaper observation, but the paper’s divergence experiment leaves open how to design a cheap proxy that tracks solve rate reliably. The largest practical improvements therefore depend both on generating useful candidates more efficiently and on obtaining a more informative estimate of what those candidates can do.
The paper’s broader-impact discussion places the result in a narrow immediate application area. It considers future uses in education, accessibility and developer tools, alongside unfair advantages in contests and interviews, bias inherited from code corpora, security risks and questions about code credit and licensing. These are possibilities raised by the authors. The experiment measures contest problem solving and leaves the usefulness and effects of deploying derived systems in those other settings to further work.
Limits that follow from the experimental design
The median-competitor comparison concerns placement in the selected fields under the study’s contest assumptions. A person can reason through a plan, inspect what went wrong, edit a program and try again. AlphaCode’s reported procedure uses many independent generations followed by execution and selection. The submission limit puts a comparable constraint on how many attempts reach the judge. It leaves the amount and kind of work behind each attempt very different. The recently active Codeforces users used to interpret the rating also form a selected population. The study gives a contest comparison with that population and cannot be extended to a percentile among programmers generally.
The copying tests are best read in light of the behaviors they can observe. Resubmitting earlier programs checks complete reuse. Substring matching checks exact reuse of contiguous text, and the hand inspection extends that analysis across several fragments of a solution. An algorithm can be represented in many ways, and knowledge of patterns from earlier problems is part of what a contest participant can legitimately bring to a new one. The results support the authors’ account of the inspected solutions as newly composed programs. They leave open how AlphaCode combines familiar algorithmic patterns, retrieves less obvious training influences or arrives at a particular choice of method.
The strongest statement-perturbation findings concern sensitivity to information that distinguishes tasks. A decline when a mathematical relation is obscured is evidence that the original relation mattered to performance. A rise when the algorithm is supplied shows that a useful inference was missing from many attempts on the original wording. Neither observation reveals the full chain of decisions behind an accepted program. The use of selected problems in some probes also limits the breadth of the inferences that can be drawn. The larger validation experiments measure more statements, at a sampling budget chosen for those experiments.
Several comparisons vary more than one property in meaningful ways. The Python-only setup varies the pretraining corpus and the languages used after pretraining. The compute-matched architectural comparison changes the number of supervised decoder tokens along with the architecture. The APPS evaluation compares systems with different training and generation procedures, and some AlphaCode components are absent. These are interpretable comparisons between actual configurations. They provide less direct evidence for a claim about what one isolated component would contribute at precisely matched compute, data and sampling budgets.
Finally, AlphaCode benefits from a task interface with a written specification, a runnable program and checks that can be applied cheaply before judging. In a repository-scale change, relevant behavior might depend on surrounding files or on what a developer intended by an issue report. Some tasks may have no public examples suitable for filtering. The paper gives evidence for selection by execution where that feedback exists. It leaves unanswered how to supply feedback of similar value in settings where success is less directly observable.
What came after
Stronger tests, fresher tasks and larger units of work
One later citing study asks how rigorously generated programs are evaluated. Its subject is directly connected to the false-positive audit in AlphaCode. A working-looking program can pass the checks a benchmark happens to exercise while giving an incorrect answer elsewhere. AlphaCode measured that problem by inspecting accepted programs and changed the benchmark to reduce it. The later study makes rigorous correctness evaluation of generated code its own research question. This line of work concerns the evidence behind a score, down to the behavior of individual accepted outputs. Is Your Code Generated by ChatGPT Really Correct?
LiveCodeBench treats contamination control as part of a broader evaluation of code capabilities. The point of contact is CodeContests’ insistence that the timing of publication matters. A program written for a problem is evidence of generalization only to the extent that the experimental setup supports the problem’s novelty. AlphaCode makes that argument by controlling what was available for training and testing a baseline that reuses earlier submissions. LiveCodeBench takes contamination-free evaluation as an explicit benchmark objective and describes its scope as holistic. LiveCodeBench
SWE-bench poses a different task by asking whether systems can resolve real GitHub issues. AlphaCode had expanded evaluation from short function completions to contest problems requiring a full program. SWE-bench shifts the unit of work to an issue in an existing project. The connection is the move toward tasks where answering requires deciding what work to do as well as producing code. The contest setting supplies a self-contained problem and judgeable inputs and outputs. The issue-resolution setting asks the system to operate in the context of software already under development. The resulting evaluations concern different skills, so a contest solve rate alone cannot settle the issue-resolution question. SWE-bench
Other ways to train, organize and evaluate code generation
Code Llama explores open foundation systems for code. It shares AlphaCode’s broad interest in learning general coding capability and then measuring what kinds of programming work become possible. AlphaCode’s distinctive system-level result concerns training for a particular contest domain and using a costly search over candidates at inference. Code Llama’s stated focus is the code foundation itself. A citation connects the two research efforts without establishing that the later work adopted the earlier system’s contest selector. Code Llama
CodeGeeX takes up pretraining for code generation and includes multilingual benchmarking through HumanEval-X. AlphaCode also uses data from several programming languages and varies the output language during generation. Those choices address different questions. In AlphaCode, switching languages is one way to widen the pool of candidate implementations for a problem. A multilingual benchmark makes performance across languages an object of measurement in its own right. The connection places AlphaCode’s language choice among broader questions about what a code generator can transfer across programming languages. CodeGeeX
Reflexion studies verbal reinforcement in language agents, another setting in which what happens after a first attempt matters. AlphaCode uses the effects of execution to remove programs and compare the survivors. Reflexion’s stated focus gives feedback a role in how an agent acts on later attempts. The shared research question is how evidence gained during a task can improve the final result. AlphaCode makes its part of that question measurable through the gap between finding a successful candidate somewhere in the pool and delivering one within the submission budget. Reflexion
The later survey devoted to code generation puts the contest approach within a field that also studies systems designed for other programming tasks. AlphaCode supplies a particular case for that comparison. Its result belongs to a generator, sampling budget, selection procedure and judge operating together. Function completion, multilingual code evaluation and resolution of repository issues give different inputs and different evidence of success. What carries across these citing works is the need to say which problem a system faced, what information it could use, and how the evaluation decided that its code worked. A Survey on Large Language Models for Code Generation
Institutions
Fields, topics and concepts
Shelves 6The field of science this work belongs to (OpenAlex fields).Computer Science · 19,503 worksArtificial Intelligence · 18,805 worksArts and Humanities · 17,959 worksLanguage and Linguistics · 17,789 worksInformation Systems · 1,888 worksComputer Science Applications · 184 works
Topics 1Research subjects and languages the work is about.Code & programming languages · 194 works
Cite
Cite as Yujia Li, David Choi, Junyoung Chung, Nate Kushman, Julian Schrittwieser, Rémi Leblond, Tom Eccles, James Keeling, Felix Gimeno, Agustin Dal Lago, Thomas Hubert, Peter Choy, Cyprien de Masson d'Autume, Igor Babuschkin, Xinyun Chen, Po-Sen Huang, Johannes Welbl, Sven Gowal, Alexey Cherepanov, James Molloy, Daniel J. Mankowitz, Esme Sutherland Robson, Pushmeet Kohli, Nando de Freitas, Koray Kavukcuoglu and Oriol Vinyals. 2022. Competition-Level Code Generation with AlphaCode. arXiv:2203.07814.
@misc{li2022competition,
title = {{Competition-Level Code Generation with AlphaCode}},
author = {Yujia Li, David Choi, Junyoung Chung, Nate Kushman, Julian Schrittwieser, Rémi Leblond, Tom Eccles, James Keeling, Felix Gimeno, Agustin Dal Lago, Thomas Hubert, Peter Choy, Cyprien {de Masson d'Autume}, Igor Babuschkin, Xinyun Chen, Po-Sen Huang, Johannes Welbl, Sven Gowal, Alexey Cherepanov, James Molloy, Daniel J. Mankowitz, Esme Sutherland Robson, Pushmeet Kohli, Nando {de Freitas}, Koray Kavukcuoglu and Oriol Vinyals},
year = {2022},
doi = {10.1126/science.abq1158},
eprint = {2203.07814},
archivePrefix = {arXiv},
url = {https://doi.org/10.1126/science.abq1158}
}References
- Albert Ziegler. Research recitation: A first look at rote learning in GitHub Copilot suggestions. https://docs.github.com/en/github/copilot/research-recitation, 2021. Accessed: 2022-01-13. OpenAlex ↗ · Scholar ↗
- M. Allamanis. The adverse effects of code duplication in machine learning models of code. In Proceedings of the 2019 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software, pages 143–153, 2019. our card
- J. Austin, A. Odena, M. Nye, M. Bosma, H. Michalewski, D. Dohan, E. Jiang, C. Cai, M. Terry, Q. Le, et al. Program synthesis with large language models. arXiv preprint arXiv:2108.07732, 2021. our card
- G. A. Aye, S. Kim, and H. Li. Learning autocompletion from real-world datasets. In 2021 IEEE/ACM 43rd International Conference on Software Engineering: Software Engineering in Practice (ICSE-SEIP), pages 131–139. IEEE, 2021. OpenAlex ↗ · Scholar ↗
- M. Balog, A. L. Gaunt, M. Brockschmidt, S. Nowozin, and D. Tarlow. DeepCoder: Learning to write programs. arXiv preprint arXiv:1611.01989, 2016. OpenAlex ↗ · Scholar ↗
- S. Borgeaud, A. Mensch, J. Hoffmann, T. Cai, E. Rutherford, K. Millican, G. van den Driessche, J.-B. Lespiau, B. Damoc, A. Clark, D. de Las Casas, A. Guy, J. Menick, R. Ring, T. Hennigan, S. Huang, L. Maggiore, C. Jones, A. Cassirer, A. Brock, M. Paganini, G. Irving, O. Vinyals, S. Osindero, K. Simonyan, J. W. Rae, E. Elsen, and L. Sifre. Improving language models by retrieving from trillions of tokens, 2021. our card
- J. Bradbury, R. Frostig, P. Hawkins, M. J. Johnson, C. Leary, D. Maclaurin, G. Necula, A. Paszke, J. VanderPlas, S. Wanderman-Milne, and Q. Zhang. JAX: composable transformations of Python+NumPy programs, 2018. URL http://github.com/google/jax. OpenAlex ↗ · Scholar ↗
- T. B. Brown, B. Mann, N. Ryder, M. Subbiah, J. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020. our card
- M. Bruch, M. Monperrus, and M. Mezini. Learning from examples to improve code completion systems. In Proceedings of the 7th joint meeting of the European software engineering conference and the ACM SIGSOFT symposium on the foundations of software engineering, pages 213–222, 2009. OpenAlex ↗ · Scholar ↗
- E. Caballero, OpenAI, and I. Sutskever. Description2Code Dataset, 8 2016. URL https://github.com/ethancaballero/description2code. OpenAlex ↗ · Scholar ↗
- N. Carlini, F. Tramer, E. Wallace, M. Jagielski, A. Herbert-Voss, K. Lee, A. Roberts, T. Brown, D. Song, U. Erlingsson, et al. Extracting training data from large language models. In 30th USENIX Security Symposium (USENIX Security 21), pages 2633–2650, 2021. our card
- M. Chen, J. Tworek, H. Jun, Q. Yuan, H. P. d. O. Pinto, J. Kaplan, H. Edwards, Y. Burda, N. Joseph, G. Brockman, et al. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021. our card
- C. B. Clement, D. Drain, J. Timcheck, A. Svyatkovskiy, and N. Sundaresan. PyMT5: multi-mode translation of natural language and Python code with transformers. arXiv preprint arXiv:2010.03150, 2020. our card
- K. Cobbe, V. Kosaraju, M. Bavarian, J. Hilton, R. Nakano, C. Hesse, and J. Schulman. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021. our card
- R. Dabre and A. Fujita. Softmax tempering for training neural machine translation models. arXiv prepring arXiv:2009.09372, 2020. OpenAlex ↗ · Scholar ↗
- J. Devlin, J. Uesato, S. Bhupatiraju, R. Singh, A.-r. Mohamed, and P. Kohli. RobustFill: Neural program learning under noisy I/O. In International conference on machine learning, pages 990–998. PMLR, 2017. our card
- J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. our card
- I. Drori and N. Verma. Solving linear algebra by program synthesis. arXiv preprint arXiv:2111.08171, 2021. OpenAlex ↗ · Scholar ↗
- A. Ebtekar. How to interpret contest ratings. https://codeforces.com/blog/entry/68288, 2021. Accessed: 2021-12-04. OpenAlex ↗ · Scholar ↗
- S. Edunov, M. Ott, M. Auli, and D. Grangier. Understanding back-translation at scale. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 489–500, Brussels, Belgium, Oct.-Nov. 2018. Association for Computational Linguistics. . URL https://aclanthology.org/D18-1045. OpenAlex ↗ · Scholar ↗
- Facebook Hacker Cup. Facebook hacker cup. https://www.facebook.com/codingcompetitions/hacker-cup, 2021. Accessed: 2021-12-09. OpenAlex ↗ · Scholar ↗
- A. Fan, M. Lewis, and Y. Dauphin. Hierarchical neural story generation. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), 2018. our card
- Z. Feng, D. Guo, D. Tang, N. Duan, X. Feng, M. Gong, L. Shou, B. Qin, T. Liu, D. Jiang, et al. CodeBERT: a pre-trained model for programming and natural languages. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: Findings, pages 1536–1547, 2020. our card
- J. Ganitkevitch, B. Van Durme, and C. Callison-Burch. PPDB: The paraphrase database. In Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 758–764, Atlanta, Georgia, June 2013. Association for Computational Linguistics. URL https://aclanthology.org/N13-1092. our card
- D. Gershgorn. GitHub’s automatic coding tool rests on untested legal ground. https://www.theverge.com/2021/7/7/22561180/github-copilot-legal-copyright-fair-use-public-code, 2021. Accessed: 2022-01-10. OpenAlex ↗ · Scholar ↗
- Google Code Jam. Google Code Jam. https://codingcompetitions.withgoogle.com/codejam, 2021. Accessed: 2021-12-09. OpenAlex ↗ · Scholar ↗
- C. C. Green. Application of theorem proving to problem solving. In IJCAI, 1969. OpenAlex ↗ · Scholar ↗
- S. Gulwani. Automating string processing in spreadsheets using input-output examples. ACM Sigplan Notices, 460 (1):0 317–330, 2011. our card
- S. Gulwani, O. Polozov, R. Singh, et al. Program synthesis. Foundations and Trends® in Programming Languages, 40 (1-2):0 1–119, 2017. OpenAlex ↗ · Scholar ↗
- D. Guo, A. Svyatkovskiy, J. Yin, N. Duan, M. Brockschmidt, and M. Allamanis. Learning to generate code sketches. arXiv preprint arXiv:2106.10158, 2021. OpenAlex ↗ · Scholar ↗
- D. Hendrycks, S. Basart, S. Kadavath, M. Mazeika, A. Arora, E. Guo, C. Burns, S. Puranik, H. He, D. Song, et al. Measuring coding challenge competence with APPS. arXiv preprint arXiv:2105.09938, 2021. our card
- T. Hennigan, T. Cai, T. Norman, and I. Babuschkin. Haiku: Sonnet for JAX, 2020. URL http://github.com/deepmind/dm-haiku. OpenAlex ↗ · Scholar ↗
- A. Hindle, E. T. Barr, Z. Su, M. Gabel, and P. Devanbu. On the naturalness of software. In Proceedings of the 34th International Conference on Software Engineering, pages 837–847, 2012. OpenAlex ↗ · Scholar ↗
- A. Holtzman, J. Buys, L. Du, M. Forbes, and Y. Choi. The curious case of neural text degeneration. In Proceedings of the $7^{th}$ International Conference on Learning Representations (ICLR), 2019. our card
- U. Hölzle. Meeting our match: Buying 100 percent renewable energy. https://www.blog.google/outreach-initiatives/environment/meeting-our-match-buying-100-percent-renewable-energy/, 2018. Accessed: 2022-01-10. OpenAlex ↗ · Scholar ↗
- P.-S. Huang, R. Stanforth, J. Welbl, C. Dyer, D. Yogatama, S. Gowal, K. Dvijotham, and P. Kohli. Achieving verified robustness to symbol substitutions via interval bound propagation. In Empirical Methods in Natural Language Processing (EMNLP), pages 4081–4091, 2019. our card
- ICPC. International collegiate programming contest. https://cse.umn.edu/cs/icpc, 2021. Accessed: 2021-12-04. OpenAlex ↗ · Scholar ↗
- ICPC Factsheet. ICPC factsheet. https://icpc.global/worldfinals/pdf/Factsheet.pdf, 2020. Accessed: 2021-12-04. OpenAlex ↗ · Scholar ↗
- ICPC Rules. ICPC rules. https://icpc.global/worldfinals/rules, 2021. Accessed: 2021-12-09. OpenAlex ↗ · Scholar ↗
- IOI. International olympiad in informatics. https://ioinformatics.org/, 2021. Accessed: 2021-12-04. OpenAlex ↗ · Scholar ↗
- N. P. Jouppi, D. H. Yoon, M. Ashcraft, M. Gottscho, T. B. Jablin, G. Kurian, J. Laudon, S. Li, P. Ma, X. Ma, et al. Ten lessons from three generations shaped Google’s TPUv4i. In 2021 ACM/IEEE 48th Annual International Symposium on Computer Architecture (ISCA), pages 1–14. IEEE, 2021. OpenAlex ↗ · Scholar ↗
- J. Kaplan, S. McCandlish, T. Henighan, T. B. Brown, B. Chess, R. Child, S. Gray, A. Radford, J. Wu, and D. Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020. our card
- D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. our card
- T. Kudo and J. Richardson. Sentencepiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. arXiv preprint arXiv:1808.06226, 2018. our card
- S. Kulal, P. Pasupat, K. Chandra, M. Lee, O. Padon, A. Aiken, and P. S. Liang. Spoc: Search-based pseudocode to code. Advances in Neural Information Processing Systems, 32, 2019. our card
- W. Ling, P. Blunsom, E. Grefenstette, K. M. Hermann, T. Kočiský, F. Wang, and A. Senior. Latent predictor networks for code generation. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, pages 599–609, 2016. URL https://aclanthology.org/P16-1057. our card
- I. Loshchilov and F. Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017. our card
- Z. Manna and R. J. Waldinger. Toward automatic program synthesis. Commun. ACM, 140 (3):0 151–165, mar 1971. ISSN 0001-0782. . URL https://doi.org/10.1145/362566.362568. OpenAlex ↗ · Scholar ↗
- N. D. Matsakis and F. S. Klock. The Rust language. ACM SIGAda Ada Letters, 340 (3):0 103–104, 2014. OpenAlex ↗ · Scholar ↗
- P. McKenzie. Falsehoods programmers believe about names. https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/, 2010. Accessed: 2022-01-10. OpenAlex ↗ · Scholar ↗
- M. Mirzayanov. Codeforces: Results of 2020. https://codeforces.com/blog/entry/89502, 2020. Accessed: 2021-12-04. OpenAlex ↗ · Scholar ↗
- V. Murali, L. Qi, S. Chaudhuri, and C. Jermaine. Neural sketch learning for conditional program generation. arXiv preprint arXiv:1703.05698, 2017. OpenAlex ↗ · Scholar ↗
- Y. Nandwani, D. Jindal, Mausam, and P. Singla. Neural learning of one-of-many solutions for combinatorial problems in structured output spaces. In International Conference on Learning Representations, 2021. OpenAlex ↗ · Scholar ↗
- R. Y. Pang and H. He. Text generation by learning from demonstrations. arXiv preprint arXiv:2009.07839, 2020. OpenAlex ↗ · Scholar ↗
- H. Pearce, B. Ahmad, B. Tan, B. Dolan-Gavitt, and R. Karri. An empirical cybersecurity evaluation of GitHub Copilot's code contributions. CoRR, abs/2108.09293, 2021. URL https://arxiv.org/abs/2108.09293. OpenAlex ↗ · Scholar ↗
- R. Puri, D. S. Kung, G. Janssen, W. Zhang, G. Domeniconi, V. Zolotov, J. Dolby, J. Chen, M. Choudhury, L. Decker, et al. Project CodeNet: A large-scale AI for code dataset for learning a diversity of coding tasks. arXiv preprint arXiv:2105.12655, 2021. our card
- A. Radford, J. Wu, R. Child, D. Luan, D. Amodei, I. Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 10 (8):0 9, 2019. OpenAlex ↗ · Scholar ↗
- J. W. Rae, S. Borgeaud, T. Cai, K. Millican, J. Hoffmann, F. Song, J. Aslanides, S. Henderson, R. Ring, S. Young, et al. Scaling language models: Methods, analysis & insights from training Gopher. arXiv preprint arXiv:2112.11446, 2021. our card
- V. Raychev, M. Vechev, and E. Yahav. Code completion with statistical language models. In Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 419–428, 2014. OpenAlex ↗ · Scholar ↗
- S. Ren, D. Guo, S. Lu, L. Zhou, S. Liu, D. Tang, N. Sundaresan, M. Zhou, A. Blanco, and S. Ma. CodeBLEU: a method for automatic evaluation of code synthesis. arXiv preprint arXiv:2009.10297, 2020. OpenAlex ↗ · Scholar ↗
- M. Resnick, J. Maloney, A. Monroy-Hernández, N. Rusk, E. Eastmond, K. Brennan, A. Millner, E. Rosenbaum, J. Silver, B. Silverman, et al. Scratch: programming for all. Communications of the ACM, 520 (11):0 60–67, 2009. OpenAlex ↗ · Scholar ↗
- R. Robbes and M. Lanza. How program history can improve code completion. In 2008 23rd IEEE/ACM International Conference on Automated Software Engineering, pages 317–326. IEEE, 2008. OpenAlex ↗ · Scholar ↗
- N. Shazeer. Fast transformer decoding: One write-head is all you need. arXiv preprint arXiv:1911.02150, 2019. OpenAlex ↗ · Scholar ↗
- A. Solar-Lezama. Program synthesis by sketching. University of California, Berkeley, 2008. our card
- N. Sussman. Falsehoods programmers believe about time. https://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time, 2017. Accessed: 2022-01-10. OpenAlex ↗ · Scholar ↗
- I. Sutskever, O. Vinyals, and Q. V. Le. Sequence to sequence learning with neural networks. In Advances in neural information processing systems, pages 3104–3112, 2014. our card
- A. Svyatkovskiy, S. K. Deng, S. Fu, and N. Sundaresan. IntelliCode compose: Code generation using transformer. In Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, pages 1433–1443, 2020. OpenAlex ↗ · Scholar ↗
- M. Tandy. Falsehoods programmers believe about addresses. https://www.mjt.me.uk/posts/falsehoods-programmers-believe-about-addresses/, 2013. Accessed: 2022-01-10. OpenAlex ↗ · Scholar ↗
- L. Tang, E. Ke, N. Singh, N. Verma, and I. Drori. Solving probability and statistics problems by program synthesis. arXiv preprint arXiv:2111.08267, 2021. OpenAlex ↗ · Scholar ↗
- D. Trivedi, J. Zhang, S.-H. Sun, and J. J. Lim. Learning to synthesize programs as interpretable and generalizable policies. In Advances in neural information processing systems, 2021. OpenAlex ↗ · Scholar ↗
- A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin. Attention is all you need. In Advances in neural information processing systems, pages 5998–6008, 2017. our card
- O. Vinyals, I. Babuschkin, W. M. Czarnecki, M. Mathieu, A. Dudzik, J. Chung, D. H. Choi, R. Powell, T. Ewalds, P. Georgiev, et al. Grandmaster level in StarCraft II using multi-agent reinforcement learning. Nature, 5750 (7782):0 350–354, 2019. OpenAlex ↗ · Scholar ↗
- L. Weidinger, J. Mellor, M. Rauh, C. Griffin, J. Uesato, P. Huang, M. Cheng, M. Glaese, B. Balle, A. Kasirzadeh, Z. Kenton, S. Brown, W. Hawkins, T. Stepleton, C. Biles, A. Birhane, J. Haas, L. Rimell, L. A. Hendricks, W. S. Isaac, S. Legassick, G. Irving, and I. Gabriel. Ethical and social risks of harm from language models. CoRR, abs/2112.04359, 2021. URL https://arxiv.org/abs/2112.04359. our card
- P. Yin and G. Neubig. A syntactic neural model for general-purpose code generation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, pages 440–450, 2017. our card
- M. Zavershynskyi, A. Skidanov, and I. Polosukhin. NAPS: Natural program synthesis dataset. arXiv preprint arXiv:1807.03168, 2018. OpenAlex ↗ · Scholar ↗
This page in Markdown https://md.research.elamur.ai/free/en/papers/li-2022-competition-level-code-generation-alphacode/