Source-linked AI summary

Paper2Code: Automating Code Generation from Scientific Papers in Machine Learning

Minju Seo, Jinheon Baek, Seongyun Lee, Sung Ju Hwang

arXiv:2504.17192v5cs.CL

TL;DR

Missing implementations make machine-learning results difficult and labor-intensive to reproduce, motivating automated paper-to-code generation. PaperCoder uses specialized agents across planning, analysis, and generation, and consistently outperforms baselines in model-based and human evaluations. Its reported results support generating faithful repositories from papers, while safe deployment requires safeguards against reproducing sensitive implementations.

  • Problem

    Only 19.5% of papers accepted to top-tier machine-learning conferences in 2024 provide code implementations, limiting readily available support for reproducing results.

  • Method

    PaperCoder is a multi-agent LLM framework that plans, analyzes, and sequentially generates code repositories directly from machine-learning papers.

  • Results

    PaperCoder consistently outperforms baselines across model-based and human evaluations on Paper2CodeBench and PaperBench Code-Dev.

  • Takeaways & Limitations

    PaperCoder generates faithful code repositories that could meaningfully support human researchers in reproducing prior work.

  • Takeaways & Limitations

    Responsible production use requires safeguards because the framework could reproduce sensitive implementations that authors withheld for security reasons.

Abstract

from arXiv · show

Despite the rapid growth of machine learning research, corresponding code implementations are often unavailable, making it slow and labor-intensive for researchers to reproduce results and build upon prior work. In the meantime, recent Large Language Models (LLMs) excel at understanding scientific documents and generating high-quality code. Inspired by this, we introduce PaperCoder, a multi-agent LLM framework that transforms machine learning papers into operational code repositories. PaperCoder operates in three stages: planning, where it constructs a high-level roadmap, designs the system architecture with diagrams, identifies file dependencies, and generates configuration files; analysis, which focuses on interpreting implementation-specific details; and generation, where modular, dependency-aware code is produced. Moreover, each phase is instantiated through a set of specialized agents designed to collaborate effectively across the pipeline. We then evaluate PaperCoder on generating code implementations from machine learning papers based on both model-based and human evaluations, particularly from the authors of those papers, with author-released repositories as ground truth if available. Our results demonstrate the effectiveness of PaperCoder in creating high-quality, faithful implementations. Furthermore, it consistently shows strengths in the recently released PaperBench benchmark, surpassing strong baselines by substantial margins. Code is available at: https://github.com/going-doer/Paper2Code.

1 INTRODUCTION

Reproducing machine-learning research is hindered by missing code, while existing LLM capabilities suggest an opportunity for paper-to-repository generation. PaperCoder addresses this through a multi-agent pipeline evaluated with model-based and human assessments.

  • Motivation: Only 19.5% of papers accepted to top-tier machine-learning conferences in 2024 provide code implementations.Missing code adds to broader reproducibility challenges involving incomplete documentation, experimental details, data, and proprietary tools.
  • Motivation: Prior LLM-based approaches often rely on pre-existing implementations, partial code snippets, or well-defined APIs.Generating faithful implementations solely from papers therefore remains an open question.
  • PaperCoder: PaperCoder transforms machine-learning papers into code repositories through planning, analysis, and generation stages.The framework is designed to generate repositories directly from research papers rather than requiring partial implementations from human inputs.
  • PaperCoder: Planning constructs implementation roadmaps and architecture, dependencies, and configuration, while later stages interpret details and generate code.The planning stage includes class and sequence diagrams, file execution orders, and configurable experimental workflows.
  • Evaluation: PaperCoder’s evaluations use model-based and expert human judgments, with 88% of generated repositories rated best over baselines and 92% of judges finding them helpful.The evaluation covers recent machine-learning papers and uses author-released repositories as ground truth when available.

2 RELATED WORK

Related work spans LLM capabilities for specialized domains, repository-level code generation, and LLM assistance across the scientific process. These lines of work establish the broader context for automating multi-file scientific implementations.

  • Large Language Models for Code: LLMs are increasingly used for specialized mathematics, science, and coding tasks, alongside strong software-engineering capabilities.The related work highlights code-specialized LLMs and their applications to software design and development.
  • Repository-Level Coding: Code-generation research has expanded from isolated single-file snippets to repository-level tasks involving jointly connected multi-file codebases.This shift reflects growing emphasis on long-context reasoning and more challenging software-development settings.
  • LLM-Powered Scientific Research: LLMs have been applied across the scientific process from ideation through experimental validation, including designing, refining, and extending code implementations.These applications position LLMs as tools for supporting scientific workflows and accelerating discovery.

3 METHOD

