GRPO (Group Relative Policy Optimization) is the online policy-optimization algorithm used by DeepSeekMath/R1 for RLVR-style reasoning RL. Three steps: (1) sample
G responses
{o1,…,oG} per prompt
q; (2) score each with the verifier and compute a group-relative advantage:
Ai=std(r1,…,rG)ri−mean(r1,…,rG)
subtracting the group mean and dividing by the group std — within a group,
Ai has zero mean and unit variance, so the advantage depends only on relative ranking, not absolute reward scale; this is the key to dropping the critic. (3) plug
Ai into a PPO-style clipped surrogate with a KL term:
JGRPO(θ)=E[G1i=1∑Gmin(πθold(oi∣q)πθ(oi∣q)Ai,clip(πθold(oi∣q)πθ(oi∣q),1−ε,1+ε)Ai)−βDKL(πθ∥πref)]
The ratio
πθ(oi∣q)/πθold(oi∣q) measures how much the policy moved on response
oi;
min plus clip (
ε≈0.2) bounds the per-update step;
βDKL(πθ∥πref) penalizes deviation from the reference policy
πref, in practice estimated with the non-normalized KL
DKL≈E[πθ(o∣q)πref(o∣q)−logπθ(o∣q)πref(o∣q)−1] — lower variance and always non-negative.