Group Relative Policy Optimization (GRPO)
Objective Function
GRPO [1] maximizes the expected total reward of a group of responses. Given a question sampled from dataset and a group of responses sampled from the old policy , the objective is:
where:
- is the question-answer pair from dataset
- is the group size; is the -th response; is the length of the -th response
- is the probability ratio of the -th token in the -th response
- / is the probability of generating token under current/old policy ( / )
- is the advantage of the -th token in the -th response
GRPO maximizes the expected total reward of the group. It:
- increases probability of high-advantage responses
- decreases probability of low-advantage responses
- keeps the policy update within a trust region
Probability Ratio
The probability ratio measures how much the current policy differs from the old policy for each token:
where:
- : probability of generating token under current policy ()
- : probability under old policy ()
- : sequence of tokens before position in response (token sequence of length )
Advantage
The advantage of the -th response is calculated by normalizing the group-level rewards :
where:
- : reward for the -th response ()
- : average reward across group
- : standard deviation of group rewards
- : normalized advantage for token in response
Note that is computed at the response level (using response reward ), so for all tokens in the same response, is the same.
The Clipping Mechanism
The core of GRPO (inherited from PPO [2]) is the clipped objective:
Recall from the probability ratio and advantage definitions that:
The behavior depends on the sign of the advantage. The following table shows the raw analysis:
| Objective | Clip? | Prevent what? | ||
| Yes | no/less advantage on positive | |||
| No | normal | |||
| Yes | over advantage on positive | |||
| Yes | no/less penalty on negative | |||
| No | normal | |||
| Yes | over penalty on negative |
Taking the in the clipped objective simplifies the behavior. When , the effectively computes . When , it becomes :
| Effective | Result | Prevent what? | ||
| already safe | ||||
| trust region | ||||
| over-increase | ||||
| over-decrease | ||||
| trust region | ||||
| self-penalizing |
Intuition:
- If and : the model already has higher advantage on this case. To prevent over-increase, clip to .
- If and : the model already has lower advantage on this case. To prevent over-decrease, clip to .
As stated in the original PPO paper: βWe only ignore the change in probability ratio when it would make the objective improve, and we include it when it makes the objective worse.β
Example
Letβs walk through a concrete example to illustrate how GRPO works in practice.
Setup
- Question:
- Group size:
- Clipping parameter:
Step 1: Group Sampling
The old policy generates responses for the question with varying lengths:
| Response | Generated Text | Length |
| βThe capital of France is Paris.β | 7 tokens | |
| βWell, the capital city of France, which is Paris.β | 12 tokens | |
| βParis, France.β | 4 tokens | |
| βFranceβs capital city is the beautiful Paris, located in Europe.β | 12 tokens |
Step 2: Reward and Advantage
Each response receives a binary reward based on correctness, then we compute group statistics and advantages:
| Response | Reward | Explanation |
| Correct | ||
| Correct | ||
| Correct | ||
| Incorrect |
Compute the group-level statistics for advantage estimation:
Using the advantage formula, compute the advantage for each response:
| Response | Advantage | Result |
Note that is the same for all tokens within response .
Step 3: Per-Token Probability Ratios
For each token , we need both and to compute the probability ratio.
Response 1:
| Pos | Token | Context | Old Policy | New Policy | Ratio | Clipped |
| 1 | βTheβ | |||||
| 2 | βcapitalβ | , βTheβ | ||||
| 3 | βofβ | , βTheβ, βcapitalβ | ||||
| 4 | βFranceβ | , β¦, βofβ | ||||
| 5 | βisβ | , β¦, βFranceβ | ||||
| 6 | βParisβ | , β¦, βisβ | ||||
| 7 | β.β | , β¦, βParisβ |
Response 2:
| Pos | Token | Context | Old Policy | New Policy | Ratio | Clipped |
| 1 | βWellβ | |||||
| 2 | β,β | , βWellβ | ||||
| 3 | βtheβ | , βWellβ, β,β | ||||
| 4 | βcapitalβ | , β¦, βtheβ | ||||
| 5 | βcityβ | , β¦, βcapitalβ | ||||
| 6 | βofβ | , β¦, βcityβ | ||||
| 7 | βFranceβ | , β¦, βofβ | ||||
| 8 | β,β | , β¦, βFranceβ | ||||
| 9 | βwhichβ | , β¦, β,β | ||||
| 10 | βisβ | , β¦, βwhichβ | ||||
| 11 | βParisβ | , β¦, βisβ | ||||
| 12 | β.β | , β¦, βParisβ |
Response 3:
| Pos | Token | Context | Old Policy | New Policy | Ratio | Clipped |
| 1 | βParisβ | |||||
| 2 | β,β | , βParisβ | ||||
| 3 | βFranceβ | , βParisβ, β,β | ||||
| 4 | β.β | , β¦, βFranceβ |
Note how βParisβ in Response 3 has , so it gets clipped to .
Response 4:
| Pos | Token | Context | Old Policy | New Policy | Ratio | Clipped |
| 1 | βFranceβsβ | |||||
| 2 | βcapitalβ | , βFranceβsβ | ||||
| 3 | βcityβ | , β¦, βcapitalβ | ||||
| 4 | βisβ | , β¦, βcityβ | ||||
| 5 | βtheβ | , β¦, βisβ | ||||
| 6 | βbeautifulβ | , β¦, βtheβ | ||||
| 7 | βParisβ | , β¦, βbeautifulβ | ||||
| 8 | β,β | , β¦, βParisβ | ||||
| 9 | βlocatedβ | , β¦, β,β | ||||
| 10 | βinβ | , β¦, βlocatedβ | ||||
| 11 | βEuropeβ | , β¦, βinβ | ||||
| 12 | β.β | , β¦, βEuropeβ |
Step 4: Objective Terms
For each token , compute the clipped objective term:
Recall our advantages from Step 2:
- for all in response 1
- for all in response 2
- for all in response 3
- for all in response 4
Response 1 objective terms ():
Response 2 objective terms ():
Response 3 objective terms ():
Response 4 objective terms ():
Step 5: Final Objective
Per-response averages:
- Response 1:
- Response 2:
- Response 3:
- Response 4:
Final GRPO objective (group average):
Follow-ups and Variants
GRPO in DeepSeek R1
DeepSeek R1 [3] modifies the original GRPO objective which includes a length normalization term and a KL divergence penalty:
DeepSeek R1 removes the length normalization term :
Dr. GRPO
Dr. GRPO [4] (GRPO Done Right, without bias) removes both the length normalization and the standard deviation normalization:
where (no std normalization compared to the original GRPO advantage).
DAPO
Decouple Clip and Dynamic sAmpling Policy Optimization (DAPO) [5] introduces several modifications:
Key innovations:
- Clip-Higher: asymmetric clipping with separate and , raising the ceiling
- Dynamic sampling: over-sample and filter out prompts with the accuracy equal to 1 and 0
- Token-level loss: rebalancing with token-level policy gradient loss
GPG
Group Policy Gradient (GPG) [6] uses log-probabilities directly instead of importance sampling ratios:
where with being an optional normalization technique.
CISPO
Clipped IS-weight Policy Optimization (CISPO) [7] combines importance sampling weights with log-probability gradients:
where is the clipped IS weight and denotes stop-gradient.
C3PO
Constrained Contextual Computation Policy Optimization (C3PO) [8] introduces a training token budget constraint:
subject to , where:
and:
- is the training token budget
- is the selected tokens by custom sampling strategy
- is the selected responses for training
- is the -th response
Value-Based Variants
PPO
A response trajectory . PPO [2] optimizes the total rewards:
where the advantage is estimated via Generalized Advantage Estimation (GAE):
Here is the Temporal Difference (TD) error between the estimated value of the next state and the estimated value of the current state .
VC-PPO
Value-Calibrated PPO (VC-PPO) [9] uses the same PPO objective, and addresses the value initialization bias through:
- Value-Pretraining: addressing the value initialization bias by value pretraining
- Decoupled-GAE: improving in-training value estimate with decoupled-GAE
VAPO
Value-model-based Augmented PPO (VAPO) [10] optimizes:
Key innovations:
- Length-Adaptive GAE: address the inconsistency across sequences of varying lengths
- Token-level policy gradient loss
Dealing with sparsity of reward signal in verifier-based tasks:
- Clip-higher
- Positive example LM loss: additional negative log-likelihood (NLL) loss for the correct outcomes
- Group-sampling: sample discriminative positive and negative samples within the same prompt
T-PPO
Truncated Proximal Policy Optimization (T-PPO) [11] optimizes:
Key innovations:
- Extended GAE: improved advantage estimation
- Token filtering: if some sequences reach an ending condition, these sequences are removed in the next training step
References
- [1] Z. Shao et al., βDeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models,β arXiv preprint arXiv:2402.03300, 2024.
- [2] J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov, βProximal Policy Optimization Algorithms,β arXiv preprint arXiv:1707.06347, 2017.
- [3] DeepSeek-AI et al., βDeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning,β Nature, vol. 645, pp. 633β638, 2025.
- [4] Z. Liu et al., βUnderstanding R1-Zero-Like Training: A Critical Perspective,β arXiv preprint arXiv:2503.20783, 2025.
- [5] Q. Yu et al., βDAPO: An Open-Source LLM Reinforcement Learning System at Scale,β arXiv preprint arXiv:2503.14476, 2025.
- [6] X. Chu, H. Huang, X. Zhang, F. Wei, and Y. Wang, βGPG: A Simple and Strong Reinforcement Learning Baseline for Model Reasoning,β arXiv preprint arXiv:2504.02546, 2025.
- [7] MiniMax et al., βMiniMax-M1: Scaling Test-Time Compute Efficiently with Lightning Attention,β arXiv preprint arXiv:2506.13585, 2025.
- [8] Ling Team et al., βRing-lite: Scalable Reasoning via C3PO-Stabilized Reinforcement Learning for LLMs,β arXiv preprint arXiv:2506.14731, 2025.
- [9] Y. Yuan, Y. Yue, R. Zhu, T. Fan, and L. Yan, βWhat's Behind PPO's Collapse in Long-CoT? Value Optimization Holds the Secret,β arXiv preprint arXiv:2503.01491, 2025.
- [10] Y. Yue et al., βVAPO: Efficient and Reliable Reinforcement Learning for Advanced Reasoning Tasks,β arXiv preprint arXiv:2504.05118, 2025.
- [11] T. Fan et al., βTruncated Proximal Policy Optimization,β arXiv preprint arXiv:2506.15050, 2025.