PaperCoder addresses repository-level code generation from machine learning papers by decomposing a difficult single-pass task into coordinated planning, analysis, and coding stages. Specialized agents progressively translate paper content into architecture, execution-aware specifications, configuration, and dependency-aware repository code.

  • Task Definition: PaperCoder defines repository generation as mapping a paper to a cohesive multi-file implementation of its methods and experiments.The repository is composed of files implementing different components that together form a complete pipeline.
  • Framework Overview: Because single-pass generation struggles with paper complexity, context limits, and cross-file dependencies, PaperCoder assigns subtasks to specialized agents.The framework is designed to generate repositories directly from papers without pre-existing artifacts such as skeleton code.
  • Planning: Planning converts papers into an overall plan, architecture design, logic design, and configuration file for subsequent implementation.These sequential planning outputs transform human-oriented scientific text into implementation-level abstractions.
  • Planning: Architecture design organizes files and modules with file lists, class diagrams, and sequence diagrams, while logic design orders implementation around dependencies and execution flow.The ordered file list and per-file logic specifications reduce inconsistencies such as generating an importing file before its dependency.
  • Coding: Coding generates each file sequentially using the paper, all planning outputs, file-specific analysis, and previously generated code.This iterative process gives each file awareness of accumulated repository context and dependencies.

4 EXPERIMENT

PaperCoder is evaluated through benchmark, model-based, and human protocols, with results showing strong performance, cross-benchmark generalization, and practical usefulness for reproduction.

  • 4.1 EXPERIMENTAL SETUP: Paper2CodeBench collects recent ICLR, ICML, and NeurIPS papers with available repositories under 70,000 tokens, while related repository-generation systems and ablations serve as baselines.The evaluation compares PaperCoder with related approaches because no baseline was designed specifically for Paper2Code.
  • 4.1 EXPERIMENTAL SETUP: Reference-based evaluation compares generated repositories with author-released code, whereas reference-free evaluation judges implementations using only the paper.Human evaluation additionally asks first authors to rank multiple generated implementations for their papers.
  • 4.2 EXPERIMENTAL RESULTS AND ANALYSIS: PaperCoder consistently outperforms all baselines on Paper2CodeBench and performs on par with author-released repositories in the non-comparable Oracle setting without statistically significant differences.The paper attributes this gap to a top-down sequence of planning, analysis, and coding for long-form scientific documents.
  • 4.2 EXPERIMENTAL RESULTS AND ANALYSIS: r = 0.79: reference-free and reference-based evaluations have a strong positive Pearson correlation, supporting reference-free evaluation as a standalone proxy.This proxy is intended for cases where official ground-truth repositories are unavailable.
  • 4.2 EXPERIMENTAL RESULTS AND ANALYSIS: PaperCoder achieves the highest replication scores on PaperBench Code-Dev across o3-mini-high and Claude 3.5 Sonnet, substantially outperforming its baselines.The results are reported as evidence of generalizability and robustness across benchmarks and models.
  • 4.2 EXPERIMENTAL RESULTS AND ANALYSIS: o3-mini-high consistently outperforms the other tested backbones across evaluation settings, while integrating all pipeline modules yields the highest ablation performance.These findings emphasize both backbone capability and the structured multi-stage design.
  • 4.2 EXPERIMENTAL RESULTS AND ANALYSIS: Human analyses find that 92% of annotators consider PaperCoder's top-ranked repository easier for reproduction than starting from scratch, with 80% Method and 79% Evaluation coverage.Many observed errors originate in Data Processing because papers often underspecify data formats, preprocessing, or loading procedures.
  • 4.3 ADDITIONAL ANALYSIS ON REPRODUCTION FROM IMPLEMENTED CODE REPOSITORY: 0.81%: only this average share of code lines requires minor modification for successful execution, while sampled case studies reproduce results at least partially for four of five repositories.The reproducibility analysis also reports PaperCoder outperforming baselines under the Paper2CodeBench rubric, with or without debugging.

5 CONCLUSION

PaperCoder generates machine-learning code repositories from research papers through a structured three-stage pipeline and consistently outperforms existing baselines across two benchmarks and evaluation types.

  • PaperCoder automatically generates machine-learning code repositories from research papers through planning, analysis, and sequential code generation.Planning defines the roadmap, architecture, execution logic, and configuration; analysis adds per-file detail before generation.
  • The framework was evaluated on Paper2CodeBench and PaperBench Code-Dev using model-based and human evaluations.
  • PaperCoder consistently outperforms existing baselines across the reported evaluations.
  • Only 0.81% of generated code lines required minor fixes for successful execution in the manual executability analysis.The reported fixes included deprecated API updates and data type corrections.
  • The authors report that PaperCoder remains effective across different LLM backbones and benefits from each pipeline stage.

