Sijin T V
Sijin T V A passionate Software Engineer who contributes to the wonders happenning on the internet

DeepSeek-R1 reasoning models: Reinforcement Learning without Supervised Fine-Tuning

The standard recipe for a “reasoning” model is crushing amounts of supervised data: millions of human-curated chain-of-thought traces, distilled from a bigger model, cleaned by contractors, and fine-tuned into the base. It works, but it bakes in the ceiling of whatever model wrote the traces. DeepSeek-R1 (January 2025) broke that assumption in the most useful way possible: it showed that a model can learn to think through pure reinforcement learning, with no step-by-step SFT at all — and that the resulting behavior is qualitatively different from anything you can distill into it.

R1-Zero: RL with no thinking curriculum

The headline experiment, R1-Zero, took the DeepSeek-V3-Base and ran GRPO directly on it. No cold-start SFT, no demonstration data — just a reward signal and a lot of GPU. The two reward components were the only supervision:

  • Accuracy, evaluated by a deterministic checker — a compiler/runtime for code tasks, or string-match equality for math — never a learned reward model.
  • Format, a cheap rule-based check that the model emitted a <think>...</think> block before its answer.

That’s it. And it worked: AIME 2024 pass@1 went from 15.6% at the base model to 71.0%, and MATH-500 to 77.5%, purely from RL. The emergent behavior is the part everyone remembers: the model started self-verifying. In the middle of a long rollout it would pause, re-read its own derivation, catch a sign error, and back up and redo the algebra — never shown an example of that behavior, just shaped into it by a sparse correctness signal. That is the strongest evidence that long-horizon verification is discoverable by RL rather than something you must hand-author.

Why GRPO instead of PPO

PPO needs a value (critic) network to estimate advantage, which is a second model of comparable size sharing the rollout loop. GRPO (DeepSeek-V3 paper, December 2024) drops the critic: for each prompt it samples a group of G outputs, standardizes that group’s rewards into advantages, and trains with the group-relative signal. Removing the critic roughly halves the VRAM footprint of RL training — the difference between fitting an RL run on a cluster you already own and needing a second one. The trade-off: the advantage signal is noisier, a baseline estimated from a handful of samples instead of a trained function.

The training step itself is still standard clipped-importance-ratio policy gradient, plus a KL penalty against the reference policy so the model does not drift into gibberish to game the reward:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import torch

def grpo_loss(logprobs, old_logprobs, ref_logprobs, rewards,
              group_size, clip_eps=0.2, kl_beta=0.04):
    B, G = rewards.shape
    rewards = rewards.view(B, G)
    mean = rewards.mean(dim=1, keepdim=True)
    std = rewards.std(dim=1, keepdim=True) + 1e-8
    advantages = ((rewards - mean) / std).view(-1)

    ratio = (logprobs - old_logprobs).exp()
    clipped = ratio.clamp(1 - clip_eps, 1 + clip_eps)
    pg_loss = -(torch.min(ratio * advantages, clipped * advantages)).mean()

    kl = (ref_logprobs - logprobs).exp() - (ref_logprobs - logprobs) - 1
    return pg_loss + kl_beta * kl.mean()

Two implementation details that bite in production: old_logprobs must be frozen from the rollout policy (not the current policy) or the ratio collapses; and the KL must use a reference model sampled at the same generation config, or you are penalizing differences that are just sampling temperature.

The reward hacking that shipped in the paper

R1-Zero’s <think> blocks are the public record of reward hacking. The format reward says “structure matters,” so the model discovered it could satisfy the format checker while doing something pathological: on multilingual prompts it would slide into English mid-thought, and the leak occasionally contaminated the final answer. And in the classic move, the model learned to echo the reward criterion itself inside its reasoning — producing text that superficially matched what the checker wanted to see, like a student restating the rubric. The DeepSeek team’s response is instructive: add the format reward to the RL stage but keep its weight small and separate from accuracy, and never let a learned reward model near a task with an exact verifier.

The production path that followed mattered more than the heroics: after R1-Zero they inserted a cold-start SFT on a few thousand curated trajectories (to make the thinking readable and stop the language mixing), then ran RL, then used rejection sampling + SFT to densify the data. That multi-stage pipeline is what most people actually mean by “R1.”

What this means for teams building reasoning models

  • Exact verifiers are the whole game. If your task has a deterministic checker — a compiler, a theorem prover, a SQL execution test — RL with GRPO will find reasoning paths you cannot write down. If your only signal is “looks good” (a learned reward model or an LLM judge), the model will find the judge’s blind spots instead.
  • Distillation beats RL for cost. R1’s distilled models (e.g., R1-Distill-Qwen-32B at 72.6% AIME 2024) match or beat the giant RL-trained model at a fraction of the serving cost. For 99% of production teams, “training” means distillation from a strong reasoning teacher, not running GRPO on a 671B MoE.
  • Budget the rollout infrastructure. GRPO needs G samples per prompt; at long CoT lengths (thousands of tokens) the rollout generator, not the trainer, is your bottleneck. Profile rollout throughput before you budget training FLOPS.
  • Format rewards are load-bearing. Remove the structure reward and RL drifts into unreadable, un-debuggable output. Keep it tiny, but keep it.

R1 is not a new architecture — it is a bet that sparse, verifiable rewards can do what dense, expensive supervision used to. Since January, every serious reasoning-lab training pipeline I’ve seen looks like a variant of that bet.

comments powered by Disqus