huggingface/open-r1

Fully open reproduction of DeepSeek-R1

What it solves

Open R1 is designed to provide a fully open reproduction of the DeepSeek-R1 pipeline. It aims to fill the gaps in the original pipeline so that the community can reproduce the reasoning capabilities of R1 models, specifically focusing on distilling high-quality reasoning traces and implementing the reinforcement learning (RL) pipeline.

How it works

The project implements a multi-stage training approach based on the DeepSeek-R1 technical report. It provides scripts for:

  • Supervised Fine-Tuning (SFT): Performing simple SFT on datasets containing reasoning traces.
  • Group Relative Policy Optimization (GRPO): Training models using RL with a vLLM backend to scale across multiple nodes.
  • Synthetic Data Generation: Using Distilabel to generate synthetic data from existing models.
  • Code Execution Rewards: Integrating with sandbox providers like E2B, Morph, and Piston to provide real-time code execution rewards for training on competitive programming tasks (e.g., Codeforces, IOI).

Who it’s for

This project is for AI researchers and developers who want to reproduce DeepSeek-R1's reasoning capabilities in smaller or open-weights models, or those looking to implement GRPO and SFT distillation pipelines for reasoning models.

Highlights

  • Open Reproduction: A complete pipeline for replicating R1-Distill models and the R1-Zero RL pipeline.
  • Verifiable Rewards: Support for code interpreter rewards using sandboxed environments for high-accuracy training on math and code.
  • Scalable Training: Integration with vLLM and Hugging Face Accelerate (DeepSpeed ZeRO-2/3) for multi-node training on H100 clusters.
  • Curated Datasets: Release of reasoning datasets like Mixture-of-Thoughts and CodeForces-CoTs.

Related

  • Dispatch
  • Dispatch
  • Dispatch
  • Dispatch
  • Project