Reinforcement learning from human feedback (RLHF) and reinforcement learning with verifiable rewards (RLVR) have become central to post-training large language models. For years, the default policy optimization algorithm in LLM alignment was Proximal Policy Optimization (PPO). While PPO offers stable policy updates through clipped surrogate objectives and Generalized Advantage Estimation (GAE), it introduces severe computational and architectural overhead when scaled to hundred-billion-parameter foundation models.
Group Relative Policy Optimization (GRPO), introduced by Shao et al. in the DeepSeekMath framework and subsequently deployed to train DeepSeek-R1-Zero and DeepSeek-R1, modifies the actor-critic paradigm. By eliminating the separate critic (value) model and replacing token-level value estimation with a group-relative baseline computed across multiple candidate rollouts, GRPO reduces GPU memory footprints while stabilizing reinforcement learning for mathematical and logical reasoning tasks.

The Value Network Bottleneck in Standard PPO
In standard PPO applied to autoregressive language models, training typically requires four separate neural networks to reside in memory or coordinate across distributed ranks:
- Policy Model (Actor, ): The active language model being trained.
- Reference Model (): A frozen copy of the supervised fine-tuned (SFT) model used to compute Kullback-Leibler (KL) divergence penalties.
- Reward Model (): A model (or programmatic scoring function) that evaluates the quality of completions.
- Value Model (Critic, ): A network, typically of identical parameter scale to the actor, initialized from the reward model and trained to predict the expected cumulative reward from each intermediate token state .
Maintaining a value network matching the size of a 70-billion or 671-billion parameter actor creates major engineering friction. First, the critic doubles the active parameter count that requires optimizer states (such as AdamW first and second moments), forward passes, and backward gradient computation. Second, predicting token-level value functions in generative language tasks is notoriously unstable: value prediction error frequently diverges during long chain-of-thought generations, propagating noisy advantage estimates through Generalized Advantage Estimation.
Mathematical Formulation of GRPO
GRPO resolves the critic bottleneck by removing the value network entirely. Instead of learning a parametric state-value estimator, GRPO estimates the baseline dynamically from a group of sampled responses to the same input query.
1. Group Sampling and Reward Assignment
For each prompt drawn from the training distribution , GRPO samples a group of distinct completions from the previous policy .
Each completion is evaluated by a scoring function to produce a scalar reward . This reward can be generated by neural preference models, deterministic rule-based verifiers, or a weighted combination of both:
2. Group-Normalized Advantage Estimation
Rather than computing token-wise temporal difference errors , GRPO computes a single advantage for each response by standardizing the rewards across the group of candidates:
Where:
- acts as an empirical estimate of the expected reward for prompt .
- $\text{std}(\{r_1, \dots, r_G\}) = \sqrt{\frac{1}{G} \sum_{j=1}^G (r_j - \text{mean}(\mathbf{r}))^2}$ normalizes the advantage scale across easy and difficult prompts.
- is a small numerical constant (typically or ) preventing division by zero when all outputs receive identical rewards.
Every token in completion is assigned the sequence-level advantage . This formulation directly reflects relative performance: completions scoring above the group average receive positive advantages (), reinforcing their token probabilities, while completions performing below the group average receive negative advantages (), suppressing their trajectories.
3. Clipped Surrogate Objective
The policy parameters are optimized by maximizing the GRPO surrogate objective:
Where:
- $\rho_{i,t} = \frac{\pi_\theta(o_{i,t} \mid q, o_{i,<t})}{\pi_{\theta_{old}}(o_{i,t} \mid q, o_{i,<t})}$ represents the importance sampling probability ratio between the current policy and the rollout policy.
- is the PPO clipping parameter (typically set to 0.1 or 0.2), bounding the update to prevent destructive policy shifts.
- is the regularization coefficient controlling drift from the reference model.
- is the sequence length of completion , ensuring that long generations do not disproportionately dominate gradient updates relative to concise outputs.
4. Unbiased Analytical KL Divergence Approximation
In conventional RLHF implementations, the KL divergence penalty is often subtracted directly from token rewards inside the rollout phase. In GRPO, the KL divergence is integrated directly into the objective function. To calculate this penalty stably without introducing high sample variance, DeepSeekMath employs the non-negative unbiased estimator described by John Schulman:
Setting , the function satisfies and for all . This property guarantees that the penalty term is strictly positive whenever the active policy drifts from the reference policy, eliminating negative KL artifacts caused by finite-sample log-ratio approximations.
Verifiable Rule-Based Rewards and Reasoning Scaling
A critical property of GRPO is its synergy with rule-based reward systems in formal domains like mathematics, formal logic, and software engineering.
In traditional open-ended generation tasks, reward models must evaluate nuanced human preferences, which leaves them vulnerable to reward hacking (adversarial exploitation of reward model blind spots). In contrast, reasoning domains allow deterministic verification:
- Accuracy Rewards: Binary scoring (1.0 for correct final answer, 0.0 for incorrect) extracted via regex parsers or validated with symbolic math engines (such as SymPy) and unit-test execution harnesses.
- Format Rewards: Structural enforcement requiring the model to enclose its intermediate scratchpad within explicit markers, such as
<think>and</think>tags, penalizing outputs that fail structural syntax constraints.
Emergence of Extended Reasoning Trajectories
When large models are trained via GRPO on verifiable tasks without intermediate supervised step-by-step demonstrations (as demonstrated in DeepSeek-R1-Zero), policy gradients driven by group-relative advantages induce emergent behaviors:
- Autonomous Search Exploration: When faced with difficult problems, rollouts that generate exploratory reasoning paths eventually stumble upon correct solutions. Standardizing within the group assigns high positive advantages to these successful reasoning paths and negative advantages to incorrect short answers.
- Self-Reflection and Error Correction: The model learns to generate reflective pivot phrases (such as "Wait, let me recalculate that" or "This leads to a contradiction, let us try an alternative substitution") without human demonstration data.
- Dynamic Thinking Budgets: Generation lengths naturally expand as the policy allocates more computation to difficult prompts, effectively discovering test-time compute scaling through reinforcement learning exploration.
PPO vs. GRPO: Architectural and Computational Comparison
The structural differences between PPO and GRPO translate directly to training throughput and infrastructure requirements:
- Memory Footprint: PPO requires memory for Actor weights, Critic weights, Actor optimizer states, Critic optimizer states, Reference model weights, and Reward model weights. GRPO requires memory only for Actor weights, Actor optimizer states, Reference model weights, and (optionally) Reward model weights. Eliminating the critic removes roughly 40% to 50% of the active VRAM allocated to trainable parameters and optimizer states.
- Baseline Estimation: PPO relies on a learned parametric neural value network , which suffers from value function approximation error and non-stationary targets. GRPO uses a non-parametric empirical mean across sampled completions for the prompt.
- Advantage Computation: PPO uses Generalized Advantage Estimation (GAE) across temporal tokens with discount factor and smoothing parameter . GRPO applies sequence-level reward standardization across the sampled group.
- Sample Efficiency vs. Group Size: GRPO requires generating multiple completions per prompt (, with to common in practice). While generating completions increases forward-pass rollout computation, generation can be executed with highly optimized inference engines (e.g., vLLM or SGLang) with KV caching, while the heavy backpropagation pass operates over a streamlined single-model graph.
Engineering Considerations and Limitations
Deploying GRPO in production pipelines involves specific algorithmic trade-offs:
- Reward Variance in Small Groups: If the group size is too small (e.g., ), the sample variance of the group standard deviation is high, leading to unstable advantage estimates. If all completions for a query fail or all succeed with identical scores, the numerator () becomes zero, yielding zero gradient updates for that prompt.
- Credit Assignment Granularity: Assigning a sequence-level advantage uniformly to all tokens in provides coarse credit assignment compared to fine-grained process-based reward models (PRMs). However, empirical results indicate that across sufficiently large training batches, policy gradient updates aggregate over token distributions to guide search behavior effectively.
- Length Normalization: Dividing token losses by sequence length prevents gradient magnitude distortion across variable-length completions, preventing the optimization objective from favoring degenerate, repetitive output loops.
Group Relative Policy Optimization demonstrates that scaling reinforcement learning for reasoning does not require complex actor-critic infrastructure. By combining group-level baseline normalization with deterministic verifiers, GRPO provides a stable, memory-efficient framework for post-training LLM reasoning engines.
Sources
- DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models (arXiv:2402.03300)
- DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning (arXiv:2501.12948)
- Proximal Policy Optimization Algorithms (arXiv:1707.06347)
- Approximating KL Divergence (John Schulman, 2020)



