Teaching an LLM to edit the code that defines itself
DGM is a recursive self-improvement system where an LLM-based coding agent iteratively rewrites its own source and keeps only the versions that score higher on SWE-bench and Polyglot benchmarks.

What it does
Darwin Gödel Machine (DGM) treats its own Python codebase as a mutable target. An LLM-based coding agent proposes edits to its own source files, then empirically validates whether the mutated version performs better on SWE-bench and Polyglot tasks. The loop repeats, theoretically bootstrapping increasingly capable self-modification.
The interesting bit
This is a practical, benchmark-grounded take on the Gödel Machine concept: the agent empirically validates each self-modification using benchmark scores rather than formal proofs. The codebase is simultaneously the product and the optimization target.
Key highlights
- Self-modification loop: the agent edits
coding_agent.pyand related files, then tests the offspring - Validation grounded in SWE-bench and Polyglot benchmark scores
- Full experiment logs from foundation model outputs are published to Google Drive
- Explicit safety warning: executes untrusted, model-generated code inside a sandbox
- Built by Sakana AI; accompanied by an arXiv paper and blog post
Caveats
- Depends on commercial LLM APIs (OpenAI and Anthropic) and a container sandbox; not a fully local or self-contained system
- README offers file structure and setup but stays vague on quantitative results or convergence behavior (those live in external Drive logs)
- Running it means letting an LLM generate and execute arbitrary code on your machine, which the authors flag as a genuine safety risk
Verdict
Worth a look if you study recursive self-improvement, autopoietic systems, or LLM-driven meta-learning. Skip it if you want a stable, production-ready coding assistant rather than a research sandbox.
Frequently asked
- What is jennyzzt/dgm?
- DGM is a recursive self-improvement system where an LLM-based coding agent iteratively rewrites its own source and keeps only the versions that score higher on SWE-bench and Polyglot benchmarks.
- Is dgm open source?
- Yes — jennyzzt/dgm is open source, released under the Apache-2.0 license.
- What language is dgm written in?
- jennyzzt/dgm is primarily written in Python.
- How popular is dgm?
- jennyzzt/dgm has 2.2k stars on GitHub.
- Where can I find dgm?
- jennyzzt/dgm is on GitHub at https://github.com/jennyzzt/dgm.