arXiv(opens in a new tab)cs.CLAug 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2609.00077

Beneath the Diff: Diagnosing and Mitigating Algorithmic Mode Collapse in Code-Level Autonomous Research Loops

Bowei He, Weixu Zhang, Yili Jin, Xue Liu

Abstract

Code-level autonomous research loops (ARLs) have recently emerged as a concrete object of study in automated machine learning research. In such loops, an LLM agent proposes modifications to an experimental training pipeline, executes the modified pipeline, and retains edits that improve a verifiable in-loop metric. Although executable metrics may appear to provide a reliable signal of progress, it remains unclear whether repeated metric-driven code editing leads to genuine improvements that generalize beyond the loop. We provide a systematic diagnosis of this question. Across various experiment settings, we identify a robust failure mode that we call algorithmic mode collapse. In this regime, surface-level edit diversity remains stable, but semantic and mechanism-level diversity collapse: the agent continues to edit different lines of code while repeatedly proposing the same kinds of algorithmic changes. This collapse is accompanied by a widening gap between in-loop metric gains and gains measured on independent held-out evaluations. We then propose Diversity-Aware Proposal Sampling (DAPS), a lightweight mitigation that combines category-coverage reweighting, persistent edit memory, and a validation gate. Under a three-tier protocol separating the in-loop metric, the audit metric read by the gate, and a blind metric no loop component ever accesses, DAPS reduces semantic-cluster decay of edits by 69.1% and improves relative faithfulness by 83.7% blind and 81.6% audited, while preserving in-loop optimization speed. We provide the code in Github repository.

1 Introduction

The recent open-source release of iterative autonomous research agents, like the most prominently autoresearch by Karpathy (2026) and the broader AI-Scientist family (Lu et al., 2024; Schmidgall et al., 2025; Tang et al., 2026; Gottweis

et al., 2025), has made code-level autonomous research loops (ARLs) a concrete object of study in automated machine learning research. In such loops, an LLM proposer generates modifications to a training pipeline (optimizer settings, architectural details, data preprocessing, or loss formulations), the modified pipeline is executed, and a validation metric decides whether the edit is retained or reverted. Thus, we can automate the iterative search for better training recipes with minimal human intervention. Unlike recursive training (Kovač et al., 2025) which relies on self-generated training samples to improve the model, code-level ARLs can access optimization signals grounded in an external, executable evaluation. Therefore, one might expect autonomous research loops to be immune to the diversity collapse in recursive training loops, which narrows the space of generated solutions and undermines generalization (Shumailov et al., 2024; Zhu and Xie, 2026; Mishra, 2026).

However, we find that this expectation should be questioned. Code-level ARL, despite using a verifiable external metric, exhibits a previously undocumented failure mode we call algorithmic mode collapse: the surface of the agent's behavior, such as the lines it edits, the lexical form of its diffs, remains diverse, while the semantics of its proposals, what each edit is actually trying to accomplish, progressively concentrates on a small number of recurring patterns. Figure 1 shows the phenomenon at a glance: across four NLP-relevant tasks, surface edit diversity is essentially flat over 500 iterations, while the number of semantic clusters in the proposal stream collapses by 50 to 70%. This narrowing changes the character of the loop. Rather than continuing to search broadly over possible algorithmic interventions, the proposer increasingly returns to a small repertoire of edits that reliably improve the in-loop metric. Such concentration might be benign if it reflected convergence on genuinely useful mechanisms. In our experiments,

*Corresponding to Dr. Yili Jin.

Figure

Figure

Figure 1: Algorithmic mode collapse in code-level ARLs. Left: surface-level edit diversity, measured as mean pairwise normalized edit distance over a sliding window of 20 accepted diffs, remains essentially flat across 500 iterations on all four tasks. Right: semantic-cluster count, obtained by Sentence-BERT (Reimers and Gurevych, 2019) embeddings of LLM-summarized edit descriptions followed by HDBSCAN clustering (Campello et al., 2013), collapses by 50 to 70% over the same horizon. The agent keeps editing different lines of code, but is increasingly proposing the same kind of change. Shaded regions are ±1\pm1 standard deviation over 3 seeds.

however, it is accompanied by a growing gap between optimization-metric improvements claimed inside the loop and improvements measured on independent held-out evaluations. As the proposer's repertoire narrows, it increasingly produces edits that overfit the in-loop signal rather than improve the underlying system. By iteration 300, average in-loop gains overstate held-out gains by a factor of 2.0 to 2.6 across our tasks.

Building on this diagnosis, we introduce the mitigation strategy Diversity-Aware Proposal Sampling (DAPS), that injects three lightweight components into an existing ARL loop: a category-coverage reweighting that nudges the proposer toward under-represented edit mechanisms, a persistent semantic memory that suppresses proposals too similar to recently accepted ones, and a validation gate that reverts the pipeline to its last faithful state when the gap between the in-loop metric and a sparingly consulted audit metric exceeds a calibrated threshold. DAPS reduces semantic-cluster decay of edit descriptions by 69.1% and improves the relative faithfulness by 81.6% averaged across tasks, while matching or slightly trailing vanilla autoresearch on in-loop optimization speed. Because the gate consumes the audit metric, we also score every configuration on blind sets that no component ever accesses, where the advantage persists.

Our contributions can be summarized as follows: (i) We conduct the first controlled empirical study of code-level ARL dynamics over long horizons across NLP tasks, producing ARL trajectories with logged proposals, diffs, executions, and held-out evaluations. (ii) We introduce a four-axis diagnos-

tic instrument: surface, semantic, mechanism, and corpus-similarity diversity, together with a faithfulness audit that operationalize algorithmic mode collapse and reveal its link to in-loop/held-out divergence. (iii) We propose DAPS, a drop-in mitigation that materially reduces collapse and improves faithfulness across three proposer LLMs without slowing optimization. (iv) We show that surface-only diversity measurements that are common in prior data-level collapse analyses (Li et al., 2026; Mishra, 2026), systematically miss algorithmic mode collapse, motivating semantic-aware monitoring for future ARL deployment.

References (37)