A large body of the literature on automated program repair develops approaches where patches are automatically generated to be validated against an oracle (e.g., a test suite). Because such an oracle can be imperfect, the generated patches, although validated by the oracle, may actually be incorrect. Our empirical work investigates different representation learning approaches for code changes to derive embeddings that are amenable to similarity computations of patch correctness identification, and assess the possibility of accurate classification of correct patch by combining learned embeddings with engineered features. Experimental results demonstrate the potential of learned embeddings to empower Leopard (a patch correctness predicting framework implemented in this work) with learning algorithms in reasoning about patch correctness: a machine learning predictor with BERT transformer-based learned embeddings associated with XGBoost achieves an AUC value of about 0.803 in the prediction of patch correctness on a new dataset of 2,147 labeled patches that we collected for the experiments. Our investigations show that deep learned embeddings can lead to complementary/better performance when comparing against the state-of-the-art, PATCH-SIM, which relies on dynamic information. By combining deep learned embeddings and engineered features, Panther (the upgraded version of Leopard implemented in this work) outperforms Leopard with higher scores in terms of AUC, +Recall and -Recall, and can accurately identify more (in)correct patches that cannot be predicted by the classifiers only with learned embeddings or engineered features. Finally, we use an explainable ML technique, SHAP, to empirically interpret how the learned embeddings and engineered features are contributed to the patch correctness prediction.
How Different Is It Between Machine-Generated and Developer-Provided Patches? An Empirical Study on The Correct Patches Generated by Automated Program Repair Techniques
背景资料:多年来,自动程序修复(Automated Program Repair,APR)由于能够降低修复错误的成本而受到学术界和工业界的广泛关注。然而,如何评估补丁的正确性仍然是一个开放的挑战。两种广泛采用的方法来应对这一挑战,包括手动检查和使用自动生成的测试进行验证,都是有偏见的(即,分别遭受主观性和低精度)。目的:为了解决这一问题,我们建议进行实证研究,了解正确的补丁,由现有的国家的最先进的APR技术,旨在为未来的补丁评估提供指导方针。方法:为此,我们首先提出了一个文献综述(LR)报告的正确补丁生成的最新技术的缺陷4J基准和收集177个正确的补丁后,健全检查的过程。我们研究了这些机器生成的正确补丁是如何实现语义等价的,但与开发人员提供的补丁相比在语法上存在差异,这些补丁如何在不同的项目和APR技术中分布,以及错误的特征如何影响为其生成的补丁。我们的主要发现包括:1)我们不需要像开发人员那样修复bug,因为我们观察到25.4%(45/177)2)机器生成的正确补丁的分布在Defects 4J项目和APR技术方面存在差异;以及3)APR技术倾向于生成与开发者针对具有大补丁大小的错误所生成的补丁不同的补丁。结论:我们的研究不仅验证了以前的研究结论,但也强调了未来的研究对评估补丁的正确性的影响。
Attention: Not Just Another Dataset for Patch-Correctness Checking
自动程序修复(Automated Program Repair,APR)技术已引起学术界和工业界的广泛关注。同时,当前最先进的APR工具的一个主要限制是,通过所有原始测试的补丁不一定是开发人员想要的正确补丁,即,合理的补丁问题。迄今为止,已经提出了各种补丁正确性检查(PCC)技术来解决这个重要问题。然而,它们仅在非常有限的数据集上进行评估,因为用于生成此类补丁的APR工具只能探索可能补丁的搜索空间的一小部分,对现有PCC研究的外部有效性构成严重威胁。在本文中,我们构建了一个广泛的PCC数据集(据我们所知最大的手动标记的PCC数据集),以重新审视所有最先进的PCC技术。更具体地说,我们的PCC数据集包括从最近的PraPR APR工具生成的1,988个补丁,该工具利用高度优化的字节码级别补丁执行,并可以在其大型预定义的搜索空间内彻底探索所有可能的合理补丁(包括众所周知的修复模式)来自各种以前的APR工具)。我们对新数据集上代表性PCC技术的广泛研究揭示了各种令人惊讶的发现,并为未来的PCC研究提供了指导。
A Critical Review of "Automatic Patch Generation Learned from Human-Written Patches": Essay on the Problem Statement and the Evaluation of Automatic Software Repair
When "Correct" Is Not Safe: Can We Trust Functionally Correct Patches Generated by Code Agents?
Carnegie Mellon University(卡内基梅隆大学);University of Michigan, Ann Arbor(密歇根大学安娜堡分校);Peking University(北京大学);Google(谷歌);Colorado State University(科罗拉多州立大学)
Not All Correct Fixes Run Alike: An Empirical Study of Patch Performance in Repository-Level Issue Resolution
The State Key Laboratory of Blockchain and Data Security, Zhejiang University(浙江大学区块链与数据安全国家重点实验室);Hangzhou High-Tech Zone (Binjiang) Institute of Blockchain and Data Security(杭州高新技术开发区(滨江)区块链与数据安全研究院);Graz University of Technology(格拉茨工业大学)
该研究以SWE-bench等基准的F2P测试为工具,搭配Claude Opus 5等模型与SWE-agent,发现LLM生成补丁的运行时性能与问题解决率无关,需将补丁性能纳入仓库级问题解决的评估。
Semantic Drift in Bug Resolution: How Behavioral Signals Propagate from Reports to Tests and Patches
University of Luxembourg(卢森堡大学);Nanjing University of Science and Technology(南京理工大学);Zhejiang University(浙江大学);Bilkent University(比尔肯特大学);Singapore Management University(新加坡管理大学)
Multi-Location Program Repair Strategies Learned from Past Successful Experience
自动程序修复(Automated program repair,APR)在减少软件维护工作量和时间消耗方面具有巨大的潜力,近年来成为软件工程的研究热点,提出了许多方法。多位置程序修复由于其逻辑和结构的复杂性一直是该领域的一个挑战。虽然一些方法并不声称具有解决多位置错误的功能,但它们在实践中为这些缺陷生成正确的补丁。在本文中,我们首先对Defects4J中的多位置错误进行了观察,并将其分为两类(即,相似的和相关的多位置错误)基于其补丁中的修复动作。然后,我们总结了当前工具修复Defects4J中多位置错误的情况。我们分析了当前工具生成的22个补丁,并提出了两个可行的策略来修复多位置错误,通过两个详细的案例研究来说明它们。最后,通过修复两个从未修复过的漏洞,验证了该方法的可行性。通过借鉴以往的成功经验,指出了多位置程序修复的可能途径。
PatUntrack: Automated Generating Patch Examples for Issue Reports without Tracked Insecure Code
Institute of Software Chinese Academy of Sciences(中国科学院软件研究所);University of Chinese Academy of Sciences(中国科学院大学);Beihang University(北京航空航天大学);The University of Queensland(昆士兰大学)