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

ComPass:基于对比学习的程序修复中自动补丁正确性评估

ComPass: Contrastive Learning for Automated Patch Correctness Assessment in Program Repair

Nanjing University of Science and Technology(南京理工大学);Nanjing University(南京大学)

Quanjun Zhang, Ye Shang, Haichuan Hu, Chunrong Fang, Zhenyu Chen, Liang Xiao

AI总结:

ComPass利用对比学习和数据增强解决程序修复中补丁过拟合问题,通过代码转换规则生成语义保持的代码片段,提升补丁正确性评估的准确性。

摘要:

自动化程序修复(APR)旨在减少手动调试工作量,在软件维护中发挥重要作用。尽管取得显著进展,APR在生成过拟合补丁方面仍存在局限,即生成的补丁通过现有测试套件但实际错误。为此,本文提出ComPass,一种基于预训练语言模型(PLM)的自动补丁正确性评估(APCA)方法,利用对比学习和数据增强解决先前工作的技术限制。ComPass通过代码转换规则生成语义保持的代码片段,用于未标记的预训练语料库和标记的微调补丁。ComPass通过对比学习预训练PLM,捕捉具有相同语义但不同结构的代码特征。最后,ComPass整合补丁代码片段的表示嵌入,并通过二分类器联合微调PLM以评估补丁代码的正确性。在Defects4J的2274个真实世界补丁上实验表明,ComPass实现了88.35%的准确率,显著优于最先进的基线APPT。

英文摘要:

Automated program repair (APR) attempts to reduce manual debugging efforts and plays a vital role in software maintenance. Despite remarkable progress, APR is still limited in generating overfitting patches, i.e., patches passing available test suites but incorrect. This issue, known as patch overfitting, has become a key concern in the APR community, with numerous approaches proposed to address it. Very recent work proposes a pre-trained language model (PLM)-based automated patch correctness assessment (APCA) approach, indicating the potential of such PLMs in reasoning about patch correctness. Despite being promising, it is still far from perfect due to various limitations, such as the training paradigm and training dataset. In this paper, we present ComPass, a PLM-based APCA approach that leverages contrastive learning and data augmentation to address the technical limitations of prior work. Our work is inspired by the opportunity to integrate contrastive learning with recent PLMs in the field of patch correctness assessment, where large-scale labeled patches are difficult to obtain. ComPass utilizes code transformation rules to generate semantic-preserving code snippets for both unlabeled pre-training corpus and labeled fine-tuning patches. ComPass then pre-trains PLMs with contrastive learning, which captures code features with the same semantics but different structures. ComPass finally integrates representation embeddings of patch code snippets and fine-tunes PLMs with a binary classifier jointly to assess patch code correctness. Experimental results on 2274 real-world patches from Defects4J demonstrate that ComPass achieves an accuracy of 88.35%, significantly outperforming state-of-the-art baseline APPT.

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

↑