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

通过代码语言模型重新审视进化程序修复

Revisiting Evolutionary Program Repair via Code Language Model

Yunan Wang, Tingyu Guo, Zilong Huang, Yuan Yuan

AI总结:

本文提出ARJA-CLM方法,将多目标进化算法与代码语言模型结合,并采用上下文感知的提示构建策略,有效解决了Java项目中多点错误修复的难题,在Defects4J等基准上表现优异。

摘要:

软件缺陷是软件开发和维护中固有的一部分。为了解决这些缺陷,自动程序修复(APR)被开发出来以自动修复错误。随着大型语言模型的出现,在代码语料库上训练的代码语言模型(CLM)在代码生成方面表现出色,使其适用于APR应用。尽管取得了这些进展,但仍存在一个重大限制:许多错误需要多点编辑才能修复,然而当前基于CLM的APR仅限于单点错误修复,这严重缩小了可修复错误的范围。此外,这些工具在为CLM构建提示时通常只考虑错误行的直接上下文,由于提供的信息有限,导致修复结果不理想。本文引入了一种新方法ARJA-CLM,它将多目标进化算法与CLM集成,以修复Java项目中的多位置错误。我们还提出了一种上下文感知的提示构建策略,该策略通过有关可访问字段和方法的额外信息来丰富提示,供CLM生成候选语句。我们在Defects4J和APR-2024竞赛基准上的实验表明,ARJA-CLM超越了许多最先进的修复系统,并且在多点错误上表现良好。结果还表明,CLM有效地利用了上下文感知提示中提供的字段和方法信息来生成候选语句。

英文摘要:

Software defects are an inherent part of software development and maintenance. To address these defects, Automated Program Repair (APR) has been developed to fix bugs automatically. With the advent of Large Language Models, Code Language Models (CLMs) trained on code corpora excels in code generation, making them suitable for APR applications. Despite this progress, a significant limitation remains: many bugs necessitate multi-point edits for repair, yet current CLM-based APRs are restricted to single-point bug fixes, which severely narrows the scope of repairable bugs. Moreover, these tools typically only consider the direct context of the buggy line when building prompts for the CLM, leading to suboptimal repair outcomes due to the limited information provided. This paper introduces a novel approach, ARJA-CLM, which integrates the multiobjective evolutionary algorithm with CLM to fix multilocation bugs in Java projects. We also propose a context-aware prompt construction stratege, which enriches the prompt with additional information about accessible fields and methods for the CLM generating candidate statements. Our experiments on the Defects4J and APR-2024 competition benchmark demonstrate that ARJA-CLM surpasses many state-of-the-art repair systems, and performs well on multi-point bugs. The results also reveal that CLMs effectively utilize the provided field and method information within context-aware prompts to produce candidate statements.

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

↑