CYCLE: Learning to Self-Refine the Code Generation
Not on the map. Why?
Abstract (arXiv)
Pre-trained code language models have achieved promising performance in code generation and improved the programming efficiency of human developers. However, their self-refinement capability is typically overlooked by the existing evaluations of code LMs, which focus only on the accuracy of the one-time prediction. For the cases when code LMs fail to implement the correct program, developers actually find it hard to debug and fix the faulty prediction since it is not written by the developers themselves. Unfortunately, our study reveals that code LMs cannot efficiently self-refine their faulty generations as well. In this paper, we propose CYCLE framework, learning to self-refine the faulty generation according to the available feedback, such as the execution results reported by the test suites. We evaluate CYCLE on three popular code generation benchmarks, HumanEval, MBPP, and APPS. The results reveal that CYCLE successfully maintains, sometimes improves, the quality of one-time code generation, while significantly improving the self-refinement capability of code LMs. We implement four variants of CYCLE with varied numbers of parameters across 350M, 1B, 2B, and 3B, and the experiments show that CYCLE consistently boosts the code generation performance, by up to 63.5%, across benchmarks and varied model sizes. We also notice that CYCLE outperforms code LMs that have 3× more parameters in self-refinement.
Key facts. Cited by 39 papers in the map (data through 7 Oct 2026). Builds on 38 of its 55 references that are in the map. First posted on arXiv 27 Mar 2024.
Builds on
38 of 55 references.
References · 38
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
- 2022Training language models to follow instructions with human feedbackcited by 15,712
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2020Scaling Laws for Neural Language Modelscited by 6,411
- 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,064
- 2017Deep reinforcement learning from human preferencescited by 3,846
- 2021Finetuned Language Models Are Zero-Shot Learnerscited by 3,747
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,317
- 2019The Curious Case of Neural Text Degenerationcited by 2,881
- 2020Learning to summarize from human feedbackcited by 2,562
26 more
- 2020The Pile: An 800GB Dataset of Diverse Text for Language Modelingcited by 2,346
- 2019Fine-Tuning Language Models from Human Preferencescited by 2,124
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2018SentencePiece: A simple and language independent subword tokenizer and detokenizer for Neural Text Processingcited by 1,973
- 2021Multitask Prompted Training Enables Zero-Shot Task Generalizationcited by 1,462
- 2022Competition-Level Code Generation with AlphaCodecited by 1,427
- 2023Large Language Models Cannot Self-Correct Reasoning Yetcited by 965
- 2023Teaching Large Language Models to Self-Debugcited by 963
- 2021Measuring Coding Challenge Competence With APPScited by 879
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
- 2023StarCoder: may the source be with you!cited by 790
- 2021Cross-Task Generalization via Natural Language Crowdsourcing Instructionscited by 696
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 492
- 2022A Systematic Evaluation of Large Language Models of Codecited by 360
- 2022The Stack: 3 TB of permissively licensed source codecited by 354
- 2021Symbolic Knowledge Distillation: from General Language Models to Commonsense Modelscited by 270
- 2022Efficient Training of Language Models to Fill in the Middlecited by 248
- 2022Grounded Copilot: How Programmers Interact with Code-Generating Modelscited by 216
- 2023SantaCoder: don't reach for the stars!cited by 169
- 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 149
- 2022Large Language Models Meet NL2Code: A Surveycited by 135
- 2023Self-Edit: Fault-Aware Code Editor for Code Generationcited by 110
- 2023DERA: Enhancing Large Language Model Completions with Dialog-Enabled Resolving Agentscited by 52
- 2023Exploring the Potential of ChatGPT in Automated Code Refinement: An Empirical Studycited by 44
- 2021Self-Tuning for Data-Efficient Deep Learningcited by 39
- 2020Patching as Translation: the Data and the Metaphorcited by 18
Built on by
Citing papers per year: 2024: 15; 2025: 16; 2026: 8.
39 papers.
Sort:
By area:
- 2024Beyond Functional Correctness: Exploring Hallucinations in LLM-Generated Codecited by 106
- 2024From LLMs to LLM-based Agents for Software Engineering: A Survey of Current, Challenges and Futurecited by 85
- 2024Alibaba LingmaAgent: Improving Automated Issue Resolution via Comprehensive Repository Explorationcited by 58
- 2024Lingma SWE-GPT: An Open Development-Process-Centric Language Model for Automated Software Improvementcited by 57
- 2024Code Repair with LLMs gives an Exploration-Exploitation Tradeoffcited by 50
- 2024From Code to Correctness: Closing the Last Mile of Code Generation with Hierarchical Debuggingcited by 46
- 2024LeDex: Training LLMs to Better Self-Debug and Explain Codecited by 39
- 2025AutoTriton: Automatic Triton Programming with Reinforcement Learning in LLMscited by 38
- 2025VulnBot: Autonomous Penetration Testing for A Multi-Agent Collaborative Frameworkcited by 30
- 2025QualityFlow: An Agentic Workflow for Program Synthesis Controlled by LLM Quality Checkscited by 22
- 2025Exploring Autonomous Agents: A Closer Look at Why They Fail When Completing Taskscited by 20
- 2025debug-gym: A Text-Based Environment for Interactive Debuggingcited by 19
27 more
- 2025Sailing by the Stars: A Survey on Reward Models and Learning Strategies for Learning from Rewardscited by 14
- 2024Are LLMs Correctly Integrated into Software Systems?cited by 13
- 2024RGD: Multi-LLM Based Agent Debugger via Refinement and Generation Guidancecited by 12
- 2025Reasoning-as-Logic-Units: Scaling Test-Time Reasoning in Large Language Models Through Logic Unit Alignmentcited by 12
- 2024API-guided Dataset Synthesis to Finetune Large Code Modelscited by 11
- 2025Risk Assessment Framework for Code LLMs via Leveraging Internal Statescited by 8
- 2025Enhancing LLM Code Generation: A Systematic Evaluation of Multi-Agent Collaboration and Runtime Debugging for Improved Accuracy, Reliability, and Latencycited by 8
- 2025Validating Network Protocol Parsers with Traceable RFC Document Interpretationcited by 7
- 2025Differentiation-Based Extraction of Proprietary Data from Fine-Tuned LLMscited by 6
- 2025QCoder Benchmark: Bridging Language Generation and Quantum Hardware through Simulator-Based Feedbackcited by 6
- 2025Large Language Models for Validating Network Protocol Parserscited by 5
- 2026How Many Tries Does It Take? Iterative Self-Repair in LLM Code Generation Across Model Scales and Benchmarkscited by 5
- 2024SeCodePLT: A Unified Platform for Evaluating the Security of Code GenAIcited by 4
- 2024Mastering the Craft of Data Synthesis for CodeLLMscited by 3
- 2025Leveraging Metamemory Agent for Enhanced Data-Free Code Generation in Large Language Modelscited by 3
- 2025Teaching LLM to Reason: Reinforcement Learning from Algorithmic Problems without Codecited by 3
- 2026Falsification, Not Exposure: An Internally Preregistered Placebo-Controlled Decomposition of Self-Repair Feedback in Frozen Small Code Modelscited by 3
- 2025SDA: Steering-Driven Distribution Alignment for Open LLMs without Fine-Tuningcited by 2
- 2026Executing as You Generate: Hiding Execution Latency in LLM Code Interpreterscited by 2
- 2024Insights from Benchmarking Frontier Language Models on Web App Code Generationcited by 1
- 2024FTSmartAudit: A Knowledge Distillation-Enhanced Framework for Automated Smart Contract Auditing Using Fine-Tuned LLMscited by 1
- 2026From LLMs to Agents in Programming: The Impact of Providing an LLM with a Compilercited by 1
- 2026Feedback Over Form: Why Execution Feedback Matters More Than Pipeline Topology in 1-3B Code Generationcited by 1
- 2026FLARE: Fine-Grained Diagnostic Feedback for LLM Code Refinementcited by 1
- 2024Investigating the Transferability of Code Repair for Low-Resource Programming Languagescited by 0
- 2026ExeCRE: Execution-Consistency Guided Reliability Estimation for Self-Correcting Code Generationcited by 0
- 2026ACTS-SQL: Agentic and Critic-Oriented Tree-Structured SQL Correctness with Large Language Modelscited by 0
- 2026ACTS-SQL: Agentic and Critic-Oriented Tree-Structured SQL Correctness with Large Language Models15 Aug 2026
- 2026ExeCRE: Execution-Consistency Guided Reliability Estimation for Self-Correcting Code Generation5 Aug 2026
- 2026Falsification, Not Exposure: An Internally Preregistered Placebo-Controlled Decomposition of Self-Repair Feedback in Frozen Small Code Models30 Jun 2026
- 2026FLARE: Fine-Grained Diagnostic Feedback for LLM Code Refinement2 Jun 2026
- 2026Feedback Over Form: Why Execution Feedback Matters More Than Pipeline Topology in 1-3B Code Generation23 Apr 2026
- 2026How Many Tries Does It Take? Iterative Self-Repair in LLM Code Generation Across Model Scales and Benchmarks12 Apr 2026
- 2026Executing as You Generate: Hiding Execution Latency in LLM Code Interpreters1 Apr 2026
- 2026From LLMs to Agents in Programming: The Impact of Providing an LLM with a Compiler17 Jan 2026
- 2025SDA: Steering-Driven Distribution Alignment for Open LLMs without Fine-Tuning20 Nov 2025
- 2025QCoder Benchmark: Bridging Language Generation and Quantum Hardware through Simulator-Based Feedback30 Oct 2025
- 2025Exploring Autonomous Agents: A Closer Look at Why They Fail When Completing Tasks18 Aug 2025
- 2025Teaching LLM to Reason: Reinforcement Learning from Algorithmic Problems without Code10 Jul 2025
27 more
- 2025AutoTriton: Automatic Triton Programming with Reinforcement Learning in LLMs8 Jul 2025
- 2025Differentiation-Based Extraction of Proprietary Data from Fine-Tuned LLMs20 Jun 2025
- 2025Sailing by the Stars: A Survey on Reward Models and Learning Strategies for Learning from Rewards5 May 2025
- 2025Enhancing LLM Code Generation: A Systematic Evaluation of Multi-Agent Collaboration and Runtime Debugging for Improved Accuracy, Reliability, and Latency4 May 2025
- 2025Validating Network Protocol Parsers with Traceable RFC Document Interpretation25 Apr 2025
- 2025Risk Assessment Framework for Code LLMs via Leveraging Internal States20 Apr 2025
- 2025Large Language Models for Validating Network Protocol Parsers18 Apr 2025
- 2025debug-gym: A Text-Based Environment for Interactive Debugging27 Mar 2025
- 2025Reasoning-as-Logic-Units: Scaling Test-Time Reasoning in Large Language Models Through Logic Unit Alignment5 Feb 2025
- 2025VulnBot: Autonomous Penetration Testing for A Multi-Agent Collaborative Framework23 Jan 2025
- 2025QualityFlow: An Agentic Workflow for Program Synthesis Controlled by LLM Quality Checks20 Jan 2025
- 2025Leveraging Metamemory Agent for Enhanced Data-Free Code Generation in Large Language Models14 Jan 2025
- 2024Lingma SWE-GPT: An Open Development-Process-Centric Language Model for Automated Software Improvement1 Nov 2024
- 2024FTSmartAudit: A Knowledge Distillation-Enhanced Framework for Automated Smart Contract Auditing Using Fine-Tuned LLMs17 Oct 2024
- 2024Mastering the Craft of Data Synthesis for CodeLLMs16 Oct 2024
- 2024SeCodePLT: A Unified Platform for Evaluating the Security of Code GenAI14 Oct 2024
- 2024RGD: Multi-LLM Based Agent Debugger via Refinement and Generation Guidance2 Oct 2024
- 2024From Code to Correctness: Closing the Last Mile of Code Generation with Hierarchical Debugging2 Oct 2024
- 2024Insights from Benchmarking Frontier Language Models on Web App Code Generation8 Sep 2024
- 2024API-guided Dataset Synthesis to Finetune Large Code Models15 Aug 2024
- 2024From LLMs to LLM-based Agents for Software Engineering: A Survey of Current, Challenges and Future5 Aug 2024
- 2024Are LLMs Correctly Integrated into Software Systems?6 Jul 2024
- 2024Investigating the Transferability of Code Repair for Low-Resource Programming Languages21 Jun 2024
- 2024Alibaba LingmaAgent: Improving Automated Issue Resolution via Comprehensive Repository Exploration3 Jun 2024
- 2024LeDex: Training LLMs to Better Self-Debug and Explain Code28 May 2024
- 2024Code Repair with LLMs gives an Exploration-Exploitation Tradeoff26 May 2024
- 2024Beyond Functional Correctness: Exploring Hallucinations in LLM-Generated Code1 Apr 2024
- 2024From LLMs to LLM-based Agents for Software Engineering: A Survey of Current, Challenges and Futurecited by 85
- 2024Lingma SWE-GPT: An Open Development-Process-Centric Language Model for Automated Software Improvementcited by 57
- 2025VulnBot: Autonomous Penetration Testing for A Multi-Agent Collaborative Frameworkcited by 30
- 2025QualityFlow: An Agentic Workflow for Program Synthesis Controlled by LLM Quality Checkscited by 22
- 2025Exploring Autonomous Agents: A Closer Look at Why They Fail When Completing Taskscited by 20
- 2025debug-gym: A Text-Based Environment for Interactive Debuggingcited by 19
- 2024RGD: Multi-LLM Based Agent Debugger via Refinement and Generation Guidancecited by 12
- 2025Enhancing LLM Code Generation: A Systematic Evaluation of Multi-Agent Collaboration and Runtime Debugging for Improved Accuracy, Reliability, and Latencycited by 8
- 2025Leveraging Metamemory Agent for Enhanced Data-Free Code Generation in Large Language Modelscited by 3
- 2026From LLMs to Agents in Programming: The Impact of Providing an LLM with a Compilercited by 1
- 2026ACTS-SQL: Agentic and Critic-Oriented Tree-Structured SQL Correctness with Large Language Modelscited by 0
- 2026ACTS-SQL: Agentic and Critic-Oriented Tree-Structured SQL Correctness with Large Language Models15 Aug 2026
- 2026From LLMs to Agents in Programming: The Impact of Providing an LLM with a Compiler17 Jan 2026
- 2025Exploring Autonomous Agents: A Closer Look at Why They Fail When Completing Tasks18 Aug 2025
- 2025Enhancing LLM Code Generation: A Systematic Evaluation of Multi-Agent Collaboration and Runtime Debugging for Improved Accuracy, Reliability, and Latency4 May 2025
- 2025debug-gym: A Text-Based Environment for Interactive Debugging27 Mar 2025
- 2025VulnBot: Autonomous Penetration Testing for A Multi-Agent Collaborative Framework23 Jan 2025
- 2025QualityFlow: An Agentic Workflow for Program Synthesis Controlled by LLM Quality Checks20 Jan 2025
- 2025Leveraging Metamemory Agent for Enhanced Data-Free Code Generation in Large Language Models14 Jan 2025
- 2024Lingma SWE-GPT: An Open Development-Process-Centric Language Model for Automated Software Improvement1 Nov 2024
- 2024RGD: Multi-LLM Based Agent Debugger via Refinement and Generation Guidance2 Oct 2024
- 2024From LLMs to LLM-based Agents for Software Engineering: A Survey of Current, Challenges and Future5 Aug 2024
- 2025Sailing by the Stars: A Survey on Reward Models and Learning Strategies for Learning from Rewardscited by 14
- 2025Reasoning-as-Logic-Units: Scaling Test-Time Reasoning in Large Language Models Through Logic Unit Alignmentcited by 12
- 2025Teaching LLM to Reason: Reinforcement Learning from Algorithmic Problems without Codecited by 3
- 2025Teaching LLM to Reason: Reinforcement Learning from Algorithmic Problems without Code10 Jul 2025
- 2025Sailing by the Stars: A Survey on Reward Models and Learning Strategies for Learning from Rewards5 May 2025
- 2025Reasoning-as-Logic-Units: Scaling Test-Time Reasoning in Large Language Models Through Logic Unit Alignment5 Feb 2025
- 2024Are LLMs Correctly Integrated into Software Systems?cited by 13
- 2024Are LLMs Correctly Integrated into Software Systems?6 Jul 2024
- 2024Mastering the Craft of Data Synthesis for CodeLLMscited by 3
- 2024Mastering the Craft of Data Synthesis for CodeLLMs16 Oct 2024
- 2024Beyond Functional Correctness: Exploring Hallucinations in LLM-Generated Codecited by 106
- 2024Alibaba LingmaAgent: Improving Automated Issue Resolution via Comprehensive Repository Explorationcited by 58
- 2024Code Repair with LLMs gives an Exploration-Exploitation Tradeoffcited by 50
- 2024From Code to Correctness: Closing the Last Mile of Code Generation with Hierarchical Debuggingcited by 46
- 2024LeDex: Training LLMs to Better Self-Debug and Explain Codecited by 39
- 2025AutoTriton: Automatic Triton Programming with Reinforcement Learning in LLMscited by 38
- 2024API-guided Dataset Synthesis to Finetune Large Code Modelscited by 11
- 2025Risk Assessment Framework for Code LLMs via Leveraging Internal Statescited by 8
- 2025Validating Network Protocol Parsers with Traceable RFC Document Interpretationcited by 7
- 2025QCoder Benchmark: Bridging Language Generation and Quantum Hardware through Simulator-Based Feedbackcited by 6
- 2025Large Language Models for Validating Network Protocol Parserscited by 5
- 2026How Many Tries Does It Take? Iterative Self-Repair in LLM Code Generation Across Model Scales and Benchmarkscited by 5
12 most cited of 21 All 21 (JSON)
- 2026ExeCRE: Execution-Consistency Guided Reliability Estimation for Self-Correcting Code Generation5 Aug 2026
- 2026Falsification, Not Exposure: An Internally Preregistered Placebo-Controlled Decomposition of Self-Repair Feedback in Frozen Small Code Models30 Jun 2026
- 2026FLARE: Fine-Grained Diagnostic Feedback for LLM Code Refinement2 Jun 2026
- 2026Feedback Over Form: Why Execution Feedback Matters More Than Pipeline Topology in 1-3B Code Generation23 Apr 2026
- 2026How Many Tries Does It Take? Iterative Self-Repair in LLM Code Generation Across Model Scales and Benchmarks12 Apr 2026
- 2026Executing as You Generate: Hiding Execution Latency in LLM Code Interpreters1 Apr 2026
- 2025QCoder Benchmark: Bridging Language Generation and Quantum Hardware through Simulator-Based Feedback30 Oct 2025
- 2025AutoTriton: Automatic Triton Programming with Reinforcement Learning in LLMs8 Jul 2025
- 2025Validating Network Protocol Parsers with Traceable RFC Document Interpretation25 Apr 2025
- 2025Risk Assessment Framework for Code LLMs via Leveraging Internal States20 Apr 2025
- 2025Large Language Models for Validating Network Protocol Parsers18 Apr 2025
- 2024FTSmartAudit: A Knowledge Distillation-Enhanced Framework for Automated Smart Contract Auditing Using Fine-Tuned LLMs17 Oct 2024
12 newest of 21 All 21 (JSON)