Gregor J. Mendel
Kurt F. Gödel
UESTC, LMU Munich, MCML

Mendel Gödel Machine

Recursive Self-Improving Coding Agents via Comparative Evolution

Changzhi Liu∗,§   Yilun Liu†,‡,§   Sikuan Yan†,‡   Volker Tresp†,‡   Yunpu Ma†,‡

UESTC   LMU Munich   MCML   §Equal contribution

changzhiliu1@gmail.com yilun.liu@tum.de cognitive.yunpu@gmail.com

Clonal Mutation Reaction-norm Mutation Cross-lineage Hybridization Hybridization reference Utility

Evolution tree of MGM. Results show the archive evolved with 200 φ-evaluations and 24 Φ-expansions on Polyglot, with nodes colored by utility estimates aggregated over accumulated φ-evaluation results, and edges corresponding with different Φ-expansion operators.


Evolution with
Controlled Inheritance.

Prior RSI research has focused more on optimizing the archive and the selection process rather than the self-modification process, which still relies on a single agent's single trajectory (typically a recent failure) on a single task to guide it editing its own source code. The expanding archive, which records all agent variants ever generated together with their behavior on all tasks evaluated, has been only used as a leaderboard for sampling, overlooking rich comparative evidence that could facilitate better-informed edits.

According to the principles of Mendelian inheritance, which isolates heritable effects through controlled comparisons, MGM structures self-modification into three operators, all of which directly operate on trajectories accumulated during routine archive maintenance and therefore incur no extra task evaluations.

CM Clonal Mutation

Standard single-agent, single-trajectory self-modification; serves as the baseline that keeps evolution moving at any cases.

RM Reaction-norm Mutation

Compare phenotypes of the same genotype across multiple tasks. Recurring failure modes can more plausibly distinct genotype-level defects from task-specific accidents.

CH Cross-lineage Hybridization

Compare performance on a shared task between multiple genotypes from. Contrastive evidence can guide targeted ability transfer and reduce redundant exploration.

Mendel Gödel Machine overview: archive lineage tree, sampling–evaluation–expansion loop, and three self-modification operators

Mendel Gödel Machine. MGM organizes self-modification via controlled inheritance based on evidence across tasks and lineages. The archive maintains a lineage tree of agent variants; each stores its source code as genotype and evaluation outcomes as phenotype. Each iteration applies π-sampling that selects an operation to perform with the necessary resources from the archive. φ-evaluation executes the agent on untested tasks and records its trajectory and results. Clonal mutation ΦCM edits the agent based on a single failure trajectory on target task τt. Reaction-norm mutation ΦRM uses the agent's trajectories across reference tasks τr. Cross-lineage hybridization ΦCH uses a reference agent ar from a different lineage that attempted the same task.

Bringing Open Models
Beyond Frontier Performance.

MGM’s reuse of archived trajectories through reaction‑norm mutation and cross‑lineage hybridization provides more informative guidance for self‑modification, yielding substantially and consistently better performance than HGM baseline without necessitating any additional task evaluations and token expenditure.

Open-source Closed-source Self-improving

Performance of coding agents on Polyglot and model sizes. Result marked with asterisk is from Polyglot-60; all other scores are from the complete Polyglot‑225. Performance of Deepseek-V4-Pro is the transfered result with the scaffold evolved on Qwen3.6-35B-A3B. Performance for models outside our experiments are sourced directly from the official Aider-Polyglot Leaderboard. Closed-source model sizes follows estimates reported by Li et al. (2026).

SWE-bench Verified-60

68.3+0 pp

Performance

0%

Relative improvement

Polyglot-60

50.8+0 pp

Performance

0%

Relative improvement

SWE-bench Verified-60 Polyglot-60 Average
Agent InitialHGMMGM InitialHGMMGM InitialHGMMGM
Accuracy 68.3 73.3+5.0 78.3+10.0 50.8 77.9+27.1 93.2+42.4 59.6 75.6+16.0 85.8+26.2
% Impr. ↑ 7.3% ↑ 14.6% ↑ 53.3% ↑ 83.5% ↑ 26.8% ↑ 44.0%
Time 93.02 h 96.11 h 44.20 h 40.14 h 68.61 h 68.12 h

Performance of coding agents evolved on SWE-bench Verified and Polyglot. Results evolved using Qwen3.6-35B-A3B after 200 φ-evaluations and 24 Φ-expansions. For each benchmark, HGM and MGM start from the same initial scaffold. Superscripts in accuracy denote absolute percentage-point improvements over corresponding initial agents. Time reported as CPU wall-clock time with 8×NVIDIA H100 GPUs.


Genuinely Reusable
Agent Scaffolds.

