Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

Program Synthesis with Large Language Models

Large language models can write short Python programs from plain descriptions

  • Problem Most program synthesis work targets restricted domain-specific languages, so general-purpose languages such as Python have been hard to reach.
  • Method The authors prompt or fine-tune Transformer language models from 244 million to 137 billion parameters on two new benchmarks, MBPP and MathQA-Python.
  • Results The largest model, at 137B, solves 59.6% of MBPP problems given 80 samples, using few-shot prompts.

Why general-purpose code synthesis is hard to reach

Program synthesis has a long history, but most learned and symbolic systems have been built for restricted domain-specific languages or for languages designed around synthesis. Mainstream languages such as Python and C++ have seldom been the output target, which narrows where such tools can help novice and expert programmers.

The study combines two trends: large language models that produce natural language text, and machine learning applied to source code for software engineering tasks. A model that emits tokens does not need an explicit grammar of the target language, because it learns the syntax from data. The specification can also be lighter than in classical work.

A short description, optionally with a few input-output examples, can replace logical constraints.

The authors ask how a set of Transformer language models performs on short programs in general-purpose languages, with Python as the target. Competition-style benchmarks such as APPS draw on contest problems whose statements hide the underlying algorithm, and the authors conjecture that this explains the low scores reported on them. HumanEval, introduced with Codex, is close to MBPP in spirit, but its I/O examples vary in number and formatting, whereas MBPP consistently gives three input-output examples as assert statements.

The two benchmarks and how they were built

MBPP contains 974 short Python programs written by crowdworkers who have basic knowledge of Python. Each item has a problem statement, a single self-contained function and three test cases, together with a reference solution that passes all three. In a random sample of 100 questions, 58% were mathematical, 43% involved list processing, 19% required string processing, 9% involved integer sequences and 2% used other data structures.

The reference solutions average 6.8 lines, with a median of 5 and a maximum of 50.

Some questions had unusual signatures, were ambiguous, or had tests that did not match their descriptions, so the authors manually edited and pruned a subset. That subset, the edited dataset, has 426 hand-verified questions, each with a standard Python signature and tests that match the description. Experiments hold out 10 problems for few-shot prompts, use 500 as the test set and 374 for fine-tuning, and keep the rest for validation.

MathQA-Python translates the ground-truth MathQA programs into Python, since the MathQA programs are written in a domain-specific language. Because correctness is checked by running code, problems whose code does not evaluate to the declared numerical answer were removed, which dropped 45% of problems and left 23914. Those 23914 problems are split into 19209 for training, 2822 for validation and 1883 for testing.

MBPP exercises more imperative control flow such as loops and conditionals, whereas MathQA-Python is mostly straight-line code with more complex natural language.

How models are pre-trained, prompted and scored

The models are dense, left-to-right, decoder-only Transformers whose non-embedding parameter counts range from 244 million to 137 billion. Pre-training used 2.97B documents, tokenized into 2.81T BPE tokens with a 32K vocabulary through the SentencePiece library. The pre-training mix includes web sites with code and text, but source code files were not specifically included except where code appeared on other web sites.

In few-shot mode, held-out example problems are concatenated into a prompt, the new problem is appended, and the pre-trained model completes the program without further training. The prompt for MathQA-Python takes the same form, with four solved examples.

Fine-tuning continues training on the training set. For MBPP the set is small, so the largest model is trained with a learning rate of 3e-5 for only 100 steps, while MathQA-Python is fine-tuned for longer. The execution results used for the output-prediction experiments were generated by roughly analogous methods.

Each sampled program is executed. An MBPP sample counts as correct when it passes the test cases, and a MathQA-Python sample counts when it returns the declared answer. The authors measure functional correctness instead of proxies such as token accuracy or BLEU. Two summaries are used: the fraction of problems solved by at least one of 80 samples, and the fraction of all samples that solve their own problem.

The first is the metric a practitioner would get by filtering samples with the tests, while the second describes how reliable individual samples are.

How MBPP solve rates change with size and fine-tuning

Measured by the fraction of problems solved by any sample, performance is linear in the logarithm of model size. The largest model, at 137B, solves 59.6% of MBPP problems given 80 samples.

Fine-tuning raises the fraction of problems solved by about 10 percentage points for most model sizes. On this problem-level metric, the fine-tuning boost looks roughly constant across sizes. The fraction-of-samples metric scales less predictably, and its gap between fine-tuned and few-shot results varies more with size.

On the 100 problems that appear in both MBPP versions, few-shot solve rates rise from 63% on the original set to 79% on the edited set. The authors read this as the edited tasks being easier, and the comparison covers only those 100 shared problems rather than all 426 edited questions.

How prompt examples and their choice matter

For the 137B model, few-shot solve rates are 43.2% with zero examples, 55.2% with one, 59.0% with two and 58.4% with three. The zero-example prompt gives only the function name, and the 59.0 in the table is the figure that varies by a small run-to-run amount from the 59.6 reported elsewhere.

