Try Again, Don't Look Back: Blind Resampling Outperforms Self-Repair in Small Code Models
🤯 Rethinking Code AI: Why Your Model’s ‘Self-Correction’ Might Be Its Biggest Flaw
If you’re building code agents or experimenting with LLMs for coding tasks, you know the drill: a model writes some code, it fails its tests, and then you feed that failure back to it. This is called self-repair, and it’s often presented as the gold standard for improving AI performance.
But groundbreaking research from Yuvraj Verma challenges this entire paradigm. The study, “Try Again, Don’t Look Back: Blind Resampling Outperforms Self-Repair in Small Code Models” (https://arxiv.org/abs/2607.26117), suggests that forcing a large language model to look at its own mistake—its previous failed code attempt—doesn’t actually help. In fact, it might be detrimental.
📉 The Core Finding: Anchoring and Repetition
The authors implemented a clever, placebo-controlled design comparing four retry methods:
- No Retry (Baseline): The standard measure.
- Failed Attempt Shown: Showing the model its own failed code/test output (Self-Repair).
- Blind Resampling: Giving the model a clean slate—just a general reminder to try again, without showing the failure details.
- Verbal Reflection: Augmenting the input with verbal commentary on the failure.
What they found was surprising: When you show the model its own failed attempt (Self-Repair), it tends to get stuck in a loop of near-identical, flawed code (the ‘anchoring’ effect). This repetition is worse than simply failing initially.
Meanwhile, Blind Resampling consistently outperformed the self-repair approach across multiple model sizes and was found to be computationally cheaper and equally effective at scale.
💡 Why Does Self-Reflection Fail? The Science of Anchoring
The paper attributes this failure to ‘anchoring’: when provided with its own previous work, the LLM is psychologically anchored to that initial attempt. Instead of diagnosing a fundamental flaw, it merely tweaks minor parts, failing to grasp the root cause.
Crucially, the study showed that the penalty caused by self-conditioning isn’t just an artifact of the specific task; it’s predictable and related only to the baseline quality of the model itself. The authors even replicated these findings on different models, solidifying the conclusion: the cost of committing to a bad first attempt is significant.
🚀 Takeaways for ML Engineers & Product Teams
If you are optimizing your coding agents, ditch the habit of feeding failed attempts directly back into the prompt. Instead:
- Embrace Blind Resampling: Treat failure as general feedback, not specific material to repeat. This method is highly effective and token-efficient.
- Minimize Context Overload: The actual content of the error message often adds nothing measurable beyond a simple ‘failure notice.’ Keep your prompts clean and focused on correction.
- Plan for Non-Repetitive Retries: When designing failure pipelines, focus less on fixing the previous attempt, and more on encouraging a wholly new line of thought.
This research is a crucial reality check for LLM agents, suggesting that sometimes the most sophisticated feedback mechanism (showing the error) is actually counterproductive. Read the full study here: https://arxiv.org/abs/2607.26117