Class-Level Code Generation from Natural Language Using Iterative, Tool-Enhanced Reasoning over Repository

要約

LLM はコード生成タスクにおいて大きな可能性を示しており、さまざまなベンチマークにわたって関数またはステートメント レベルで有望な結果を達成しています。
ただし、特に現実世界のソフトウェア リポジトリのコンテキスト内で、クラスなどのコード アーティファクトの作成に関連する複雑さは、まだ十分に解明されていません。
これまでの研究では、クラスレベルの生成を独立したタスクとして扱い、現実世界のソフトウェア環境の特徴である複雑な依存関係や相互作用を無視していました。
このギャップに対処するために、実際のリポジトリ内で複雑なクラスレベルのコードを生成する際に LLM を厳密に評価するように設計された包括的なベンチマークである RepoClassBench を導入します。
RepoClassBench には、選択したリポジトリからの Java、Python、C# にわたる「自然言語からクラスへの生成」タスクが含まれています。
データセット内の各クラスには、リポジトリ内でファイル間の依存関係があるだけでなく、その機能を検証するための対応するテスト ケースも含まれていることを確認します。
現在のモデルは、主に関連するリポジトリ コンテキストへの露出が限られているため、ベンチマークによってもたらされる現実的な課題に苦戦していることがわかりました。
この欠点に対処するために、私たちは Retrieve-Repotools-Reflect (RRR) を導入します。これは、LLM に静的分析ツールを装備し、エージェントベースのフレームワークでリポジトリ レベルのコンテキストを繰り返しナビゲートして推論するための新しいアプローチです。
私たちの実験では、RRR が RepoClassBench の既存のベースラインを大幅に上回るパフォーマンスを示し、プログラミング言語間およびさまざまな設定下でのその有効性を示しています。
私たちの調査結果は、ソフトウェア開発の複雑さをより正確に反映するためにリポレベルの依存関係を組み込むコード生成ベンチマークの重要な必要性を強調しています。
私たちの取り組みは、LLM のリポジトリ コンテキストの理解を強化するために特殊なツールを活用する利点を示しています。
データセットと評価ハーネスを公開する予定です。

要約(オリジナル)

LLMs have demonstrated significant potential in code generation tasks, achieving promising results at the function or statement level across various benchmarks. However, the complexities associated with creating code artifacts like classes, particularly within the context of real-world software repositories, remain underexplored. Prior research treats class-level generation as an isolated task, neglecting the intricate dependencies & interactions that characterize real-world software environments. To address this gap, we introduce RepoClassBench, a comprehensive benchmark designed to rigorously evaluate LLMs in generating complex, class-level code within real-world repositories. RepoClassBench includes ‘Natural Language to Class generation’ tasks across Java, Python & C# from a selection of repositories. We ensure that each class in our dataset not only has cross-file dependencies within the repository but also includes corresponding test cases to verify its functionality. We find that current models struggle with the realistic challenges posed by our benchmark, primarily due to their limited exposure to relevant repository contexts. To address this shortcoming, we introduce Retrieve-Repotools-Reflect (RRR), a novel approach that equips LLMs with static analysis tools to iteratively navigate & reason about repository-level context in an agent-based framework. Our experiments demonstrate that RRR significantly outperforms existing baselines on RepoClassBench, showcasing its effectiveness across programming languages & under various settings. Our findings emphasize the critical need for code-generation benchmarks to incorporate repo-level dependencies to more accurately reflect the complexities of software development. Our work shows the benefits of leveraging specialized tools to enhance LLMs’ understanding of repository context. We plan to make our dataset & evaluation harness public.

arxiv情報

著者 Ajinkya Deshpande,Anmol Agarwal,Shashank Shet,Arun Iyer,Aditya Kanade,Ramakrishna Bairi,Suresh Parthasarathy
発行日 2024-06-05 17:44:24+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.AI, cs.SE パーマリンク