Crafter: Towards Automated Reproducible Machine Learning via Agentic Code Generation

Fangru Linghu, Jackson Runtian Ye, Jieying Wang, Alexandre V. Morozov, Ian T. Foster, Zhao ZhangNeurIPS 2026

TL;DR

Reproducing a machine learning paper from scratch often feels like detective work—crucial details are buried in appendices, implied in diagrams, or missing altogether. Crafter is an automated, multi-agent pipeline that reads research PDFs, actively hunts down missing implementation details, and generates executable, debugged codebases. Instead of producing code that merely looks plausible, Crafter gets repositories significantly closer to actually running and validating a paper's core scientific claims.

What Problem Does This Paper Address?

Machine learning has a reproducibility headache. Many papers arrive without code, leaving engineers to translate dense math and high-level prose into working software. While LLMs are great at everyday coding, handing a raw paper to an LLM—or even to existing multi-stage "paper-to-code" pipelines like Paper2Code or DeepCode—often results in broken repositories.

The authors pinpoint two specific failure modes behind this:

  1. Fabrication-by-omission: When a paper forgets to mention a detail (like a learning rate or dataset split), the LLM silently guesses a plausible default rather than flagging or researching it.
  2. Fabrication-by-extrapolation: Given partial clues (say, a brief mention of an adapter module), the LLM gets overly creative and invents extra APIs, parameters, or logic unsupported by the text.

Methods

Crafter treats paper reproduction not as single-pass text-to-code translation, but as context-calibrated implementation recovery. Rather than letting agents chat freely—which can amplify hallucinations—Crafter enforces a strict pipeline mediated by a shared key-value store (GlobalMemory), while giving individual agents private scratchpads (LocalMemory).

Figure 1: Crafter architecture. Specialized agents across three stages pass information through a shared GlobalMemory. The partition agent decomposes the paper into structured partitions, which feed the VLM and gap analysis. Preprocessing outputs are passed to the planning agents, which produce the implementation plan used by the implementation loop.

