mlsanityData to 7 Oct 2026

How Many Tries Does It Take? Iterative Self-Repair in LLM Code Generation Across Model Scales and Benchmarks

arXiv 2604.10508 ↗First posted 12 Apr 2026cs.SE cs.AIcited by 5

Not on the map. Why?

Abstract (arXiv)

Large language models frequently fail to produce correct code on their first attempt, yet most benchmarks evaluate them in a single-shot setting. We investigate iterative self-repair (feeding execution errors back to the model for correction) across seven models spanning three families and both open-weight and proprietary providers: Llama 3.1 8B, Llama 3.3 70B, Llama 4 Scout (MoE, 16 experts), Llama 4 Maverick (MoE, 128 experts), Qwen3 32B, Gemini 2.5 Flash, and Gemini 2.5 Pro. On HumanEval (164 problems) and MBPP Sanitized (257 problems) with up to five attempts, self-repair universally improves pass rates: +4.9 to +17.1 pp on HumanEval and +16.0 to +30.0 pp on MBPP. Gemini 2.5 Flash achieves the highest final pass rates (96.3% HumanEval, 93.8% MBPP). Most gains concentrate in the first two rounds.Error-type analysis shows assertion errors (logical mistakes) are the hardest to repair at ~45%, while syntax and name errors are repaired at substantially higher rates, connecting to broader findings on the limits of LLM self-correction. Prior work found that weaker models fail at self-repair or require fine-tuning; we show that modern instruction-tuned models succeed with prompting alone, even at 8B scale. We also provide the first comparison of dense and MoE architectures for self-repair, and extend the repair-vs-resampling tradeoff analysis to modern models. A prompt ablation reveals chain-of-thought repair yields up to +5.5 pp additional self-repair gain (measured as improvement in repair delta) over minimal prompting for capable models.

Key facts. Cited by 5 papers in the map (data through 7 Oct 2026). Builds on 23 of its 30 references that are in the map. First posted on arXiv 12 Apr 2026.

Builds on

23 of 30 references.

References · 23

  1. 2025Qwen3 Technical Reportcited by 8,195
  2. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  3. 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,064
  4. 2021Program Synthesis with Large Language Modelscited by 3,509
  5. 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,317
  6. 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
  7. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  8. 2024LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Codecited by 1,906
  9. 2022Competition-Level Code Generation with AlphaCodecited by 1,427
  10. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
  11. 2023Large Language Models Cannot Self-Correct Reasoning Yetcited by 965
  12. 2023Teaching Large Language Models to Self-Debugcited by 963
11 more
  1. 2021Measuring Coding Challenge Competence With APPScited by 879
  2. 2024BigCodeBench: Benchmarking Code Generation with Diverse Function Calls and Complex Instructionscited by 527
  3. 2022CodeRL: Mastering Code Generation through Pretrained Models and Deep Reinforcement Learningcited by 342
  4. 2023Self-collaboration Code Generation via ChatGPTcited by 255
  5. 2023Is Self-Repair a Silver Bullet for Code Generation?cited by 191
  6. 2019SPoC: Search-based Pseudocode to Codecited by 176
  7. 2024Code Repair with LLMs gives an Exploration-Exploitation Tradeoffcited by 50
  8. 2023SelfEvolve: A Code Evolution Framework via Large Language Modelscited by 43
  9. 2024CYCLE: Learning to Self-Refine the Code Generationcited by 39
  10. 2024LeDex: Training LLMs to Better Self-Debug and Explain Codecited by 39
  11. 2025Revisit Self-Debugging with Self-Generated Tests for Code Generationcited by 21

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2026: 5.

5 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025The Art of Repair: Optimizing Iterative Program Repair with Instruction-Tuned Models
  2. 2026Unlocking LLM Code Correction with Iterative Feedback Loops
  3. 2025Self-Bootstrapping Automated Program Repair: Using LLMs to Generate and Evaluate Synthetic Training Data for Bug Repair
  4. 2026Does Fixing Break Security? An Empirical Study of Security Degradation in Iterative LLM-Driven Infrastructure-as-Code Repair ↗
  5. 2025Unlocking LLM Repair Capabilities Through Cross-Language Translation and Multi-Agent Refinement
  6. 2025FeedbackEval: A Benchmark for Evaluating Large Language Models in Feedback-Driven Code Repair Tasks
  7. 2026Structured Feedback Improves Repair in an LLM Agent Loop
  8. 2024Aligning the Objective of LLM-based Program Repair