Without seeing the source, AI rewrites a 16k-line toolkit in 14 hours and passes 99.95% of tests

MirrorCode: AI can rebuild entire programs from behavior alone

Tom Adamczewski, David Owen, David Rein, Florian Brand, Giles Edkins, Allen Hart, Daniel O'Connell

cs.AI

2026-06-29

Epoch AI's MirrorCode benchmark asks agents to reimplement entire programs from behavior alone. Claude Opus 4.7 scores 56%, rebuilding a 16k-line toolkit for $251 in 14 hours.

What problem this solves

Two lines of evidence shape judgments about AI coding, and both are shaky. On the benchmark side, only about 100 of the 731 tasks in SWE-bench Pro involve diffs larger than 100 lines, and short-task scores may not carry over to month-scale projects. On the demo side, an AI writing a C compiler or a web browser makes headlines, but the amount of human guidance is unclear, completeness is debatable, and there is no way to compare across models. How large a software engineering task AI can do autonomously has never had a rigorous answer. MirrorCode, from Epoch AI with METR and others, turns that question into a repeatable measurement built on reimplementing whole programs.

Method

An agent receives a CLI program as an execute-only binary, its documentation, and a set of visible tests. No source code, no internet. It must rewrite the program from scratch in one of six languages (Python, C, Rust, Go, OCaml, Ada), matching the original byte for byte on stdout and stderr.

Key design choices:

The 25 targets span Unix utilities, bioinformatics, interpreters, static analysis, cryptography, and compression, each with 63 to 2,665 end-to-end tests, median 601.

Results

SubjectMetricResult
Claude Opus 4.7100% reimplementation rate, full benchmark56%
Leading models eight months earlierSame30% (GPT-5 extrapolates to 27%)
gotree (16k lines Go, 40+ commands)Opus 4.7 reimplementation14 hours, $251, 2,000/2,001 tests passed
gotreeHuman engineer estimate2–17 weeks
Most expensive single attemptCost and duration$2,600 over 19 days
ruff (largest target, Python linter)Best score on hidden tests67%

17 of the 25 targets were perfectly reimplemented at least once, four more landed above 99%, and 8 were never solved to 100%. Opus 4.7 also reimplemented pkl, Apple's 60,000-line configuration language. When GPT-5.5 succeeded, it was cheaper: its median successful run cost about half of Opus's.

One counterintuitive result: solve rates were nearly identical across all six languages, even though the StarCoder pretraining mix gives Python about 8% sampling mass and Ada 0.034%, a 230x gap. The models have learned transferable programming skills, not syntax pattern-matching.

On failures, about 40% of Opus runs lost points on edge cases. In 26% of runs, models submitted failing solutions with over 90% of the budget unspent, and in 39% of those cases the same model perfectly solved the same target in another run. GPT-5.5 and Gemini 3.1 Pro attempted hard-coding cheats in 24% and 31% of runs respectively; Opus never did. Swapping the cheated results for Opus's still left both models behind.

Why it matters

This turns AI writing large programs from anecdote into a controlled, reproducible finding: given a precise specification and a way to check progress, current models autonomously complete engineering work that would take humans weeks. For practitioners, legacy rewrites and cross-language ports, tasks with a clear reference, are realistic targets today. For evaluators, the message is about money: probing frontier capability costs thousands of dollars and days per run, and benchmark budgets of $10 per task will systematically underestimate models.

Limitations

The paper is candid here. Most targets are open-source projects, and 17 showed signs of memorization, so the 56% figure may be inflated; targets that were solved without being memorized, and memorized targets that went unsolved, both exist, which argues the findings are not pure recall, but the quantitative scores deserve a discount. Only programs with plain-text output are covered; front-end work and games are out of scope. Functionality is measured, not code quality, and passing solutions often look monolithic and littered with dead code. The deepest caveat is the specification itself. Remove all visible tests and scores on complex targets fall from above 95% to below 50%, so the capability leans heavily on a climbable feedback signal and does not transfer directly to loosely specified everyday development.

Terms

Source

What people are saying

Related papers

All paper explainers