arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2108.07732cs.PLcs.LG
收藏

基于大语言模型的程序合成

Program Synthesis with Large Language Models

Google Research(谷歌研究院);MIT(麻省理工学院)

Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie Cai, Michael Terry, Quoc Le, Charles Sutton

摘要:

本文探讨了目前通用程序设计语言中用于程序合成的大语言模型的局限性。我们在两个新的基准测试MBPP和MathQA-Python上评估了一系列这样的模型(参数在244 M和137 B之间),包括Few-Shot和微调机制。我们的基准测试旨在测量这些模型从自然语言描述合成简短Python程序的能力。MBPP(Mostly Basic Programming Problems)数据集包含974个编程任务,旨在让入门级程序员解决。MathQA基准的Python版本MathQA-Python数据集包含23914个问题,这些问题评估了模型从更复杂的文本合成代码的能力。在这两个数据集上,我们发现合成性能与模型大小呈对数线性关系。我们最大的模型,即使没有对代码数据集进行微调,也可以使用少样本学习和精心设计的提示,从MBPP中合成59.6%的问题的解决方案。在大多数模型大小上,对数据集的保留部分进行微调可以将性能提高约10个百分点。在MathQA-Python数据集上,最大的微调模型达到了83.8%的准确率。更进一步,我们研究了模型参与关于代码的对话的能力,并结合了人类的反馈来改进其解决方案。我们发现,与模型的初始预测相比,来自人类的自然语言反馈将出错率减半。此外,我们还进行了错误分析,以揭示这些模型的不足之处以及最难生成的程序类型。最后,我们通过微调这些模型来预测程序执行的结果,从而探索这些模型的语义基础。我们发现,即使是我们最好的模型通常也无法预测给定特定输入的程序的输出。

英文摘要:

This paper explores the limits of the current generation of large language models for program synthesis in general purpose programming languages. We evaluate a collection of such models (with between 244M and 137B parameters) on two new benchmarks, MBPP and MathQA-Python, in both the few-shot and fine-tuning regimes. Our benchmarks are designed to measure the ability of these models to synthesize short Python programs from natural language descriptions. The Mostly Basic Programming Problems (MBPP) dataset contains 974 programming tasks, designed to be solvable by entry-level programmers. The MathQA-Python dataset, a Python version of the MathQA benchmark, contains 23914 problems that evaluate the ability of the models to synthesize code from more complex text. On both datasets, we find that synthesis performance scales log-linearly with model size. Our largest models, even without finetuning on a code dataset, can synthesize solutions to 59.6 percent of the problems from MBPP using few-shot learning with a well-designed prompt. Fine-tuning on a held-out portion of the dataset improves performance by about 10 percentage points across most model sizes. On the MathQA-Python dataset, the largest fine-tuned model achieves 83.8 percent accuracy. Going further, we study the model's ability to engage in dialog about code, incorporating human feedback to improve its solutions. We find that natural language feedback from a human halves the error rate compared to the model's initial prediction. Additionally, we conduct an error analysis to shed light on where these models fall short and what types of programs are most difficult to generate. Finally, we explore the semantic grounding of these models by fine-tuning them to predict the results of program execution. We find that even our best models are generally unable to predict the output of a program given a specific input.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