[论文解读] An Analysis of the Automatic Bug Fixing Performance of ChatGPT
ChatGPT 的错题修复性能在 QuixBugs 上与 Codex 和 CoCoNut 相当,显著优于标准 APR;对话提示的使用显著提高成功率(最高 40 问中 31)。
To support software developers in finding and fixing software bugs, several automated program repair techniques have been introduced. Given a test suite, standard methods usually either synthesize a repair, or navigate a search space of software edits to find test-suite passing variants. Recent program repair methods are based on deep learning approaches. One of these novel methods, which is not primarily intended for automated program repair, but is still suitable for it, is ChatGPT. The bug fixing performance of ChatGPT, however, is so far unclear. Therefore, in this paper we evaluate ChatGPT on the standard bug fixing benchmark set, QuixBugs, and compare the performance with the results of several other approaches reported in the literature. We find that ChatGPT's bug fixing performance is competitive to the common deep learning approaches CoCoNut and Codex and notably better than the results reported for the standard program repair approaches. In contrast to previous approaches, ChatGPT offers a dialogue system through which further information, e.g., the expected output for a certain input or an observed error message, can be entered. By providing such hints to ChatGPT, its success rate can be further increased, fixing 31 out of 40 bugs, outperforming state-of-the-art.
研究动机与目标
- 在标准基准测试(QuixBugs)上评估 ChatGPT 的自动错题修复性能。
- 将 ChatGPT 与 Codex 和传统的深度学习 APR 方法(CoCoNut、Codex)进行比较。
- 研究基于对话的提示如何影响 ChatGPT 的错题修复成功率。
- 描述 ChatGPT 回应的类型以及后续互动对修复率的影响。
提出的方法
- 以 QuixBugs 的 Python 问题(共 40 个)作为基准。
- 对每个问题用提示语:'Does this program have a bug? How to fix it?' 四次查询 ChatGPT,且不带注释。
- 将结果与既有文献进行比较:Ye 等人(2021)的标准 APR 方法,以及 DL 基础方法 CoCoNut(Lutellier 等)和 Codex(Prenner 等)。
- 将 ChatGPT 的回答分类到预定义类别并分析回答模式(例如需要更多信息、未发现错误、修正正确)。
- 通过提供提示来进行对话研究,并衡量对修复率的影响(后续请求)。
实验结果
研究问题
- RQ1与 Codex、CoCoNut 及标准 APR 方法在 QuixBugs 上相比,ChatGPT 在自动错题修复上的表现如何?
- RQ2将对话式提示融入是否能提高 ChatGPT 的错题修复成功率?
- RQ3在请求修复错误时,ChatGPT 会给出哪些类型的回答,这些回答如何影响修复结果?
- RQ4后续信息(提示)在多大程度上能够提升 ChatGPT 修复错误的能力?
主要发现
- ChatGPT 能修复 40 个中的 19 个错误,与 Codex(21 个)和 CoCoNut(19 个)相当,明显优于标准 APR(7 个)。
- 通过对话可提升性能:提供提示将修复数提升到 40 个中的 31 个。
- ChatGPT 的结果在每个问题上方差较大(通常在 1–2 次运行中修复;如 bucketsort/flatten 等在所有运行中均修复)。
- 与传统 APR 相比,基于 DL 的模型显示更高的错误修复率,可能是因为更广泛的搜索和学习到的修复模式,而标准 APR 对测试套件过拟合。
- 支持对话的交互允许有针对性的信息交换(例如失败输入或期望输出),可大大提升修复成功率。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。