Training Language Models on Synthetic Edit Sequences Improves Code Synthesis

要約

ソフトウェア・エンジニアは、主に既存のプログラムを編集してコードを書く。対照的に、大規模言語モデル(LLM)は、1回のパスでプログラムを自己回帰的に合成する。この理由の一つは、オープンソース化された編集データが少ないことである。コード合成のための高品質な命令データはすでに少ないが、高品質な編集データはさらに少ない。このギャップを埋めるために、我々はLintSeqと呼ばれる合成データ生成アルゴリズムを開発した。このアルゴリズムは、プログラムを逐次記述するために使用できるエラーのない挿入を手続き的にサンプリングするためにリンターを使用することにより、既存のコードをコード編集シーケンスにリファクタリングする。編集シーケンスは、連続するプログラムの差分からなるテキスト文字列として出力される。LintSeqをテストするために、命令+プログラムのペアのデータセットを命令+プログラム-差分-シーケンスのタプルにリファクタリングするために使用します。次に、このデータセットのリファクタリング版とオリジナル版の両方について、2.6Bから14Bのパラメータに及ぶ一連の小さなLLMをインストラクション・ファインチューニングし、コード合成ベンチマークにおけるゼロショット性能を比較する。繰り返しサンプリング中に、編集シーケンス微調整モデルはベースラインよりも多様なプログラムを生成することを示す。この結果、サンプルの関数として、ベンチマークカバレッジの推論時間のスケーリングが改善される。例えば、HumanEval pass@50では、合成編集配列でファインチューニングされた小さなLLMはGPT-4と競合し、ベースラインデータセットでファインチューニングされたモデルを絶対スコアで+20% (+/-3%) 上回った。最後に、コード理解のために、独自の小さなLMを事前学習する。合成コード編集で微小モデルを微調整することで、オンデバイスモデルクラスで最先端のコード合成が得られることを示す。我々の150Mパラメータ編集シーケンスLMは、CodexやAlphaCodeを含む、繰り返しサンプリングの有無にかかわらず、2倍のパラメータ数を持つコードモデルと一致するか、それを上回る。

要約(オリジナル)

Software engineers mainly write code by editing existing programs. In contrast, large language models (LLMs) autoregressively synthesize programs in a single pass. One explanation for this is the scarcity of open-sourced edit data. While high-quality instruction data for code synthesis is already scarce, high-quality edit data is even scarcer. To fill this gap, we develop a synthetic data generation algorithm called LintSeq. This algorithm refactors existing code into a sequence of code edits by using a linter to procedurally sample across the error-free insertions that can be used to sequentially write programs. It outputs edit sequences as text strings consisting of consecutive program diffs. To test LintSeq, we use it to refactor a dataset of instruction + program pairs into instruction + program-diff-sequence tuples. Then, we instruction finetune a series of smaller LLMs ranging from 2.6B to 14B parameters on both the re-factored and original versions of this dataset, comparing zero-shot performance on code synthesis benchmarks. We show that during repeated sampling, edit sequence finetuned models produce more diverse programs than baselines. This results in better inference-time scaling for benchmark coverage as a function of samples, i.e. the fraction of problems ‘pass@k’ solved by any attempt given ‘k’ tries. For example, on HumanEval pass@50, small LLMs finetuned on synthetic edit sequences are competitive with GPT-4 and outperform models finetuned on the baseline dataset by +20% (+/-3%) in absolute score. Finally, we also pretrain our own tiny LMs for code understanding. We show that finetuning tiny models on synthetic code edits results in state-of-the-art code synthesis for the on-device model class. Our 150M parameter edit sequence LM matches or outperforms code models with twice as many parameters, both with and without repeated sampling, including Codex and AlphaCode.

arxiv情報

著者 Ulyana Piterbarg,Lerrel Pinto,Rob Fergus
発行日 2024-10-03 17:57:22+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, DeepL

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