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

MORepair:通过多目标微调教会大语言模型修复代码

MORepair: Teaching LLMs to Repair Code via Multi-Objective Fine-tuning

School of Information Science and Engineering, Yanshan University(燕山大学信息科学与工程学院);School of Computing and Information Systems, University of Melbourne(墨尔本大学计算与信息系);School of Big Data and Software Engineering, Chongqing University(重庆大学大数据与软件学院);SnT, University of Luxembourg(卢森堡大学技术与创新研究所);School of Computer Science, Carnegie Mellon University(卡内基梅隆大学计算机科学学院)

Boyang Yang, Haoye Tian, Jiadong Ren, Hongyu Zhang, Jacques Klein, Tegawendé F. Bissyandé, Claire Le Goues, Shunfu Jin

AI总结:

MORepair提出多目标微调方法,同时适应代码转换的语法特征和代码变更背后的逻辑原因,在四个开源LLM上验证可将程序修复性能提升11.4%至56.0%,优于现有最先进方法。

摘要:

在软件工程领域,代码上的专门任务(如程序修复)带来了独特挑战,需要微调大语言模型(LLMs)以释放最先进的性能。文献中针对程序修复任务提出的LLM微调方法通常忽略了在数据中的语法模式之外,对代码变更背后的逻辑进行推理的需求。高性能的微调实验通常也伴随着非常高的计算成本。借助MORepair,我们为程序修复的LLM微调学习重点提出了一种新视角:我们不仅使LLM参数适应代码转换任务的语法细微差别(目标1),还专门针对训练数据中代码变更背后的逻辑原因对LLM进行微调(目标2)。这种多目标微调将指导LLM生成高质量的补丁。我们应用MORepair微调了四个具有不同规模和架构的开源LLM。在函数级和仓库级修复基准上的实验结果表明,所实现的微调有效地将LLM修复性能提升了11.4%至56.0%。我们进一步表明,与最先进的方法(包括标准微调、Fine-tune-CoT和RepairLLaMA)相比,我们的微调策略具有更优的性能。

英文摘要:

Within the realm of software engineering, specialized tasks on code, such as program repair, present unique challenges, necessitating fine-tuning Large language models~(LLMs) to unlock state-of-the-art performance. Fine-tuning approaches proposed in the literature for LLMs on program repair tasks generally overlook the need to reason about the logic behind code changes, beyond syntactic patterns in the data. High-performing fine-tuning experiments also usually come at very high computational costs. With MORepair, we propose a novel perspective on the learning focus of LLM fine-tuning for program repair: we not only adapt the LLM parameters to the syntactic nuances of the task of code transformation (objective 1), but we also specifically fine-tune the LLM with respect to the logical reason behind the code change in the training data (objective 2). Such a multi-objective fine-tuning will instruct LLMs to generate high-quality patches. We apply MORepair to fine-tune four open-source LLMs with different sizes and architectures. Experimental results on function-level and repository-level repair benchmarks show that the implemented fine-tuning effectively boosts LLM repair performance by 11.4% to 56.0%. We further show that our fine-tuning strategy yields superior performance compared to the state-of-the-art approaches, including standard fine-tuning, Fine-tune-CoT, and RepairLLaMA.

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

↑