使用神经机器翻译学习生成纠正补丁
Learning to Generate Corrective Patches using Neural Machine Translation
摘要:
Bug修复通常是一项手工密集型任务。然而,最近的工作提出了自动程序修复的想法,其目的是修复(至少是一个子集)的错误,以不同的方式,如代码突变等以下在同一行的工作自动修复错误,在本文中,我们的目标是利用过去的修复,提出修复当前/未来的错误。具体来说,我们提出了棘轮,一个纠正补丁生成系统,使用神经机器翻译。通过使用神经序列到序列模型学习过去修复中相应的预校正和后校正代码,Ratchet能够为给定的容易出错的代码查询生成修复代码。我们进行了实证研究与五个开源项目,即Ambari,骆驼,Hadoop,Jetty和Wicket,评估棘轮的有效性。我们的研究结果表明,棘轮可以生成语法有效的语句98.7%的时间,并实现F1的措施之间的0.29 - 0.83的实际修复采用的代码库。此外,我们使用20名参与者进行定性验证,看看生成的语句是否有助于纠正错误。我们的调查显示,Ratchet的输出被认为在许多情况下有助于修复错误,即使修复不是100%正确。
英文摘要:
Bug fixing is generally a manually-intensive task. However, recent work has proposed the idea of automated program repair, which aims to repair (at least a subset of) bugs in different ways such as code mutation, etc. Following in the same line of work as automated bug repair, in this paper we aim to leverage past fixes to propose fixes of current/future bugs. Specifically, we propose Ratchet, a corrective patch generation system using neural machine translation. By learning corresponding pre-correction and post-correction code in past fixes with a neural sequence-to-sequence model, Ratchet is able to generate a fix code for a given bug-prone code query. We perform an empirical study with five open source projects, namely Ambari, Camel, Hadoop, Jetty and Wicket, to evaluate the effectiveness of Ratchet. Our findings show that Ratchet can generate syntactically valid statements 98.7% of the time, and achieve an F1-measure between 0.29 - 0.83 with respect to the actual fixes adopted in the code base. In addition, we perform a qualitative validation using 20 participants to see whether the generated statements can be helpful in correcting bugs. Our survey showed that Ratchet's output was considered to be helpful in fixing the bugs on many occasions, even if fix was not 100% correct.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。