An Empirical Study on Learning Bug-Fixing Patches in the Wild via Neural Machine Translation

An Empirical Study on Learning Bug-Fixing Patches in the Wild via Neural Machine Translation
复制标题

DOI:
10.1145/3340544
复制
发表时间:
2018-12
期刊:
ACM Transactions on Software Engineering and Methodology (TOSEM)
影响因子:
--
通讯作者:
Michele Tufano;Cody Watson;G. Bavota;M. D. Penta;Martin White;D. Poshyvanyk
Michele Tufano;Cody Watson;G. Bavota;M. D. Penta;Martin White;D. Poshyvanyk
中科院分区:
其他
文献类型:
--
作者:
Michele Tufano;Cody Watson;G. Bavota;M. D. Penta;Martin White;D. Poshyvanyk

文献摘要

被引文献

相似文献

代码库中有数百万个修复了许多bug的开源项目。可以利用软件开发历史的这种扩散来学习如何修复常见的编程错误。为了探索这种潜力,我们进行了一项实证研究,以评估使用神经机器翻译技术学习修复真实的缺陷的补丁的可行性。首先,我们从GitHub上托管的项目的更改历史中挖掘数百万个错误修复,以提取此类错误修复的有意义的示例。接下来,我们抽象出错误代码和相应的修复代码,并使用它们来训练一个编码器-解码器模型,该模型能够将错误代码翻译成其修复版本。在我们的实证调查中,我们发现这样的模型能够修复数千种独特的错误方法。总的来说,这个模型能够在9- 50%的情况下预测开发人员生成的固定补丁,这取决于我们允许它生成的候选补丁的数量。此外,该模型能够模拟各种不同的抽象树操作,并在一瞬间生成候选补丁。
Millions of open source projects with numerous bug fixes are available in code repositories. This proliferation of software development histories can be leveraged to learn how to fix common programming bugs. To explore such a potential, we perform an empirical study to assess the feasibility of using Neural Machine Translation techniques for learning bug-fixing patches for real defects. First, we mine millions of bug-fixes from the change histories of projects hosted on GitHub in order to extract meaningful examples of such bug-fixes. Next, we abstract the buggy and corresponding fixed code, and use them to train an Encoder-Decoder model able to translate buggy code into its fixed version. In our empirical investigation, we found that such a model is able to fix thousands of unique buggy methods in the wild. Overall, this model is capable of predicting fixed patches generated by developers in 9--50% of the cases, depending on the number of candidate patches we allow it to generate. Also, the model is able to emulate a variety of different Abstract Syntax Tree operations and generate candidate patches in a split second.