arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2301.01113cs.SEcs.LG
收藏

Invalidator:通过语义和句法推理的自动补丁正确性评估

Invalidator: Automated Patch Correctness Assessment via Semantic and Syntactic Reasoning

The University of Melbourne(墨尔本大学);Hanoi University of Science and Technology(河内理工大学);Singapore Management University(新加坡管理大学)

Thanh Le-Cong, Duc-Minh Luong, Xuan Bach D. Le, David Lo, Nhat-Hoa Tran, Bui Quang-Huy, Quyet-Thang Huynh

摘要:

自动程序修复(APR)面临着测试过拟合的挑战,其中生成的补丁通过验证测试,但未能推广。现有的补丁评估方法涉及生成新的测试或手动检查,这可能是耗时的或有偏见的。在本文中,我们提出了一种新的技术,INVALIDATOR,通过语义和语法推理自动评估APR生成的补丁的正确性。INVALIDATOR利用程序不变量来推理程序语义,同时还通过使用预训练的语言模型从大型代码语料库中学习的语言语义来捕获程序语法。给定一个有缺陷的程序和开发人员修补的程序,INVALIDATOR推断出这两个程序上可能的不变量。然后,INVALIDATOR确定一个APR生成的补丁过拟合,如果:(1)它违反了正确的规范或(2)保持了原始错误程序的错误行为。如果我们的方法无法基于不变量确定过拟合补丁,INVALIDATOR将利用来自标记补丁的训练模型来基于程序语法评估补丁正确性。INVALIDATOR的好处有三方面。首先,INVALIDATOR利用语义和句法推理来增强其区分能力。其次,INVALIDATOR不需要生成新的测试用例,而是只依赖于当前的测试套件,并使用不变式推理来概括程序行为。第三,INVALIDATOR是完全自动化的。实验结果表明,INVALIDATOR优于现有的方法在准确性和F-措施,正确识别79%的过拟合补丁和检测23%以上的过拟合补丁比最好的基线。

英文摘要:

Automated program repair (APR) faces the challenge of test overfitting, where generated patches pass validation tests but fail to generalize. Existing methods for patch assessment involve generating new tests or manual inspection, which can be time-consuming or biased. In this paper, we propose a novel technique, INVALIDATOR, to automatically assess the correctness of APR-generated patches via semantic and syntactic reasoning. INVALIDATOR leverages program invariants to reason about program semantics while also capturing program syntax through language semantics learned from a large code corpus using a pre-trained language model. Given a buggy program and the developer-patched program, INVALIDATOR infers likely invariants on both programs. Then, INVALIDATOR determines that an APR-generated patch overfits if: (1) it violates correct specifications or (2) maintains erroneous behaviors from the original buggy program. In case our approach fails to determine an overfitting patch based on invariants, INVALIDATOR utilizes a trained model from labeled patches to assess patch correctness based on program syntax. The benefit of INVALIDATOR is threefold. First, INVALIDATOR leverages both semantic and syntactic reasoning to enhance its discriminative capability. Second, INVALIDATOR does not require new test cases to be generated, but instead only relies on the current test suite and uses invariant inference to generalize program behaviors. Third, INVALIDATOR is fully automated. Experimental results demonstrate that INVALIDATOR outperforms existing methods in terms of Accuracy and F-measure, correctly identifying 79% of overfitting patches and detecting 23% more overfitting patches than the best baseline.

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

↑