paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Better Patching Using LLM Prompting, via Self-Consistency

通过自一致性使用 LLM 提示实现更好的程序修补
ASE 2023 38th IEEE/ACM International Conference on Automated Software Engineering (ASE)2023匹配度 2/10 · 论文属于LLM提示工程用于程序修复,核心是自一致性采样与提交日志作为少样本解释,与用户关注的静态分析、形式化验证、浮点/贝叶斯程序分析无直接关联;且属于通过提示词技巧提升LLM能力的研究,与画像中不感兴趣的方向相符。引用 71 inbox
Toufique Ahmed, Premkumar Devanbu
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:将提交日志作为少样本解释,结合自一致性采样提升 LLM 程序修复补丁质量。

大语言模型可通过少样本提示、思维链和自一致性显著提升复杂问题求解能力,但自一致性依赖解释,而多数软件工程数据集缺少解释,限制了其在程序修复中的应用。本文提出在基于提示的程序修复中使用自一致性:仅在少样本示例里把修复对应的 commit log 当作解释,随后让 LLM 多次采样生成“解释-补丁”对,忽略解释并对候选补丁进行多数投票。在 MODIT 数据集上,该方法超过此前基于提示的程序修复方法,取得当前最优结果;进一步证据表明,正确的提交信息有助于 LLM 学会生成更好的补丁。

问题
自一致性与思维链提示虽强,却因软件数据集普遍缺少解释而难以直接用于软件工程任务;本文研究如何将其用于基于提示的程序修复。
方法
仅在少样本示例中使用修复提交日志作为解释,让 LLM 重复采样生成解释-补丁池,再忽略解释、按出现频率选择补丁。
评估
在 MODIT 数据集上评估,结果超过已有基于提示的程序修复方法;经验证据显示正确的 commit message 有助于产生更优补丁。
原文摘要(Abstract)

Large Language models (LLMs) can be induced to solve non-trivial problems with “few-shot” prompts including illustrative problem-solution examples. Now if the few-shots also include “chain of thought” ($\mathcal{C}oT$) explanations, which are of the form problem-explanation-solution, LLMs will generate a “explained” solution, and perform even better. Recently an exciting, substantially better technique, self-consistency [1] ($\mathcal{S}-C$) has emerged, based on the intuition that there are many plausible explanations for the right solution; when the LLM is sampled repeatedly to generate a pool of explanation-solution pairs, for a given problem, the most frequently occurring solutions in the pool (ignoring the explanations) tend to be even more likely to be correct! Unfortunately, the use of this highly-performant $\mathcal{S}-C$ (or even $\mathcal{C}oT$) approach in software engineering settings is hampered by the lack of explanations; most software datasets lack explanations. In this paper, we describe an application of the $\mathcal{S}-C$ approach to program repair, using the commit log on the fix as the explanation, only in the illustrative few-shots. We achieve state-of-the art results, beating previous approaches to prompting-based program repair, on the MODIT dataset; we also find evidence suggesting that the correct commit messages are helping the LLM learn to produce better patches.

链接与引用

DOI 原文 · arXiv · PDF(开放获取) · DBLP

BibTeX
@inproceedings{AhmedD23,
  title = {Better Patching Using LLM Prompting, via Self-Consistency},
  author = {Toufique Ahmed and Premkumar Devanbu},
  booktitle = {ASE},
  year = {2023},
  doi = {10.1109/ase56229.2023.00065}
}