Skip to content

Group Relative Policy Optimization (GRPO)

GRPO (Shao et al., 2024 — DeepSeek) simplifies PPO for language model training by removing the critic network entirely. Instead of learning a value function to estimate advantages, GRPO computes advantages by comparing outputs within a group sampled from the same prompt.

PPO requires a critic Vϕ(s)V_\phi(s) to compute advantages. For LLMs, this critic:

  • Must be a model comparable in size to the policy (expensive!)
  • Is hard to train well for diverse prompts
  • Adds significant memory and compute overhead

GRPO asks: can we estimate advantages without a critic?

For each prompt xx, sample a group of GG outputs from the current policy:

{y1,y2,,yG}πθ(x)\{y_1, y_2, \ldots, y_G\} \sim \pi_\theta(\cdot \mid x)

Score each output with a reward function R(x,yi)R(x, y_i), then normalize within the group:

A^i=R(x,yi)mean({R(x,yj)}j=1G)std({R(x,yj)}j=1G)\hat{A}_i = \frac{R(x, y_i) - \text{mean}(\{R(x, y_j)\}_{j=1}^G)}{\text{std}(\{R(x, y_j)\}_{j=1}^G)}

This group-relative advantage tells us how good each output is compared to its peers, without needing any learned baseline.

GRPO uses a clipped surrogate similar to PPO:

LGRPO(θ)=Ex[1Gi=1Gmin(ri(θ)A^i,  clip(ri(θ),1ϵ,1+ϵ)A^i)βDKL(πθπref)]L^{GRPO}(\theta) = \mathbb{E}_{x} \left[ \frac{1}{G} \sum_{i=1}^{G} \min \left( r_i(\theta) \hat{A}_i, \; \text{clip}(r_i(\theta), 1-\epsilon, 1+\epsilon) \hat{A}_i \right) - \beta \, D_{KL}(\pi_\theta \| \pi_\text{ref}) \right]

where:

  • ri(θ)=πθ(yix)πθold(yix)r_i(\theta) = \frac{\pi_\theta(y_i \mid x)}{\pi_{\theta_\text{old}}(y_i \mid x)} is the probability ratio for the full output
  • βDKL\beta \, D_{KL} is a KL penalty to prevent the policy from drifting too far from a reference model

Edit the rewards for a group of sampled outputs and watch the advantages recompute. Try making all rewards identical (signal vanishes) or one of them much larger (it dominates).

Now let the loop run. A tiny “LLM” chooses among four answering strategies; a verifier returns 0 or 1. Every tick is one complete GRPO group: sample GG rollouts, score, normalize, update. Prompts alternate between an easy and a hard type, sharing one policy:

What it models. Each group samples G strategies from π (blue bars), gets binary rewards (dashed lines mark each strategy’s true success rate on easy/hard prompts), and converts them into group-relative advantages  — watch the right panel: within one group, the ✓ rollouts get positive  and the ✗ rollouts negative, regardless of the prompt’s absolute difficulty. That is the critic-free baseline doing its job.

Knobs. G is the group size; the ÷σ toggle switches between (r−μ)/σ and plain r−μ (watch the  magnitudes change); learning rate scales the update.

Try this. Run at 1× and watch a hard-prompt group and an easy-prompt group back to back — comparable  magnitudes despite wildly different mean reward. Then speed up and watch the wasted groups curves: as π(CoT) → 1, easy prompts increasingly come back all-correct — σ = 0, zero gradient, nothing learned — while hard prompts keep teaching. Finally drop G to 2: even mixed outcomes become rare, and most of your compute buys no signal. This is exactly why DAPO-style dynamic sampling filters out prompts whose groups are all-correct or all-wrong.

AspectPPOGRPO
Advantage estimationLearned critic VϕV_\phiGroup normalization
Extra modelYes (critic)No
Per-token or per-outputPer-token advantagesPer-output advantages
KL constraintClipping onlyClipping + explicit KL penalty
Memory overheadHigh (policy + critic)Lower (policy only)
  • Shao et al. DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models. 2024 — where GRPO was introduced. arXiv:2402.03300
  • DeepSeek-AI. DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning. 2025 — GRPO at reasoning-model scale. arXiv:2501.12948