[论文解读] Beep: Fine-grained Fix Localization by Learning to Predict Buggy Code Elements
该论文提出 Beep,一种深度学习模型,能够以细粒度精度定位错误代码标记并预测所需的修复操作。该模型在 CoCoNut 数据集上使用 AST 路径进行训练,多个基准测试中的平均首次排名(Mean First Rank)为 7–12,召回率@1(Recall@1)为 30–45%,通过消除过拟合并提升效率,在两个修复流水线中实现了 100% 正确的补丁生成。
Software Fault Localization refers to the activity of finding code elements (e.g., statements) that are related to a software failure. The state-of-the-art fault localization techniques, however, produce coarse-grained results that can deter manual debugging or mislead automated repair tools. In this work, we focus specifically on the fine-grained identification of code elements (i.e., tokens) that must be changed to fix a buggy program: we refer to it as fix localization. This paper introduces a neural network architecture (named Beep) that builds on AST paths to predict the buggy code element as well as the change action that must be applied to repair a program. Leveraging massive data of bugs and patches within the CoCoNut dataset, we trained a model that was (1) effective in localizing the buggy tokens with the Mean First Rank significantly higher than a statistics based baseline and a machine learning-based baseline, and (2) effective in predicting the repair operators (with the associated buggy code elements) with a Recall@1= 30-45% and the Mean First Rank=7-12 (evaluated by CoCoNut, ManySStuBs4J, and Defects4J datasets). To showcase how fine-grained fix localization can help program repair, we employ it in two repair pipelines where we use either a code completion engine to predict the correct token or a set of heuristics to search for the suitable donor code. A key strength of accurate fix localization for program repair is that it reduces the chance of patch overfitting, a challenge in generate-and-validate automated program repair: both two repair pipelines achieve a correctness ratio of 100%, i.e., all generated patches are found to be correct. Moreover, accurate fix localization helps enhance the efficiency of program repair.
研究动机与目标
- 为解决手动和自动化调试中粗粒度故障定位的局限性,该局限性阻碍了高效且准确的错误修复。
- 通过实现对错误代码元素的精确定位,减少生成与验证型自动化程序修复(APR)中的过拟合。
- 通过识别必须修改的确切标记和更改操作符,提升 APR 流水线的效率与正确性。
- 开发一种神经网络模型,利用 AST 路径和大规模错误/补丁数据,预测细粒度的代码更改。
- 证明细粒度修复定位可借助代码补全或基于启发式的修复流水线实现 100% 正确的补丁生成。
提出的方法
- Beep 使用一种神经网络架构,通过处理抽象语法树(AST)路径来编码代码元素周围的结构与语义上下文。
- 该模型在 CoCoNut 数据集上进行训练,该数据集包含来自真实世界软件项目的数百万个错误-修复对。
- 采用序列到序列学习方法,联合预测错误标记和对应的修复操作符(例如,UPDATE、INSERT、DELETE)。
- 该模型利用对 AST 路径的注意力机制,聚焦于错误代码周围的相关语法与语义特征。
- 评估了两种修复流水线:一种使用代码补全引擎预测正确标记,另一种使用启发式方法搜索源代码片段。
- 该方法在 CoCoNut、ManySStuBs4J 和 Defects4J 数据集上进行评估,使用标准指标如平均首次排名和召回率@1。
实验结果
研究问题
- RQ1深度学习模型能否在方法内部精确定位确切的错误标记,而不仅仅是粗粒度的行或方法级别?
- RQ2该模型能否准确预测与错误标记相关的正确修复操作符(例如,UPDATE、INSERT)?
- RQ3细粒度修复定位是否通过仅对实际错误元素进行更改,从而减少对非错误代码的更改,降低过拟合风险?
- RQ4使用 Beep 预测结果的修复流水线能否实现 100% 的补丁生成正确率?
- RQ5在故障定位准确性和修复有效性方面,Beep 的性能与基线故障定位技术相比如何?
主要发现
- Beep 在 CoCoNut、ManySStuBs4J 和 Defects4J 上的错误标记定位中实现了 7–12 的平均首次排名,显著优于统计和机器学习基线方法。
- 该模型在预测正确修复操作符方面的召回率@1 达到 30–45%,表明其在识别所需更改方面具有强大精度。
- 当集成到两个修复流水线中时,Beep 实现了 100% 的正确率,即所有生成的补丁均正确并通过了所有测试用例。
- 使用细粒度修复定位可降低过拟合风险,确保仅对实际错误元素进行更改。
- 由于避免了对非错误代码元素进行无意义更改,修复流水线效率更高,显著缩小了搜索空间。
- Beep 在多种基准测试中泛化良好,包括 Defects4J 中的真实工业项目和 ManySStuBs4J 中的大规模测试套件。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。