arXiv:2410.16655cs.SEcs.AI2024-10中稿 · ICSE 2026, Researc…被引 3

用语义引导的贪心解码,让小模型高效修复代码漏洞

Memory-Efficient Large Language Models for Program Repair with Semantic-Guided Patch Generation

  • 不依赖束搜索,改用语义反馈指导的贪心解码,降低内存占用
  • 在Defects4J上减少83%内存消耗,修复133个缺陷,比基线多修10个
  • 适合资源有限但需高效自动化修复的开发者和研究者

本文指出,即使对于1B-7B参数的小型大语言模型,增大束宽也会导致显著的GPU占用,引发高达80%的内存溢出崩溃。尽管量化模型和串行束搜索看似可降低内存消耗,但理论分析与实验均表明其效果有限。为此,我们提出FLAMES,一种新型基于大语言模型的程序修复技术。它采用语义引导的最优优先搜索,在每一步解码中利用测试通过/失败数量等语义反馈,选择最有希望的候选词进行扩展,同时使用贪婪解码提升内存效率。在Defects4J上的评估显示,相比传统方法,FLAMES内存消耗最多降低83%,且未牺牲时间效率;共修复133个缺陷,比最佳基线多修复10个。该方法在HumanEval-Java和TransformedD4J数据集上分别生成12%和36.5%更多正确补丁。

原文摘要 · Abstract (English)

In this paper, we first show that increases in beam size, even for small-sized LLMs (1B-7B params), require extensive GPU usage, leading to up to 80% of recurring crashes due to memory overloads in LLM-based APR. Seemingly simple solutions to reduce memory consumption are (1) to quantize LLM models, i.e., converting the weights of an LLM from high-precision values to lower-precision ones, and (2) to make beam search sequential, i.e., forwarding each beam through the model sequentially and then concatenating them back into a single output. However, we show that these approaches still do not work via both theoretical analysis and experiments. To address this, we introduce FLAMES, a novel LLM-based APR technique that employs semantic-guided patch generation to enhance repair effectiveness and memory efficiency. Unlike conventional methods that rely on beam search, FLAMES utilizes greedy decoding to enhance memory efficiency while steering the search towards more potentially good repair candidates via a semantic-guided best-first search algorithm. At each decoding step, FLAMES uses semantic feedback from test validation, such as the number of passing and failing test cases, to select the most promising token to explore further. Our empirical evaluation on Defects4J shows thatFLAMES substantially reduces memory consumption by up to 83% compared to LLM-based APR without compromising time efficiency. Moreover, FLAMES correctly fixes 133 bugs on Defects4J, fixing 10 bugs more than the best baseline. Additionally, these improvements also generalize to the HumanEval-Java and TransformedD4J datasets, where FLAMES generates 12% and 36.5% more correct patches, respectively, than the best baseline.

程序修复大模型内存优化语义引导

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。