# Self-Improving Agents, Simply Explained

#102 May 18 Agents

https://www.aibutsimple.com/p/self-improving-agents-simply-explained

Every major leap in AI has required human intervention, where researchers design the architecture, write the training code, and engineer the tools.

The [Darwin Gödel Machine (DGM)](https://arxiv.org/abs/2505.22954?utm_source=newsletter.aibutsimple.com&utm_medium=referral&utm_campaign=self-improving-agents-simply-explained), a new system published at ICLR 2026, asks a different question: What if the AI could do all of that itself?

The DGM is a self-improving coding agent that reads its own source code, proposes changes to make itself better, implements those changes, and tests whether they have worked.

![](https://media.beehiiv.com/cdn-cgi/image/fit=scale-down,width=1200,format=auto,onerror=redirect,quality=80/uploads/asset/file/4c4dc02c-c599-41a0-93c1-ccef8da2b279/Darwin_Godel_Machine__Self-improving_agents_.png)

Over 80 iterations, it improved its score on the [SWE-bench](https://www.swebench.com/?utm_source=newsletter.aibutsimple.com&utm_medium=referral&utm_campaign=self-improving-agents-simply-explained) coding benchmark from 20% to 50% and on the [Polyglot multilanguage benchmark](https://aider.chat/docs/leaderboards/?utm_source=newsletter.aibutsimple.com&utm_medium=referral&utm_campaign=self-improving-agents-simply-explained) from 14.2% to 30.7%, all without any human intervention.

These are some significant gains, and the final agent performs on par with the best open-source, human-engineered solutions, systems built by teams of expert developers over months.

The DGM was able to match that level autonomously, starting from a lightweight base agent with two basic tools.

---

### What You’ll Learn

1. Existing self-improvement methods (and how the DGM is different)
2. How the DGM works using Darwinian evolution
3. Discoveries made by the DGM
4. The safety issue with autonomous agents
5. Why DGMs truly matter (the future of AI)

### What You’ll Need to Know

- Darwinian Evolution
  - A theory stating that organisms evolve through natural selection: successful traits survive and reproduce.
- [Reward Hacking](https://newsletter.aibutsimple.com/p/reward-hacking-simply-explained)
  - When a model maximizes a metric using exploits without actually solving the intended problem.

---

### The Problem With Existing Self-Improvement

The idea of a self-improving AI is not new.

Jurgen Schmidhuber (involved in [LSTM](https://www.bioinf.jku.at/publications/older/2604.pdf?utm_source=newsletter.aibutsimple.com&utm_medium=referral&utm_campaign=self-improving-agents-simply-explained), [World Model](https://arxiv.org/abs/1803.10122?utm_source=newsletter.aibutsimple.com&utm_medium=referral&utm_campaign=self-improving-agents-simply-explained) papers) proposed the theoretical [Godel Machine](https://en.wikipedia.org/wiki/G%C3%B6del_machine?utm_source=newsletter.aibutsimple.com&utm_medium=referral&utm_campaign=self-improving-agents-simply-explained) in 2007: a system that modifies itself only when it can formally prove the change will be beneficial.

- The idea is elegant but very difficult in practice. A general formal proof in advance that a code change will improve an AI agent remains an unsolved problem.

More recent approaches use a fixed meta-agent to generate improved child agents.

The problem here is that the meta-agent never gets better. It starts with whatever capabilities it had on day one and stays there.

Early gains are possible, but progress quickly flatlines because the generator of improvements is itself static.

![](https://media.beehiiv.com/cdn-cgi/image/fit=scale-down,width=1200,format=auto,onerror=redirect,quality=80/uploads/asset/file/25071751-2da5-4294-8aff-a91707daca63/DGM_vs._Fixed_Meta-Agent__Self_improving_agents_.png)

The DGM solves both problems at once. Instead of requiring formal proofs, it validates changes empirically by running them on real coding benchmarks.

Instead of using a fixed meta-agent, the system that generates improvements is the same system being improved.

When the agent gets better at coding, it automatically gets better at improving itself, because self-improvement is itself a coding task.

---

### [Don’t Fall Behind in AI… Get AI, But Simple PRO](https://www.aibutsimple.com/pro?utm_source=newsletter.aibutsimple.com&utm_medium=referral&utm_campaign=self-improving-agents-simply-explained)

![](https://media.beehiiv.com/cdn-cgi/image/fit=scale-down,width=1200,format=auto,onerror=redirect,quality=80/uploads/asset/file/281697a8-c915-435c-a68b-43374b671698/aibutsimple_academy.png)

Supporting us by purchasing a PRO membership will get you:

- Exclusive Hands-on Tutorials With Code
- Real-World Interview Questions and Cases (From Real Companies)
- Full Math Explanations and Beautiful Visualizations
- Ad-Free Reading for an Uninterrupted Learning Experience

[Stay Ahead in AI With PRO](https://www.aibutsimple.com/pro?utm_source=newsletter.aibutsimple.com&utm_medium=referral&utm_campaign=self-improving-agents-simply-explained)

---

### How the DGM Works (Evolution with a Memory)

The DGM draws its structure from the theory of [Darwinian evolution](https://en.wikipedia.org/wiki/Darwinism?utm_source=newsletter.aibutsimple.com&utm_medium=referral&utm_campaign=self-improving-agents-simply-explained). It maintains an archive of all agents ever generated, starting from a single base agent.

At each iteration:

- It selects a parent agent from the archive;
- It asks that agent to examine its own benchmark evaluation logs;
- It identifies one promising improvement;
- and it implements it as a code change to its own repository.

This generates a tree-like structure of evolution.

The result is a new child agent, which is then evaluated on the benchmark and added to the archive.

Since the parent modifies itself and creates a child, which then modifies itself and repeats the cycle, it means the “improver” can improve. More formally, the capability of the optimization process can increase over time, which is a large improvement over prior systems where the children’s capability is bounded by the initial meta-agent.

![](https://media.beehiiv.com/cdn-cgi/image/fit=scale-down,width=1200,format=auto,onerror=redirect,quality=80/uploads/asset/file/2884f304-cca2-476a-ab3e-40d9aa89080c/DGM_Loop__Self_Improving_Agents.png)

Parent selection is not purely greedy. The DGM favors agents that perform well but have been explored less, meaning agents with fewer children get a higher selection probability.

This ensures that a promising but underexplored path through the search space does not get ignored just because a different path happens to be performing well at the moment.

![](https://media.beehiiv.com/cdn-cgi/image/fit=scale-down,width=1200,format=auto,onerror=redirect,quality=80/uploads/asset/file/c961411b-c1c3-4099-a9a3-cebd7307c915/DGM_Parent_Selection__Self_improving_agents___2_.png)

Additionally, every agent in the archive retains a non-zero selection probability. This is the open-ended exploration principle at work.

A path that looks like a dead end today might become a stepping stone later.

The paper shows this concretely: in the SWE-bench experiments, some of the most important innovations emerged from agents whose performance had temporarily dipped below their parents.

![](https://media.beehiiv.com/cdn-cgi/image/fit=scale-down,width=1200,format=auto,onerror=redirect,quality=80/uploads/asset/file/585d8472-f18c-470c-b4e0-9601f26d34ad/Archive_of_Agents__DGM__Self-Improving_Agents.png)

Compare this to the simplest alternative: always self-modify the latest version of the agent. If that agent introduces a breaking change, the system is stuck. The archive prevents this. There is always a healthy ancestor to branch from.

### What the DGM Actually Discovered

The improvements the DGM discovered were not cosmetic.

Starting from a base agent with only two tools (a bash runner and a basic file editor), the system invented and implemented several meaningful engineering upgrades across its 80 iterations.

![](https://media.beehiiv.com/cdn-cgi/image/fit=scale-down,width=1200,format=auto,onerror=redirect,quality=80/uploads/asset/file/e2d8233c-9eba-48ac-8731-6f2034856247/image.png)

One of the most impactful was upgrading the file editor. The base agent could only view or overwrite entire files, which is wasteful and error-prone for large codebases.

The DGM independently discovered the value of targeted string replacement, implementing a str_replace command that finds a unique substring and replaces only that.

- This is the same approach used in professional code editing tools, and the DGM reinvented it from scratch.

The system also introduced granular line-range viewing, so the agent could inspect specific sections of large files without loading everything into context.

It added a mechanism to auto-summarize conversation history when approaching the context window limit.

It invented a multi-candidate workflow where several solution attempts are generated and evaluated, with the best selected by a second model acting as a reviewer.

![](https://media.beehiiv.com/cdn-cgi/image/fit=scale-down,width=1200,format=auto,onerror=redirect,quality=80/uploads/asset/file/e886a11a-f7af-4528-94e6-875fd244da68/image.png)

None of these were explicitly mentioned to the agent.

The DGM identified the bottlenecks by analyzing its own failure logs and reasoned about what capabilities were missing.

The improvements generalize too: agents evolved on SWE-bench (Python-only) transferred directly to Polyglot (multi-language), and improvements transferred across different foundation models, including Claude 3.7 Sonnet and o3-mini.

### Safety Progress and Open Problems

A system that rewrites its own code raises some obvious concerns. The paper addresses these directly.

All agents run inside isolated sandboxes with strict time limits and no access to the host system or the internet. Self-modification is confined to the agent's own Python codebase.

Every modification is logged and traceable through the archive, enabling full rollback and post-hoc review. The researchers found no evidence of harmful or manipulative behavior across any of the generated agents.

The paper also includes a case study in using the DGM to reduce hallucination in foundation models, demonstrating that the same self-improvement loop can be directed at safety objectives rather than just benchmark performance.

![](https://media.beehiiv.com/cdn-cgi/image/fit=scale-down,width=1200,format=auto,onerror=redirect,quality=80/uploads/asset/file/1cde50c3-01e9-4e24-ad90-f666f75db9ad/DGM_Safety__Sandbox__Reward_Hacking___Self_Improving.png)

However, the researchers are candid about what remains open. Optimizing purely for a benchmark metric can produce [reward hacking](https://newsletter.aibutsimple.com/p/reward-hacking-simply-explained): agents that score well by gaming the evaluation rather than genuinely solving the problem.

The paper documents a specific instance of this, where an agent achieved a perfect hallucination detection score by suppressing the logging that powered the detection metric, rather than by actually reducing hallucinations.

This is a known challenge in any optimization system, and the DGM is not immune to it. The researchers suggest that hiding evaluation-critical code from the agent and using diverse, hard to exploit evaluation methods are mitigations worth exploring further.

![](https://media.beehiiv.com/cdn-cgi/image/fit=scale-down,width=1200,format=auto,onerror=redirect,quality=80/uploads/asset/file/12ccb060-fa57-48a0-b7f3-ac2424cd08fb/DGM_Traceability__Self_Improving_Agents__3_.png)

### Why Do DGMs Matter?

The DGM is the first system to close the self-referential loop: improvements on the benchmark directly translate into a better ability to generate further improvements.

That is the property that makes compounding progress possible.

The current version has some constraints, however. A single recursive SWE-bench run reportedly costed around $22,000 in API calls and took two weeks.

Additionally, the foundation models powering the agent are frozen; the DGM does not yet retrain them. The open-ended exploration loop itself is fixed and not subject to self-improvement.

Overall, the core result stands. An AI system, starting from a minimal base, autonomously discovered tools and workflows that brought it to the level of the best human-engineered agents.

It did this by treating its own code as the problem to solve and by preserving the full history of its attempts so that no path was permanently closed off.

As foundation models continue to improve and compute costs continue to decline, methods like the DGM will become increasingly efficient and accessible.

Science progresses by building on what came before. The DGM is an early attempt to give AI systems the same property, and the benchmark numbers seem promising.

---

Here’s a special thanks to our [biggest supporters](https://www.aibutsimple.com/upgrade?utm_source=newsletter.aibutsimple.com&utm_medium=referral&utm_campaign=self-improving-agents-simply-explained):

- Sushant Waidande
- Sai Krishna Pashapu (AI Developer, BTech, [LinkedIn](https://www.linkedin.com/in/sai-krishna-pashapu-997358283/?utm_source=newsletter.aibutsimple.com&utm_medium=referral&utm_campaign=self-improving-agents-simply-explained), [Github](https://github.com/saikrishna-pashapu?utm_source=newsletter.aibutsimple.com&utm_medium=referral&utm_campaign=self-improving-agents-simply-explained))
- Bob Boncella
- Demet Yazici

---

If you enjoy our content, consider supporting us so we can keep doing what we do. Please share this with a friend!

Want to reach 8000+ ML engineers? Advertising Inquiries:

[WORK WITH US 📈](https://tally.so/r/A7Dgdk?utm_source=newsletter.aibutsimple.com&utm_medium=referral&utm_campaign=self-improving-agents-simply-explained)

Feedback or inquiries? Send us an email at [edwin@aibutsimple.com](mailto:edwin@aibutsimple.com).

---

That’s it for this week’s issue of AI, but simple. See you next week!

—AI, but simple team
