Group sampling
For each prompt , GRPO samples a group of responses from the old policy , typically 8 to 64 of them. A reward model, or a rule that checks the final answer, scores each response, giving rewards . With outcome supervision, every token of response gets the same advantage, the reward normalized within its group: where the small constant (for example ) keeps the fraction defined when the standard deviation is zero. A response that beats the other responses to the same prompt gets a positive advantage, and one that falls behind gets a negative advantage. If all responses in a group get the same reward, for example when every answer fails the check, the numerator is zero for every response, every advantage is zero, and the prompt contributes no gradient. With process supervision, a reward model scores each reasoning step, the step rewards are normalized across the group the same way, and the advantage of a token is the sum of the normalized rewards of the steps from that token on.The objective
GRPO keeps PPO’s clipped ratio, applied token by token, and averages over tokens and over the group: where is the probability ratio of token of response . Two details differ from PPO for language models:- The KL penalty to the reference model is a term of the loss, not a deduction from the reward. The advantages therefore stay pure group comparisons.
- The KL divergence is estimated per token with the unbiased, always nonnegative estimator , evaluated at the sampled token.
Relation to REINFORCE with baseline
The group mean is a Monte Carlo baseline. REINFORCE with baseline subtracts a learned estimate of the state value from the return. GRPO subtracts the average return of other samples from the same state, which here is the prompt. The baseline needs no training, at the cost of generating several responses per prompt. Because the mean includes the response being scored, it is slightly correlated with that response’s own reward; a leave-one-out mean over the other responses avoids this. Dividing by the group’s standard deviation rescales the advantages per prompt, so easy and hard prompts contribute updates of similar size. This is a choice of weighting, not part of the policy gradient, and later work has questioned it.Context
DeepSeekMath used GRPO with a learned reward model to improve mathematical reasoning. DeepSeek-R1 (DeepSeek-AI et al., 2025) applied GRPO to a base model with rule-based rewards: one for a correct final answer, checked by a program, and one for following the required output format. The model learned long chains of reasoning without supervised examples of them. Rewards that can be checked by a program are hard for the policy to game, and they make the group comparison cheap, which is a large part of why GRPO spread quickly. The GRPO math reasoning section fine-tunes a small instruction model this way.GRPO talk
GRPO talk
References
- Shao, Z., Wang, P., Zhu, Q., Xu, R., Song, J., et al. (2024). DeepSeekMath: Pushing the limits of mathematical reasoning in open language models. arXiv [cs.CL]. Link
- DeepSeek-AI, Guo, D., Yang, D., Zhang, H., Song, J., et al. (2025). DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning. arXiv [cs.CL]. Link
Found an error on this page? Report an issue.

