Vibe Engines
YouTube

Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path

~9 min readDeepSeek · 2025

DeepSeek-R1,
explained.

Most models are taught to reason by showing them thousands of worked solutions to copy. DeepSeek-R1 tried something bolder: don't show it how to think at all. Just reward it for getting the final answer right, over and over, and see what happens. What happened surprised everyone — the model taught itself to slow down, work step by step, and even catch its own mistakes. Reasoning wasn't programmed in. It grew.

The delta

What changes against o1: outcome reward alone, and everything published

Rung 4 establishes that reasoning can be trained and does not say how. This rung's change is to show that the recipe can be far simpler than anyone expected and to publish it. The starkest version is the variant trained with no supervised fine-tuning at all: reinforcement learning applied directly to a base model, with a reward that checks only whether the final answer is correct and whether the output is in the required format. No human reasoning demonstrations, no step-level labels, no learned reward model to game.

What emerges under that reward is the finding. The model's responses get longer on their own over training — nothing rewards length — and behaviours the ladder below had to scaffold appear inside a single generated stream: reconsidering an approach, checking its own work, backtracking from a line that is not working. Rung 3 built that with an external search; here it is a policy the model arrived at because it raised the probability of being right.

Stated in the units this ladder compares on: rung 9 of the post-training ladder argues that supervising the process beats supervising the outcome, and buys that with an enormous annotation effort. This rung reaches comparable reasoning behaviour with outcome supervision only, paying in reinforcement-learning compute instead of in labels. The released version adds a small amount of cold-start data before the reinforcement learning, for reasons the standing block explains, and the weights and method are open.

01

The reasoning gap

A standard chat model answers fast — it predicts a response in one flowing pass. That's fine for "summarize this email," but it stumbles on problems that need genuine multi-step work: hard math, tricky code, layered logic. Answering such a question well requires thinking — trying an approach, checking it, backing up, trying another — before committing to a final answer.

OpenAI's o1 had shown that letting a model generate a long internal chain of thought before answering dramatically boosts reasoning — but the recipe was closed. The open question DeepSeek-R1 set out to answer: how do you actually train a model to think like that? And could you do it without a mountain of hand-written reasoning examples?

02

R1-Zero: reward, and nothing else

The boldest experiment came first: DeepSeek-R1-Zero. Take a base model and skip the usual supervised fine-tuning on example reasoning entirely. Instead, apply reinforcement learning directly, with a shockingly simple reward — mostly just: is the final answer correct? (checkable for math and code), plus a small reward for putting the reasoning in the right format.

Pure RL — reward only the outcome, not the steps
Problem
→
Model generates
a full attempt
→
Reward
answer correct?
↺
Update policy

Crucially, nothing rewards the reasoning itself — no human ranks the steps, no example solutions are copied. The model is only ever told whether it landed on the right answer. Everything about how to get there is left for it to discover. It's the leanest possible teaching signal: outcome only.

03

Reasoning emerges on its own

The result was the paper's headline. Left to maximize correctness, the model discovered — with no instruction to do so — that thinking longer helps. Over training, its responses grew from short guesses into extended chains of reasoning: laying out steps, computing intermediate results, and exploring more than one path before answering. Accuracy on hard math and coding benchmarks climbed steeply alongside this growing "thinking time."

This is a striking demonstration that a complex skill can be incentivized rather than imitated. Nobody wrote reasoning examples for R1-Zero to copy; the reasoning behavior was an emergent strategy for earning more reward. Give a capable base model the right pressure, and the sophisticated behavior falls out.

The key idea

Imitation learning teaches by showing examples. R1-Zero shows reasoning can instead be discovered — the model invents chain-of-thought because thinking step by step is simply the strategy that gets more answers right.

You can see the emergence fall out of the numbers. If expected accuracy rises with thinking length but each step costs a little compute, reward pressure drives the chain to exactly the length where the next step stops paying for itself:

No one wrote a single reasoning example; long chains appeared purely because they earn more reward. The runnable version below grows the chain and shows the reward is ungameable.

04

The 'aha moment'

The most talked-about observation: during training, the model spontaneously learned to stop and reconsider. Mid-solution, it would effectively say "wait — let me rethink this," abandon a flawed approach, and try again. It also learned to spend more thinking on harder problems and less on easy ones, budgeting its own effort.

