arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2301.12453cs.SE
收藏

APPT:通过微调预训练模型提升自动补丁正确性预测

APPT: Boosting Automated Patch Correctness Prediction via Fine-tuning Pre-trained Models

Quanjun Zhang, Chunrong Fang, Weisong Sun, Yan Liu, Tieke He, Xiaodong Hao, Zhenyu Chen

AI总结:

本文提出 APPT 技术,通过联合微调预训练模型、LSTM 和分类器来提升自动补丁正确性预测,在 Defects4J 和真实世界补丁上均取得优于现有方法的性能。

摘要:

自动程序修复(APR)旨在无需人工调试即可自动修复软件缺陷,在软件开发和维护中发挥着关键作用。尽管前景广阔,APR 仍长期受到过拟合问题的困扰(即生成的补丁看似合理但实际过拟合)。因此,研究者提出了多种技术来解决过拟合问题。近年来,研究人员采用 BERT 提取代码特征,再将其用于训练补丁正确性预测分类器。然而,BERT 仅被限制用于分类器训练的特征提取,未能从训练过程中获益,可能为被修补代码片段生成次优的向量表示。本文提出 APPT,一种基于预训练模型的自动化补丁正确性评估技术,同时结合预训练与微调。APPT 采用预训练模型作为编码器堆栈,后接 LSTM 堆栈和深度学习分类器。更重要的是,预训练模型与其他组件作为一个完整流水线联合微调,使其完全适配于补丁正确性推理任务。我们在 1,183 个 Defects4J 补丁上进行了广泛实验,实验结果表明 APPT 实现了 79.7% 的预测准确率和 83.2% 的召回率,分别比 CACHE 高出 4.3% 和 6.7%。我们对 49,694 个真实世界补丁的进一步研究表明,与现有表示学习技术相比,APPT 取得了最优性能。我们还进一步研究了每个组件的影响,发现它们均对 APPT 有积极贡献,例如微调过程和 LSTM 堆栈分别使 F1-score 提高了 10.22% 和 4.11%。我们还证明采用更先进的预训练模型可以进一步带来实质性提升,凸显了 APPT 的通用性。

英文摘要:

Automated program repair (APR) aims to fix software bugs automatically without human debugging efforts and plays a crucial role in software development and maintenance. Despite promising, APR is still challenged by a long-standing overfitting problem (i.e., the generated patch is plausible but overfitting). Various techniques have thus been proposed to address the overfitting problem. Recently, researchers have employed BERT to extract code features, which are then used to train a classifier for patch correctness prediction. However, BERT is restricted to feature extraction for classifier training without benefiting from the training process, potentially generating sub-optimal vector representations for patched code snippets. In this paper, we propose APPT, a pre-trained model-based automated patch correctness assessment technique by both pre-training and fine-tuning. APPT adopts a pre-trained model as the encoder stack, followed by an LSTM stack and a deep learning classifier. More importantly, the pre-trained model is fine-tuned in conjunction with other components as a whole pipeline to fully adapt it specifically for reasoning about patch correctness. We conduct an extensive experiment on 1,183 Defects4J patches and the experimental results show that APPT achieves prediction accuracy of 79.7% and recall of 83.2%, outperforming CACHE by 4.3% and 6.7%. Our additional investigation on 49,694 real-world patches shows that APPT achieves the optimum performance compared with existing representation learning techniques. We further investigate the impact of each component and find that they all positively contribute to APPT, e.g., the fine-tuning process and the LSTM stack increase F1-score by 10.22% and 4.11%, respectively. We also prove that adopting advanced pre-trained models can further provide substantial advancement, highlighting the generalizability of APPT.

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

↑