Mara Chain: Rethinking Failure as a Stepping Stone for AI System Auto-Evolution
Organizations: Ant Group
Abstract
Optimizing deployed AI systems increasingly amounts to editing prompts, skills, harnesses, and code rather than model weights. Existing approaches commonly optimize these artifacts through propose-evaluate-select procedures, where candidate configurations are evaluated and only those meeting an acceptance criterion are selected. Yet our analysis shows that discarded candidates often contain information critical for subsequent optimization. Discarding them causes later proposals to revisit the same failure modes. We introduce Mara Chain, a refinement procedure that turns rejected candidates into stepping stones. Rather than discarding a rejected candidate, Mara Chain retains and iteratively refines it using evidence accumulated across preceding attempts. The procedure limits each refinement chain to a fixed depth and applies Pareto-filtered Top-N selection to bound the candidate pool. Across AppWorld skill optimization, TerminalBench 2.1 harness optimization, and MuSiQue retrieval-pipeline optimization, Mara Chain delivers greater task-performance gains with fewer rollouts. It outperforms GEPA, ACE, and SkillOpt-Lite by up to 20.5% in relative performance on AppWorld, reaching the target score with 65.5% fewer rollouts than GEPA. It improves the pass rate by 20.2 and 22.5 percentage points over AHE and Meta-Harness on TerminalBench 2.1, respectively, and improves MuSiQue test nDCG@10 and Recall@10 by 0.104 and 0.131 over a hand-written retrieval pipeline.
Figures & tables
| Optimized skill configuration | Normal TGC | Normal SGC | Challenge TGC | Challenge SGC |
|---|---|---|---|---|
| Empty skill | 48.2 | 35.7 | 33.3 | 19.4 |
| SkillOpt-Lite ( Shen et al., 2026 ) | 70.8 +22.6 | 51.8 +16.1 | 68.3 +35.0 | 46.0 +26.6 |
| GEPA ( Agrawal et al., 2025 ) | 83.3 +35.1 | 67.9 +32.2 | 69.3 +36.0 | 44.6 +25.2 |
| ACE ( Zhang et al., 2026c ) | 83.9 +35.7 | 69.6 +33.9 | 74.1 +40.8 | 55.4 +36.0 |
| Mara Chain | 89.9 +41.7 (2) | 83.9 +48.2 (2) | 76.7 +43.4 (1) | 59.0 +39.6 (1) |
| Artifact configuration | nDCG@10 (test) | Recall@10 (test) | nDCG@10 (val) | Recall@10 (val) |
|---|---|---|---|---|
| Default (hand-written) | 0.301 | 0.329 | 0.419 | 0.395 |
| w/o Mara Chain (2-slot) | 0.371 +0.070 | 0.421 +0.092 | 0.505 +0.087 | 0.560 +0.165 |
| Mara Chain (2-slot) | 0.405 +0.104 | 0.460 +0.131 | 0.553 +0.134 | 0.605 +0.210 |
| LLM Model | Method | N-TGC | N-SGC | C-TGC | C-SGC | |
|---|---|---|---|---|---|---|
| GLM-5 | Empty skill | 48.2 | 35.7 | 33.3 | 19.4 | — |
| Mara Chain | 86.9 | 75.0 | 76.7 | 59.0 | +40.3 | |
| DeepSeek-V4-Pro | Empty skill | 66.7 | 39.3 | 60.9 | 30.9 | — |
| Mara Chain | 93.5 | 83.9 | 81.5 | 69.8 | +32.7 | |
| Qwen3.5-397B-A17B | Empty skill | 63.7 | 48.2 | 50.1 | 30.2 | — |
| Mara Chain | 82.7 | 73.2 | 73.6 | 56.1 | +23.4 |
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
| Metric | Mara Chain + Top- | Mara Chain | Top- |
|---|---|---|---|
| N-TGC | 86.9 | 86.9 | 83.3 |
| N-SGC | 75.0 | 76.8 | 67.9 |
| C-TGC | 76.7 | 71.9 | 73.6 |
| C-SGC | 59.0 | 51.8 | 53.2 |
| TB2.1 (%) | 71.9 | 57.3 | — |
| MuSiQue nDCG@10 (test) | 0.405 | 0.371 | — |
| Artifact configuration | Asset | Type | Role at runtime | |
|---|---|---|---|---|
| AppWorld | skill/SKILL.md | prose | strategy instructions (agent may ignore) | |
| skill/references/ | prose | API docs/examples, on-demand | ||
| skill/scripts/ | script | verification helpers (deterministic when invoked) | ||
| TerminalBench | agent/kira_agent.py | extension | harness code: loop/tools/middleware, cannot bypass | |
| agent/prompt-templates/ | prose | system prompt template (NL) | ||
| skill/SKILL.md | prose | task-solving strategy |
| Task | Codex | OpenCode | Kira | Mara Chain | Mara Chain | AHE | Meta-Harness |
|---|---|---|---|---|---|---|---|
| bn-fit-modify | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| build-pmars | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| cobol-modernization | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| constraints-scheduling | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| count-dataset-tokens | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| Known concept | framework functional equivalent |
|---|---|
| parameter | artifact configuration (artifact directory tree) |
| search space | schema-instantiated artifact tree (not a fixed DSL) |
| gradient direction | rollout-derived edit direction ( ArtifactAction ) |
| learning rate | edit budget per epoch |
| optimizer | reflective proposer (two-phase coding agent) |
| momentum | Mara Chain (correction accumulated across a chain of failures) |
| rd | candidate | form | asset edited | residual (drives next) |
|---|---|---|---|---|
| 0 | f95e6890cfa1 | (start) | (inherits parent, no task-specific edit) | agent cat s forward.py (not black-box) |
| 0 | dd5d0e8a3382 | prose+ref | SKILL black-box rule + extraction ref | evaluator np.random.seed pollution |
| 1 | 38899c80b3fe | ext+ref | random-state isolation | correct method, no runnable impl |
| 2 | fe8a3fbab6c9 | ref+scr | extract-relu-weights.py v0 (freq. clustering) | too slow; agent abandons |
| 3 | d87d45d2e963 | ref+scr | efficiency: samples | over-counts: vs neurons |
| 4 | 38b2f87817e4 ✓ | ext+ref+scr | algorithm rewrite: line-scan | PASS |
| rd | candidate | form | asset edited | residual (drives next) |
|---|---|---|---|---|
| 0 | 899d9d350389 | ext+prose | FC fix in kira_agent | uses HIV-1 capsid instead of FLAG tag |
| 0 | 52aa7b868cdc | ext+prose | terminal spirals in kira_agent | wrong source, strips tags from data |
| 1 | 51e925ee9e77 | ext+prose | data-source checklist in kira_agent † + SKILL rule † | assembly still wrong |
| 2 | 216373b50662 | ext+prose | verbatim / His-tag rule in SKILL † + runtime mod | X-residue handling wrong |
| 3 | c0f841ac9754 | ext+prose+scr | data-source rule in SKILL † + tool alias + sanitizer | length offset, first amino acid |
| 4 | fddaf3b3e11c ✓ | ext+prose+scr | X-residue rule in SKILL † + cross-compiler | PASS |
| gen | rd | node | edit | solved |
|---|---|---|---|---|
| 3 | 1 | 39102e8295c9 | fix login rule, pagination order, substring collisions | _3 |
| 4 | 1 | ec65a28a8e6e | step- banking: paginate all contacts + client-side filter (prerequisite; seeds checkpoint) | locates msg |
| 4 | 2 | f66bfcd1ab39 | prevent context overflow from exhaustive message pagination | _2 , _3 |
| 7 | 0 | 9ccdf0fbfefe | add pagination_helper.py + prevent restart loops ( Mara Chain-only checkpoint) | sustains |
| 14 | 1 | a810bbf06036 | fix fragile parsing (line-by-line extraction) | _2 , _3 |
| 15 | 1 | 6ebfc3cbb94b | enforce requester-message retrieval gate (root cause: agent never retrieved the request) | _2 |
LLM Agent Workflow Optimization
LLM agent workflow optimization studies how to design and run multi-step agents for better task success, reliability, latency, and cost.
See all 262 papers