[論文レビュー] CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learning
CodeRLは事前学習済みのコード言語モデル(CodeT5)と、ユニットテスト信号を用いてコード生成を精練するアクター-クリティック強化学習フレームワークを組み合わせます。APPSで最先端の結果を達成し、MBPPで強力なゼロショット転移を示します。
Program synthesis or code generation aims to generate a program that satisfies a problem specification. Recent approaches using large-scale pretrained language models (LMs) have shown promising results, yet they have some critical limitations. In particular, they often follow a standard supervised fine-tuning procedure to train a code generation model only from the pairs of natural-language problem descriptions and ground-truth programs. Such paradigm largely ignores some important but potentially useful signals in the problem specification such as unit tests, which thus often results in poor performance when solving complex unseen coding tasks. To address the limitations, we propose "CodeRL", a new framework for program synthesis tasks through pretrained LMs and deep reinforcement learning (RL). Specifically, during training, we treat the code-generating LM as an actor network, and introduce a critic network that is trained to predict the functional correctness of generated programs and provide dense feedback signals to the actor. During inference, we introduce a new generation procedure with a critical sampling strategy that allows a model to automatically regenerate programs based on feedback from example unit tests and critic scores. For the model backbones, we extended the encoder-decoder architecture of CodeT5 with enhanced learning objectives, larger model sizes, and better pretraining data. Our method not only achieves new SOTA results on the challenging APPS benchmark, but also shows strong zero-shot transfer capability with new SOTA results on the simpler MBPP benchmark.
研究の動機と目的
- ユニットテストからの機能的信号を活用して、標準的な監督付きファインチューニングを超えたプログラム合成の改善を動機づける。
- アクターが事前学習済みのコードLMであるアクター-クリティックRLフレームワークを提案し、クリティックが機能的正確性を予測する。
- CodeT5の事前学習を、生成タスクにより適したより大規模なデータと次のトークン予測の目的で強化する。
- ユニットテストのフィードバックとクリティックの指針を用いて、推論時に新しい生成手順を導入し、プログラムの再生成または修復を行う。
提案手法
- コード生成言語モデルをRL設定のアクターとして扱い、合成コード列をサンプリングする。
- クリティックを訓練してユニットテストの結果(CompileError、RuntimeError、FailedTest、PassedTest)を予測し、その隠れ状態を用いてトークンレベルの値を推定する。
- ユニットテストのフィードバックからRLリターンを定義し、トレーニングの安定化のためにベースラインを適用する。
- 生成中にトークンレベルの指針を提供するため、クリティックからの中間リターンを組み込む。
- 推論時に例題のユニットテストとクリティックスコアを用いて出力を洗練または修復する批評付き生成手順を実装する。
実験結果
リサーチクエスチョン
- RQ1ユニットテストを強化学習に統合するにはどうすればよいか?プログラム合成における機能的正確性を改善するために、ユニットテストを強化学習に統合するにはどうすればよいか?
- RQ2ユニットテストの結果を予測するクリティックを含むアクター-クリティックフレームワークは、標準的なファインチューニングと比較して生成を改善するか?
- RQ3次のトークン予測とより大規模なPythonデータを用いたCodeT5の拡張前訓練は、コード生成ベンチマークの性能を向上させるか?
- RQ4推論中のクリティック主導の生成とプログラムの修復/洗練が最終的な正確性に与える影響は何か?
- RQ5このアプローチは異なるコード生成モデルやベンチマーク(例:APPS、MBPP)に跨って移植可能か?
主な発見
- APPSでpass@1、pass@5、pass@1000の改善を含む最先端の結果を達成(それぞれ2%超、6%、20%超)。
- MBPPで強力なゼロショット転送を示し、ファインチューニング済みGPT-3-7Bベースラインの61.4%を上回る63.0%のpass@80を達成。
- CodeT5をより大きなモデルサイズと改善された前学習データ/目的で拡張し、より大きなLMと競合する性能を得る。
- RLベースのファインチューニングは、ユニットテスト信号を用いた場合、異なるバックボーンモデル全体で一貫して性能を向上させる。
- 提案されたクリティックサンプリング手法は、機能的正確性シグナルに基づく効果的な生成、洗練、修復を可能にする。
より良い研究を、今すぐ始めましょう
論文設計から論文執筆まで、研究時間を劇的に削減しましょう。
クレジットカード登録不要
このレビューはAIが作成し、人間の編集者が確認しました。