RepoFusion: リポジトリを理解するためのコードモデルのトレーニング
RepoFusion: Training Code Models to Understand Your Repository
June 19, 2023
著者: Disha Shrivastava, Denis Kocetkov, Harm de Vries, Dzmitry Bahdanau, Torsten Scholak
cs.AI
要旨
大規模言語モデル(LLMs)がGitHub Copilotのようなコーディングアシスタントで大きな成功を収めているにもかかわらず、これらのモデルはリポジトリ内のコンテキスト(例えば、インポート、親クラス、類似した名前のファイルなど)を理解するのに苦労し、その結果、不正確なコード補完を生成してしまいます。この効果は、モデルがトレーニング中に見たことのないリポジトリ(例えば、プロプライエタリなソフトウェアや進行中のコードプロジェクト)でこれらのアシスタントを使用する際に特に顕著です。最近の研究では、推論中にリポジトリからのコンテキストを使用することの可能性が示されています。本研究では、このアイデアを拡張し、関連するリポジトリコンテキストを組み込むようにモデルをトレーニングするためのフレームワークであるRepoFusionを提案します。単一行のコード補完に関する実験では、リポジトリコンテキストを使用してトレーニングされたモデルが、CodeGen-16B-multi(約73倍大きい)のようなはるかに大きなコードモデルを大幅に上回り、Fill-in-the-Middle目的でトレーニングされた約70倍大きいStarCoderBaseモデルの性能に匹敵することが示されました。これらの結果は、リポジトリコンテキストを使用したトレーニングがもたらす利点の新規かつ説得力のある実証であると考えます。我々は、コンテキストの種類、コンテキストの数、コンテキストの長さ、初期化などの設計選択が及ぼす影響を調査するために、広範なアブレーションスタディを実施しました。最後に、パーミッシブライセンスを持つ200のJavaリポジトリと、3種類のリポジトリコンテキストで拡張されたほぼ重複除去されたファイルを含むデータセットであるStack-Repoを公開します。さらに、我々の研究のコードとトレーニング済みチェックポイントも公開しています。公開されたリソースはhttps://huggingface.co/RepoFusionで見つけることができます。
English
Despite the huge success of Large Language Models (LLMs) in coding assistants
like GitHub Copilot, these models struggle to understand the context present in
the repository (e.g., imports, parent classes, files with similar names, etc.),
thereby producing inaccurate code completions. This effect is more pronounced
when using these assistants for repositories that the model has not seen during
training, such as proprietary software or work-in-progress code projects.
Recent work has shown the promise of using context from the repository during
inference. In this work, we extend this idea and propose RepoFusion, a
framework to train models to incorporate relevant repository context.
Experiments on single-line code completion show that our models trained with
repository context significantly outperform much larger code models as
CodeGen-16B-multi (sim73times larger) and closely match the performance of
the sim 70times larger StarCoderBase model that was trained with the
Fill-in-the-Middle objective. We find these results to be a novel and
compelling demonstration of the gains that training with repository context can
bring. We carry out extensive ablation studies to investigate the impact of
design choices such as context type, number of contexts, context length, and
initialization within our framework. Lastly, we release Stack-Repo, a dataset
of 200 Java repositories with permissive licenses and near-deduplicated files
that are augmented with three types of repository contexts. Additionally, we
are making available the code and trained checkpoints for our work. Our
released resources can be found at https://huggingface.co/RepoFusion.