SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2504.17192 · ICLR · 2025

Paper2Code: Automating Code Generation from Scientific Papers in Machine Learning

Sung Hwang, Jinheon Baek, Kaist, Deepauto Ai, Seongyun Lee, Minju Seo

arXiv · PDF · Open in the Atlas

Code that ran

4 of 5 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 0 failures of our instrument; 1 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2504.17192.json · badge: /api/ran/2504.17192.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
going-doer/Paper2Code canonical (classifier label)
classifier basis not recorded on the link
4 ran · 1 no recorded run
FunctionStatusWhere it lives
content_to_json Ran
ran on a synthesized input
going-doer/Paper2Code/codes/utils.py
code served (permissive licence) · get_code("9540dd6a0fa2b5f8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import re

def content_to_json2(data):
    clean_data = re.sub('\\[CONTENT\\]|\\[/CONTENT\\]', '', data).strip()
    clean_data = re.sub('(".*?"),\\s*#.*', '\\1,', clean_data)
    clean_data = re.sub('(".*?")\\s*#.*', '\\1', clean_data)
    clean_data = re.sub(',\\s*\\]', ']', clean_data)
    clean_data = re.sub('\\n\\s*', '', clean_data)
    try:
        json_data = json.loads(clean_data)
        return json_data
    except json.JSONDecodeError as e:
        return content_to_json3(data)

def content_to_json3(data):
    clean_data = re.sub('\\[CONTENT\\]|\\[/CONTENT\\]', '', data).strip()
    clean_data = re.sub('(".*?"),\\s*#.*', '\\1,', clean_data)
    clean_data = re.sub('(".*?")\\s*#.*', '\\1', clean_data)
    clean_data = re.sub(',\\s*\\]', ']', clean_data)
    clean_data = re.sub('\\n\\s*', '', clean_data)
    clean_data = re.sub('"""', '"', clean_data)
    clean_data = re.sub("'''", "'", clean_data)
    clean_data = re.sub('\\\\', "'", clean_data)
    try:
        json_data = json.loads(f'{clean_data}')
        return json_data
    except json.JSONDecodeError as e:
        return content_to_json4(data)

def content_to_json4(data):
    pattern = '"Logic Analysis":\\s*(\\[[\\s\\S]*?\\])\\s*,\\s*"Task list":\\s*(\\[[\\s\\S]*?\\])'
    match = re.search(pattern, data)
    if match:
        logic_analysis = json.loads(match.group(1))
        task_list = json.loads(match.group(2))
        result = {'Logic Analysis': logic_analysis, 'Task list': task_list}
    else:
        result = {}
    return result

def content_to_json(data):
    clean_data = re.sub('\\[CONTENT\\]|\\[/CONTENT\\]', '', data).strip()
    clean_data = re.sub('(".*?"),\\s*#.*', '\\1,', clean_data)
    clean_data = re.sub(',\\s*\\]', ']', clean_data)
    clean_data = re.sub('\\n\\s*', '', clean_data)
    try:
        json_data = json.loads(clean_data)
        return json_data
    except json.JSONDecodeError as e:
        return content_to_json2(data)


# Valid test data with JSON content
test_data = '[CONTENT]{"name": "test", "values": [1, 2, 3], "flag": true}[/CONTENT]'

ARGS = {
    "data": test_data
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
content_to_json2 Ran
ran on a synthesized input
going-doer/Paper2Code/codes/utils.py
code served (permissive licence) · get_code("d8cf90662cd6acee")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import re

# The function takes a single parameter 'data' which is a string
# It processes the string through regex operations and attempts to parse it as JSON
# We need to create test cases that demonstrate the function's behavior

# Test case 1: Simple valid JSON with content tags
test_data_1 = '[CONTENT]{"name": "test", "value": 42}[/CONTENT]'

# Test case 2: JSON with comments that need to be removed
test_data_2 = '''[CONTENT]
{
    "name": "test",  # this is a comment
    "value": 42  # another comment
}
[/CONTENT]'''

# Test case 3: JSON with trailing commas before closing bracket
test_data_3 = '''[CONTENT]
{
    "items": [1, 2, 3, ],
    "name": "test",
}
[/CONTENT]'''

# Test case 4: JSON with triple quotes
test_data_4 = '''[CONTENT]
{
    "text": """hello world""",
    "data": 123
}
[/CONTENT]'''

# Test case 5: Complex nested structure that would fall back to content_to_json3
test_data_5 = '''[CONTENT]
{
    "Logic Analysis": ["step1", "step2"],
    "Task list": ["task1", "task2"]
}
[/CONTENT]'''

# Use the simplest valid case that demonstrates the function works
ARGS = {
    'data': '[CONTENT]{"name": "test", "value": 42}[/CONTENT]'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
extract_planning Ran
ran on a synthesized input
going-doer/Paper2Code/codes/utils.py
code served (permissive licence) · get_code("3eeceaf35787f5cb")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import tempfile
import os

# Create a temporary JSON file with trajectories
temp_dir = tempfile.mkdtemp()
trajectories_file = os.path.join(temp_dir, "trajectories.json")

# Build sample trajectory data matching the function's expectations
trajectories_data = [
    {
        "role": "user",
        "content": "What is the capital of France?"
    },
    {
        "role": "assistant",
        "content": "<think>The user is asking about the capital of France. I need to recall that Paris is the capital.</think>Paris is the capital of France."
    },
    {
        "role": "user",
        "content": "What is its population?"
    },
    {
        "role": "assistant",
        "content": "<think>The user is asking about Paris's population. I should provide approximate current data.</think>Paris has a population of approximately 2.2 million people in the city proper."
    },
    {
        "role": "user",
        "content": "Tell me more about its history."
    },
    {
        "role": "assistant",
        "content": "<think>The user wants to know about Paris's history. I should mention key historical periods.</think>Paris was founded by Celtic tribes, conquered by Romans, and became a major medieval center."
    },
    {
        "role": "user",
        "content": "What about modern Paris?"
    },
    {
        "role": "assistant",
        "content": "<think>Additional context about modern developments.</think>Modern Paris is a global center for art, fashion, and culture."
    }
]

# Write the JSON file
with open(trajectories_file, 'w') as f:
    json.dump(trajectories_data, f)

ARGS = {
    "trajectories_json_file_path": trajectories_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
remove_spans Ran
ran on a synthesized input
going-doer/Paper2Code/codes/0_pdf_process.py
code served (permissive licence) · get_code("187cdf4b63527436")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function remove_spans recursively processes data structures
# It removes certain keys from dicts and recursively processes nested structures
# It handles dicts, lists, and returns other types as-is

# Construct a representative test case with nested dicts and lists
test_data = {
    'text': 'Some research paper text',
    'cite_spans': [{'ref_id': '1', 'start': 0, 'end': 5}],
    'ref_spans': [{'ref_id': '2', 'start': 10, 'end': 15}],
    'eq_spans': [{'start': 20, 'end': 25}],
    'authors': ['John Doe', 'Jane Smith'],
    'bib_entries': {'ref1': {'title': 'A Paper'}},
    'year': 2023,
    'venue': 'NeurIPS',
    'identifiers': {'arxiv': '2301.00001'},
    '_pdf_hash': 'abc123def456',
    'header': 'Introduction',
    'nested_dict': {
        'content': 'nested content',
        'cite_spans': [{'nested': True}],
        'more_data': 'keep this'
    },
    'nested_list': [
        {'title': 'item1', 'authors': ['Author1']},
        {'title': 'item2', 'ref_spans': [{'ref': 1}]},
        'plain string item',
        42
    ],
    'plain_value': 'this should remain'
}

ARGS = {
    'data': test_data
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_write_msg Not yet run
unverified (harvested, no recorded run)
going-doer/Paper2Code/codes/3.1_coding_sh.py
code served (permissive licence) · get_code("b3d675b6543ecf1f")
How it ran

no invocation recorded.

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 5 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

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 Pa-perCoder 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. Reproducibility lies at the heart of scientific progress, which enables researchers to validate findings, build upon prior work, and ultimately push the boundaries of knowledge (Collaboration, 2015;Baker, 2016;Pineau et al., 2021). However, reproducing scientific results remains an enduring challenge. This is often due to incomplete documentation, missing experimental details, lack of access to data or proprietary tools, and, especially in machine learning research, the absence of corresponding code: for example, only average 19.5% of the papers accepted to top-tier machine learning conferences in 2024 provide their code implementations shown in Figure 1. As a result, researchers frequently invest substantial effort in reverse-engineering methods and experimental results from papers, a process that is both time-consuming and labor-intensive, subsequently slowing down the overall pace of science. Meanwhile, recent Large Language Models (LLMs) have shown outstanding capabilities in understanding and generating both natural language and programming code (Dubey et al., 2024; OpenAI, 2024;Reid et al., 2024), with performances increasingly approaching or even surpassing that of domain experts in some scenarios. In addition, this progress has sparked growing interest in leveraging LLMs to accelerate scientific workflows, particularly in the early stages of ideation for new and valid research hypotheses (

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2504.17192")
get_code_for_paper("2504.17192")
have("2504.17192")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2504.17192.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2504.17192.svg)](https://syntology.ai/paper/2504.17192)

Connect an agent — have() is free.