… so the value would be 12.
Wait. Let me re-check that step — the substitution was wrong.
Reconsidering: if x = 3, then the correct value is 15. ✓

None of this self-correction was designed in. It emerged because catching your own mistakes gets more answers right, and the reward found it. The authors called it an "aha moment" — a genuinely surprising sign that reflective, self-checking behavior can arise from pure outcome-based reinforcement.

05

Fixing R1-Zero's rough edges

R1-Zero reasoned impressively but communicated poorly. With only correctness rewarded, its chains of thought were often hard to read and sometimes mixed languages mid-answer — nobody had rewarded clean, human-friendly output. Powerful, but not pleasant to use.

So the full DeepSeek-R1 added structure around the pure-RL core. First, fine-tune the base model on a small batch of high-quality cold-start reasoning examples to instill a clean style. Then run the large-scale RL for reasoning. Then a round of rejection sampling and more training to polish helpfulness and readability. The emergent reasoning is preserved; the output becomes coherent and well-behaved.

06

Distilling reasoning into small models

Running large-scale RL is expensive, so DeepSeek showed a cheaper path to spread the capability: distillation. Use the strong R1 to generate many high-quality reasoning traces, then simply fine-tune smaller open models (in the 1.5B–70B range) on those traces. No RL needed for the small models — they learn to reason by imitating R1's worked solutions.

ModelHow it got reasoning
R1-Zeropure RL, outcome reward
R1cold-start + RL + polish
Distilled 1.5B–70Bfine-tuned on R1's traces

The distilled models inherited a large share of R1's reasoning — small models that punch far above their size on math and code. It's strong evidence that reasoning skill, once created, transfers cheaply, putting capable reasoners within reach on modest hardware.

07

The limits

The clean RL recipe works best where answers are automatically checkable — math, code, formal logic. For open-ended tasks with no crisp "correct" signal (writing, judgment, taste), outcome-based RL is far harder to apply, so R1's edge is narrower there. Long chains of thought also cost real test-time compute: thinking longer means more tokens, more latency, more money per answer.

And reasoning fluency isn't truthfulness — a confident, well-structured chain of thought can still reach a wrong conclusion, and the visible "thinking" doesn't guarantee the model actually followed that logic. Emergent self-correction reduces errors; it doesn't eliminate them.

08

Why it still matters

DeepSeek-R1 opened the reasoning era to everyone. It reproduced o1-class reasoning with an openly published recipe and open weights, and — through R1-Zero — showed something conceptually deep: advanced reasoning can be incentivized into existence by rewarding correct outcomes, not painstakingly demonstrated. That reframes how we think about teaching models hard skills.

It also cemented test-time compute — letting a model think longer at inference — as a first-class lever alongside making models bigger. Together with the cheap distillation of reasoning into small models, R1 pushed the whole field toward reasoning-first systems and made them broadly accessible, not just a frontier-lab privilege.

Read next

R1 builds on chain-of-thought prompting (the behavior it grows) and the RLHF lineage from InstructGPT (the RL machinery it repurposes toward correctness).

How it works

How DeepSeek trained R1-Zero and R1

DeepSeek-R1 is a report from DeepSeek-AI, released in January 2025 and later published in Nature. It describes two models trained from the same base, DeepSeek-V3-Base, a mixture-of-experts model with 671B total and 37B active parameters, plus a cheap way to pass the result on to smaller models.

DeepSeek-V3-Base GRPO, rule rewards R1-Zero AIME 71.0% readable R1-Zero outputs 1 Cold start thousands of CoT 2 Reasoning RL GRPO + language 3 Rejection SFT 800k, on V3-Base 4 General RL rules + pref. RMs Distilled models 1.5B–70B, SFT only DeepSeek-R1 AIME 79.8%
Two models from one base. R1-Zero is reinforcement learning applied straight to V3-Base; R1 runs four stages, the third restarting from V3-Base on about 800k curated samples that also distill the small models.

