LEVER: Learning to Verify Language-to-Code Generation with Execution
Ansong Ni, Srini Iyer, Dragomir Radev, Veselin Stoyanov, Wen-Tau Yih, Sida I. Wang, Xi Victoria Lin
Abstract
The advent of large language models trained on code (code LLMs) has led to significant progress in language-to-code generation. State-of-the-art approaches in this area combine LLM decoding with sample pruning and reranking using test cases or heuristics based on the execution results. However, it is challenging to obtain test cases for many real-world language-to-code applications, and heuristics cannot well capture the semantic features of the execution results, such as data type and value range, which often indicates the correctness of the program. In this work, we propose LEVER, a simple approach to improve language-to-code generation by learning to verify the generated programs with their execution results. Specifically, we train verifiers to determine whether a program sampled from the LLMs is correct or not based on the natural language input, the program itself and its execution results. The sampled programs are reranked by combining the verification score with the LLM generation probability, and marginalizing over programs with the same execution results. On four datasets across the domains of table QA, math QA and basic Python programming, LEVER consistently improves over the base code LLMs(4.6% to 10.9% with code-davinci-002) and achieves new state-of-the-art results on all of them.
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.
76 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 Self-Consistency Improves Chain of Thought Reasoning in Language Models
- OctoPack: Instruction Tuning Code Large Language Models cites Teaching Large Language Models to Self-Debug
- OctoPack: Instruction Tuning Code Large Language Models cites CRITIC: Large Language Models Can Self-Correct with Tool-Interactive Critiquing
- 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 Finetuned Language Models are Zero-Shot Learners
- Self-Consistency Improves Chain of Thought Reasoning in Language Models cites Language Models are Few-Shot Learners
- Teaching Large Language Models to Self-Debug cites Self-Consistency Improves Chain of Thought Reasoning in Language Models
- Teaching Large Language Models to Self-Debug cites Language Models are Few-Shot Learners
- CRITIC: Large Language Models Can Self-Correct with Tool-Interactive Critiquing cites Self-Consistency Improves Chain of Thought Reasoning in Language Models
- 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
- Chain-of-Table: Evolving Tables in the Reasoning Chain for Table Understanding cites Language Models are Few-Shot Learners
- Finetuned Language Models are Zero-Shot Learners cites Language Models are Few-Shot Learners
- Many-Shot In-Context Learning cites Language Models are Few-Shot Learners
Cited by top-tier papers76
- Teaching Large Language Models to Self-DebugXinyun Chen, Maxwell Lin, Nathanael Schärli, Denny ZhouICLR 2024 · 1,085 citations
- CRITIC: Large Language Models Can Self-Correct with Tool-Interactive CritiquingZhibin Gou, Zhihong Shao, Yeyun Gong, Yelong Shen et al.ICLR 2024 · 699 citations
- Many-Shot In-Context LearningRishabh Agarwal, Avi Singh, Lei Zhang, Bernd Bohnet et al.NeurIPS 2024 · 271 citations
- Chain-of-Table: Evolving Tables in the Reasoning Chain for Table UnderstandingZilong Wang, Hao Zhang, Chun-Liang Li, Julian Martin Eisenschlos et al.ICLR 2024 · 244 citations
- OctoPack: Instruction Tuning Code Large Language ModelsNiklas Muennighoff, Qian Liu, Armel Randy Zebaze, Qinkai Zheng et al.ICLR 2024 · 203 citations
Builds on18
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- Finetuned Language Models are Zero-Shot LearnersJason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu et al.ICLR 2022 · 4,966 citations
- 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
- Self-Consistency Improves Chain of Thought Reasoning in Language ModelsXuezhi Wang, Jason Wei, Dale Schuurmans, Quoc V. Le et al.ICLR 2023 · 681 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
Related papers
- CodePRM: Execution Feedback-enhanced Process Reward Model for Code GenerationQingyao Li, Xinyi Dai, Xiangyang Li, Weinan Zhang et al.ACL Findings 2025 · 6 citations
- Scaling Agentic Verifier for Competitive CodingZeyao Ma, Jing Zhang, Xiaokang Zhang, Jiaxi Yang et al.ICML 2026 · 2 citations
- HARDTESTGEN: A High-Quality RL Verifier Generation Pipeline for LLM Algorithimic CodingZhongmou He, Yee Man Choi, Kexun Zhang, Ivan Bercovich et al.ICLR 2026
- Revisit Self-Debugging with Self-Generated Tests for Code GenerationXiancai Chen, Zhengwei Tao, Kechi Zhang, Changzhi Zhou et al.ACL 2025
- Debug like a Human: A Large Language Model Debugger via Verifying Runtime Execution Step by StepLi Zhong, Zilong Wang, Jingbo ShangACL Findings 2024 · 69 citations
