Reasoning Models: GRPO, Verifiable Rewards (RLVR) & Test-Time Compute
How frontier reasoning models (o1/o3, DeepSeek-R1, Gemini Thinking) work under the hood: Critic-free GRPO group-relative advantage, Reinforcement Learning with Verifiable Rewards (RLVR), emergent self-correction, and Test-Time Compute scaling.
GRPO (Group Relative Policy Optimization) samples a group of G reasoning rollouts per prompt, scores them with objective verifiable rewards (unit tests / math answers), and reinforces above-average traces without a critic network.
Verifiable RL + Test-Time Compute unlocked self-verifying reasoning models (DeepSeek-R1, o1/o3) that think longer on hard coding and math tasks to solve problems SFT alone cannot.
GRPO + Verifiable Rewards (RLVR) is the breakthrough behind DeepSeek-R1, OpenAI o1/o3, and Gemini Thinking — unlocking emergent self-verification and AIME/IOI-level reasoning!
Because GRPO drops the giant Critic network and replaces learned Reward Models with exact code/math verifiers (pytest, SymPy, regex), even small research teams can now train reasoning models!
Understanding Test-Time Compute explains why spending 5× more inference tokens on a smaller thinking model can outperform a 10× larger non-thinking model on hard coding and math!
Hottest 2025–2026 frontier AI interview question: 'How does DeepSeek-R1's GRPO eliminate PPO's Critic network, and why does RLVR trigger emergent backtracking without human CoT labels?'
In GRPO (Group Relative Policy Optimization), how do we compute the Advantage A_i of rollout o_i WITHOUT training a separate 70B Critic/Value network?
- Derive GRPO's Critic-free group-relative advantage A_i = (r_i − mean(r)) / std(r) across G sampled rollouts
- Explain why GRPO cuts RL VRAM nearly in half compared to PPO while excelling on long reasoning chains
- Contrast noisy human-preference Reward Models with deterministic Verifiable Rewards (RLVR: unit tests, SymPy math verifiers)
- Explain Test-Time Compute scaling (longer thinking traces, Best-of-N verification & Process Reward Models) as the 3rd LLM scaling axis
Imagine a math coach who doesn't grade your handwriting style — they just ask you to try 8 different scratchpad attempts on a tough olympiad problem, check which attempts get the exact right answer (RLVR), and say: 'Do more of whatever thinking habits showed up in your winning attempts, and less of the ones in your failing attempts!' (GRPO). Over thousands of problems, the model discovers on its own that pausing, checking edge cases, and backtracking wins far more often!
1. GRPO: Deleting the Critic Network via Group Z-Scoring
Click 0/4 through 4/4 Pass in the mini-lab below to compute live GRPO group advantages — and notice what happens when a prompt is too easy (4/4) or too hard (0/4)!
The GRPO Objective (Shao et al. / DeepSeekMath / DeepSeek-R1)
For each prompt , sample a group of rollouts , score each with reward , and compute: Then optimize the PPO-clipped surrogate loss + direct KL penalty to — with ZERO Critic model in memory!
A_i = (r_i − μ_group) / (σ_group + ε)
Replaces the 70B learned Value/Critic network with the empirical mean of G rollouts!
[1, 0, 0, 0]), mean = 0.25, std = 0.433 → the rare winning trace gets a huge +1.73 boost while the 3 failures get −0.58!GRPO Group Advantage Calculator (G = 4 Rollouts)
2. RLVR & Emergent 'Aha!' Self-Correction
Why did DeepSeek-R1-Zero avoid Reward Hacking even during massive pure-RL runs?
Unhackable Verifiers Fuel Genuine Reasoning
Unlike neural Reward Models (which can be tricked by polite formatting or fluff), a Python pytest suite or SymPy math checker cannot be charmed: either the code passes all hidden tests (r = 1) or it fails (r = 0). Plus a simple Format Reward enforces <think>...</think> separation from the final answer — and out emerges spontaneous verification, backtracking, and longer thinking on harder problems!
3. Test-Time Compute Scaling: The 3rd Scaling Axis
Pre-training scaling (Module 2.5) hits the internet Data Wall — Test-Time Compute unlocks a whole new log-linear accuracy curve at inference time!
Two Complementary Ways to Spend Test-Time Compute
- Sequential Test-Time Scaling: Letting a reasoning model generate longer internal
<think>chains (2K → 16K → 32K tokens) to backtrack and verify steps. - Parallel Test-Time Scaling (Best-of-N / Majority Vote): Generating independent solutions in parallel and picking the winner via a unit-test verifier, Process Reward Model (PRM), or consensus vote!
Worked Example: Why 0/G and G/G Prompts Yield Zero GRPO Gradient
Prompt A is trivial (rewards = [1, 1, 1, 1]). Prompt B is medium (rewards = [1, 0, 1, 0]).
mean = 1.0 → every r_i - mean = 0.0 → A_i = 0 for all 4 rollouts!
What happens to GRPO advantages A_i when ALL G rollouts for a prompt fail (r_i = 0 for all i)?
Why did DeepSeek-R1 add a tiny Cold-Start SFT phase (a few thousand clean <think> examples) before GRPO, improving on pure-RL DeepSeek-R1-Zero?
The exact honest questions almost every beginner wonders — answered in plain English without hiding behind jargon.
Yes — anywhere you can write a deterministic or rubric-verifiable checker: SQL execution equivalence, JSON schema + constraint satisfaction, formal theorem provers (Lean 4), and unit-tested multi-file software patches!
GRPO Group-Advantage Rollout & Verifiable Reward (RLVR) Studio
Watch GRPO sample G = 4 reasoning traces, grade them deterministically, and compute Critic-free group advantages.
Frontier Coding & Math Reasoning (o3, DeepSeek-R1, Gemini Thinking)
Combines Cold-Start SFT + GRPO on verifiable math/code/logic tasks + Test-Time Compute scaling.
import torch
# Group Relative Policy Optimization (GRPO): Critic-free group-normalized advantages
def grpo_surrogate_loss(
logp_new: torch.Tensor,
logp_old: torch.Tensor,
rewards: torch.Tensor,
clip_eps: float = 0.2,
) -> torch.Tensor:
# Normalize verifiable rewards within each sampled group of G completions
adv = (rewards - rewards.mean()) / (rewards.std() + 1e-6)
ratio = torch.exp(logp_new - logp_old)
clipped = torch.clamp(ratio, 1.0 - clip_eps, 1.0 + clip_eps)
return -torch.minimum(ratio * adv, clipped * adv).mean()
# Example: G=4 reasoning rollouts for one math prompt (2 correct, 2 wrong)
rewards = torch.tensor([1.0, 0.0, 1.0, 0.0])
loss = grpo_surrogate_loss(torch.tensor([-4.1, -5.2, -3.9, -4.8]), torch.tensor([-4.2, -5.1, -4.0, -4.7]), rewards)
print(f"GRPO policy loss: {loss.item():.4f}")