R1-Zero: reinforcement learning straight on the base model

  1. Fix a template, not a style. Every prompt is wrapped in one short instruction: the assistant thinks first and then answers, with the reasoning between <think> and </think> tags and the answer between <answer> tags. Nothing in it asks for reflection or any particular strategy, so whatever reasoning style appears is learned.
  2. Reward with rules, not a model. Two rewards. Accuracy: a math answer must appear in a required format, such as inside a box, so it can be checked against the reference, and code is compiled and run against test cases. Format: the reasoning must sit inside the think tags. The authors deliberately avoided neural reward models, outcome or process, because a large policy learns to hack them and retraining them adds cost and complexity.
  3. Optimize with GRPO. For each question, sample a group of answers from the current policy, score each with the rules, and use each answer's reward relative to its own group, standardized by the group's mean and standard deviation, as its advantage. There is no learned critic, which removes a second model as large as the policy from the training loop.
  4. Repeat for thousands of steps. Average response length grows steadily without being rewarded, from hundreds of tokens to thousands, and AIME 2024 accuracy climbs with it.

R1: four stages

  1. Cold start. Fine-tune V3-Base on thousands of long chain-of-thought examples, gathered by few-shot prompting with long examples, by prompting for detailed answers with reflection and verification, and by having annotators clean up R1-Zero outputs. Each example ends with a readable summary.
  2. Reasoning RL. The R1-Zero procedure on math, code, science and logic, with one added reward for language consistency: the share of the chain written in the target language. In the authors' ablation it costs a little accuracy and makes the output readable.
  3. Rejection sampling and fine-tuning. From the converged checkpoint, sample several responses per prompt and keep only correct ones, judging some with DeepSeek-V3 against a reference answer, and drop chains with mixed languages, long paragraphs or code blocks: about 600k reasoning samples. Add about 200k non-reasoning samples, such as writing, factual QA and translation, from the DeepSeek-V3 pipeline. Then fine-tune V3-Base again, not the RL checkpoint, for two epochs on the roughly 800k samples.
  4. RL for all scenarios. A second RL stage mixes rule rewards for reasoning prompts with preference reward models for general ones. Helpfulness is judged on the final summary only; harmlessness on the whole response, reasoning included.

Distillation and inference

The same 800k samples fine-tune open dense models, Qwen2.5 at 1.5B, 7B, 14B and 32B and Llama at 8B and 70B, with supervised learning only and no RL stage. At evaluation, every model generates up to 32,768 tokens at temperature 0.6 and top-p 0.95, and pass@1 is averaged over several samples per question.

The math

GRPO, the objective behind DeepSeek-R1

For each question q, GRPO samples a group of G outputs o1 … oG from the old policy and maximizes:

J(θ) = E[ (1/G) Σi=1^G ( min( ρi Ai , clip(ρi, 1 − ε, 1 + ε) Ai ) − β DKL(πθ ‖ πref) ) ]
ρi = πθ(oi | q) / πold(oi | q)
Ai = ( ri − mean(r1 … rG) ) / std(r1 … rG)
DKL = πref(oi | q) / πθ(oi | q) − log[ πref(oi | q) / πθ(oi | q) ] − 1
  • ri — the rule-based reward for output i: accuracy plus format
  • Ai — the advantage, how much better output i scored than its own group; it replaces PPO's learned value function
  • ρi, ε — the probability ratio and PPO's clip, which caps how far one update can move the policy
  • β, πref — the KL penalty weight and the frozen reference model it anchors to

If every output in a group earns the same reward, every advantage is zero and the question contributes no reward signal, so only questions the model sometimes solves teach it anything. The KL estimate is never negative and is zero when the two policies agree. Liu and colleagues later argued, in their 2025 Dr. GRPO analysis, that dividing by the group's standard deviation, and by response length in the token-level form of GRPO, biases training, for example letting long wrong answers grow; they proposed dropping both.

The evidence

What DeepSeek ran, and what it showed

Evaluation used reasoning benchmarks (AIME 2024, MATH-500, GPQA Diamond, LiveCodeBench, Codeforces) and general ones such as MMLU, against OpenAI's o1 releases, GPT-4o, Claude 3.5 Sonnet and DeepSeek-V3. Pass@1 is averaged over several samples per question at temperature 0.6.

ModelAIME 2024 pass@1Other headline results
R1-Zero, start of RL15.6%—
R1-Zero, end of RL71.0%86.7% with majority voting
DeepSeek-R179.8%MATH-500 97.3%; Codeforces rating 2,029
OpenAI o1-121779.2%MATH-500 96.4%
R1-Distill-Qwen-7B55.5%fine-tuning only
R1-Distill-Qwen-32B72.6%MATH-500 94.3%
Qwen2.5-32B-Base + R1-Zero-style RL47.0%no distillation