ETHICS STATEMENT

The framework may reproduce sensitive implementations that authors intentionally withhold for security reasons, motivating safeguards for production use.

  • PaperCoder could reproduce sensitive implementations involving jailbreaking or exploitation techniques.The concern applies when papers intentionally omit implementations because of security risks.
  • Production deployment would require harmful-content filters, protective prompting, and secure execution environments.
  • The stated aim is to support open science and facilitate rapid experimentation, alongside acknowledging misuse risks.

ACKNOLEDGEMENTS

The work acknowledges financial support from Korean government-funded research programs and agencies.

  • The project received support from the Institute for Information and Communications Technology Planning and Evaluation.
  • Funding included the Artificial Intelligence Graduate School Program at KAIST.
  • The work also received support from the National Research Foundation of Korea.

A.1 IMPLEMENTATION DETAILS

The implementation used o3-mini-high as its default backbone, recruited qualified annotators, and applied specified procedures for evaluation, execution, and benchmark construction.

  • Implementation setup: All experiments used o3-mini-high as the default backbone, with repositories generated for 90 papers.The model was released on January 31, 2025; paper data came from OpenReview and Semantic Scholar APIs.
  • Implementation setup: Documents were converted into structured JSON using s2orc-doc2json.
  • Human evaluation: Human evaluators had at least one peer-reviewed paper and a computer-science degree and were compensated $15 per hour.They received instructions, examples, and generated repositories grouped into three sets.
  • Evaluation protocol: When reference repositories exceeded evaluator context limits, GPT-4o selected relevant files for reference-based scoring.
  • Benchmark adaptation: PaperBench Code-Dev required an additional reproduce.sh script, which PaperCoder generated through an extra coding-agent prompt.
  • Execution procedure: Execution used Docker with NVIDIA RTX 2080 or RTX A6000 GPUs, while some hyperparameters were adjusted for hardware constraints.
  • Code-availability analysis: Table 9 reports accepted-paper totals, publicly available-code counts, and percentages for ICLR, ICML, NeurIPS, plus their average.
  • Benchmark results: Table 10 reports average replication scores and standard deviations on PaperBench Code-Dev, generally over three PaperCoder runs.The exceptions were o1 and o3 because of costs.

B.2 ADDITIONAL ANALYSIS ON EXECUTABILITY

PaperCoder’s generated repositories generally require limited, mostly local repairs to become executable, while automatic repair resolves issues in few iterations. The evaluation frames executability as a practical aid to reproduction rather than perfect one-shot reproduction.

  • Repair characteristics: Execution fixes are overwhelmingly minor syntax issues, missing imports, or variable-name adjustments rather than logic- or architecture-level revisions.These fixes are illustrated in Figures 8–12 and summarized in Table 15.
  • Human debugging: Developer-time estimates show that correcting execution errors does not require a significant amount of time.The estimate multiplies modified lines by a difficulty factor from 1 to 3.
  • Automatic repair: LLM-assisted repair resolves all reported issues mostly within a small number of iterations.The repairs use o4-mini-high and GPT-5, with GPT-5.1 categorizing errors primarily as syntactic or import-related rather than logic-level.

B.3 PAPERBENCH CODE-DEV RESULTS

PaperCoder achieves strong replication scores across reasoning models, with o3 reaching 60.86%, while methodology removal lowers code-generation scores. Execution failures are dominated by environment and packaging issues, which the framework treats as outside its primary method-level focus.

  • Replication across models: 60.86% is PaperCoder’s highest replication score when using o3 among the evaluated reasoning models.The results indicate stronger performance from newer, larger models with stronger reasoning and coding capabilities.
  • Paper-content sensitivity: Removing the Methodology section lowers the reference-based average score from 4.26 to 3.75 on 30 Paper2CodeBench papers.The experiment uses o3-mini-high and samples 10 papers from each of ICLR, ICML, and NeurIPS.
  • Failure analysis: MissingDependency, ImportError, and ModuleNotFoundError are the most frequent error categories when repositories run without debugging.The categories are automatically assigned from raw error messages using o4-mini-high.
  • Environment scope: PaperCoder prioritizes faithful reconstruction of the methodological pipeline over fully automated environment configuration.An additional 30-paper experiment with prompts for inferring and repairing environment requirements observed no dependency-related failures; a dedicated DevOps agent is proposed as future work.

B.7 ANALYSIS OF PERFORMANCE ACROSS PAPER CATEGORIES

PaperCoder’s performance varies across paper categories, with theory and interpretability/explainability scoring highest and reinforcement learning/control and dataset-focused papers scoring lowest. The evaluation uses 90 papers from Paper2CodeBench, while the 2024-paper selection reduces the likelihood of data contamination.

  • Category variation: Average reference-based scores range from 3.38 to 4.21 across paper categories, a maximum gap of about 0.83.This indicates measurable variation in implementation difficulty across categories.
  • Highest-scoring categories: Theory and interpretability/explainability achieve the highest category scores, at 4.21 and 3.97 respectively.These values are reported from 90 Paper2CodeBench papers evaluated with o4-mini-high.
  • Lowest-scoring categories: Reinforcement learning/control and dataset-focused papers yield the lowest category scores, at 3.38 each.The paper presents these categories as more challenging for PaperCoder to implement.
  • Evaluation setting: Using ICLR, ICML, and NeurIPS 2024 papers places the targets after the primary models’ October 2023 knowledge cutoff, making meaningful contamination unlikely.The authors cannot fully rule out indirect exposure.

B.9 CROSS-FAMILY VALIDATION FOR PAPER2CODEBENCH MODEL EVALUATION

Because full-scale human evaluation is prohibitively expensive, the study uses LLM-as-a-judge for primary assessment. Strong correlations with human judgments support o3-mini-high as a proxy in both reference-based and reference-free settings.

  • Cross-family validation: o3-mini-high correlates 0.78 with human judgments in the reference-based setting and 0.73 in the reference-free setting.These correlations support the reliability of LLM-based evaluation as a proxy.
  • Evaluation design: LLM-as-a-judge is adopted for primary assessment because evaluating all baselines and papers with humans would be prohibitively expensive.The paper still characterizes human evaluation as potentially the most reliable form of assessment.

C LIMITATIONS AND FUTURE WORK

PaperCoder’s current scope is limited to machine learning papers and textual inputs, while improving executability remains an open direction. The appendix also documents evaluation, debugging, and reproducibility analyses.

  • Limitations and Future Work: PaperCoder currently targets machine learning papers rather than scientific domains where code is not the primary validation medium.The authors identify theoretical mathematics and other domains as future directions.
  • Limitations and Future Work: The current system processes only textual inputs, motivating future extension to figures and tables through visual-input capabilities.The authors specifically mention OCR models as a possible avenue for extracting visual information.
  • Limitations and Future Work: Improving executability remains challenging, consistent with the appendix’s analyses of automatic repair iterations, modified lines, and reproducibility case studies.These analyses include repair iterations, debugging changes, qualitative repository assessments, and reproducibility results.
  • Appendix Analyses: The appendix presents case studies of dependency-aware generation and manual debugging across repositories including CoLoR, cognitive-behavior, RADA, self-instruct, and geval.One ablation case shows that adding Logic Design resolves duplicated functions by aligning file-generation order.
  • Appendix Analyses: Paper2CodeBench reports average reference-based scores by category, with bar transparency indicating the number of papers in each category.The figure labels each category with its average score and paper count.

D PROMPTS

The prompts operationalize PaperCoder as a staged workflow: planning defines the repository structure, analysis specifies implementation logic, and coding generates modular files under explicit constraints. Evaluation prompts then compare generated repositories against gold implementations using correctness-focused criteria.

  • Planning: The planning prompt asks for a detailed roadmap aligned with the paper’s methodology, experimental setup, and evaluation metrics.The roadmap spans preprocessing, architecture, training, and evaluation before code generation.
  • Planning: Architecture prompts convert the plan into a concise, complete software design using a simple architecture and appropriate open-source libraries.The design focuses on reproducing the paper’s method while keeping the overall system usable and maintainable.
  • Planning: Logic Design breaks the technical design into tasks and analyzes dependencies to determine an implementation order.Its stated purpose is to outline tasks and dependencies for reproducing the paper’s method and experiments.
  • Planning: Configuration prompts require elegant, modular code and instruct the model to extract training details without fabricating values.Examples include learning rate, batch size, and epochs, with settings referenced from the configuration file.
  • Analysis: Analysis prompts require file-level logic to align with the paper’s methodology, experimental setup, evaluation criteria, design interfaces, and explicit configuration settings.They prohibit changing the specified design or assuming values not provided in config.yaml.
  • Analysis and Generation: The analysis stage processes each file according to the Logic Design sequence, while coding prompts generate each file using accumulated previously generated code files.Both prompts use structured inputs containing the paper, design, and task information.
  • Evaluation: Reference-based evaluation compares a target repository with a gold repository and assigns a 1–5 correctness score based on implementation fidelity.Evaluators inspect core concepts, algorithms, methodology, completeness, deviations, and logical errors rather than minor organizational details.
  • Evaluation: The evaluation procedure examines the paper, gold repository, and target repository before identifying deviations and producing a critique of core implementation correctness.The gold repository serves as a reference for translating the paper’s methodology into code.
Loading 2504.17192v5…