CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learning
arXiv:2207.01780
Abstract
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.
arXiv commentAn earlier version of the work was accepted to NeurIPS 2022
Cited by in corpus (14)
- Large Language Models for Code: Security Hardening and Adversarial Testing
- Natural Language Generation and Understanding of Big Code for AI-Assisted Programming: A Review
- Deep Learning-based Software Engineering: Progress, Challenges, and Opportunities
- LLM4PLC: Harnessing Large Language Models for Verifiable Programming of PLCs in Industrial Control Systems
- Reinforcement Learning for Generative AI: State of the Art, Opportunities and Open Research Challenges
- Multi-Agent Reinforcement Learning: Methods, Applications, Visionary Prospects, and Challenges
- A Comprehensive Review of State-of-The-Art Methods for Java Code Generation from Natural Language Text
- Generative AI Agents in Autonomous Machines: A Safety Perspective
- Generating User Experience Based on Personas with AI Assistants
- Large Language Models to the Rescue: Reducing the Complexity in Scientific Workflow Development Using ChatGPT
- PyTester: Deep Reinforcement Learning for Text-to-Testcase Generation
- Dependency-Aware Code Naturalness
- B4: Towards Optimal Assessment of Plausible Code Solutions with Plausible Tests
- Learning to generate Reliable Broadcast Algorithms