[論文レビュー] RepairAgent: An Autonomous, LLM-Based Agent for Program Repair
RepairAgentは、動的なプロンプト、修復ツールのセット、そして修正を導く有限状態機械を利用するプログラム修正の初の自律的なLLMベースエージェントです。Defects4Jで164件の正しい修正を達成し(うち39件は先行研究で修正されていません)、バグ1件あたり約14セントです。
Automated program repair has emerged as a powerful technique to mitigate the impact of software bugs on system reliability and user experience. This paper introduces RepairAgent, the first work to address the program repair challenge through an autonomous agent based on a large language model (LLM). Unlike existing deep learning-based approaches, which prompt a model with a fixed prompt or in a fixed feedback loop, our work treats the LLM as an agent capable of autonomously planning and executing actions to fix bugs by invoking suitable tools. RepairAgent freely interleaves gathering information about the bug, gathering repair ingredients, and validating fixes, while deciding which tools to invoke based on the gathered information and feedback from previous fix attempts. Key contributions that enable RepairAgent include a set of tools that are useful for program repair, a dynamically updated prompt format that allows the LLM to interact with these tools, and a finite state machine that guides the agent in invoking the tools. Our evaluation on the popular Defects4J dataset demonstrates RepairAgent's effectiveness in autonomously repairing 164 bugs, including 39 bugs not fixed by prior techniques. Interacting with the LLM imposes an average cost of 270,000 tokens per bug, which, under the current pricing of OpenAI's GPT-3.5 model, translates to 14 cents of USD per bug. To the best of our knowledge, this work is the first to present an autonomous, LLM-based agent for program repair, paving the way for future agent-based techniques in software engineering.
研究の動機と目的
- 自動化されたプログラム修正(APR)の推進と、固定プロンプトLLMループを超えて意思決定を行う自律的なエージェントの必要性を訴える。
- 修正計画・実行・検証を行う自律的でツール対応のLLMであるRepairAgentを紹介する。
- Defects4Jでの有効性を示し、先行アプローチでは達成できなかった修正を含み、リソースコストを分析する。
提案手法
- 修復ツールのセットを介してバグ修正アクションを計画・実行できる自律的なLLMエージェントを定義する。
- バグの理解、情報収集、パッチ検証をエージェントに導く動的に更新されるプロンプト形式を導入する。
- ツール使用を制約し修復プロセスを導く有限状態機械を採用する。
- LLM出力をツール呼び出しへ解析・対応づけするミドルウェアを提供し、エラーハンドリングのヒューリスティクスを含む。
- 人手の修復ワークフローを模倣するために、コードの読み取り/抽出、コードの検索/生成、テスト/パッチ適用、制御を含む14のツールを活用する。
- Defects4Jデータセットで修復を実行し、3つのベースライン(ChatRepair、ITER、SelfAPR)と比較する。

実験結果
リサーチクエスチョン
- RQ1RQ1 RepairAgentは実世界のバグ修正にどれだけ有効か?
- RQ2RQ2 アプローチのコストはどの程度か?
- RQ3RQ3 LLMエージェントは利用可能なツールをどのように活用するのか?
主な発見
- RepairAgentはDefects4Jで164件のバグを修正し、うち39件は先行研究では修正されていなかった。
- RepairAgentはv1.2で74件、v2.0で90件の修正を達成し、合計186件の妥当な修正を得た。
- 対話の平均トークンコストはバグあたり約270,000トークン(GPT-3.5価格で約$0.14)である。
- RepairAgentは単一行、複数行、複数ファイルのバグで能力を示す(115単一行、46複数行、3複数ファイル)。
- ChatRepair、ITER、SelfAPRと比較して、RepairAgentは総修正数が同程度で、Defects4Jv2で優れており、他の手法が修正した数より多くの修正を90件行った。
- このアプローチはツールセットに依存する独自の修正をいくつか生み出す(例:find_similar_api_calls、generate_method_body)。

より良い研究を、今すぐ始めましょう
論文設計から論文執筆まで、研究時間を劇的に削減しましょう。
クレジットカード登録不要
このレビューはAIが作成し、人間の編集者が確認しました。