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

我们能从开发者的错误中吸取教训吗?学习从真正的bug修复中定位和修复真正的bug

Can we learn from developer mistakes? Learning to localize and repair real bugs from real bug fixes

University of Oldenburg(奥尔登堡大学)

Cedric Richter, Heike Wehrheim

摘要:

在开源仓库中找到的真正的bug修复似乎是学习本地化和修复真正bug的完美来源。然而,由于缺乏大规模的bug修复集合,过去很难在训练较大的神经模型时有效地利用真正的bug修复。相比之下,人工bug--通过改变现有源代码产生--可以很容易地以足够的规模获得,因此在现有方法的训练中通常是首选的。尽管如此,在人工错误上训练的本地化和修复模型在面对真正的错误时通常表现不佳。这就提出了一个问题,即在真实的bug修复上训练的bug定位和修复模型在定位和修复真实的bug方面是否更有效。我们通过引入RealIT来解决这个问题,这是一种预训练和微调方法,可以有效地学习从真正的错误修复中定位和修复真正的错误。RealiT首先在传统变异算子产生的大量人工bug上进行预训练,然后在较小的一组真实bug修复上进行微调。微调不需要任何修改的学习算法,因此可以很容易地采用在各种训练场景的缺陷定位或修复(即使当真正的训练数据是稀缺的)。此外,我们发现,使用Realit对真实错误修复进行训练的经验非常强大,可以将现有模型对真实错误的本地化性能提高近一倍,同时保持甚至提高修复性能。

英文摘要:

Real bug fixes found in open source repositories seem to be the perfect source for learning to localize and repair real bugs. However, the absence of large scale bug fix collections has made it difficult to effectively exploit real bug fixes in the training of larger neural models in the past. In contrast, artificial bugs -- produced by mutating existing source code -- can be easily obtained at a sufficient scale and are therefore often preferred in the training of existing approaches. Still, localization and repair models that are trained on artificial bugs usually underperform when faced with real bugs. This raises the question whether bug localization and repair models trained on real bug fixes are more effective in localizing and repairing real bugs. We address this question by introducing RealiT, a pre-train-and-fine-tune approach for effectively learning to localize and repair real bugs from real bug fixes. RealiT is first pre-trained on a large number of artificial bugs produced by traditional mutation operators and then fine-tuned on a smaller set of real bug fixes. Fine-tuning does not require any modifications of the learning algorithm and hence can be easily adopted in various training scenarios for bug localization or repair (even when real training data is scarce). In addition, we found that training on real bug fixes with RealiT is empirically powerful by nearly doubling the localization performance of an existing model on real bugs while maintaining or even improving the repair performance.

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

↑