Lune

ICLR2024Top-tier venue

Is Self-Repair a Silver Bullet for Code Generation?

Theo X. Olausson, Jeevana Priya Inala, Chenglong Wang, Jianfeng Gao, Armando Solar-Lezama

Abstract

Large language models have shown remarkable aptitude in code generation, but still struggle to perform complex tasks. Self-repair -- in which the model debugs and repairs its own code -- has recently become a popular way to boost performance in these settings. However, despite its increasing popularity, existing studies of self-repair have been limited in scope; in many settings, its efficacy thus remains poorly understood. In this paper, we analyze Code Llama, GPT-3.5 and GPT-4's ability to perform self-repair on problems taken from HumanEval and APPS. We find that when the cost of carrying out repair is taken into account, performance gains are often modest, vary a lot between subsets of the data, and are sometimes not present at all. We hypothesize that this is because self-repair is bottlenecked by the model's ability to provide feedback on its own code; using a stronger model to artificially boost the quality of the feedback, we observe substantially larger performance gains. Similarly, a small-scale study in which we provide GPT-4 with feedback from human participants suggests that even for the strongest models, self-repair still lags far behind what can be achieved with human-level debugging.

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.

59 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

  • CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learning cites Training language models to follow instructions with human feedback
  • Self-Refine: Iterative Refinement with Self-Feedback cites CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesis
  • Self-Refine: Iterative Refinement with Self-Feedback cites Training language models to follow instructions with human feedback
  • Teaching Large Language Models to Self-Debug cites CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learning
  • 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 Self-Refine: Iterative Refinement with Self-Feedback
  • Teaching Large Language Models to Self-Debug cites Training language models to follow instructions with human feedback
  • Magicoder: Empowering Code Generation with OSS-Instruct cites CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesis
  • Magicoder: Empowering Code Generation with OSS-Instruct cites Teaching Large Language Models to Self-Debug
  • AnalogCoder: Analog Circuit Design via Training-Free Code Generation cites Teaching Large Language Models to Self-Debug
  • WorldCoder, a Model-Based LLM Agent: Building World Models by Writing Code and Interacting with the Environment cites Teaching Large Language Models to Self-Debug
  • DiLu: A Knowledge-Driven Approach to Autonomous Driving with Large Language Models cites Training language models to follow instructions with human feedback
  • Goedel-Prover-V2: Scaling Formal Theorem Proving with Scaffolded Data Synthesis and Self-Correction cites Teaching Large Language Models to Self-Debug
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers59

  1. DiLu: A Knowledge-Driven Approach to Autonomous Driving with Large Language ModelsLicheng Wen, Daocheng Fu, Xin Li, Xinyu Cai et al.ICLR 2024 · 255 citations
  2. Magicoder: Empowering Code Generation with OSS-InstructYuxiang Wei, Zhe Wang, Jiawei Liu, Yifeng Ding et al.ICML 2024 · 246 citations
  3. Goedel-Prover-V2: Scaling Formal Theorem Proving with Scaffolded Data Synthesis and Self-CorrectionYong Lin, Shange Tang, Bohan Lyu, Ziran Yang et al.ICLR 2026 · 160 citations
  4. WorldCoder, a Model-Based LLM Agent: Building World Models by Writing Code and Interacting with the EnvironmentHao Tang, Darren Key, Kevin EllisNeurIPS 2024 · 123 citations
  5. AnalogCoder: Analog Circuit Design via Training-Free Code GenerationYao Lai, Sungyoung Lee, Guojin Chen, Souradip Poddar et al.AAAI 2025 · 105 citations

Builds on13

  1. Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida et al.NeurIPS 2022 · 24,707 citations
  2. Self-Refine: Iterative Refinement with Self-FeedbackAman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan et al.NeurIPS 2023 · 4,972 citations
  3. Teaching Large Language Models to Self-DebugXinyun Chen, Maxwell Lin, Nathanael Schärli, Denny ZhouICLR 2024 · 1,085 citations
  4. CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement LearningHung Le, Yue Wang, Akhilesh Deepak Gotmare, Silvio Savarese et al.NeurIPS 2022 · 571 citations
  5. 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

  1. Self-Edit: Fault-Aware Code Editor for Code GenerationKechi Zhang, Zhuo Li, Jia Li, Ge Li et al.ACL 2023 · 42 citations
  2. INTERVENOR: Prompting the Coding Ability of Large Language Models with the Interactive Chain of RepairHanbin Wang, Zhenghao Liu, Shuo Wang, Ganqu Cui et al.ACL Findings 2024 · 14 citations
  3. Iterative Refinement of Project-Level Code Context for Precise Code Generation with Compiler FeedbackZhangqian Bi, Yao Wan, Zheng Wang, Hongyu Zhang et al.ACL Findings 2024 · 18 citations
  4. DebugBench: Evaluating Debugging Capability of Large Language ModelsRunchu Tian, Yining Ye, Yujia Qin, Xin Cong et al.ACL Findings 2024 · 54 citations
  5. 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
Dusk over the sea between two cliffs drawn in fine vertical lines