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

实用函数级程序修复能走多远?

How Far Can We Go with Practical Function-Level Program Repair?

Jiahong Xiang, Xiaoyang Xu, Fanchu Kong, Mingyuan Wu, Zizheng Zhang, Haotian Zhang, Yuqun Zhang

AI总结:

针对现有基于LLM的APR多聚焦单行/块级修复、实用性受限的问题,本文首次全面研究函数级APR,提出双LLM框架的SRepair技术,在Defects4J数据集上修复性能超越现有技术至少85%,并首次实现多函数缺陷修复。

摘要:

近年来,多种基于大语言模型(LLM)的自动化程序修复(APR)技术被提出以提升修复性能。这些技术主要聚焦于单行或代码块级修复,但由于修复任务范围有限且语句级故障定位成本高昂,在实际应用中面临重大挑战。然而,更具实用性的函数级APR将APR任务范围扩展至修复整个有缺陷的函数,且仅需成本较低的函数级故障定位,目前仍未得到充分研究。本文首次对基于LLM的函数级APR开展全面研究,包括探究少样本学习机制及辅助修复相关信息的作用。具体而言,我们采用6种被广泛研究的LLM,并在Defects4J 1.2和2.0数据集上构建了基准测试集。研究表明,采用零样本学习的LLM已是性能强劲的函数级APR技术,而应用少样本学习机制会导致修复性能出现差异。此外,我们发现直接向LLM引入辅助修复相关信息可显著提升函数级修复性能。受这些发现启发,我们提出一种基于LLM的函数级APR技术——SRepair,该技术采用双LLM框架,利用辅助修复相关信息提升修复性能。评估结果显示,SRepair可正确修复Defects4J数据集中的300个单函数缺陷,无需成本高昂的语句级故障定位信息,性能大幅超越所有此前的APR技术至少85%。此外,SRepair成功修复了Defects4J数据集中的32个多函数缺陷,据我们所知,这是有史以来任何APR技术首次实现该成果。

英文摘要:

Recently, multiple Automated Program Repair (APR) techniques based on Large Language Models (LLMs) have been proposed to enhance the repair performance. While these techniques mainly focus on the single-line or hunk-level repair, they face significant challenges in real-world application due to the limited repair task scope and costly statement-level fault localization. However, the more practical function-level APR, which broadens the scope of APR task to fix entire buggy functions and requires only cost-efficient function-level fault localization, remains underexplored. In this paper, we conduct the first comprehensive study of LLM-based function-level APR including investigating the effect of the few-shot learning mechanism and the auxiliary repair-relevant information. Specifically, we adopt six widely-studied LLMs and construct a benchmark in both the Defects4J 1.2 and 2.0 datasets. Our study demonstrates that LLMs with zero-shot learning are already powerful function-level APR techniques, while applying the few-shot learning mechanism leads to disparate repair performance. Moreover, we find that directly applying the auxiliary repair-relevant information to LLMs significantly increases function-level repair performance. Inspired by our findings, we propose an LLM-based function-level APR technique, namely SRepair, which adopts a dual-LLM framework to leverage the power of the auxiliary repair-relevant information for advancing the repair performance. The evaluation results demonstrate that SRepair can correctly fix 300 single-function bugs in the Defects4J dataset, largely surpassing all previous APR techniques by at least 85%, without the need for the costly statement-level fault location information. Furthermore, SRepair successfully fixes 32 multi-function bugs in the Defects4J dataset, which is the first time achieved by any APR technique ever to our best knowledge.

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

↑