arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2303.07263cs.SE
收藏

InferFix:使用LLM进行端到端程序修复

InferFix: End-to-End Program Repair with LLMs

Matthew Jin, Syed Shahriar, Michele Tufano, Xin Shi, Shuai Lu, Neel Sundaresan, Alexey Svyatkovskiy

摘要:

软件开发的生存周期深受bug的影响:它们的引入、识别和最终的解决方案占软件成本的很大一部分。这促使软件工程研究人员和从业人员提出不同的方法来自动识别和修复软件缺陷。通过Few-Shot演示学习和指令提示,大语言模型已经适应了程序修复任务,将其视为填充任务。然而,这些模型只专注于学习从公共存储库中挖掘的未分类错误的一般错误修复模式。在本文中,我们提出了InferFix:一个基于transformer的程序修复框架与最先进的静态分析器配对,以修复关键的安全和性能错误。InferFix结合了检索器-通过对比学习目标预训练的Transformer编码器模型,其目的是搜索语义等效的错误和相应的修复;和生成器-一个大语言模型(Codex Cushman)对监督错误修复数据进行微调,并通过错误类型注释和从外部非参数存储器检索的语义相似的修复来增强提示。为了训练和评估我们的方法,我们策划了InferredBugs,这是一个新颖的、元数据丰富的bug数据集,通过对数千个Java和C#存储库的更改历史执行Infer静态分析器来提取。我们的评估表明,InferFix优于强大的LLM基线,在C#中生成修复的前1准确率为65.6%,在Java中为76.8%。我们将讨论InferFix与Infer在微软的部署,Infer提供了一个端到端的解决方案,用于检测,分类和定位错误,以及修复和验证候选补丁,集成在持续集成管道中,以自动化软件开发工作流程。

英文摘要:

Software development life cycle is profoundly influenced by bugs: their introduction, identification, and eventual resolution account for a significant portion of software cost. This has motivated software engineering researchers and practitioners to propose different approaches for automating the identification and repair of software defects. Large language models have been adapted to the program repair task through few-shot demonstration learning and instruction prompting, treating this as an infilling task. However, these models have only focused on learning general bug-fixing patterns for uncategorized bugs mined from public repositories. In this paper, we propose InferFix: a transformer-based program repair framework paired with a state-of-the-art static analyzer to fix critical security and performance bugs. InferFix combines a Retriever -- transformer encoder model pretrained via contrastive learning objective, which aims at searching for semantically equivalent bugs and corresponding fixes; and a Generator -- a large language model (Codex Cushman) finetuned on supervised bug-fix data with prompts augmented via bug type annotations and semantically similar fixes retrieved from an external non-parametric memory. To train and evaluate our approach, we curated InferredBugs, a novel, metadata-rich dataset of bugs extracted by executing the Infer static analyzer on the change histories of thousands of Java and C# repositories. Our evaluation demonstrates that InferFix outperforms strong LLM baselines, with a top-1 accuracy of 65.6% for generating fixes in C# and 76.8% in Java. We discuss the deployment of InferFix alongside Infer at Microsoft which offers an end-to-end solution for detection, classification, and localization of bugs, as well as fixing and validation of candidate patches, integrated in the continuous integration pipeline to automate the software development workflow.

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

↑