arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2106.08253cs.SEcs.AI
收藏

一种用于神经程序修复的语法引导编辑解码器

A Syntax-Guided Edit Decoder for Neural Program Repair

Peking University(北京大学);Stony Brook University(石溪大学)

Qihao Zhu, Zeyu Sun, Yuan-an Xiao, Wenjie Zhang, Kang Yuan, Yingfei Xiong, Lu Zhang

摘要:

自动程序修复(APR)有助于提高软件开发和维护的效率。最近的APR技术使用深度学习,特别是编码器-解码器架构来生成补丁。虽然现有的基于DL的APR方法提出了不同的编码器架构,解码器仍然是标准的,它生成一个序列的令牌一个接一个地取代错误的语句。该解码器有多个限制:1)允许生成语法不正确的程序,2)低效地表示小的编辑,以及3)不能生成项目特定的标识符。在本文中,我们提出了一个语法引导的编辑解码器,占位符生成。修补程序在多个方面都是新颖的:1)修补程序生成编辑而不是修改的代码,允许有效地表示小的编辑; 2)修补程序是语法引导的,具有新颖的提供者/决定者架构,以确保修补程序的语法正确性和准确生成; 3)修补程序生成占位符,稍后可以实例化为项目特定的标识符。我们进行了实验,以评估395缺陷从Defects 4J v1.2和420额外的缺陷从Defects 4J v2.0的错误。我们的研究结果表明,在Defects 4J v1.2上,Budder修复了53个bug,比之前针对单块bug(TBar)的最先进方法提高了21.4%。重要的是,据我们所知,Aprider是第一个基于DL的APR方法,它在这个数据集上的表现优于传统的APR方法。此外,Adjuster还修复了Defects 4J v2.0中的19个bug,比TBar(8个bug)多137.5%,比SimFix(2个bug)多850%。这一结果表明,与现有的APR方法相比,该方法具有更好的推广性。

英文摘要:

Automated Program Repair (APR) helps improve the efficiency of software development and maintenance. Recent APR techniques use deep learning, particularly the encoder-decoder architecture, to generate patches. Though existing DL-based APR approaches have proposed different encoder architectures, the decoder remains to be the standard one, which generates a sequence of tokens one by one to replace the faulty statement. This decoder has multiple limitations: 1) allowing to generate syntactically incorrect programs, 2) inefficiently representing small edits, and 3) not being able to generate project-specific identifiers. In this paper, we propose Recoder, a syntax-guided edit decoder with placeholder generation. Recoder is novel in multiple aspects: 1) Recoder generates edits rather than modified code, allowing efficient representation of small edits; 2) Recoder is syntax-guided, with the novel provider/decider architecture to ensure the syntactic correctness of the patched program and accurate generation; 3) Recoder generates placeholders that could be instantiated as project-specific identifiers later. We conduct experiments to evaluate Recoder on 395 bugs from Defects4J v1.2 and 420 additional bugs from Defects4J v2.0. Our results show that Recoder repairs 53 bugs on Defects4J v1.2, which achieves 21.4% improvement over the previous state-of-the-art approach for single-hunk bugs (TBar). Importantly, to our knowledge, Recoder is the first DL-based APR approach that has outperformed the traditional APR approaches on this dataset. Furthermore, Recoder also repairs 19 bugs on the additional bugs from Defects4J v2.0, which is 137.5% more than TBar (8 bugs) and 850% more than SimFix (2 bugs). This result suggests that Recoder has better generalizability than existing APR approaches.

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

↑