---
title: "Mini-R1: Reproduce Deepseek R1 „aha moment“ a RL tutorial"
description: "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."
url: "https://swe.quest/articles/mini-r1-reproduce-deepseek-r1-aha-moment-a-rl-tutorial-a09c9653360cce5a"
canonical: "https://huggingface.co/blog/open-r1/mini-r1-contdown-game"
source: "Hugging Face"
published: "2025-01-31"
difficulty: "hard"
kind: "How-to"
reading_minutes: 15
tags: ["model-training","llms","python"]
---

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

A post on [Hugging Face](https://swe.quest/sources/hugging-face.md), published 2025-01-31, 15 min read, How-to. Original: [https://huggingface.co/blog/open-r1/mini-r1-contdown-game](https://huggingface.co/blog/open-r1/mini-r1-contdown-game)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Python](https://swe.quest/tags/python.md) (Languages)

## Prerequisites

- reinforcement learning basics ([easy posts on Model training](https://swe.quest/tags/model-training.md?difficulty=easy))
- PPO
- LLM fine-tuning ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- distributed GPU training ([easy posts on Hardware](https://swe.quest/tags/hardware.md?difficulty=easy))

## Keywords

GRPO, DeepSeek-R1, TRL, vLLM, DeepSpeed, Qwen2.5-3B-Instruct, Countdown Game

## Related posts

- [Open R1: Update #2](https://swe.quest/articles/open-r1-update-2-8012bcb3a4bd440c.md): Hugging Face · 2025-02-10 · Hard · 14 min read · Model training, LLMs, Evaluation, Inference & serving
  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.
- [Open-R1: a fully open reproduction of DeepSeek-R1](https://swe.quest/articles/open-r1-a-fully-open-reproduction-of-deepseek-r1-1e5b97c561871dc1.md): Hugging Face · 2025-01-28 · Easy · 9 min read · Model training, LLMs, Open source
  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.
- [Open-R1: Update #1](https://swe.quest/articles/open-r1-update-1-663f996689b7bd10.md): Hugging Face · 2025-02-02 · Medium · 10 min read · Model training, Inference & serving, LLMs, Evaluation
  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.
- [DeepMath: A lightweight math reasoning Agent with smolagents](https://swe.quest/articles/deepmath-a-lightweight-math-reasoning-agent-with-smolagents-e010b89eb984330e.md): Hugging Face · 2025-12-04 · Hard · 5 min read · Model training, AI agents, LLMs, Evaluation, Sandboxing & isolation
  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.
- [Turning Database Grading into RL Rewards: Post-Training Agents with ThinkingBox](https://swe.quest/articles/turning-database-grading-into-rl-rewards-post-training-agents-with-thinkingbox-9126975f97c5fba4.md): Hugging Face · 2026-10-22 · Hard · 18 min read · Model training, AI agents, Evaluation, LLMs
  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.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
