Mendel Gödel Machine: Recursive Self-Improving Coding Agents via Comparative Evolution
Changzhi Liu, Yilun Liu, Sikuan Yan, Volker Tresp, Yunpu Ma
cs.AI, cs.LG
2026-08-08
MGM adds cross-task and cross-lineage comparative edits to self-improving coding agents, lifting a Qwen3.6-35B-A3B scaffold from 50.8% to 93.2% on Polyglot and to 96.9% when transferred to DeepSeek-V4-Pro, about 1/117th of GPT-5's parameters.
Self-improving coding agents iteratively rewrite their own source code to get better. Prior work (DGM, HGM) keeps a growing archive tree of every agent variant and its trajectories on every task, then samples one to rewrite each round. The bottleneck is that each rewrite is conditioned on a single failure trajectory from one agent on one task, while the archive actually overflows with comparative signal: how one agent behaves across many tasks, and how different agents behave on the same task. That signal gets used only as a leaderboard and never fed back into the rewrite.
MGM (Mendel Gödel Machine) keeps HGM's tree-search skeleton and splits the single rewrite operator into three, chosen by what comparative evidence the archive can assemble:
Hybridization does not splice source files. The failing agent itself extracts a transferable behavioral trait from the reference trajectory and adapts it to its own codebase. To create overlaps, MGM weights tasks in a failed-task pool so different lineages collide on the same tasks. None of this costs extra task evaluations.
The authors also prove, under an additive fitness landscape (agent as binary genotype, progress as Hamming distance to an oracle), that richer comparative evidence raises the probability a rewrite hits a true defect, so convergence is faster than single-trajectory baselines; Monte Carlo simulations confirm it.
All runs use Qwen3.6-35B-A3B under an identical 200-evaluation budget:
| Setting | Initial | HGM | MGM |
| Polyglot-60 | 50.8% | 77.9% | 93.2% |
| SWE-bench Verified-60 | 68.3% | 73.3% | 78.3% |
On Polyglot, MGM lifts 50.8% to 93.2%, more than double HGM's gain. On the full 225-task Polyglot, the Qwen-evolved scaffold transferred to DeepSeek-V4-Pro scores 96.9%, beating closed-source GPT-5 with about 117x fewer parameters. The scaffold also transfers zero-shot to SWE-bench Pro and Multilingual (positive for MGM, negative for HGM on Pro), and survives a backbone swap to DeepSeek-V4-Flash/Pro. Ablations drop Polyglot to 79.7% without reaction-norm mutation and 74.6% without hybridization, making hybridization the more critical operator.
MGM evolves the agent scaffold (prompts, tool workflows) rather than model weights, so the gains are reusable workflow-level skills that transfer across benchmarks and backbones. The practical recipe is concrete: evolve a scaffold on a cheap small model and a small dataset, then bolt the finished scaffold onto a stronger model. This moves the self-improvement bottleneck from how the archive is stored and sampled to what evidence each rewrite uses, and the evidence is a free byproduct of evaluation.
The authors are explicit. It is expensive: repository-level evolution and evaluation consume heavy wall-clock and GPU time, so few independent seeds and hyperparameter sweeps are reported. It is history-dependent: reaction-norm mutation needs many trajectories from one agent and hybridization needs cross-lineage task overlap, so MGM degenerates toward the single-trajectory baseline when the archive is small. Edits are not guaranteed correct, general, or maintainable; the actual rewrite still comes from an LLM editor, and failed edits waste budget. The formal analysis rests on a simplified additive surrogate that cannot fully represent real editable agent spaces.