R1 matched o1-1217 on math and came close on competitive programming, and trailed it on GPQA Diamond, 71.5% against 75.7%. R1-Zero's 86.7% with majority voting was above the earlier o1-0912 release under the same kind of voting.

Negative results. The key ablation is the last row: the R1-Zero recipe run directly on Qwen2.5-32B-Base for more than 10,000 steps reached roughly QwQ-32B-Preview's level, while distilling R1 into the same base scored far higher. The authors also report two methods that did not work. A process reward model was hard to define for general reasoning, hard to label, and open to reward hacking once learned. Monte Carlo tree search over reasoning steps faced a search space far larger than a board game's and a value model that was hard to train, so it did not keep improving the model. R1 itself was weaker than DeepSeek-V3 at function calling, multi-turn dialogue, role-play and JSON output, sensitive to prompts, with few-shot prompting hurting it, and barely better on software-engineering benchmarks, where slow evaluation limited the RL.

Since then

What the authors admit, and what happened next

The admissions are unusually concrete. The pure-reinforcement-learning variant produces reasoning that is hard to read and mixes languages mid-chain — which is exactly what a reward that only checks the final answer should be expected to produce, since nothing in it ever asks the reasoning to be legible to a human. The cold-start data exists to fix that, and the paper says so. It also reports being weaker on some non-reasoning capabilities, so this is a trade rather than a free gain.

The most interesting reported negative concerns small models: distilling from the large reasoning model beat running the same reinforcement learning directly on a small one. The reasoning behaviour did not bootstrap itself at small scale — it had to be produced by something large and then transferred. That is a finding about where this capability comes from, and it echoes rung 1's threshold from the other end of the ladder.

How it held up: it was reproduced widely and quickly, which is the strongest possible contrast with rung 4's position, and it turned reasoning training from a frontier-lab capability into something many groups could run. The tension it leaves open is genuine and unresolved: outcome-only reward at sufficient scale produced what process supervision was designed to produce, and whether that means process supervision was unnecessary or that expensive reinforcement learning is rediscovering it the slow way is not settled by either result.

SOLVE IT YOURSELF

Grow reasoning from reward alone

R1-Zero's teaching signal is almost nothing: a rule-based reward for a correct answer plus a small format bonus. Two things fall out, and you can run both. First, the reward is ungameable — a wrong-but-fluent answer earns only the format crumb, never the accuracy point. Second, reasoning emerges: since longer thinking raises expected accuracy, pure reward pressure grows the chain from 1 step to ~29 with no examples to copy. Watch the length climb and the accuracy follow. Change the per-step cost or the accuracy curve.

YOUR TASK

Write the body of rl_grow. Everything else in the file is already written; this is the function the paper is about. Press ▶ Run to check it against the 5 assertions below — they start red.

WHAT IT HAS TO SATISFY — 5 ASSERTIONS
  1. Accuracy rises with reasoning length
  2. Expected accuracy saturates below 1
  3. Reward pressure grows the chain far past its start
  4. A correct answer out-rewards a fluent wrong one
  5. The reward is ungameable: fluent-but-wrong earns only the format bonus
CPython · WebAssembly
Questions

Questions people ask about DeepSeek-R1

How does GRPO differ from PPO?

PPO needs a learned value function, a critic usually as large as the policy, to estimate how good each response is. GRPO, introduced in DeepSeek's earlier DeepSeekMath work and used for R1, drops the critic. For each question it samples a group of responses, scores them, and uses each response's reward minus the group mean, divided by the group standard deviation, as its advantage. The rest is PPO: a clipped probability ratio limits each update, and a KL penalty keeps the policy near a reference model. Dropping the critic saves memory and compute, and with rule-based rewards there is also no reward model to train. The cost is needing many samples per question.

What are the four stages of the DeepSeek-R1 training pipeline?

First, a cold start: DeepSeek-V3-Base is fine-tuned on thousands of long, readable chain-of-thought examples. Second, reasoning-focused reinforcement learning with GRPO on math, code, science and logic, using rule-based accuracy and format rewards plus a language-consistency reward. Third, rejection sampling: the RL checkpoint generates many answers, only correct and readable ones are kept, about 600k, and these are combined with about 200k non-reasoning samples to fine-tune V3-Base again for two epochs. Fourth, a second reinforcement learning stage over all kinds of prompts, with rule rewards for reasoning and preference reward models for helpfulness and harmlessness. R1-Zero, the earlier experiment, skips everything except the reinforcement learning.

