[논문 리뷰] 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 baseline의 61.4%를 넘는 63.0% pass@80을 달성.
- 더 큰 모델 크기와 개선된 사전 학습 데이터/목표로 CodeT5를 확장하여 더 큰 LM과의 경쟁력 있는 성능을 얻는다.
- 단위 테스트 신호를 이용한 RL 기반 미세조정이 서로 다른 백본 모델에서 일관되게 성능을 향상시킨다.
- 제안된 크리틱 샘플링 절차는 기능적 정확성 신호를 기반으로 프로그래밍의 효과적인 생성, 정제 및 수정이 가능하도록 한다.
더 나은 연구,지금 바로 시작하세요
논문 읽기부터 검토까지, 연구 시간을 획기적으로 줄여보세요.
카드 등록 없음 · 무료 플랜 제공
이 리뷰는 AI가 만들고, 인간 에디터가 검토했습니다.