Lune

NeurIPS2022Top-tier venue

CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learning

Hung Le, Yue Wang, Akhilesh Deepak Gotmare, Silvio Savarese, Steven Chu-Hong Hoi

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.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

168 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • DAPO: An Open-Source LLM Reinforcement Learning System at Scale cites Teaching Large Language Models to Self-Debug
  • DAPO: An Open-Source LLM Reinforcement Learning System at Scale cites Reflexion: language agents with verbal reinforcement learning
  • DAPO: An Open-Source LLM Reinforcement Learning System at Scale cites Language Models are Few-Shot Learners
  • DAPO: An Open-Source LLM Reinforcement Learning System at Scale cites Training language models to follow instructions with human feedback
  • CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation cites CodeBERT: A Pre-Trained Model for Programming and Natural Languages
  • Mastering Sparse CUDA Generation through Pretrained Models and Deep Reinforcement Learning cites CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generation
  • Mastering Sparse CUDA Generation through Pretrained Models and Deep Reinforcement Learning cites Training language models to follow instructions with human feedback
  • GeDi: Generative Discriminator Guided Sequence Generation cites Language Models are Few-Shot Learners
  • Teaching Large Language Models to Self-Debug cites Language Models are Few-Shot Learners
  • Teaching Large Language Models to Self-Debug cites Training language models to follow instructions with human feedback
  • Reflexion: language agents with verbal reinforcement learning cites Teaching Large Language Models to Self-Debug
  • CRITIC: Large Language Models Can Self-Correct with Tool-Interactive Critiquing cites GeDi: Generative Discriminator Guided Sequence Generation
  • CRITIC: Large Language Models Can Self-Correct with Tool-Interactive Critiquing cites Teaching Large Language Models to Self-Debug
  • CRITIC: Large Language Models Can Self-Correct with Tool-Interactive Critiquing cites Language Models are Few-Shot Learners
  • CRITIC: Large Language Models Can Self-Correct with Tool-Interactive Critiquing cites Training language models to follow instructions with human feedback
  • Training language models to follow instructions with human feedback cites GeDi: Generative Discriminator Guided Sequence Generation
  • Training language models to follow instructions with human feedback cites Language Models are Few-Shot Learners
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers168

  1. Reflexion: language agents with verbal reinforcement learningNoah Shinn, Federico Cassano, Ashwin Gopinath, Karthik Narasimhan et al.NeurIPS 2023 · 5,828 citations
  2. DAPO: An Open-Source LLM Reinforcement Learning System at ScaleQiying Yu, Zheng Zhang, Ruofei Zhu, Yufeng Yuan et al.NeurIPS 2025 · 2,828 citations
  3. Teaching Large Language Models to Self-DebugXinyun Chen, Maxwell Lin, Nathanael Schärli, Denny ZhouICLR 2024 · 1,085 citations
  4. CRITIC: Large Language Models Can Self-Correct with Tool-Interactive CritiquingZhibin Gou, Zhihong Shao, Yeyun Gong, Yelong Shen et al.ICLR 2024 · 699 citations
  5. Mastering Sparse CUDA Generation through Pretrained Models and Deep Reinforcement LearningYaoyu Wang, Hankun Dai, Zhidong Yang, Junmin Xiao et al.ICLR 2026 · 476 citations

Builds on11

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida et al.NeurIPS 2022 · 24,707 citations
  3. CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan et al.EMNLP Findings 2020 · 2,828 citations
  4. CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and GenerationYue Wang, Weishi Wang, Shafiq R. Joty, Steven C. H. HoiEMNLP 2021 · 1,224 citations
  5. GeDi: Generative Discriminator Guided Sequence GenerationBen Krause, Akhilesh Deepak Gotmare, Bryan McCann, Nitish Shirish Keskar et al.EMNLP Findings 2021 · 219 citations

Related papers

  1. Automatic Unit Test Data Generation and Actor-Critic Reinforcement Learning for Code SynthesisPhilip John Gorinski, Matthieu Zimmer, Gerasimos Lampouras, Derrick-Goh-Xin Deik et al.EMNLP Findings 2023 · 1 citation
  2. CodeRM-NT: Reward Model for Code RL without Unit TestsXiao Xia, Dan Zhang, Tianrui SunACL Findings 2026
  3. RLEF: Grounding Code LLMs in Execution Feedback with Reinforcement LearningJonas Gehring, Kunhao Zheng, Jade Copet, Vegard Mella et al.ICML 2025
  4. CODERL+: Improving Code Generation via Reinforcement with Execution Semantics AlignmentXue Jiang, Yihong Dong, Mengyang Liu, Hongyi Deng et al.ACL 2026 · 18 citations
  5. B-Coder: Value-Based Deep Reinforcement Learning for Program SynthesisZishun Yu, Yunzhe Tao, Liyu Chen, Tao Sun et al.ICLR 2024 · 20 citations
Dusk over the sea between two cliffs drawn in fine vertical lines