The pipeline balances two opposing forces: Expansion (gathering missing evidence) and Contraction (strictly limiting what each coding agent sees so it doesn't invent things). It runs in three stages:

  • Preprocessing (Expansion): A Partition Agent splits the PDF into sections, while a Vision-Language Agent translates architecture diagrams into structured graphs (filtering out result plots). Crucially, a Gap Agent spots missing details—like hyperparameters or referenced architectures—and tries to resolve them via a three-tier cascade: checking a local ML dataset registry, cross-referencing appendices/footnotes, and querying the Semantic Scholar API. Unresolved gaps are explicitly flagged.
  • Planning: Main and Sub-Planning Agents build a strict "implementation contract" (specification). A constraint validator and cross-module review pass check that entry points (like main.py) don't duplicate module logic and that return types match across files.
  • Implementation & Debugging (Contraction): When writing a module, the code generator only sees that module's spec and declared dependencies, preventing symbol leakage. Finally, a Debug Agent runs the code in a subprocess, reading the generator's LocalMemory to understand original intent and applying targeted fixes (or re-triggering planning if a file repeatedly fails).

Datasets

Because Crafter is an inference-time agentic system, there are no training datasets. For evaluation, the authors use:

  • 27 Research Papers for Faithfulness: 23 ICML 2024 papers from the existing PaperBench benchmark (using its fine-grained Code-Dev rubrics to grade source-code completeness), plus 4 recent ICLR 2026 papers posted after the LLM's knowledge cutoff to test against data contamination.
  • Fixture-Scale Execution Benchmark (New): Source-code rubrics don't tell you if code actually runs, and full ML training takes weeks. The authors introduce an execution-readiness benchmark across 7 papers using lightweight "fixtures" (synthetic/small data on a single GPU) and a 7-step milestone ladder (M0 to M7) that tests whether the code launches, finishes pilot runs, and reproduces the qualitative direction of the paper's main claim.

Key Insights and Ideas

  • Decouple the contract from the code: By building an explicit specification before coding—and deriving validation checks from that spec—the model isn't grading its own homework.
  • Looking complete $\neq$ working: In execution tests, zero generated repositories (from Crafter or baselines) passed the final scientific contribution check (M7) out of the box without human-in-the-loop repair. Measuring repair distance (how many edits it takes to reach M7) is far more revealing than static code grading alone.
  • Spend compute upfront to save human debugging later: Crafter costs roughly twice as much in API tokens per paper (~$21.64 vs. ~$12 for baselines), but cuts downstream repair cycles roughly in half.

Key Results

Using Claude Sonnet 4.6 as the backbone (and consistent trends with MiniMax M2.7), Crafter outperforms both Paper2Code and DeepCode:

Figure 2: Per-paper Code-Dev: Crafter vs. each baseline. Each panel pairs one backend (Claude / MiniMax) with one baseline (Paper2Code / DeepCode). Claude panels include 23 PaperBench papers and four additional ICLR 2026 papers; MiniMax panels include the 23 PaperBench papers. A point is one paper at coordinates (baseline, Crafter). Points above the y = x diagonal (blue circles) are papers where Crafter outperforms the baseline; points below (orange / red squares) are papers where the baseline wins. The papers with the largest gain and the largest loss (by ∆= Crafter −baseline) are annotated in each panel; corner boxes report wins / 27 for Claude and wins / 23 for MiniMax, together with the mean ∆.
  • Implementation Faithfulness: Across 23 PaperBench papers, Crafter hits an average Code-Dev score of 0.8354 (winning 17/23 papers), beating Paper2Code (0.6979) by 18.4% and DeepCode (0.6844) by 21.8%. On the 4 post-cutoff ICLR 2026 papers, Crafter wins all 4 (0.8215 average).
  • Execution & Repair Distance: On the 7-paper execution benchmark, Crafter reaches higher initial pre-repair milestones on 6/7 papers. Under a bounded repair loop, Crafter reaches M7 (passing contribution checks) on all 7/7 papers (vs. 6/7 for baselines), while slashing average source-edit repair cycles from 10.7–12.9 down to 5.7.
  • Ablations: Removing the debug loop drops the 9-paper subset score from 0.8879 to 0.8421; removing gap-filling drops it even further to 0.8296, proving how vital upfront evidence recovery is.

Limitations and Future Work

  • Lossy visual parsing: Converting architecture diagrams into text/graph records is currently one-way; the system doesn't double-check extracted graphs against the original image before planning.
  • Environment setup: Crafter generates Python source code, but fully portable reproduction requires automatically generating container environments and dependency configs alongside it.
  • Scale of validation: Execution checks currently verify qualitative claim directions on small fixtures rather than full-scale, multi-week quantitative replications, and still require bounded repair cycles to cross the finish line.

Summary updated

Abstract

Reproducing machine learning research is challenging because many papers do not provide executable code, and key implementation details are often scattered, implicit, or missing. Existing paper-to-code systems improve over direct prompting, but the generated repositories can still miss paper-critical logic or fail at execution time. We present Crafter, an automated paper-to-code pipeline that treats reproduction as a problem of context-calibrated implementation recovery rather than single-pass code generation. Crafter builds an evidence-grounded specification, resolves missing implementation details before planning, and repairs the generated repository through execution-aware debugging. We evaluate Crafter with the PaperBench Code-Dev protocol for implementation faithfulness and a fixture-scale protocol for execution readiness. Across 27 research papers using the Claude Sonnet 4.6 backend, Crafter achieves an average Code-Dev score of 0.83, improving over Paper2Code by 18.4% and over DeepCode by 21.8%. In execution evaluation, Crafter satisfies the fixture-level contribution checks after repair on all seven evaluated papers, compared with six for each baseline, while reducing average repair cycles from 10.7–12.9 to 5.7.
BibTeX
@inproceedings{linghu2026crafter,
  author = {Fangru Linghu and Jackson Runtian Ye and Jieying Wang and Alexandre V. Morozov and Ian T. Foster and Zhao Zhang},
  title = {{Crafter: Towards Automated Reproducible Machine Learning via Agentic Code Generation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=cWMcK8uzFF},
}
Figure