Mechanism

Samples a group of GG outputs {y1,…,yG}\{y_1, \dots, y_G\} from the old policy πθold(⋅∣x)\pi_{\theta_{\text{old}}}(\cdot\mid x) for each prompt xx, computes their rewards {r1,…,rG}\{r_1, \dots, r_G\}, and estimates the advantage of token tt in output ii via group z-score normalization without any value critic: A^i,t=ri−mean({r1,…,rG})std({r1,…,rG})+ε\hat{A}_{i,t} = \frac{r_i - \text{mean}(\{r_1,\dots,r_G\})}{\text{std}(\{r_1,\dots,r_G\}) + \varepsilon} Maximizes the clipped surrogate with a direct per-token KL penalty estimator DKL(πθ∥πref)=πrefπθ−log⁡πrefπθ−1\mathbb{D}_{\text{KL}}(\pi_\theta\|\pi_{\text{ref}}) = \frac{\pi_{\text{ref}}}{\pi_\theta} - \log\frac{\pi_{\text{ref}}}{\pi_\theta} - 1: JGRPO(θ)=Ex,{yi}[1G∑i=1G1∣yi∣∑t=1∣yi∣(min⁡(ρi,t(θ)A^i,t, clip(ρi,t(θ),1−ϵ,1+ϵ)A^i,t)−βDKL(πθ∥πref))]\mathcal{J}_{\text{GRPO}}(\theta) = \mathbb{E}_{x, \{y_i\}}\left[\frac{1}{G}\sum_{i=1}^G \frac{1}{|y_i|}\sum_{t=1}^{|y_i|} \left(\min\left(\rho_{i,t}(\theta)\hat{A}_{i,t}, \, \text{clip}(\rho_{i,t}(\theta), 1-\epsilon, 1+\epsilon)\hat{A}_{i,t}\right) - \beta \mathbb{D}_{\text{KL}}(\pi_\theta\|\pi_{\text{ref}})\right)\right]

Practical Notes

The most widely adopted RL algorithm of 2024–2025; however, the 1∣yi∣\frac{1}{|y_i|} length normalization and std(r)\text{std}(r) denominator introduce length and difficulty biases addressed by Dr.GRPO and DAPO.

References

  1. DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models ↗

    Zhihong Shao, Peiyi Wang, Qihao Zhu, Runxin Xu, Junxiao Song, Xiao Bi et al. · 2024

    All 11 authors

    Zhihong Shao, Peiyi Wang, Qihao Zhu, Runxin Xu, Junxiao Song, Xiao Bi, Haowei Zhang, Mingchuan Zhang, Y. K. Li, Y. Wu, Daya Guo