Manuscript Offprint

arXiv:2608.24291

ReproAgent: Contract-Guided Paper-to-Code Reproduction

Xue Hu, Zewei Pan, Zhongyuan Wang, Zhou Liu, Zeli Su, Wentao Zhang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Paper-to-code reproduction asks scientific AI agents to turn research papers into executable repositories that preserve the paper’s method, protocol and artifacts. This is difficult because the specification is split: explicit paper content such as algorithms, metrics and artifacts is often lost across long agent trajectories, while implicit details such as framework defaults and conventions inherited from related work are absent from the paper. We introduce REPROAGENT, a four-stage Prepare–Plan–Generate–Repair pipeline built around a persistent implementation contract with two channels: an implementation-requirement channel that turns paper snippets into code obligations, and a reference-evidence channel that retrieves content and structure evidence from related repositories. Both are bound to work packages, projected into file-level contracts, and consumed across generation and repair. On PaperBench Code-Dev (Starace et al., 2025), ReproAgent reaches the highest mean score among same-backbone scaffolds under both Claude-Sonnet-4.5 and Gemini-3-Flash. End-to-end channel ablations and per-paper cases support the contribution of both channels. Code and experimental artifacts are publicly available. 1^{1}

1 Introduction

Large language models are increasingly used to assist scientific research, but a long-standing reproducibility crisis persists (Baker, 2016; Pineau et al., 2021). Systematic reviews of NLP reproduction studies report that only a small fraction of attempted reproductions recover the original scores (Belz et al., 2021), and even strong LLM judges detect only 46.7% of real-world discrepancies between papers and their accompanying code (Baumgärtner and Gurevych, 2026). Together, faster method production and persistent reproducibility gaps make it harder to validate new methods, compare baselines fairly, and build on prior work. An automated framework that turns each new paper into a faithful, runnable repository, rather than merely executable code, would make paper-specific methods, protocols, and artifacts easier to inspect and reuse.

Recent paper-to-code agents take a step in this direction (Seo et al., 2026; Xiang et al., 2025; Zhao et al., 2025; Zhou et al., 2025), but a substantial fidelity gap remains. A recurring failure mode is runnable but unfaithful code: a generated repository may import correctly, pass smoke tests, and even produce plausible experimental results, while still dropping or misimplementing key paper-specific details, such as substituting a generic training loop for the paper's algorithm, omitting the decisive metric or artifact, or altering a loss term. Runtime success alone is therefore an insufficient proxy for faithful paper reproduction.

We identify a split-specification problem behind these failures. A paper states some implementation requirements explicitly, including algorithms, metrics, artifacts and evaluation protocols. However, many decisions needed to build a faithful repository are implicit in framework defaults, cited implementations and community conventions. Existing paper-to-code agents mainly condition generation on the paper text and transient planning context, without a persistent object that carries paper-derived obligations or binds implicit details to external evidence. As a result, explicit requirements drift out of context across long trajectories, while implicit details fall back on model priors rather than grounded evidence. Faithful reproduction therefore needs a persistent implementation contract that preserves paper-derived obligations and attaches external repository evidence to the implementation decisions it supports.

REPROAGENT instantiates this idea with a global implementation contract containing two channels. The implementation-requirement chan-

1^{1}https://github.com/kernel-14/ReproAgent.

Figure

Figure 1: Overview of REPROAGENT. A four-stage pipeline, Prepare, Plan, Generate, and Repair, carries an implementation-requirement channel and a reference-evidence channel into a shared file-level implementation contract. The implementation-requirement channel preserves paper-derived code obligations across generation and repair, while the reference-evidence channel supplies package-local content and structure evidence from related repositories.

nel extracts explicit paper knowledge as code obligations, while the reference-evidence channel grounds implicit repository knowledge in related implementations. Both channels are bound to work packages and projected into file-level contracts, so the same contract guides generation and serves as the audit target for detecting missing obligations, unsupported implementation choices, broken interfaces, and runtime failures.

REPROAGENT carries this contract through a four-stage pipeline. Prepare segments the paper, extracts implementation requirements, and builds a reference-repository index. Plan organizes requirements into work packages, binds package-local reference evidence, derives the target architecture, and freezes file-level contracts over obligations, evidence, validation checks, and file responsibilities. Generate produces the repository file by file under these local contracts. Repair audits the result against the same contract together with runtime checks, so failures are reported as violated paper-derived obligations, missing evidence use, broken interfaces, or execution failures rather than only as crashing commands.

We evaluate REPROAGENT on PaperBench Code-Dev (Starace et al., 2025), using repository-level rubric grading to test whether generated code implements the target paper rather than merely executing. We run REPROAGENT with two backbones, Claude-Sonnet-4.5 and Gemini-3-Flash, and under each backbone REPROAGENT reaches the highest mean score among same-backbone scaffolds. Ablations of the two contract channels together with a per-paper case analysis support that both the implementation-requirement and reference-evidence channels contribute to faithful reproduction.

Our main contributions are:

• We formulate paper-to-code reproduction as contract-guided repository construction under partial paper specifications, where faithful generation requires preserving explicit paper obligations and grounding implicit implementation choices.

• We introduce a two-channel implementation contract over paper-derived requirements and related-repository evidence, with work-package bindings, file-level obligations, provenance records, and typed requirement-review/runtime reports that preserve both traces across generation and repair.

• We instantiate this contract in REPROAGENT, a four-stage Prepare–Plan–Generate–Repair pipeline, and evaluate it on the full 20-paper PaperBench Code-Dev suite with same-backbone comparisons and ablations that remove each contract channel.

References (35)