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

通过 Self-Consistency 利用 LLM 提示实现更好的补丁修复

Better patching using LLM prompting, via Self-Consistency

UC Davis(加州大学戴维斯分校)

Toufique Ahmed, Premkumar Devanbu

AI总结:

针对软件数据集缺少 CoT 解释的问题,本文将修复提交日志作为少样本示例中的解释,并引入 S-C 多数投票,在 MODIT 上提升基于 LLM 提示的程序修复效果。

摘要:

大型语言模型(LLM)可以通过包含说明性问题-解决方案示例的“少样本”提示,被引导解决非平凡问题。如果少样本示例还包含“思维链”(CoT)解释,即采用问题-解释-解决方案的形式,LLM 将生成“带解释的”解决方案,并表现得更好。近来出现了一种令人振奋且显著更优的技术 self-consistency [1](S-C),其直觉是:正确解决方案存在许多合理的解释;当针对给定问题反复采样 LLM 以生成一组解释-解决方案对时,该集合中最频繁出现的解决方案(忽略解释)往往更有可能是正确的!遗憾的是,这种高性能的 S-C(甚至 CoT)方法在软件工程场景中的使用受到解释缺失的阻碍;大多数软件数据集都缺乏解释。本文描述了 S-C 方法在程序修复中的应用:仅在说明性少样本示例中,将修复提交上的提交日志作为解释。我们在 MODIT 数据集上取得了最先进结果,击败了以往基于提示的程序修复方法;我们还发现证据表明,正确的提交消息正在帮助 LLM 学会生成更好的补丁。

英文摘要:

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" (CoT) 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] (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 S-C (or even CoT) 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 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.

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

↑