Open R1: An Open-Source Reproduction of DeepSeek-R1 for Advanced LLM Training

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Open R1: An Open-Source Reproduction of DeepSeek-R1 for Advanced LLM Training

Summary

Open R1 is a Hugging Face project dedicated to creating a fully open reproduction of DeepSeek-R1, a powerful reasoning language model. This initiative provides comprehensive tools and recipes for training, evaluating, and generating data for large language models. It fosters community collaboration in AI research, enabling developers to build upon and understand the complex R1 pipeline.

Repository Information

Analyzed by OSRepos on November 17, 2025

Use at your own risk

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.

Introduction

Open R1 is an ambitious project by Hugging Face, aiming to deliver a fully open-source reproduction of DeepSeek-R1, a state-of-the-art reasoning language model. The core goal is to build the missing pieces of the R1 pipeline, making it accessible for everyone to reproduce and innovate upon. The project is designed for simplicity, primarily consisting of src/open_r1 for training and synthetic data generation scripts, and a Makefile for streamlined execution of the R1 pipeline steps.

The development follows a clear plan of attack, guided by the DeepSeek-R1 tech report. This includes replicating R1-Distill models through high-quality corpus distillation, establishing a pure Reinforcement Learning (RL) pipeline for R1-Zero, and demonstrating multi-stage training from base models to RL-tuned variants. Recent milestones include the release of the Mixture-of-Thoughts dataset, CodeForces-CoTs, and OpenR1-Math-220k, marking significant progress in replicating DeepSeek-R1's capabilities.

Installation

To get started with Open R1, ensure you have CUDA 12.4 and Python 3.11. The project leverages uv for environment management and vLLM and FlashAttention for high-performance operations.

  1. Create a virtual environment and install pip:

    uv venv openr1 --python 3.11 && source openr1/bin/activate && uv pip install --upgrade pip
    
  2. Install vLLM and FlashAttention:

    uv pip install vllm==0.8.5.post1
    uv pip install setuptools && uv pip install flash-attn --no-build-isolation
    

    Note: PyTorch v2.6.0 is required for vLLM binaries.

  3. Install remaining dependencies (e.g., for development):

    GIT_LFS_SKIP_SMUDGE=1 uv pip install -e ".[dev]"
    
  4. Log in to Hugging Face and Weights and Biases:

    huggingface-cli login
    wandb login
    
  5. Verify Git LFS installation:

    git-lfs --version
    

    If not installed, run: sudo apt-get install git-lfs.

Examples

Open R1 provides robust tools for training, evaluating, and generating data for LLMs.

Training Models

The project supports Supervised Fine-Tuning (SFT) and Group Relative Policy Optimization (GRPO) with DDP or DeepSpeed. Training commands are configured for 8 x H100s, with flexibility for different hardware.

SFT Example (using a YAML config):

accelerate launch --config_file recipes/accelerate_configs/zero3.yaml src/open_r1/sft.py \
    --config recipes/OpenR1-Distill-7B/sft/config_distill.yaml

GRPO Example (single-node with vLLM colocation):

ACCELERATE_LOG_LEVEL=info \
    accelerate launch --config_file recipes/accelerate_configs/zero3.yaml \
    src/open_r1/grpo.py --config recipes/DeepSeek-R1-Distill-Qwen-1.5B/grpo/config_demo.yaml \
    --vllm_mode colocate

The project also includes a code reward function for training with a code interpreter, supporting E2B and Morph sandboxes, and specific reward functions for competitive programming problems like IOI and CodeForces.

Evaluating Models

Model evaluation is performed using lighteval with vLLM, supporting both single-GPU and multi-GPU (data or tensor parallel) setups. This allows for comprehensive benchmarking against various tasks.

Example Evaluation (AIME 2024 on a single GPU):

export VLLM_WORKER_MULTIPROC_METHOD=spawn # Required for vLLM
MODEL=deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B
MODEL_ARGS="model_name=$MODEL,dtype=bfloat16,max_model_length=32768,gpu_memory_utilization=0.8,generation_parameters={max_new_tokens:32768,temperature:0.6,top_p:0.95}"
OUTPUT_DIR=data/evals/$MODEL

TASK=aime24
lighteval vllm $MODEL_ARGS "lighteval|$TASK|0|0" \
    --use-chat-template \
    --output-dir $OUTPUT_DIR

Open R1 provides detailed instructions and results for reproducing DeepSeek's reported performance on benchmarks like AIME 2024, MATH-500, GPQA Diamond, and LiveCodeBench.

Data Generation

