CodeRAG-Bench: Can Retrieval Augment Code Generation?

要約

言語モデル (LM) はコード生成に非常に優れていることが証明されていますが、LM がパラメトリックな知識だけを使用して生成するプログラムは多くが困難です。
ライブラリドキュメントなどの外部コンテキストを提供すると、正確で機能的なコードの生成が容易になります。
検索拡張生成 (RAG) はさまざまなテキスト指向のタスクで成功を収めていますが、コード生成を改善する可能性は依然として十分に調査されていません。
この作業では、どのようなシナリオでコード生成モデルを取得できるか? という問いを立てて、体系的かつ大規模な分析を実行します。
そしてどのような課題が残っているのでしょうか?
まず、基本的なプログラミング、オープンドメイン、リポジトリレベルの問題を含む 3 つのカテゴリのコード生成タスクを網羅する包括的な評価ベンチマーク CodeRAG-Bench を作成します。
コンテキストを取得するモデルの 5 つのソース (競合ソリューション、オンライン チュートリアル、ライブラリ ドキュメント、StackOverflow 投稿、GitHub リポジトリ) からドキュメントを集約します。
1 つまたは複数のソースから取得したコンテキストを提供することで、CodeRAG-Bench で最高のパフォーマンスのモデルを検査します。
さまざまな設定にわたって高品質のコンテキストを取得することにより、最終的なコード生成で顕著な向上が見られますが、私たちの分析では改善の余地があることが明らかになりました。現在のレトリバーは、特に語彙の重複が限られている場合に有用なコンテキストをフェッチするのに依然として苦労しており、ジェネレータはコンテキストの長さが制限されているため改善できません。
または追加のコンテキストを統合する機能。
CodeRAG-Bench が、高度なコード指向の RAG メソッドのさらなる開発を促進する効果的なテストベッドとして機能することを願っています。

要約(オリジナル)

While language models (LMs) have proven remarkably adept at generating code, many programs are challenging for LMs to generate using their parametric knowledge alone. Providing external contexts such as library documentation can facilitate generating accurate and functional code. Despite the success of retrieval-augmented generation (RAG) in various text-oriented tasks, its potential for improving code generation remains under-explored. In this work, we conduct a systematic, large-scale analysis by asking: in what scenarios can retrieval benefit code generation models? and what challenges remain? We first curate a comprehensive evaluation benchmark, CodeRAG-Bench, encompassing three categories of code generation tasks, including basic programming, open-domain, and repository-level problems. We aggregate documents from five sources for models to retrieve contexts: competition solutions, online tutorials, library documentation, StackOverflow posts, and GitHub repositories. We examine top-performing models on CodeRAG-Bench by providing contexts retrieved from one or multiple sources. While notable gains are made in final code generation by retrieving high-quality contexts across various settings, our analysis reveals room for improvement — current retrievers still struggle to fetch useful contexts especially with limited lexical overlap, and generators fail to improve with limited context lengths or abilities to integrate additional contexts. We hope CodeRAG-Bench serves as an effective testbed to encourage further development of advanced code-oriented RAG methods.

arxiv情報

著者 Zora Zhiruo Wang,Akari Asai,Xinyan Velocity Yu,Frank F. Xu,Yiqing Xie,Graham Neubig,Daniel Fried
発行日 2024-06-20 16:59:52+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

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