AI自动生成代码循环训练会导致模型质量下降,需外部验证防止崩溃。
When AI Reviews Its Own Code: Recursive Self-Training Collapse in Code LLMs

- 用AI自身评分和困惑度做代码筛选,看似有效实则失效
- 无审查时模型性能最快退化,人类过滤仅延缓不阻止崩溃
- 代码生成循环中应依赖外部审核,而非模型自我审查
递归自训练在神经生成模型中可能导致性能退化,当生成数据被重复使用而缺乏新鲜人工数据或外部质量控制时尤为明显。本文研究代码大模型中的这一风险:AI生成的代码进入真实仓库后,可能再次成为训练数据,形成仓库级别的自训练循环。传统软件开发通过代码审查、测试、编译和人工审批中断此循环,但如今AI编码工具生成速度已超过人类审查能力,且代码审查本身也日益由AI系统自动化。因此,本文对比三种递归微调策略:无审查、基于独立于模型的过滤器(如编译与静态检查)的人类把关,以及利用代码大模型自身信号(如困惑度和二元自评分)的AI自把关。在多个代码大模型和基准测试中,无审查组退化最快;人类把关虽可减缓但无法阻止崩溃;而AI自把关初期表现良好,后期过滤效果丧失,在最清晰案例中,二元自把关进入‘盖章式’接受状态——接受率上升,基准正确率反而下降。本文通过将审查建模为受控分布重加权,证明在自确认接受条件下,AI自把关会退化为无控制自训练,并给出表示层协方差集中性的谱分析。结果表明,稳定递归代码大模型训练需依赖外源验证,而非模型内耦合的自我审查。
原文摘要 · Abstract (English)
Recursive self-training can degrade neural generative models when generated data is reused without fresh human data or external quality control. We study this risk in code LLMs, where AI-generated code can enter real repositories, later become training data, and create a repository-scale self-training loop. While software development traditionally interrupts this loop through pull-request review, tests, compilation, and human approval, AI coding tools now produce code faster than humans can review it, and code review itself is increasingly automated by AI systems. We therefore compare three recursive fine-tuning regimes: no review, Human-gate review using model-independent filters such as compilation and static quality checks, and AI-self-gate review using the code LLM's own signals such as perplexity and binary self-scoring. Across multiple code LLMs and benchmarks, no review collapses fastest, Human-gate filters slow but do not stop collapse, and AI-self-gate filters can look strong early but later lose their filtering effect. In the clearest case, the binary self-gate enters a rubber-stamp regime where acceptance scores rise while benchmark correctness falls. We explain this behavior by formulating review as gated distributional reweighting, proving that AI self-gating degenerates to ungated self-training under a self-confirming acceptance condition, and giving a spectral analysis of representation-level covariance concentration under recursive retraining. These results suggest that stable recursive code LLM training requires exogenous verification rather than model-coupled self-review.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。