Including three asserts instead of one solved only 3 more problems, so the number of asserts matters little. The authors read this as the model mostly not using test asserts to reason about semantics, even though it sometimes overfits them, as discussed in Section 4.5.

The specific examples chosen matter much more. Seed 14 solves 60% of tasks, while many other example sets solve far fewer. Long, repetitive samples that do not fit the 512-token context window are a common failure for weak prompts, and compact prompts that use external libraries work best.

The solved sets overlap only partly: seed 13 solves 19 problems that seed 14 does not. Counting a problem as solved if any seed solves it raises the share of problems solved from 59.6% to 66.4%.

Where programs fail and whether passing tests means correct semantics

For the 137B model, over 63% of all failures are failed test assertions rather than runtime or syntax errors.

Of those 50, 33 solutions pass the normal tests (66%), and 29 also pass the challenge tests (58%). The gap implies roughly 12% of counted solutions would fail adversarial tests, so the authors estimate that almost 90% of solutions generalize in the sense measured.

In task 11, the normal tests accept a program that removes every occurrence of the character, while the challenge tests require removing only the first and last occurrence. Occasionally the model reads the asserts and hard-codes an if-expression. In the Woodall example, the program returns True only for 383, which is one of the three asserts.

Overlap between MBPP solutions and the pre-training set is small, which the authors argue reduces the chance that results come from memorization.

MathQA results across formats and sizes

Accuracy is the percentage of test tasks solved by any sample, and for the 137B model it is 16.7% few-shot and 83.8% fine-tuned on MathQA-DSL. On MathQA-Python, the 137B model reaches 33.4% few-shot accuracy and 81.2% fine-tuned accuracy.

The abstract attributes the 83.8% fine-tuned figure to MathQA-Python, while Table 6 gives 83.8% for MathQA-DSL and 81.2% for MathQA-Python; this article follows the table.

The few-shot models do better on Python, which the authors attribute to the DSL being unlikely to resemble pre-training text. The fine-tuned models score slightly higher on the DSL format, suggesting the fine-tuning set is large enough for the model to overcome its unfamiliarity with the DSL.

For a harder problem, the 137B model fine-tuned on Python solved the problem in fewer than 10% of samples without a hint. With the parenthesized hint about computing the volume of acid, correct answers appeared in 40% of samples. Prompting also elicited a line-by-line explanation, but the explanation of t0 is incorrect, and the explanations contain various inaccuracies.

The authors present this as a starting point for future work rather than a thorough evaluation.

Improving code through dialog

The dialog starts with a user description of a function, the model asks for an example, and the user supplies a test assertion. The model's attempt is run against the test, and when it fails, the user returns a short hint and the model revises the code.

Few-shot performance is 30% without human feedback and rises to 65% after four dialog turns, a 50% error reduction. The abstract states the same result as natural language feedback halving the error rate compared to the initial prediction.

The model uses the short natural language hints both to repair its outputs and to clarify under-specified prompts. The authors describe these collaboration experiments as preliminary.

Predicting program outputs

Both few-shot and fine-tuned models were asked to predict a program's output for a particular input, and even the largest models were generally unable to do so. The authors treat this ability as a prerequisite for claiming that a model understands the programs it synthesizes.

The authors note that they did not train on a much larger set of execution examples, which they leave as future work.

Limitations

The benchmark therefore does not yet cover the breadth and complexity of program synthesis.

Many solved problems are solved by only one or two of 80 samples, so the approach depends on drawing many samples and checking them by machine. The authors also note that some problems are simply unsolvable for the models.

The models have not been treated for safety, and they can learn biased behavior or reveal sensitive training data, so output analysis is needed before practical use. The pre-training step used an estimated 451MWh of energy and produced 26 tCO2e.

Paper info

Authors
Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie Cai, Michael Terry, Quoc Le, Charles Sutton
Venue
arXiv · Preprint
First published
2021-8-16
Added
2026-11-12
Updated
2021-8-16
Version
v1
arXiv
2108.07732
Category
cs.PL · cs.LG
Original paper terms
arXiv non-exclusive 1.0
What we show
Paper info and commentary

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Quote from the paper

Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie Cai, Michael Terry, Quoc Le, Charles Sutton (2021). Program Synthesis with Large Language Models. arXiv:2108.07732v1. https://arxiv.org/abs/2108.07732v1

BibTeX
@misc{austin2021program,
  title = {{Program Synthesis with Large Language Models}},
  author = {Jacob Austin and Augustus Odena and Maxwell Nye and Maarten Bosma and Henryk Michalewski and David Dohan and Ellen Jiang and Carrie Cai and Michael Terry and Quoc Le and Charles Sutton},
  year = {2021},
  eprint = {2108.07732},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2108.07732v1}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up