MGM‑evolved scaffolds can transfer zero‑shot from standalone coding tasks (Polyglot) to repository‑level software‑engineering benchmarks (SWE-bench Pro and SWE‑bench Multilingual) with significant gains over the baseline. MGM also generalizes better across backbone models when scaffolds evolved on Qwen3.6‑35B‑A3B are switched to working with significantly larger DeepSeek‑V4‑Flash or DeepSeek‑V4‑Pro. These results demonstrate that MGM's comparative evolution can help discover genuinely reusable workflow‑level improvements rather than benchmark-specific or model-specific hacks, pointing toward scalable self‑improving agent development where scaffolds evolved on smaller datasets and cheaper backbones can be reused on stronger models.

Cross-benchmark
Polyglot → SWE-bench Pro & Multilingual

29.2+0 pp

Average Performance

0%

Relative improvement

Cross-model
Qwen3.6-35B-A3B → DeepSeek-V4-Flash & Pro

47.5+0 pp

Average Performance

0%

Relative improvement

SWE-bench Pro SWE-bench Multilingual Avg.
Agent InitialHGMMGM InitialHGMMGM InitialHGMMGM
Accuracy 16.7 13.3−3.4 26.7+10.0 41.7 43.3+1.6 55.0+13.3 29.2 28.3−0.9 40.9+11.7
% Impr. ↓ 20.4% ↑ 59.9% ↑ 3.8% ↑ 31.9% ↓ 3.1% ↑ 40.1%

Cross-benchmark generalization from Polyglot to SWE-bench Pro and SWE-bench Multilingual. All agents evolved on Polyglot are evaluated zero-shot on held-out SWE-bench variants, using Qwen3.6-35B-A3B. Superscripts in accuracy denote absolute percentage-point improvements over corresponding initial agents.

Evolved Transferred
Qwen3.6-35B-A3B DeepSeek-V4-Flash DeepSeek-V4-Pro Avg.
Agent Init.HGMMGM Init.HGMMGM Init.HGMMGM Init.HGMMGM
Acc. 68.3 73.3+5.0 78.3+10.0 50.0 60.0+10.0 66.7+16.7 45.0 70.0+25.0 75.0+30.0 47.5 65.0+17.5 70.8+23.3
% Impr. ↑ 7.3% ↑ 14.6% ↑ 20.0% ↑ 33.3% ↑ 55.6% ↑ 66.7% ↑ 36.8% ↑ 49.1%

Cross-model transfer on SWE-bench Verified-60. The Qwen3.6-35B-A3B block reports the original evolved agents, while the DeepSeek blocks report transferred performance by using the scaffolds evolved on Qwen3.6-35B-A3B and evaluating with LLM backbone replaced. Superscripts in accuracy denote absolute percentage-point improvements over corresponding initial agents.

Reliably Better,
Across All Conditions.

To validate MGM's design against baselines, we utilize an additive fitness landscape model where agents possess a binary genotype representing scaffold-level capabilities, and tasks evaluate specific loci subsets that must be correct for a successful phenotype. We theoretically demonstrate that comparative evidence acts as diagnostic compression, significantly improving the effective fix probability of self-modification by cross-referencing multiple genotypes or phenotypes to isolate recurring defects and filter out non-causal loci.

Additive fitness landscape model illustration
DGM HGM MGM oracle

Additive fitness landscape model. Each agent carries genotype with loci, which is only exposed through φ-evaluation, where each task τi examines a subset of loci for a successful phenotype. Φ-expansion modifies the examined loci under certain probabilities.

Real-time simulation of performance evolution over cumulative budget spent. The panel shows the edit distance results (lower is better) averaged across random seeds with 95% CIs. Dashed lines mark oracle optima.

Real-time simulation of final performance distribution. The panel shows the distribution of final edit distance results (lower is better) across all random seeds, with dashed lines marking per-method means.

Controlled Monte Carlo simulations isolating this advantage across a range of tasks difficulities and fix-probability advantage ratio confirm that MGM consistently achieves faster convergence and lower final edit distances than baselines, which scales directly with the advantage, confirming that MGM's robust gains are driven by its superior diagnostic capabilities of comparaitive evidence.


Cite it,
Evolve it.

We would be delighted if MGM has been helpful in your research or development! If so, please consider citing our paper:

@misc{liu2026mendelgodelmachinerecursive,
      title={Mendel G\"odel Machine: Recursive Self-Improving Coding Agents via Comparative Evolution}, 
      author={Changzhi Liu and Yilun Liu and Sikuan Yan and Volker Tresp and Yunpu Ma},
      year={2026},
      eprint={2608.07645},
      archivePrefix={arXiv},
      primaryClass={cs.AI},
      url={https://arxiv.org/abs/2608.07645}, 
}