{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/coderl-mastering-code-generation-through","title":"CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learning","arxiv_id":"2207.01780","date":"2022-07-05","proceeding":null,"authors":["Hung Le","Yue Wang","Akhilesh Deepak Gotmare","Silvio Savarese","Steven C. H. 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.","url_abs":"https://arxiv.org/abs/2207.01780v3","url_pdf":"https://arxiv.org/pdf/2207.01780v3.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"coderl-mastering-code-generation-through","repo_url":"https://github.com/salesforce/coderl","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"jax","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"paper_slug":"coderl-mastering-code-generation-through","repo_url":"https://github.com/salesforce/codet5","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"code-generation","task_name":"Code Generation"},{"task_slug":"decoder","task_name":"Decoder"},{"task_slug":"deep-reinforcement-learning","task_name":"Deep Reinforcement Learning"},{"task_slug":"program-synthesis","task_name":"Program Synthesis"},{"task_slug":"reinforcement-learning-1","task_name":"Reinforcement Learning (RL)"},{"task_slug":null,"task_name":"mbpp"},{"task_slug":"reinforcement-learning-2","task_name":"reinforcement-learning"}],"methods":[{"method_slug":"adafactor","method_name":"Adafactor"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"glu","method_name":"Gated Linear Unit"},{"method_slug":"inverse-square-root-schedule","method_name":"Inverse Square Root Schedule"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"sentencepiece","method_name":"SentencePiece"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"t5","method_name":"T5"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/code-generation-on-apps","task":"Code Generation","dataset":"APPS","model":"CodeRL+CodeT5","rank_in_archive_order":10,"of":18,"metrics":{"Competition Pass@1":"33.3","Interview Pass@1":"13.5","Introductory Pass@1":"20"},"uses_additional_data":false},{"leaderboard":"/sota/code-generation-on-apps","task":"Code Generation","dataset":"APPS","model":"GPT-J 6B (Finetuned)","rank_in_archive_order":11,"of":18,"metrics":{"Competition Pass@1":"0.69%","Competition Pass@1000":"15.70%","Competition Pass@5":"2.36%","Competition Pass@any":"15.70%","Interview Pass@1":"1.80%","Interview Pass@1000":"14.33%","Interview Pass@5":"4.48%","Interview Pass@any":"14.33%","Introductory Pass@1":"6.77%","Introductory Pass@1000":"38.10%","Introductory Pass@5":"15.27%","Introductory Pass@any":"38.10%"},"uses_additional_data":false},{"leaderboard":"/sota/code-generation-on-apps","task":"Code Generation","dataset":"APPS","model":"GPT-Neo 2.7B (Finetuned)","rank_in_archive_order":13,"of":18,"metrics":{"Competition Pass@1":"0.02%","Competition Pass@1000":"3.23%","Competition Pass@5":"0.09%","Competition Pass@any":"3.32%","Interview Pass@1":"0.14%","Interview Pass@1000":"3.70%","Interview Pass@5":"0.51%","Interview Pass@any":"3.70%","Introductory Pass@1":"4.14%","Introductory Pass@1000":"25.02%","Introductory Pass@5":"9.65%","Introductory Pass@any":"25.02%"},"uses_additional_data":false},{"leaderboard":"/sota/code-generation-on-apps","task":"Code Generation","dataset":"APPS","model":"GPT2 1.5B (Finetuned)","rank_in_archive_order":15,"of":18,"metrics":{"Competition Pass@1":"0.00%","Competition Pass@5":"0.00%","Competition Pass@any":"0.0%","Interview Pass@1":"0.57%","Interview Pass@5":"0.80%","Interview Pass@any":"0.80%","Introductory Pass@1":"3.90%","Introductory Pass@5":"5.50%","Introductory Pass@any":"5.50%"},"uses_additional_data":false}],"syntology":{"syntology_url":"https://syntology.ai/paper/2207.01780","atlas_url":"https://app.syntology.ai/?focus=2207.01780","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2207.01780"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/salesforce/codet5","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/salesforce/coderl","reach":{"status":"ok","spdx":"BSD-3-Clause"}}],"summary":{"ran_draft_wrong":1},"by_repo_kind":{"official":{"samples":1,"ran":1,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"6a5218b692e1a379","entry":"generate_prompt","repo":"salesforce/CodeRL","repo_kind":"official","path":"generate.py","file_url":"https://github.com/salesforce/CodeRL/blob/HEAD/generate.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"6a5218b692e1a379"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}