arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.06598cs.SEcs.LG
收藏

CigaR:基于大语言模型的成本高效程序修复

CigaR: Cost-efficient Program Repair with LLMs

KTH Royal Institute of Technology(瑞典皇家理工学院)

Dávid Hidvégi, Khashayar Etemadi, Sofia Bobadilla, Martin Monperrus

AI总结:

针对大语言模型自动化程序修复token成本高的问题,本文提出CigaR工具,通过优化提示及设置、分两步生成补丁,在429个bug上最高降低96%的token成本,实现低成本高效程序修复。

摘要:

大语言模型(LLM)已被证明在自动化程序修复(APR)领域效果显著。然而,使用LLM的成本可能很高,企业会按token数量向用户收费。本文提出了CigaR——首个专注于最小化修复成本的基于LLM的APR工具。CigaR主要分为两个步骤:生成首个合理补丁,以及扩增合理补丁数量。CigaR对提示词及提示设置进行优化,以尽可能少的token数量为LLM提供最大化的信息量。我们在广泛使用的Defects4J和HumanEval-Java数据集的429个bug上开展实验,结果显示CigaR将token成本降低了73%。平均而言,CigaR每个bug消耗12.7万token,而基线方法每个bug消耗46.7万token。在两者都能修复的bug子集上,CigaR每个bug消耗2万token,基线方法则消耗60.8万token,成本节省达96%。我们的大量实验表明,CigaR是一款具有成本效益的基于LLM的程序修复工具,能够以较少的token自动生成补丁。

英文摘要:

Large language models (LLM) have proven to be effective at automated program repair (APR). However, using LLMs can be costly, with companies invoicing users by the number of tokens. In this paper, we propose CigaR, the first LLM-based APR tool that focuses on minimizing the repair cost. CigaR works in two major steps: generating a first plausible patch and multiplying plausible patches. CigaR optimizes the prompts and the prompt setting to maximize the information given to LLMs using the smallest possible number of tokens. Our experiments on 429 bugs from the widely used Defects4J and HumanEval-Java datasets shows that CigaR reduces the token cost by 73%. On average, CigaR spends 127k tokens per bug while the baseline uses 467k tokens per bug. On the subset of bugs that are fixed by both, CigaR spends 20k per bug while the baseline uses 608k tokens, a cost saving of 96%. Our extensive experiments show that CigaR is a cost-effective LLM-based program repair tool that uses a low number of tokens to automatically generate patches.

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

↑