Coder Reviewer Reranking for Code Generation
Tianyi Zhang, Tao Yu, Tatsunori Hashimoto, Mike Lewis, Wen-Tau Yih, Daniel Fried, Sida Wang
Abstract
Sampling diverse programs from a code language model and reranking with model likelihood is a popular method for code generation but it is prone to preferring degenerate solutions. Inspired by collaborative programming, we propose Coder-Reviewer reranking. We augment Coder language models from past work, which generate programs given language instructions, with Reviewer models, which evaluate the likelihood of the instruction given the generated programs. We perform an extensive study across six datasets with eight models from three model families. Experimental results show that Coder-Reviewer reranking leads to consistent and significant improvement (up to 17% absolute accuracy gain) over reranking with the Coder model only. When combined with executability filtering, Coder-Reviewer reranking can often outperform the minimum Bayes risk method. Coder-Reviewer reranking is easy to implement by prompting, can generalize to different programming languages, and works well with off-the-shelf hyperparameters.
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.
37 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- OctoPack: Instruction Tuning Code Large Language Models cites CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesis
- OctoPack: Instruction Tuning Code Large Language Models cites Teaching Large Language Models to Self-Debug
- OctoPack: Instruction Tuning Code Large Language Models cites Language Models are Few-Shot Learners
- OctoPack: Instruction Tuning Code Large Language Models cites DS-1000: A Natural and Reliable Benchmark for Data Science Code Generation
- OctoPack: Instruction Tuning Code Large Language Models cites LEVER: Learning to Verify Language-to-Code Generation with Execution
- CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesis cites Language Models are Few-Shot Learners
- CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesis cites The Curious Case of Neural Text Degeneration
- Teaching Large Language Models to Self-Debug cites CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesis
- Teaching Large Language Models to Self-Debug cites Language Models are Few-Shot Learners
- Teaching Large Language Models to Self-Debug cites LEVER: Learning to Verify Language-to-Code Generation with Execution
- Language Models are Few-Shot Learners cites The Curious Case of Neural Text Degeneration
- Self-Evaluation Guided Beam Search for Reasoning cites Language Models are Few-Shot Learners
- Self-Evaluation Guided Beam Search for Reasoning cites The Curious Case of Neural Text Degeneration
- LEVER: Learning to Verify Language-to-Code Generation with Execution cites Language Models are Few-Shot Learners
- LEVER: Learning to Verify Language-to-Code Generation with Execution cites DS-1000: A Natural and Reliable Benchmark for Data Science Code Generation
- Noisy Channel Language Model Prompting for Few-Shot Text Classification cites Language Models are Few-Shot Learners
- CRUXEval: A Benchmark for Code Reasoning, Understanding and Execution cites CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesis
- CRUXEval: A Benchmark for Code Reasoning, Understanding and Execution cites Teaching Large Language Models to Self-Debug
- CRUXEval: A Benchmark for Code Reasoning, Understanding and Execution cites Language Models are Few-Shot Learners
- CRUXEval: A Benchmark for Code Reasoning, Understanding and Execution cites DS-1000: A Natural and Reliable Benchmark for Data Science Code Generation
Cited by top-tier papers37
- Teaching Large Language Models to Self-DebugXinyun Chen, Maxwell Lin, Nathanael Schärli, Denny ZhouICLR 2024 · 1,085 citations
- LEVER: Learning to Verify Language-to-Code Generation with ExecutionAnsong Ni, Srini Iyer, Dragomir Radev, Veselin Stoyanov et al.ICML 2023 · 318 citations
- Self-Evaluation Guided Beam Search for ReasoningYuxi Xie, Kenji Kawaguchi, Yiran Zhao, James Xu Zhao et al.NeurIPS 2023 · 316 citations
- CRUXEval: A Benchmark for Code Reasoning, Understanding and ExecutionAlex Gu, Baptiste Rozière, Hugh James Leather, Armando Solar-Lezama et al.ICML 2024 · 270 citations
- OctoPack: Instruction Tuning Code Large Language ModelsNiklas Muennighoff, Qian Liu, Armel Randy Zebaze, Qinkai Zheng et al.ICLR 2024 · 203 citations
Builds on11
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- The Curious Case of Neural Text DegenerationAri Holtzman, Jan Buys, Li Du, Maxwell Forbes et al.ICLR 2020 · 4,112 citations
- DS-1000: A Natural and Reliable Benchmark for Data Science Code GenerationYuhang Lai, Chengxi Li, Yiming Wang, Tianyi Zhang et al.ICML 2023 · 504 citations
- Noisy Channel Language Model Prompting for Few-Shot Text ClassificationSewon Min, Mike Lewis, Hannaneh Hajishirzi, Luke ZettlemoyerACL 2022 · 237 citations
- CodeGen: An Open Large Language Model for Code with Multi-Turn Program SynthesisErik Nijkamp, Bo Pang, Hiroaki Hayashi, Lifu Tu et al.ICLR 2023 · 234 citations
Related papers
- Functional Overlap Reranking for Neural Code GenerationHung To, Minh Nguyen, Nghi BuiACL Findings 2024 · 1 citation
- A Pair Programming Framework for Code Generation via Multi-Plan Exploration and Feedback-Driven RefinementHuan Zhang, Wei Cheng, Yuhan Wu, Wei HuASE 2024 · 7 citations
- PairCoder: Pair Programming-Inspired Two-Agent Collaboration for Code GenerationJunhao Chen, Xiang Li, Yibin Xu, Yuehan Cui et al.ACL Findings 2026 · 2 citations
- When Benchmarks Talk: Re-Evaluating Code LLMs with Interactive FeedbackJane Pan, Ryan Shar, Jacob Pfau, Ameet Talwalkar et al.ACL Findings 2025
- CodeRAG: Finding Relevant and Necessary Knowledge for Retrieval-Augmented Repository-Level Code CompletionSheng Zhang, Yifan Ding, Shuquan Lian, Shun Song et al.EMNLP 2025 · 3 citations
