Darwin Godel Machine: Open-Ended Evolution of Self-Improving Agents — part 1/6
Cleaned-text code points [0, 15251). Bibliography omitted here; source.md includes it.
# Darwin Gödel Machine: Open-Ended Evolution of Self-Improving Agents ###### Abstract Most of today’s AI systems are constrained by human-designed, fixed architectures and cannot autonomously and continuously improve themselves. The scientific method, on the other hand, is a cumulative and open-ended system, where each innovation builds upon previous artifacts, enabling future discoveries. There is growing hope that the current manual process of advancing AI could itself be automated. If done safely, such automation would accelerate AI development and allow us to reap its benefits much sooner. This prospect raises the question of how AI systems can endlessly improve themselves while getting better at solving relevant problems. Meta-learning can automate the discovery of novel algorithms, but is limited by first-order improvements and the human design of a suitable search space. The Gödel machine ( Schmidhuber, 2007 ) proposed a theoretical alternative: a self-improving AI that repeatedly modifies itself in a provably beneficial manner. Unfortunately, proving that most changes are net beneficial is impossible in practice. We introduce the Darwin Gödel Machine (DGM), a novel self-improving system that iteratively modifies its own code (thereby also improving its ability to modify its own codebase) and empirically validates each change using coding benchmarks. Inspired by Darwinian evolution and open-endedness research, the DGM grows an archive of generated coding agents. It samples agents from this archive, which self-modify to create new, interesting versions of themselves. This open-ended exploration forms a growing tree of diverse, high-quality agents and allows the parallel exploration of many different paths through the search space. Empirically, the DGM automatically improves its coding capabilities (e.g., better code editing tools, long-context window management, peer-review mechanisms), increasing performance on SWE-bench from 20.0% to 50.0%, and on Polyglot from 14.2% to 30.7%. Furthermore, the DGM significantly outperforms baselines without self-improvement or open-ended exploration. All experiments were done with safety precautions (e.g., sandboxing, human oversight). Overall, the DGM represents a significant step toward self-improving AI, capable of gathering its own stepping stones along a path that unfolds into endless innovation. All code is open-sourced at https://github.com/jennyzzt/dgm . ## 1 Introduction Scientific progress is cumulative and open-ended, with each breakthrough standing on the shoulders of countless prior insights. In the same way, our most advanced AI systems are built upon a long lineage of innovations. For instance, transformers ( Vaswani et al., 2017 ) , the backbone of current large language models (LLMs) ( Brown et al., 2020 ) , did not emerge in isolation but were built upon years of past innovations, such as recurrent neural networks ( Linnainmaa, 1970 ; Amari, 1972 ; Hopfield, 1982 ; Rumelhart et al., 1985 ) and attention mechanisms ( Schmidhuber and Huber, 1990 ; Bahdanau et al., 2015 ; Kim et al., 2017 ; Parikh et al., 2016 ) . However, most of today’s AI systems remain bound by fixed, human-designed architectures that learn within predefined boundaries, without the capacity to autonomously rewrite their own source code to self-improve. As a result, each advancement in AI development still leans heavily on human interventions, tethering the pace of progress. This paper investigates the intriguing possibility of safely automating the search for ever-better AI. One can imagine an AI system that, like scientific discovery itself, becomes an engine of its own advancement: building upon its past, recursively improving, and propelling itself toward more advanced capabilities. Schmidhuber (2007) presented a class of mathematically rigorous, self-referential, self-improving problem solvers. It relies on formal proofs to justify code rewrites, ensuring that any self-modification is provably beneficial. However, in practice and without restrictive assumptions about the system, it is impossible to formally prove whether a modification to an AI system will be beneficial. For example, while it may seem that an LLM-based coding agent would benefit from access to more tools (e.g., code search, test runners), the actual impact depends heavily on the model’s training and task context (e.g., a testing tool that is optimized for one setup may confuse the agent when working with others). Instead of requiring formal proofs, we empirically validate self-modifications against a benchmark, allowing the system to improve and explore based on observed results. This approach mirrors biological evolution, where mutations and adaptations are not verified in advance but are produced, trialed, and then selected via natural selection. We also take inspiration from Darwinian evolution ( Darwin, 2023 ) and investigate the effectiveness of maintaining a library of previously discovered agents to serve as stepping stones for future generations. We propose the Darwin Gödel Machine (DGM) , a self-referential, self-improving system that writes and modifies its own code to become a better coding agent. Each self-modification requires the DGM to edit its own codebase. We use Python, which is Turing-complete, giving the DGM the potential to build any computable machine. Our framework envisions agents that can rewrite their own training scripts (including training a new foundation model (FM)). However, we do not show that in this paper, as training FMs is computationally intensive and would introduce substantial additional complexity, which we leave as future work. Instead, this paper focuses on improving the design of coding agents with frozen pretrained FMs (e.g., tool use, workflows). The DGM alternates between self-modification and evaluation phases. During the self-modification phase, selected coding agents from the archive generate modified versions of themselves. During the evaluation phase, each modified agent is tested on a coding benchmark, estimating the agent’s coding capabilities, and then added to the archive. By improving its own capabilities through this loop, the DGM becomes better at both solving coding tasks and making future self-improvements. A key assumption is that an increase in performance on coding benchmarks indicates better coding capabilities, and hence better ability to self-modify and self-improve. Furthermore, the DGM maintains an archive of generated coding agents, initialized with only one agent, and continuously accumulates all generated variants over time. To support continual self-improvement, the DGM draws inspiration from open-endedness research ( Wang et al., 2019 ; Fernando et al., 2024 ; Faldor et al., 2025 ) , accumulating diverse stepping stones (i.e., interesting yet suboptimal solutions or features that may enable future breakthroughs). This open-ended exploration encourages the discovery of novel and potentially useful self-modifications beyond immediate performance gains. We present results on two coding benchmarks: SWE-bench ( Jimenez et al., 2024 ) and Polyglot ( Paul Gauthier, 2024 ) . The DGM automatically improves itself from 20.0% to 50.0% on SWE-bench, and from 14.2% to 30.7% on Polyglot. We show that self-improvement enables continued progress, as the DGM outperforms the baseline where the same base agent is repeatedly used to modify and generate new agents without self-improvement. We also show that open-ended exploration and keeping an archive of all previously generated agents lead to the discovery of better coding agents. The DGM outperforms the baseline of not having open-ended exploration (i.e., a baseline without the accumulation of an archive of interestingly different stepping stones), where the coding agent always builds off the most recent version of itself. Overall, the DGM represents a step toward AI systems that can build upon their own prior innovations and improve recursively. We consider and discuss safety aspects extensively, including sandboxing and traceability of self-modifications, to ensure responsible experimentation ( Section 5 ). By advancing the possibility of safe, self-referential, self-improving models, the DGM moves us closer to AI that not only learns but evolves in an open-ended, self-accelerating trajectory, much like science itself. ## 2 Related Work Open-Endedness. A grand challenge for driving unbounded innovation is designing open-ended AI systems that continuously generate novel and learnable artifacts ( Stanley et al., 2017 ) . Hughes et al. (2024) characterized open-endedness as a system’s capacity to generate sequences of artifacts that are both novel and learnable from an observer’s perspective. A central difficulty lies in structuring and exploring vast search spaces to consistently produce artifacts that are interesting to humans ( Clune, 2019 ; Jiang et al., 2023 ) . Early progress drew on quality-diversity algorithms, goal-directed exploration, intrinsic motivation, and learning-progress frameworks ( Pugh et al., 2016 ; Ecoffet et al., 2019 ; Lehman and Stanley, 2011 ; Oudeyer et al., 2007 ) , while recent advances leverage large-scale foundation models (FMs) as proxies for human interestingness and versatile engines for generating and evaluating novel behaviors across diverse domains ( Brown et al., 2020 ; Hu et al., 2025 ; Zhang et al., 2024b ) . However, these approaches have yet to close the self-referential self-improvement loop, meaning improvements on downstream tasks do not translate into enhanced capabilities for self-modification or the acceleration of further innovations. We aim to mimic the acceleration of science and technology, where new tools and discoveries catalyze the creation of even more discoveries. How can we emulate nature’s arc of evolution, which bends not only toward complexity but also an ever greater capacity to evolve ( Dawkins, 2019 ; Gerhart and Kirschner, 2007 ; Hendrikse et al., 2007 ) ? Meta-Learning FM Agents. Many FM-based agents are handcrafted. Some building blocks include prompt engineering ( Chen et al., 2023 ; Schulhoff et al., 2024 ) , chain-of-thought ( Wei et al., 2022 ; Yao et al., 2023 ; Hu and Clune, 2024 ; Guo et al., 2025 ; Lightman et al., 2023 ; Muennighoff et al., 2025 ; Zelikman et al., 2024a ) , self-reflection ( Shinn et al., 2023 ; Yao et al., 2023 ; Madaan et al., 2023 ) , multi-agent debate ( Zhuge et al., 2023 ; Liang et al., 2023 ; Khan et al., 2024 ) , memory ( Liu et al., 2023 ; Zhong et al., 2024 ; Modarressi et al., 2023 ) , temperature sampling ( Zhu et al., 2024 ) , and retrieval augmented generation ( Lewis et al., 2020 ) . The manual composition of these components limits the system’s abilities to the ingenuity of its human designer. More recently, several meta-learning approaches have emerged that leverage FM to automatically optimize prompts ( Fernando et al., 2024 ; (FAIR)† et al., 2022 ; Khattab et al., 2023 ; Cheng et al., 2024 ; Yuksekgonul et al., 2024 ; Yuan et al., 2024 ) and design agentic modules ( Zhang et al., 2024c ; Zhou et al., 2024 ; Yin et al., 2024 ; Zhuge et al., 2024 ; Rosser and Foerster, 2025 ; Zhang et al., 2025a ; Ye et al., 2025 ; Gao et al., 2025 ; Nie et al., 2025 ; Su et al., 2025 ; Zhang et al., 2025b ; Niu et al., 2025 ) . The Automated Design of Agentic Systems ( Hu et al., 2025 , ADAS,) iteratively generates downstream agents with a fixed meta-agent, evaluates them against a target benchmark, and incorporates feedback to refine subsequent generations. In contrast, the DGM is a single system that both solves downstream tasks (i.e., coding problems) and refines its own implementation (i.e., its codebase), removing the need for a fixed, handcrafted meta-agent and enabling self-referential improvements. Self-Improving AI. Early on, various researchers outlined theoretical and conceptual approaches to self-improvement ( Good, 1966 ; Schmidhuber, 1987 ; Schmidhuber, 2007 ) . Some practical approaches to automated self-improvement include systems defined by neural network weight parameterizations ( Schmidhuber, 1993 ; Hall, 2007 ; Hobbhahn, 2025 ; Kirsch and Schmidhuber, 2022 ; Irie et al., 2022 ; Irie et al., 2025 ; Lu et al., 2023 ; Havrilla et al., 2024b ) . Metz et al. (2021) developed a gradient-based optimizer that is self-referentially meta-trained using a variant of population-based training ( Jaderberg et al., 2017 ) . Lange et al. (2023) extended this approach to gradient-free learning. Silver et al. (2017) used self-play to continuously evolve agents, achieving superhuman performance in challenging domains such as chess and Go. More closely related to the DGM are recent approaches that leverage FM-based agents for self-improvement ( Yin et al., 2024 ; Robeyns et al., 2025 ; Hu et al., 2024 ; Zelikman et al., 2024b ; Huang et al., 2022 ; Singh et al., 2023 ) . Zelikman et al. (2024b) use a meta-agent to generate downstream agents, updating the meta-agent based on the meta-utility derived from the generated solutions. Yin et al. (2024) use a single system to both solve downstream tasks and recursively modify itself. However, the downstream tasks or the meta-utility do not always align with the capabilities required for self-improvement. In the DGM, improvement in downstream tasks directly reflects an increase in self-improvement ability, enabling the potential for self-accelerating progress. Most similar is concurrent work by Robeyns et al. (2025) , which also has a single agent recursively solving coding problems and modifying its own codebase. The main difference from Robeyns et al. (2025) (and also Zelikman et al. (2024b) ; Yin et al. (2024) ) is that the DGM has an open-ended exploration loop, encouraging self-modifications beyond immediate performance gains and thus avoiding stagnation in suboptimal states. Appendix B also discusses additional related work on program synthesis and Darwinian evolution. ## 3 Darwin Gödel Machine A Gödel Machine is a theoretical idea of an AI that searches for ways that provably improve itself ( Schmidhuber, 2007 ) . In this paper, we propose Darwin Gödel Machine (DGM), an attempt to realize the long-held dream of creating a Gödel Machine. The DGM relaxes the Gödel Machine’s impractical requirement of theoretically proving that a change will improve the system, instead requiring empirical evidence from experiments to demonstrate that a proposed new version enhances performance. Additionally, since the DGM relies on empirical evidence of improvement, it may get stuck in a local optimum within the vast search space of possible systems (i.e., all computable algorithms). To address this, the DGM maintains an archive of discovered solutions during the search, facilitating open-ended exploration rather than relying on evolving a single solution. Since the principles echo Darwinian evolution ( Darwin, 2023 ) ( Appendix B ), where new innovations emerge by selecting an entity from an archive of previously discovered solutions, modifying it, and keeping it if it is interestingly new ( Zhang et al., 2024b ; Faldor et al., 2025 ; Stanley and Lehman, 2015 ) , we call our algorithm a Darwin Gödel Machine ( Figure 1 ).