arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.18494cs.SEcs.LGcs.PL
收藏

通过大型语言模型实现有保证的自动编程

Assured Automatic Programming via Large Language Models

National University of Singapore(新加坡国立大学);Delft University of Technology(代尔夫特理工大学)

Martin Mirchev, Andreea Costea, Abhishek Kr Singh, Abhik Roychoudhury

AI总结:

本研究提出程序-证明协同进化修复引擎,通过迭代细化代码、逻辑规范与测试的一致性,从大型语言模型生成的代码中提取无歧义意图,并提高Dafny数据集上可验证自动生成程序的比例。

摘要:

随着基于人工智能的编码引擎的出现,将自然语言需求转换为标准编程语言中的可执行代码成为可能。然而,人工智能生成的代码可能不可靠,且驱动这些代码的自然语言需求可能具有歧义。换言之,意图可能未被准确捕获在由诸如Copilot等人工智能编码引擎生成的代码中。我们工作的目标是发现程序员意图,同时生成符合该意图的代码以及这一符合性的证明。我们的意图发现方法由一个名为“程序-证明协同进化”的新型修复引擎驱动,其中修复对象是由大型语言模型从同一自然语言描述生成的元组(代码、逻辑规范、测试)。程序和规范捕获了意图的初始操作性和声明性描述,而测试则代表了对意图的具体但部分的理解。我们的目标是通过逐步细化对用户意图的理解,实现程序、规范和测试之间的一致性。通过这一修复过程达到一致性,为我们提供了对意图的正式逻辑描述,该描述随后被翻译回自然语言以供开发者检查。由此产生的意图描述虽然以自然语言表达,但已无歧义。我们展示了通过我们的方法发现的明确意图,如何在最近提出的Dafny编程语言数据集上提高可验证自动生成程序的百分比。

英文摘要:

With the advent of AI-based coding engines, it is possible to convert natural language requirements to executable code in standard programming languages. However, AI-generated code can be unreliable, and the natural language requirements driving this code may be ambiguous. In other words, the intent may not be accurately captured in the code generated from AI-coding engines like Copilot. The goal of our work is to discover the programmer intent, while generating code which conforms to the intent and a proof of this conformance. Our approach to intent discovery is powered by a novel repair engine called program-proof co-evolution, where the object of repair is a tuple (code, logical specification, test) generated by an LLM from the same natural language description. The program and the specification capture the initial operational and declarative description of intent, while the test represents a concrete, albeit partial, understanding of the intent. Our objective is to achieve consistency between the program, the specification, and the test by incrementally refining our understanding of the user intent. Reaching consistency through this repair process provides us with a formal, logical description of the intent, which is then translated back into natural language for the developer's inspection. The resultant intent description is now unambiguous, though expressed in natural language. We demonstrate how the unambiguous intent discovered through our approach increases the percentage of verifiable auto-generated programs on a recently proposed dataset in the Dafny programming language.

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

↑