arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2312.15955cs.SE
收藏

通过细粒度模式挖掘提升基于冗余的自动化程序修复

Boosting Redundancy-based Automated Program Repair by Fine-grained Pattern Mining

Jiajun Jiang, Fengjie Li, Zijie Zhao, Zhirui Ye, Mengjiao Liu, Bo Wang, Hongyu Zhang, Junjie Chen

AI总结:

针对基于冗余的自动化程序修复方法修复错误少、补丁错误多的问题,提出含两级模式挖掘的Repatt技术,在Defects4J基准上实验显示其能提升正确补丁数量、精度,结合排序策略后修复效果更优。

摘要:

基于冗余的自动化程序修复(APR)通过参考现有源代码生成补丁,因其能有效修复真实世界的错误且具有良好的可解释性而备受关注。然而,由于现有方法要么要求存在多行相似代码,要么随机参考现有代码,它们只能修复少量错误且生成大量不正确的补丁,阻碍了其在实际中的广泛应用。在这项工作中,我们旨在通过探索更有效的源代码复用方法来提高基于冗余的APR的有效性,以增加正确补丁的数量并减少不正确的补丁。具体而言,我们提出了一种名为Repatt的新修复技术,该技术包含一个两级模式挖掘过程(即令牌级和表达式级)来指导有效的补丁生成。我们在广泛使用的Defects4J基准上进行了大量实验,并将Repatt与十种最先进的APR方法进行了比较。结果表明,在提供完美故障定位的情况下,与最新的基于大语言模型(LLM)和深度学习的方法相比,它能修复9个独特的错误;与传统修复方法相比,能修复19个独特的错误。此外,在实际应用中完美故障定位未知的情况下,尽管Repatt修复的错误较少,但其补丁精度显著高于基线方法,达到83.8%。而且,我们进一步提出了一种有效的补丁排序策略,以结合Repatt和基线方法的优势。结果显示,仅考虑Top-1补丁时,它能修复124个错误,比性能最佳的修复方法多修复39个错误。这些结果证明了我们的方法在实际应用中的有效性。

英文摘要:

Redundancy-based automated program repair (APR), which generates patches by referencing existing source code, has gained much attention since they are effective in repairing real-world bugs with good interpretability. However, since existing approaches either demand the existence of multi-line similar code or randomly reference existing code, they can only repair a small number of bugs with many incorrect patches, hindering their wide application in practice. In this work, we aim to improve the effectiveness of redundancy-based APRs by exploring more effective source code reuse methods for improving the number of correct patches and reducing incorrect patches. Specifically, we have proposed a new repair technique named Repatt, which incorporates a two-level pattern mining process for guiding effective patch generation (i.e., token and expression levels). We have conducted an extensive experiment on the widely-used Defects4J benchmark and compared Repatt with ten state-of-the-art APR approaches. The results show that it complements existing approaches by repairing 9 unique bugs compared with the latest Large Language Model (LLM)-based and deep learning-based methods and 19 unique bugs compared with traditional repair methods when providing the perfect fault localization. In addition, when the perfect fault localization is unknown in real practice, Repatt significantly outperforms the baseline approaches by achieving much higher patch precision, i.e., 83.8\%, although it repairs fewer bugs. Moreover, we further proposed an effective patch ranking strategy for combining the strength of Repatt and the baseline methods. The result shows that it repairs 124 bugs when only considering the Top-1 patches and improves the best-performing repair method by repairing 39 more bugs. The results demonstrate the effectiveness of our approach for practical use.

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

↑