TL;DR
As AI-generated code increasingly populates public repositories, future code LLMs risk being trained recursively on their own outputs, triggering severe "model collapse." This paper demonstrates that while model-independent filters (like syntax checks) can slow down this degradation, letting an AI review its own code creates a delusional "rubber-stamp" loop where the model praises and trains on its own increasingly broken code.
What Problem Does This Paper Address?
When generative models are trained recursively on synthetic data without fresh human data or external quality anchors, they suffer from model collapse—a failure mode where the model loses diversity, accumulates errors, and drifts away from the true data distribution.
In traditional software engineering, this loop is interrupted by a pull-request (PR) pipeline involving compilation, unit tests, and human code review. However, AI coding assistants now generate code faster than humans can review it, leading organizations to automate code review using LLMs. This paper investigates what happens when the code generator and the code reviewer are coupled in a closed recursive loop. The authors explore how different review regimes—no review, model-independent "Human-gates," and AI "self-gates"—affect the long-term stability of code LLMs.
Methods
The authors formalize the code review process as gated distributional reweighting, where generated samples are filtered by an acceptance function before entering the next round of fine-tuning. They evaluate three distinct gashing regimes over multiple recursive rounds:
- Vanilla (Ungated): No filtering; every generated code snippet is directly reused as training data for the next generation.
- Human-gate (Exogenous): Employs fixed, model-independent filters. Specifically, they use a syntax gate via Python's
compile()function and static quality metrics (repetition rate and token length constraints). - AI-self-gate (Endogenous): The code LLM evaluates its own generated code using internal signals. They test two variants: Perplexity filtering (retaining the lowest 25% perplexity samples) and a Binary Classifier (ranking by the logit-difference score between "good" and "bad" labels under a prompt).
Theoretical Analysis
Beyond empirical testing, the paper provides two key theoretical insights:
- Theorem 2.3 (Degeneracy to Ungated Recursion): They prove mathematically that under a self-confirming acceptance condition, an AI self-gate becomes constant on its own support, making it mathematically identical to completely unfiltered training.
- Proposition 2.1 (Spectral Concentration): They provide a representation-level view showing that recursive retraining causes representation covariance to concentrate into a low-dimensional subspace, explaining why output diversity narrows over time.
Datasets
The recursive training pipeline generates synthetic code using a fixed prompt pool extracted from The Stack. To measure degradation across rounds, the models are evaluated on three prominent benchmarks:
- HumanEval / HumanEval+: Evaluates functional correctness against unit tests.
- MBPP / MBPP+: Contains crowd-sourced introductory Python problems.
- LiveCodeBench (LCB): A continuously updated, contamination-free benchmark featuring recent competitive programming problems to probe out-of-distribution reasoning.
Key Insights and Ideas
- The "Rubber-Stamp" Regime: AI self-gates suffer from severe self-preference bias; they inherently favor code written in their own stylistic distribution. As the model's generation quality degrades, its internal reviewer continues to score its own outputs highly, effectively rubber-stamping nonsense code and accelerating collapse.
- Syntax $\neq$ Semantics: Human gates (like compilation checks) successfully maintain syntactically valid code across many rounds. However, they fail to arrest semantic drift—the code compiles perfectly but completely fails to solve the intended programming task.
- Universal Attractor Floor: Regardless of model architecture, parameter size (from 1.1B to 7B), or initial baseline performance, all models recursively trained on self-generated data degrade toward a common performance floor.
Key Results
The authors validated their findings across four model families: SantaCoder (1.1B), StarCoder2 (3B), Qwen2.5-Coder (1.5B), and Code Llama (7B) over 5 recursive rounds (15k total training steps).
- Rapid Vanilla Collapse: Unfiltered self-training destroys performance. SantaCoder's MBPP+ score plummeted by 97.3% (from a 0.294 baseline down to 0.008) by round 4.
- The Delusion of AI Gating: Under the Binary Classifier self-gate, an alarming divergence occurred: the model's internal acceptance scores rose over successive rounds while its actual benchmark correctness fell.
- Hard Tasks Disappear First: Complex reasoning tasks collapse almost immediately. Qwen2.5-Coder, which started with the highest LiveCodeBench baseline (0.238), collapsed to 0.000 by Round 5 under vanilla self-training.
Limitations and Future Work
- Simplified Proxies: The "Human-gate" filters used in this study (compilation and basic static rules) are simplified abstractions of real-world software pipelines. They do not fully check deep execution semantics, security vulnerabilities, or architectural design quality.
- Scope Constraints: The empirical evaluation focused primarily on Python benchmarks and models capped at 7B parameters.
- Future Directions: The authors emphasize that exploring longer training horizons, larger frontier models, multilingual codebases, and stronger execution-based verification (such as automated unit test generation) remain critical paths forward to finding stable training loops.
Summary updated