Skip to content

Paper2Code: Automating Code Generation from Scientific Papers in Machine Learning

Notifications You must be signed in to change notification settings

continuous1024/Paper2Code

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📄 Paper2Code: Automating Code Generation from Scientific Papers in Machine Learning

PaperCoder Overview

📄 Read the paper on arXiv

PaperCoder is a multi-agent LLM system that transforms paper into code repository. It follows a three-stage pipeline: planning, analysis, and code generation, each handled by specialized agents.
Our method outperforms strong baselines both on Paper2Code and PaperBench and produces faithful, high-quality implementations.


⚡ QuickStart

  • Note: The following command runs example paper (Attention Is All You Need).
  • 💵 Estimated cost for using o3-mini: $0.50–$0.70
pip install openai

export OPENAI_API_KEY="<OPENAI_API_KEY>"

cd scripts
bash run.sh

Output Folder Structure (Only Important Files)

outputs
├── Transformer
│   ├── analyzing_artifacts
│   ├── coding_artifacts
│   └── planning_artifacts
└── Transformer_repo  # Final output repository

📚 Detailed Setup Instructions

🛠️ Environment Setup

  • Note: If you wish to use the o3-mini version, please make sure to install the latest version of the OpenAI package.
pip install openai

📄 Convert PDF to JSON

  1. Clone the s2orc-doc2json repository to convert your PDF file into a structured JSON format.
    (For detailed configuration, please refer to the official repository.)
git clone https://github.com/allenai/s2orc-doc2json.git
  1. Running the PDF processing service.
cd ./s2orc-doc2json/grobid-0.7.3
./gradlew run
  1. Convert your PDF into JSON format.
mkdir -p ./s2orc-doc2json/output_dir/paper_coder
python ./s2orc-doc2json/doc2json/grobid2json/process_pdf.py \
    -i ${PDF_PATH} \
    -t ./s2orc-doc2json/temp_dir/ \ 
    -o ./s2orc-doc2json/output_dir/paper_coder

🚀 Runing PaperCoder

  • Note: The following command runs example paper (Attention Is All You Need).
    If you want to run PaperCoder on your own paper, please modify the environment variables accordingly.
export OPENAI_API_KEY="<OPENAI_API_KEY>"

cd scripts
bash run.sh

About

Paper2Code: Automating Code Generation from Scientific Papers in Machine Learning

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 96.7%
  • Shell 3.3%