Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 15 min read How-to hardMaster

Mini-R1: Reproduce Deepseek R1 „aha moment“ a RL tutorial

Recreates DeepSeek R1's "aha moment" by training Qwen2.5-3B-Instruct with GRPO on the Countdown numbers game, using rule-based format and accuracy rewards in TRL with DeepSpeed ZeRO-3 and vLLM generation on 4x H100s. GRPO drops PPO's value model and instead normalizes rewards within a group of sampled outputs to compute advantages. The DeepSeekMath hyperparameters became unstable after about 150 steps, so the learning rate was lowered to 5e-7 and the KL beta to 0.001. The model learned the output format by step 50 and reached about 50% success by step 450 (roughly 6 hours), shifting around step 200 from verbal reasoning to programmatic trial-and-check search.

Related posts

  • Open R1: Update #2

    Hugging Face hardMaster

    OpenR1-Math-220k is a math reasoning dataset built by generating 800k DeepSeek R1 traces for 400k NuminaMath 1.5 problems on 512 local H100s. Switching inference from vLLM to SGLang nearly doubled throughput, from 15 to 25 generations per hour per H100. Traces were filtered with Math-Verify plus a Llama-3.3-70B-Instruct judge, which recovered 28k rejected problems, while reward-model selection among correct answers gave no gain over random choice. Fine-tuning Qwen2.5-Math-Instruct on the 94k default split nearly matches DeepSeek-Distill-Qwen-7B, and the update also covers community GRPO results, small curated datasets (s1K, LIMO) and controlling chain-of-thought length with budget forcing and cosine rewards.

  • Open-R1: a fully open reproduction of DeepSeek-R1

    Hugging Face easyNovice

    Open-R1 is a Hugging Face project to openly reconstruct DeepSeek-R1's missing training data and code, since only the model weights were released. DeepSeek-R1 builds on the 671B MoE DeepSeek-V3. R1-Zero was trained with pure reinforcement learning using GRPO and simple accuracy and format rewards, while R1 added a cold-start SFT phase followed by further RL and rejection sampling to improve readability. The plan has three steps: distill a reasoning dataset from R1 to replicate the R1-Distill models, replicate the pure-RL R1-Zero pipeline with new math, reasoning and code datasets, and demonstrate multi-stage base → SFT → RL training.

  • Open-R1: Update #1

    Hugging Face mediumAdept

    Open-R1's first week reproduced DeepSeek's MATH-500 scores for the R1-Distill models using lighteval, mostly within a few points of the reported numbers. GRPO training landed in TRL 0.14 with DeepSpeed ZeRO and vLLM generation, though R1's very long outputs (about 6,000 tokens on average, some over 20,000) make memory a constraint. For synthetic data generation, serving R1 on 4x 8xH100 nodes instead of 2 avoided KV-cache preemption. Switching from batched to streaming async requests kept GPU utilization steady. The update closes with a roundup of industry reactions, training-cost discussions, community reproductions such as TinyZero and Mini-R1, and R1-derived reasoning datasets.

  • DeepMath: A lightweight math reasoning Agent with smolagents

    Hugging Face hardMaster

    DeepMath fine-tunes Qwen3-4B Thinking with GRPO so it emits short Python snippets for intermediate math steps, runs them in a sandbox (module allow-list, no file I/O or network, per-snippet timeouts), and feeds results back into its reasoning. The agent is built on smolagents with vLLM inference, and TRL's vLLM client/server was modified so GRPO candidates are generated by the agent. Rewards cover correctness and code use, completions are capped at 5k tokens, temperature is scheduled linearly from 1.2 to 0.7, and training uses the OpenMathReasoning TIR subset. On MATH500, AIME, HMMT and HLE, agentic inference alone cuts output length by up to 66% with mixed accuracy, and combining it with GRPO training gives the best accuracy with shorter traces.

  • Turning Database Grading into RL Rewards: Post-Training Agents with ThinkingBox

    Hugging Face hardMaster

    Executable checks on terminal database state, originally built to grade agents in ThinkingBox-Bench, double as binary RL rewards for post-training tool-using agents. Fine-tuning Qwen3.8-27B with token-mean GRPO for 50 steps on 187 out-of-distribution tasks raised pass@1 from 51.70% to 60.78% and tasks solved on all 20 attempts from 38 to 107, while pass@20 coverage dipped slightly, consistent with sharpening. The key lever is offline policy-relative difficulty: candidate tasks are probed against the base policy, a Jeffreys Beta posterior estimates success probability, and only tasks likely to yield mixed reward groups (non-zero GRPO advantage) are kept. Cost per dependable task fell from $24.36 to $8.00, approaching frontier models.

The quest for software engineering knowledge.

Look:
Layout: