Rapid Fixes, Gradual Failures: Exploring Iterative Self-Correction Dynamics in Large Language Models for Program Synthesis

Tyler Holloway, Nada AminDL4C @ ICML 2026

TL;DR

Iterative self-correction is often touted as a way for Large Language Models (LLMs) to fix their own coding errors, but this paper reveals it is a game of diminishing returns. Most successful "repairs" happen on the very first attempt, and if a model fails to solve a task in its initial batch of samples, it is unlikely to ever self-correct, regardless of how many iterations or how much "refinement history" it is given.

What Problem Does This Paper Address?

While LLMs are impressive at generating code, they rarely get it right 100% of the time on the first try. The industry has moved toward "self-repair" loops, where a model critiques its own buggy code and attempts to fix it. However, we don't fully understand the dynamics of these loops.

Is the model actually "reasoning" through its mistakes over multiple steps, or is it just getting a second (or third) lucky roll of the dice? Does seeing a history of its previous failed attempts help it avoid repeating mistakes, or does it just add noise? This paper investigates whether self-correction is a "silver bullet" or a process prone to stagnation and gradual failure.

Methods

The researchers evaluated three frontier models—GPT-4o-mini, GPT-5.1, and Claude Sonnet 4.5—across a trajectory of up to 10 refinement attempts.

Unlike previous studies that used independent sampling (which mimics self-repair but isn't a true loop), this work used greedy decoding ($\tau=0$) for the critique and refinement steps. This ensures that any change in the code is due to the model's internal reasoning rather than random sampling noise. They tested two primary conditions:

  • $h=0$ (Critique Only): The model only sees the current buggy program and the task description.
  • $h=1$ (Full History): The model sees the entire history of its previous attempts and their respective "pass fractions" (how many tests they passed).

Datasets

The study utilized four major execution-based benchmarks:

  1. HumanEval: The classic Python coding benchmark (164 tasks).
  2. HumanEval-Java: A Java translation to test cross-language dynamics.
  3. MBPP+: An "augmented" version of the Mostly Basic Python Problems with significantly more test cases to prevent "lucky" passes.
  4. APPS (Intro & Comp): A more difficult dataset featuring introductory and competition-level programming challenges.

Key Insights and Ideas

  • Recovery is a Task-Level Property: The strongest predictor of whether a model can fix a buggy program isn't the code itself, but whether the model managed to solve that same task in any of its other initial attempts. If a model failed all five initial seeds, the recovery rate was only 22.9%. If it solved at least one, the recovery rate for the remaining buggy seeds jumped to 76.6%. This suggests that self-repair only works when the task is already within the model's "capability envelope."
  • The "First Attempt" Cliff: Refinement is heavily front-loaded. About 57% of all successful repairs happen on the very first try. If the model doesn't fix the bug immediately, the probability of success drops off a cliff in subsequent rounds.
  • Stagnation is Endemic: For seeds that didn't recover, about 45% of them entered a state of "stagnation," where the model generated new code that passed the exact same number of tests as the previous version, making zero measurable progress over 10 iterations.
  • History Can Hurt: Surprisingly, providing the model with a history of its failed attempts ($h=1$) did not consistently improve results. In fact, for GPT models on the MBPP+ benchmark, history actually degraded performance. The authors suggest that even "clean" history can compound self-reinforcing errors.

Key Results

  • Odds Ratio of 11x: Failing seeds on tasks where at least one other seed passed were 11 times more likely to recover than those on tasks where every initial seed failed.
  • Immediate Divergence: By the first refinement attempt, there is already a 42 percentage point gap in pass fractions between seeds that will eventually recover and those that won't.
  • Language Sensitivity: Models working in Java degraded 30–50% faster per iteration than those working in Python, likely due to Java's stricter type system and compilation requirements narrowing the "plausible" move space.
  • Model Variance: On the hardest tasks (APPS Comp), a massive 46.9 percentage point gap emerged between GPT-5.1 (which improved) and GPT-4o-mini (which struggled), showing that model "intelligence" scales significantly in self-repair scenarios.

Limitations and Future Work

The authors acknowledge that their "history" condition ($h=1$) only provided the code and pass fractions. They did not provide raw compiler error messages or specific failing test cases (the "oracle" feedback).

Future work could investigate whether a "richer" feedback channel—such as stack traces or execution logs—would break the stagnation patterns observed here. Additionally, because these benchmarks are well-known, training-set contamination remains a background concern for all LLM evaluations, though the researchers argue the dynamics of the repair loop are likely still representative.

Summary updated

BibTeX
@inproceedings{holloway2026rapid,
  author = {Tyler Holloway and Nada Amin},
  title = {{Rapid Fixes, Gradual Failures: Exploring Iterative Self-Correction Dynamics in Large Language Models for Program Synthesis}},
  booktitle = {DL4C @ ICML},
  year = {2026},
  url = {https://openreview.net/forum?id=QSO4fnmXfR},
}
Figure