Skip to main content
QUICK REVIEW

[論文レビュー] Keep the Conversation Going: Fixing 162 out of 337 bugs for $0.42 each using ChatGPT

Chunqiu Steven Xia, Lingming Zhang|arXiv (Cornell University)|Apr 1, 2023
Software Testing and Debugging Techniques被引用数 43
ひとこと要約

ChatRepairを紹介する。対話駆動型のAPRアプローチで、Patch生成と即時フィードバックをChatGPTを用いて織り交ぜ、Defects4jで最新の修正性能を達成し、337個のバグのうち162個を1件あたり$0.42のコストで修正。

ABSTRACT

Automated Program Repair (APR) aims to automatically generate patches for buggy programs. Recent APR work has been focused on leveraging modern Large Language Models (LLMs) to directly generate patches for APR. Such LLM-based APR tools work by first constructing an input prompt built using the original buggy code and then queries the LLM to generate patches. While the LLM-based APR tools are able to achieve state-of-the-art results, it still follows the classic Generate and Validate repair paradigm of first generating lots of patches and then validating each one afterwards. This not only leads to many repeated patches that are incorrect but also miss the crucial information in test failures as well as in plausible patches. To address these limitations, we propose ChatRepair, the first fully automated conversation-driven APR approach that interleaves patch generation with instant feedback to perform APR in a conversational style. ChatRepair first feeds the LLM with relevant test failure information to start with, and then learns from both failures and successes of earlier patching attempts of the same bug for more powerful APR. For earlier patches that failed to pass all tests, we combine the incorrect patches with their corresponding relevant test failure information to construct a new prompt for the LLM to generate the next patch. In this way, we can avoid making the same mistakes. For earlier patches that passed all the tests, we further ask the LLM to generate alternative variations of the original plausible patches. In this way, we can further build on and learn from earlier successes to generate more plausible patches to increase the chance of having correct patches. While our approach is general, we implement ChatRepair using state-of-the-art dialogue-based LLM -- ChatGPT. By calculating the cost of accessing ChatGPT, we can fix 162 out of 337 bugs for \$0.42 each!

研究の動機と目的

  • 静的なプロンプトに依存し、テスト失敗情報の組み込みが欠如している従来および既存のLLMベースAPRアプローチの限界を動機づけて是正する。
  • テスト失敗情報と過去のパッチ履歴を活用してパッチ生成を導くための完全自動の対話型APRワークフローを提案する。
  • パッチ生成と即時フィードバックを織り交ぜることが、従来法よりパッチ品質と多様性を向上させることを示す。
  • 修正済みバグごとのChatGPT API使用量を算出することでコスト意識の評価を実証する。

提案手法

  • ChatRepairを提案する。ChatGPTを基盤とした対話駆動型APRツールで、フィードバックループ付きの対話の中でパッチを生成する。
  • 初期プロンプトを種として、パッチ生成を導くために簡潔で関連性の高いテスト失敗情報を抽出する。
  • 失敗したパッチの反復を避け、エラーから学ぶため、パッチ生成と即時のテストベースフィードバックを組み合わせる。
  • もっともらしいパッチについては、候補修正の集合を広げるために代替バリエーションを生成する。
  • Defects4j 1.2、2.0、およびQuixBugsで評価し、最先端の修復性能を確立し、1バグあたりのコストを算出する。
  • 豊富なテスト失敗情報とパッチ履歴を組み込める promptingベースの対話を用いて汎用性をサポートする。
Figure 1. Example bug fix with original testcase information
Figure 1. Example bug fix with original testcase information

実験結果

リサーチクエスチョン

  • RQ1従来のGenerate-and-Validateアプローチと比較して、LLMを用いた対話駆動型の対話が自動パッチ生成を改善できるか。
  • RQ2テスト失敗情報と過去のパッチ履歴を組み込むことで、より妥当で正確なパッチを実現できるか。
  • RQ3標準ベンチマークでChatGPTによる対話型APRを使用した場合の修復性能の向上と、それに伴うコストはいくらか。

主な発見

  • ChatRepairは最先端の修復性能を達成し、Defects4j 1.2で114件、Defects4j 2.0で48件の正解修正を達成。
  • このアプローチは337のバグ中162件を修正し、1件あたり$0.42のコストでChatGPT APIアクセスを使用。
  • 豊富なテスト失敗情報と対話履歴の組み込みが、より良いパッチ品質と多様な妥当なパッチを生む。
  • アブレーション研究は、失敗情報と対話パラダイムの使用による利得を示す。
  • 評価にはDefects4j 1.2、2.0、QuixBugsデータセットを含み、従来のベースラインより優れた性能を示す。
Figure 2. Overview of ChatRepair
Figure 2. Overview of ChatRepair

より良い研究を、今すぐ始めましょう

論文の読解から最終レビューまで、研究時間を劇的に削減しましょう。

クレジットカード登録不要

このレビューはAIが作成し、人間の編集者が確認しました。