Synthetic data can be generated using distilabel with vLLM, enabling the creation of high-quality datasets for training. This includes generating data from smaller distilled R1 models or the larger DeepSeek-R1 model using Slurm clusters.

Example (generating data from a smol distilled R1 model):

from datasets import load_dataset
from distilabel.models import vLLM
from distilabel.pipeline import Pipeline
from distilabel.steps.tasks import TextGeneration

prompt_template = """\
You will be given a problem. Please reason step by step, and put your final answer within \boxed{}:
{{ instruction }}"""

dataset = load_dataset("AI-MO/NuminaMath-TIR", split="train").select(range(10))

model_id = "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B"

with Pipeline(
    name="distill-qwen-7b-r1",
    description="A pipeline to generate data from a distilled r1 model",
) as pipeline:

    llm = vLLM(
        model=model_id,
        tokenizer=model_id,
        extra_kwargs={
            "tensor_parallel_size": 1,
            "max_model_len": 8192,
        },
        generation_kwargs={
            "temperature": 0.6,
            "max_new_tokens": 8192,
        },
    )
    prompt_column = "problem"
    text_generation = TextGeneration(
        llm=llm, 
        template=prompt_template,
        num_generations=4,
        input_mappings={"instruction": prompt_column} if prompt_column is not None else {}
    )


if __name__ == "__main__":
    distiset = pipeline.run(dataset=dataset)
    distiset.push_to_hub(repo_id="username/numina-deepseek-r1-qwen-7b")

The project also offers a script for data decontamination, using 8-grams to deduplicate and clean datasets against benchmark contamination.

Why Use Open R1?

Open R1 offers a unique opportunity for researchers and developers to engage with the cutting-edge field of large language model development. By providing an open reproduction of DeepSeek-R1, it democratizes access to advanced reasoning capabilities. The project's comprehensive toolkit, including scalable training with GRPO, robust evaluation with lighteval, and flexible data generation with distilabel, makes it an invaluable resource. Its community-driven nature ensures continuous improvement and collaboration, pushing the boundaries of open AI research.

Links

Related repositories

Similar repositories that may be relevant next.

StringWars: Benchmarking High-Performance String Processing in Rust and Python

StringWars: Benchmarking High-Performance String Processing in Rust and Python

July 21, 2026

StringWars is a comprehensive GitHub repository dedicated to benchmarking performance-oriented string processing libraries in Rust and Python. It meticulously compares various operations, including substring search, hashing, and edit distances, across both CPUs and GPUs. This project serves as an invaluable resource for developers seeking to identify the fastest and most efficient solutions for critical string manipulation tasks, particularly those leveraging modern SIMD instructions and GPU acceleration.

benchmarkstring-processingRust
awesome-python-books: A Curated Directory of Python Books for All Levels

awesome-python-books: A Curated Directory of Python Books for All Levels

July 19, 2026

The `awesome-python-books` repository is an extensive, curated directory of Python books, catering to learners from absolute beginners to advanced practitioners. It organizes a vast collection of resources across various domains, making it an invaluable tool for anyone looking to deepen their Python knowledge. This list simplifies the search for high-quality educational materials in the Python ecosystem.

PythonBooksLearning
Become-A-Full-Stack-Web-Developer: Free Resources for Web Development

Become-A-Full-Stack-Web-Developer: Free Resources for Web Development

July 19, 2026

The Become-A-Full-Stack-Web-Developer repository is an extensive collection of free resources designed to guide aspiring developers through the entire journey of full-stack web development. It covers a wide array of topics, from foundational languages like HTML, CSS, and JavaScript to advanced frameworks such as React and Node.js, alongside databases, APIs, and career preparation. This resource is invaluable for anyone looking to build a strong skill set in modern web development.

Full StackWeb DevelopmentLearning Resources
Mergoo: Efficiently Merge and Train Multiple LLM Experts

Mergoo: Efficiently Merge and Train Multiple LLM Experts

July 7, 2026

Mergoo is an open-source Python library designed to simplify the merging of multiple Large Language Model (LLM) experts. It enables efficient training of these merged LLMs, allowing users to integrate knowledge from various generic or domain-specific models. The library supports several merging methods, including Mixture-of-Experts and Mixture-of-Adapters, across popular base models.

artificial-intelligencefine-tuninggenerative-ai

Source repository

Open the original repository on GitHub.

8 counted GitHub visits

View on GitHub
OS
OSRepos

Analysis and discovery of open source repositories. Find interesting projects and follow their updates.

Monitor your website with YourWebsiteScore

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of third-party repository code is at your own risk. Always review source code, dependencies, licenses, and security implications before running anything.

© 2025 OSRepos. Built with Nuxt 3 and lots of ❤️