面向SMT辅助的证明导向编程的神经合成研究
Towards Neural Synthesis for SMT-Assisted Proof-Oriented Programming
AI总结:
本文构建了大规模F*程序与证明数据集及片段检查器,研究用AI合成证明导向程序,发现微调小模型性能可比肩GPT-4且成本更低,并验证了基于类型的检索增强技术的显著效果。
摘要:
证明导向的程序将计算内容与程序正确性证明相结合。然而,尽管在F*等语言中使用可满足性模理论(SMT)求解器来自动化证明,编程和证明所涉及的人力仍然相当可观。为了推动使用AI自动化构建证明导向程序的研究,我们整理了一个包含60万行开源F*程序和证明的数据集,其中包括用于从Windows和Linux到Python和Firefox等生产系统的软件。我们的数据集包含约3.2万个顶层F*定义,每个定义代表一个类型导向的程序和证明合成问题,即在给定以F*类型表达的形式规范的情况下生成一个定义。我们提供了一个程序片段检查器,通过查询F*来检查候选解决方案的正确性。我们还报告了该数据集的扩展版本,共包含94万行程序和证明,总计5.4万个顶层F*定义。我们相信这是最大的SMT辅助程序证明语料库,并配有可复现的程序片段检查器。基于该数据集,我们研究了使用AI在F*中合成程序及其证明的方法,并取得了有前景的结果。我们的主要发现是,微调后的小型语言模型(如Phi-2或StarCoder)的性能与大型语言模型(如GPT-4)相比具有优势,且计算成本低得多。我们还识别了各种基于类型的检索增强技术,并发现它们能显著提升性能。通过详细的错误分析和案例研究,我们识别了模型和技术的潜在优势与不足,并提出了未来改进的方向。
英文摘要:
Proof-oriented programs mix computational content with proofs of program correctness. However, the human effort involved in programming and proving is still substantial, despite the use of Satisfiability Modulo Theories (SMT) solvers to automate proofs in languages such as F*. Seeking to spur research on using AI to automate the construction of proof-oriented programs, we curate a dataset of 600K lines of open-source F* programs and proofs, including software used in production systems ranging from Windows and Linux to Python and Firefox. Our dataset includes around 32K top-level F* definitions, each representing a type-directed program and proof synthesis problem producing a definition given a formal specification expressed as an F* type. We provide a program fragment checker that queries F* to check the correctness of candidate solutions. We also report on an extended version of our dataset containing a total of 940K lines of programs and proofs, with a total of 54k top-level F* definitions. We believe this is the largest corpus of SMT-assisted program proofs coupled with a reproducible program-fragment checker. Grounded in this dataset, we investigate the use of AI to synthesize programs and their proofs in F*, with promising results. Our main finding in that the performance of fine-tuned smaller language models (such as Phi-2 or StarCoder) compare favorably with large language models (such as GPT-4), at a much lower computational cost. We also identify various type-based retrieval augmentation techniques and find that they boost performance significantly. With detailed error analysis and case studies, we identify potential strengths and weaknesses of models and techniques and suggest directions for future improvements.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。