Darwin Godel Machine: Open-Ended Evolution of Self-Improving Agents — part 2/6
Cleaned-text code points [15251, 30921). Bibliography omitted here; source.md includes it.
Self-referential Self-improvement of Coding Agents. The DGM is initialized with only one coding agent, and its progression is evaluated on coding benchmarks. A coding agent is defined as a single system, implemented with a code repository and powered by frozen pretrained foundation models (FMs), capable of reading, writing, and executing code. Code, when expressed in a general-purpose Turing-complete language (e.g., Python), is a powerful medium for building and improving intelligent systems because it can represent any computable process. Recent works ( Hu et al., 2025 ; Zhang et al., 2024c ) demonstrate that such agents can be improved through meta-learning of their designs (e.g., prompts, workflows, and tools), which are implemented in their code repository. Therefore, we define self-improvement as a coding task that involves modifying the design of an agent’s own components (i.e., its own code, which does not include the open-ended exploration process described in the next paragraph). The key motivation is that the empirical evidence must reflect the system’s ability to both self-improve and solve downstream tasks. By configuring the DGM as a coding agent and testing its coding capabilities, the observed improvements demonstrate not only enhanced performance in downstream tasks but also the capacity for further self-improvement, as self-improvement is fundamentally a coding task that modifies the coding agent’s own code repository. Population-based Open-ended Exploration. Starting from a single initial coding agent, the DGM builds an archive of all discovered agents. In each iteration, the DGM selects parent agents to self-modify and branch off to produce new agents. Parent selection is roughly proportional to each agent’s performance score and inversely proportional to the number of its children with codebase-editing functionality ( Section C.2 ). This favors high-performing agents that have been underexplored (i.e., have fewer existing children), thereby promoting both exploitation of strong performers and exploration of promising but less-sampled lineages. All agents retain a non-zero selection probability, ensuring that any path to improvement remains feasible given sufficient compute. Each selected parent analyzes its own benchmark evaluation logs, proposes the next feature to implement, and receives this proposal as a problem statement to execute ( Section C.3 ). The parent then implements the suggested feature into its own codebase, generating a new coding agent. Each newly generated agent is quantitatively evaluated on a chosen coding benchmark to estimate its coding abilities. Only agents that compile successfully and retain the ability to edit a given codebase are added to the DGM archive, as only they can continue self-modification. All others are discarded. The cycle of parent selection, self-modification, and evaluation continues, progressively growing the archive of solutions. Importantly, we note that archived solutions can serve as stepping stones that result in improvements much later than their original discovery, making our approach substantially different from hill-climbing agentic design approaches ( Robeyns et al., 2025 ) . Currently, the open-ended exploration process (i.e., archive maintenance, parent selection) is fixed and not modifiable by the DGM, which we leave as an avenue for future work. Section C.4 shows the pseudocode for the DGM algorithm. ## 4 Experiments Section 4.1 describes the experimental setup, including the initial coding agent that initializes the DGM. We conduct experiments on two coding benchmarks: SWE-bench ( Jimenez et al., 2024 ) and Polyglot ( Paul Gauthier, 2024 ) ( Section 4.2 ). For each benchmark, we compare the DGM against two baselines: DGM without self-improving agents and DGM without open-ended exploration ( Section 4.3 ). Across all experiments, we find that the DGM outperforms both baselines, showing that the self-improvement mechanism and open-ended exploration are essential for sustained performance gains ( Section 4.4 ). Furthermore, we show that the features discovered by the DGM transfer across models, benchmarks, and tasks ( Section 4.4 ). ### 4.1 Experiment Setup The DGM is initialized with a single coding agent. This base agent is built around a frozen FM and augmented with tool use capabilities ( Schick et al., 2023 ; Anthropic, 2024b ) . The FM autonomously determines its action at each step, using whichever tool it deems appropriate. The base agent has access to two tools: a Bash tool for executing bash commands, and an edit tool for viewing and editing directories and entire files ( Section C.1 ). The agent receives a single input prompt that specifies the location of the target repository, the problem statement, and the repository’s testing framework ( Section C.1 ). The base agent is intentionally lightweight to provide a simple starting point from which self-improvement can be clearly demonstrated. We run the DGM for 80 iterations (generating one new agent per iteration), with two iterations running in parallel for SWE-bench and four for Polyglot ( Section C.2 ). During self-modifications, coding agents are powered by Claude 3.5 Sonnet (New) ( Anthropic, 2024a ) in both SWE-bench and Polyglot experiments. During benchmark evaluation, coding agents are powered by Claude 3.5 Sonnet (New) for SWE-bench and o3-mini ( OpenAI, 2025 ) for Polyglot ( Section D.1 ). ### 4.2 Benchmarks We evaluate the DGM on two popular benchmarks that assess different aspects of coding tasks to validate the algorithm’s effectiveness across various use cases. Both SWE-bench and Polyglot are benchmarks that evaluate how well AI agents solve coding tasks automatically. Given a code repository and a task instruction, the agent is expected to make changes to the repository in order to fulfill the task. Both SWE-bench and Polyglot are widely used benchmarks ( Zhang et al., 2024d ; Zhang et al., 2024a ; Xia et al., 2024 ; Cao et al., 2024 ; Google DeepMind, 2025 ; Gauthier, 2024 ) that require the AI agent to navigate a code repository, understand the interplay between functions in different files, and spot small errors in convoluted code. SWE-bench only has Python tasks, while Polyglot has tasks in multiple programming languages. Another difference is that each SWE-bench task may require edits to multiple files, whereas each Polyglot task primarily involves implementing a solution from scratch in a single file (although the agent still needs to examine other files to understand what changes are necessary), resulting in fewer file edits overall. SWE-bench. To avoid wasting compute on unsolvable tasks, we use SWE-bench Verified ( OpenAI, 2024 ) , a human-filtered subset of SWE-bench ( Jimenez et al., 2024 ) where all tasks are solvable. Throughout this paper, the term SWE-bench refers by default to to the SWE-bench Verified subset. Polyglot. Polyglot includes tasks in multiple programming languages (C++, Rust, Python, etc.) ( Paul Gauthier, 2024 ) . Compared to SWE-bench, one of the most widely used coding benchmarks and likely included in the training sets of FMs, Polyglot is more niche and less likely to be included in FMs’ post-training data. Additionally, Polyglot is primarily used by its developer to evaluate Aider ( Gauthier, 2024 ) . This provides an opportunity to compare automatically designed agents with a representative coding agent in the community, which has been continuously developed and tested against the Polyglot benchmark over a year by human developers. Finally, Polyglot enables testing of the DGM’s ability to generalize across multiple programming languages beyond just Python. We follow the Polyglot leaderboard setup ( Paul Gauthier, 2024 ) , with one key difference: the leaderboard reports pass@2, where the agent can view feedback from ground-truth tests once, whereas we report pass@1, where the agent never sees ground-truth test results. Since it is expensive to evaluate on the full benchmarks ( Section E.1 ), we use a staged evaluation strategy to estimate the coding agent’s performance. In general, we evaluate the coding agent on more tasks when we are more confident that it is a relatively strong performer. We first evaluate each coding agent on a set of 10 tasks to verify basic codebase-editing functionality. Only agents that retain the ability to edit code can solve downstream coding tasks or perform further self-modifications. Agents that pass this initial stage are then evaluated on an expanded set of 50 tasks. For SWE-bench, tasks are selected based on SWE-bench-verified-mini ( Hobbhahn, 2025 ) , which is designed to be a representative sample of the full benchmark ( Section E.2 ). For Polyglot, tasks are chosen as a random subset of the full benchmark ( Section E.3 ). Because the LLMs we use are inherently stochastic, performance can be noisy. We use smaller subset evaluations to estimate general effectiveness and identify top candidates. For SWE-bench, if a coding agent achieves over 40% success (a heuristic chosen based on the noise observed in preliminary runs) on the 60-task subset and ranks among the top two performers in the archive, it is then evaluated on 200 tasks (140 plus the previous 60) to more accurately assess its true coding capability ( Section E.2 ). For Polyglot, if a coding agent achieves over 40% success on the 10-task subset, it is evaluated on an expanded 50-task subset ( Section E.3 ). ### 4.3 Baselines To isolate and evaluate the contribution of the DGM’s core components, we compare the DGM against two baselines: DGM without self-improving agents ( DGM w/o self-improve ) and DGM without open-ended exploration ( DGM w/o open-ended exploration ). DGM w/o self-improve replicates the approach of ADAS ( Hu et al., 2025 ) in this setting, wherein the meta agent responsible for modifying the coding agents remains fixed as the base agent throughout the experiment ( Algorithm 2 ). This baseline allows us to assess the role of iterative self-improvement in accelerating the evolution of better coding agents. DGM w/o open-ended exploration eliminates the use of an archive and always self-modifies the latest stored version of itself ( Algorithm 3 ). If a coding agent self-modifies to the point where it loses the basic functionality required to edit a codebase, it can no longer modify itself or solve any coding task. Therefore, DGM w/o open-ended exploration retains the latest version of itself that still maintains the basic functionality for codebase editing. This baseline allows us to evaluate the impact of having an archive and the well-documented beneficial principles of open-ended exploration ( Clune, 2019 ; Stanley and Lehman, 2015 ; Zhang et al., 2024b ; Fernando et al., 2024 ; Lee et al., 2020 ; Samvelyan et al., 2024 ; Colas et al., 2022b ) in guiding the agent’s evolution. In addition to the learned baselines, we compare the DGM against handcrafted, open-source solutions. For SWE-bench, we take the state-of-the-art (SoTA) open-source solution that has been checked (i.e., the SWE-bench team was able to reproduce the results) ( Section E.4 ). For Polyglot, we take the representative agent (Aider) ( Gauthier, 2024 ) , which is open-sourced and designed to support multiple programming languages and large codebase editing ( Section E.5 ). For a fair comparison, we measure the percentage of solved tasks on the same benchmark subsets used to evaluate the DGM ( Section E.2 , Section E.3 ). These values are shown as dotted horizontal lines in Figure 2 . ### 4.4 Results After 80 iterations of the DGM, the coding agent’s performance increases from 20.0% to 50.0% on SWE-bench, and from 14.0% to 38.0% on Polyglot ( Figure 2 ). Since the DGM is evaluated on only 50 tasks in the Polyglot experiment setup ( Section 4.2 ), we additionally evaluate both the base agent and the best DGM-discovered agent on the full Polyglot benchmark to more accurately estimate the improvement. On the full Polyglot benchmark, the DGM improves the coding agent from 14.2% to 30.7%. This shows that the DGM can automatically self-improve to create a better coding agent. Moreover, the performance of the best DGM-discovered agent is comparable to that of the checked, open-source, human-designed SoTA on SWE-bench ( Figure 2 ). On Polyglot, although the DGM starts with a base agent whose performance is lower than that of Aider, it discovers an agent that far surpasses Aider ( Figure 2 ). The DGM-discovered agents are comparable to or outperform handcrafted agents on both benchmarks. While the SoTA SWE-bench agent and Aider were painstakingly shaped by human efforts, the DGM hints at a future in which such ingenuity is automated, evolving through self-referential cycles of continuous self-improvements. The DGM automatically improves both the tools and the workflow of how FMs are utilized ( Figure 3 ). For example, the DGM enhanced the edit tool to allow more granular file viewing (by lines) and more precise file editing (by string replacement), instead of always viewing or replacing the entire file. Workflow improvements include making multiple attempts to solve a task and using another FM to evaluate and select the best solution. Other workflow improvements include considering previous attempts when generating subsequent ones. Section F.1 and Section F.2 show all modifications leading up to the final best-discovered agents on SWE-bench and Polyglot respectively. Because open-ended exploration allows branching from any agent in the archive with non-zero probability, the DGM can get out of deceptive dips or peaks in performance. For example, at iterations 4 and 56 of the experiment on SWE-bench, although the agent’s score temporarily fell below that of its parent, the DGM was still able to explore innovations along that path and create a new agent that outperformed all of its predecessors ( Figure 3 ). Furthermore, open-ended exploration allows different implementations of the same target functionality to be attempted. For example, while the goal is to provide finer - grained editing tools, the specific implementation of this feature can vary greatly and hence lead to very different performance ( Appendix G ). The DGM can explore multiple implementations to find the most suitable one and avoid getting trapped in a suboptimal one. The DGM outperforms the baselines of DGM w/o self-improve and DGM w/o open-ended exploration on both benchmarks ( Figure 2 ). Without updating the meta agent that modifies coding agents, DGM w/o self-improve improves the agents in early iterations, but its gains taper off quickly ( Section A.1 ). In DGM w/o open-ended exploration, only the most recent agent is retained, so a poorly performing self-modification makes subsequent improvements harder to achieve ( Section A.1 ). To evaluate the generality of the improvements from the DGM, we tested the base agent ( Section 4.1 ) and the best agent discovered during the DGM run ( Figure 2 ) with different FMs than those used during optimization. For SWE-bench, where the DGM was run using Claude 3.5 Sonnet (New), we replaced the FM with Claude 3.7 Sonnet ( Anthropic, 2025 ) or o3-mini, and evaluated on 200 tasks ( Figure 4 , Left). With o3-mini, the base agent achieved 23.0% and the DGM-discovered agent 33.0%. With Claude 3.7 Sonnet, the base agent achieved 19.0% and the DGM-discovered agent 59.5%. These results suggest that the DGM yields improvements that generalize across FMs, rather than being tightly coupled to the specific FM used during its run ( Figure 4 ). Model transfer results on Polyglot are presented in Section A.2 .