Better patching using LLM prompting, via Self-Consistency

被引:12
作者
Ahmed, Toufique [1 ]
Devanbu, Premkumar [1 ]
机构
[1] Univ Calif Davis, Davis, CA 95616 USA
来源
2023 38TH IEEE/ACM INTERNATIONAL CONFERENCE ON AUTOMATED SOFTWARE ENGINEERING, ASE | 2023年
基金
美国国家科学基金会;
关键词
LLMs; Self-consistency; Program Repair;
D O I
10.1109/ASE56229.2023.00065
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
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.
引用
收藏
页码:1742 / 1746
页数:5
相关论文
共 27 条
[11]  
Jiang N, 2023, Arxiv, DOI arXiv:2302.05020
[12]   CURE: Code-Aware Neural Machine Translation for Automatic Program Repair [J].
Jiang, Nan ;
Lutellier, Thibaud ;
Tan, Lin .
2021 IEEE/ACM 43RD INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING (ICSE 2021), 2021, :1161-1173
[13]  
Just Rene., 2014, International Symposium on Software Testing and Analysis, ISSTA '14, San Jose, CA, USA - July 21 - 26, 2014, P437, DOI [10.1145/2610384.2628055, DOI 10.1145/2610384.2628055]
[14]  
Lin D, 2017, PROCEEDINGS COMPANION OF THE 2017 ACM SIGPLAN INTERNATIONAL CONFERENCE ON SYSTEMS, PROGRAMMING, LANGUAGES, AND APPLICATIONS: SOFTWARE FOR HUMANITY, SPLASH COMPANION 2017, P55, DOI 10.1145/3135932.3135941
[15]  
Lu S., 35 C NEUR INF PROC S
[16]   CoCoNuT: Combining Context-Aware Neural Translation Models using Ensemble for Program Repair [J].
Lutellier, Thibaud ;
Hung Viet Pham ;
Pang, Lawrence ;
Li, Yitong ;
Wei, Moshi ;
Tan, Lin .
PROCEEDINGS OF THE 29TH ACM SIGSOFT INTERNATIONAL SYMPOSIUM ON SOFTWARE TESTING AND ANALYSIS, ISSTA 2020, 2020, :101-114
[17]   NOTE ON THE SAMPLING ERROR OF THE DIFFERENCE BETWEEN CORRELATED PROPORTIONS OR PERCENTAGES [J].
McNemar, Quinn .
PSYCHOMETRIKA, 1947, 12 (02) :153-157
[18]   Retrieval-Based Prompt Selection for Code-Related Few-Shot Learning [J].
Nashid, Noor ;
Sintaha, Mifta ;
Mesbah, Ali .
2023 IEEE/ACM 45TH INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING, ICSE, 2023, :2450-2462
[19]  
Nijkamp E, 2022, Arxiv, DOI [arXiv:2203.13474, DOI 10.48550/ARXIV.2203.13474]
[20]   The probabilistic relevance framework: BM25 and beyond [J].
Robertson, Stephen ;
Zaragoza, Hugo .
Foundations and Trends in Information Retrieval, 2009, 3 (04) :333-389