Why did DeepSeek-R1 use rule-based rewards instead of a reward model?

Because a learned reward model can be gamed. Under large-scale reinforcement learning, a policy finds outputs that score well with a neural reward model without actually being better, and keeping the reward model ahead of that means retraining it, which adds compute and complexity. For math and code, correctness can be checked by rule instead: the final answer must appear in a fixed format and match the reference, or the code must pass its test cases. A format reward checks that the reasoning sits between the think tags. The authors also tried a process reward model and found step-level correctness hard to define and to label, so the rules were both simpler and harder to hack.

Was the aha moment in DeepSeek-R1-Zero really emergent?

DeepSeek reported that an intermediate R1-Zero checkpoint began pausing mid-solution to re-examine its approach, which the authors called an aha moment, and presented it as behavior that reinforcement learning discovered. Later work questioned how new it was. Liu and colleagues, in a 2025 analysis of R1-Zero-style training, found that base models including DeepSeek-V3-Base already produce self-reflection phrases before any RL, which suggests RL amplifies and rewards an existing behavior rather than inventing it. They also argued that part of the growth in response length can come from biases in the GRPO objective rather than from better reasoning. The training result stands; the story of spontaneous discovery is contested.

Why did distillation beat reinforcement learning for small DeepSeek-R1 models?

DeepSeek ran the comparison directly. Applying the R1-Zero reinforcement learning recipe to Qwen2.5-32B-Base for more than 10,000 steps produced a model at about the level of QwQ-32B-Preview, 47.0% on AIME 2024. Fine-tuning the same base on the 800k samples generated with R1, with no RL at all, reached 72.6%. The authors' reading is that reasoning patterns found by a large model are hard for a small model to discover through RL on its own, while imitating them is cheap. They also note that going beyond what distillation gives may still need stronger base models and larger-scale RL, so distillation spreads the capability but does not replace the large run that created it.

Check yourself

4 questions to test what you just read

Work each one out before you open it — a number, a prediction or a reason, not a definition. Producing the answer is what makes it stick. Your progress is kept on this device.

A GRPO group of four answers gets rewards 1, 0, 0, 1. Using the population standard deviation, what is each answer's advantage, and what happens if all four had scored 1?

Show answer

Mean 0.5 and standard deviation 0.5, so the correct answers get A = (1 − 0.5) / 0.5 = +1 and the wrong ones −1. If all four score 1, every reward equals the mean and every advantage is 0: the question gives no reward signal, and only the KL term acts on the policy.

R1-Zero rose from 15.6% to 71.0% pass@1 on AIME 2024, and majority voting took it to 86.7%. Which of those two numbers belongs next to o1's 74% pass@1 from OpenAI's post, and why not the other?

Show answer

71.0%, because both are single-attempt averages. 86.7% is a consensus score that spends many samples per problem, so setting it beside a pass@1 figure flatters R1-Zero; its fair comparison is another model's consensus score.

Stage 3 fine-tunes V3-Base again rather than continuing from the stage-2 RL checkpoint. Where does the stage-2 model's value end up, then?

Show answer

In the data, not the weights. The RL checkpoint serves as a generator of about 600k correct, readable reasoning traces, which, together with about 200k general samples, train a fresh copy of the base. The same 800k samples then distill the small models, so stage 2's main product is reusable.

How would R1-Zero's reward score a correct chain that switches between English and Chinese, and why did stage 2 of R1 add a reward for it?

Show answer

Nothing: the accuracy and format rewards check only the final answer and the tags, so a mixed-language chain that ends correctly earns full reward, and the mixing persists. Stage 2 added a language-consistency reward, the share of the chain in the target language, accepting a slight accuracy cost for readability.

Where this sits

Reasoning you can prompt, then train

It began as a prompting trick and ended as a training objective. Read in order, the progression from "let's think step by step" to a model trained to.

  1. 1Chain-of-Thought Prompting2022
  2. 2Self-Consistency2022
  3. 3Tree of Thoughts2023
  4. 4OpenAI o12024
  5. 5DeepSeek-R12025

All 110 papers, in 19 ladders →

Finished this one? 0 / 110 Paper Breakdowns done
NextVision Transformer (ViT) Next in “The Papers Bootcamp” · step 19 of 22

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More Paper Breakdowns