[論文レビュー] ClarifyGPT: Empowering LLM-based Code Generation with Intention Clarification
ClarifyGPT はコードの一貫性チェックを通じて曖昧な要件を検出し、推論ベースのプロンプトで対象的な明確化質問を行い、ユーザーフィードバックを受けて洗練したコードを生成します。
We introduce a novel framework named ClarifyGPT, which aims to enhance code generation by empowering LLMs with the ability to identify ambiguous requirements and ask targeted clarifying questions. In particular, ClarifyGPT first detects whether a given requirement is ambiguous by performing a code consistency check. If it is ambiguous, ClarifyGPT prompts an LLM to generate targeted clarifying questions. After receiving question responses, ClarifyGPT refines the ambiguous requirement and inputs it into the same LLM to generate a final code solution. To evaluate our ClarifyGPT, we first conduct a human evaluation involving ten participants who use ClarifyGPT for code generation on two publicly available benchmarks: MBPP-sanitized and MBPP-ET. The results show that ClarifyGPT elevates the performance (Pass@1) of GPT-4 from 70.96% to 80.80% on MBPP-sanitized. Furthermore, to perform large-scale automated evaluations of ClarifyGPT across different LLMs and benchmarks without requiring user participation, we introduce a high-fidelity simulation method to simulate user responses. The automated evaluation results also demonstrate that ClarifyGPT can significantly enhance code generation performance compared to the baselines. In particular, ClarifyGPT improves the average performance of GPT-4 and ChatGPT across four benchmarks from 68.02% to 75.75% and from 58.55% to 67.22%, respectively. We believe that ClarifyGPT can effectively facilitate the practical application of LLMs in real-world development environments.
研究の動機と目的
- ユーザー要件が曖昧または不完全な場合にコード生成を改善する動機づけ。
- 曖昧さを検出し、明確化質問を生成し、コード生成のプロンプトを改良する4段階のフレームワークを提案。
- 高忠実度のユーザーシミュレーションを用いて自動評価を可能にし、大規模で再現可能なテストを可能にする。
- 複数のベンチマークと実ユーザーのフィードバックで ClarifyGPT を評価し、性能向上を定量化する。
提案手法
- ステージ1: seed入力と型認識変異を用いて、要件に対する高品質なテスト入力を生成。
- ステージ2: 複数のコード解決案をサンプリングし、生成されたテスト入力に対する出力を比較して曖昧さを検出するコード一貫性チェックを実施。
- ステージ3: 推論ベースのプロンプトを通じて、コード解決案間の不整合を分析し、対象的な明確化質問を生成。
- ステージ4: 明確化質問への回答で元の要件を洗練させ、洗練されたプロンプトから最終コード解決案を生成。

実験結果
リサーチクエスチョン
- RQ1RQ1: 実ユーザーのフィードバックを用いた場合、ベースラインと比較して ClarifyGPT はどのように性能を発揮するか。
- RQ2RQ2: 自動評価における仮想ユーザーフィードバックを用いた場合、ベースラインと比較して ClarifyGPT はどのように性能を発揮するか。
- RQ3RQ3: プロンプト内のデモンストレーション数が ClarifyGPT の性能にどう影響するか。
主な発見
- 人間のフィードバックを用いると、MBPP-sanitized の GPT-4 Pass@1 が 70.96% から 80.80% に改善。
- 人間のフィードバックを用いると、MBPP-ET の GPT-4 Pass@1 が 51.52%(ベースライン)から 60.19% に改善。
- 4つのベンチマークにおいて、ClarifyGPT はベースラインに対して GPT-4 で平均+11.52ポイント、ChatGPT で平均+15.07ポイントの向上をもたらす。
- 自動シミュレーションでは、4つのベンチマーク全体で平均 Pass@1 が GPT-4 で 11.52%、ChatGPT で 15.07% 向上。
- ClarifyGPT は Human-assisted 評価および自動評価の両方で、Default、CoT、GPT-Engineer のベースラインに対して大幅な改善を達成。

この論文を読む
Nubintのビューアで原文を開き、読みながら気になる箇所をすぐに質問できます。
Nubintでこの論文を読むこのレビューはAIが論文の原文をもとに作成しました。引用する前に原文をご確認ください。