Group Relative Policy Optimization (GRPO): Mathematical Foundations, Group-Relative Baselines, and Critic-Free Reinforcement Learning in Reasoning Models
Reinforcement learning from human and automated feedback has become the central mechanism for eliciting complex reasoning, tool use, and mathematical problem-solving in large language models. For years, Proximal Policy Optimization (PPO) served as the default algorithmic framework for on-policy alignment. However, standard PPO introduces significant infrastructure overhead when applied to multi-billion parameter models. PPO requires instantiating and training a separate value network (the critic) alongside the policy model (the actor), roughly doubling the GPU memory required for training parameters, optimizer states, and forward-backward activations.
To resolve this systems bottleneck while optimizing policy exploration in complex reasoning domains, DeepSeek researchers introduced Group Relative Policy Optimization (GRPO) in the DeepSeekMath foundation model. GRPO discards the parameterized critic network entirely. Instead, it computes advantage estimates dynamically by generating a group of candidate outputs for each prompt, evaluating their task rewards, and standardizing the resulting scores against the empirical mean and standard deviation of the group.
This architectural shift reduces training-time memory consumption, eliminates the instability of value function approximation, and aligns naturally with rule-based outcome verification in mathematical reasoning and code generation.
The Infrastructure and Optimization Bottlenecks of Actor-Critic PPO
To understand why critic-free reinforcement learning is essential for scaling reasoning models, one must examine the computational footprint of standard actor-critic PPO in large language models.

In classical PPO applied to autoregressive sequence generation, the training harness typically orchestrates four distinct models or model states:
- The Policy Model (): The active actor network undergoing optimization via policy gradients.
- The Reference Model (): A frozen snapshot of the initial supervised fine-tuned (SFT) policy, used to compute Kullback-Leibler (KL) divergence penalties to prevent policy collapse.
- The Reward Model (): A neural preference model (or automated scoring harness) that provides scalar evaluations of completed generations.
- The Value Network (): The critic network, parameterized identically or similarly to the policy, trained via mean squared error regression to predict the expected discounted cumulative return from every token state.
The Token-Level Advantage and GAE Recursion
Standard PPO uses the value network to compute Generalized Advantage Estimation (GAE) across the generated sequence of length . At each token step , the temporal difference (TD) residual is computed as:
The generalized advantage estimate is then derived recursively:
While GAE provides an effective bias-variance trade-off for token-level credit assignment, it imposes severe systems penalties:
- Memory Duplication: The critic network possesses an architecture comparable in size to the actor . In a 70-billion parameter training run, maintaining the critic adds 140 GB of raw weights in FP16/BF16, plus 560 GB of FP32 optimizer states (first and second moments under AdamW), along with full activation memory during backward passes.
- Value Approximation Error: In long-form reasoning trajectories (such as chain-of-thought derivations exceeding thousands of tokens), intermediate token states often carry ambiguous value. When the reward signal is sparse and only provided at the final answer token, fitting a dense token-level value function produces high variance and noisy gradient updates that can destabilize the policy.
Mathematical Formulation of GRPO
Group Relative Policy Optimization sidesteps the need for a parameterized value network by substituting a statistical group baseline in place of .
1. Group Rollout Sampling
For each training prompt or question drawn from the training distribution , GRPO samples a cohort of independent candidate outputs using the current rollout policy :
In production implementations, typically ranges from 8 to 64 outputs per query, depending on distributed memory constraints and batch topologies.
2. Task Reward Computation and Group Normalization
Each sampled completion is evaluated by a scoring function to produce a scalar reward . In verifiable domains such as mathematics and programming, is typically computed by deterministic rule-based verifiers:
- Correctness Reward (): Binary indicator (e.g., for matching the ground-truth final mathematical expression, otherwise) or unit test pass rate.
- Formatting Reward (): Structural penalty or bonus enforcing that reasoning steps are correctly enclosed within structured tags (e.g.,
<think> ... </think>).
Given the set of scalar rewards for prompt , GRPO computes the empirical sample mean and sample standard deviation:
where is a small numerical stabilizer (e.g., ) preventing division by zero when all outputs in a group receive identical rewards.
The group-relative advantage for candidate output is defined as the standardized z-score:
Crucially, is a sequence-level advantage applied uniformly across all tokens in completion . Completions that outperform the group average receive positive advantage (), while completions that score below the group average receive negative advantage ().
3. The Objective Function and Surrogate Loss
The objective function optimized by GRPO incorporates PPO-style probability ratio clipping with a per-token length normalization and an unbiased sample-level KL divergence penalty:
The per-token clipped surrogate objective is defined as:
where the probability ratio is:
and is the clipping threshold (typically set to ).
The Non-Negative Unbiased KL Divergence Estimator
In classical reinforcement learning implementations, the KL divergence penalty between the optimized policy and the reference model is frequently incorporated directly into the reward function:
However, when optimizing multi-turn sequence models without a value network, incorporating the KL term into the reward alters the scale of and distorts the empirical standard deviation during group standardization.
Instead, GRPO optimizes the KL divergence directly within the surrogate loss function using an unbiased, non-negative sample estimator. Specifically, for each token , the divergence is calculated as:
Mathematical Derivation of Non-Negativity
Let denote the likelihood ratio of the reference model to the active policy. The estimator function is:
- At (where the policy and reference distributions match exactly):
- Taking the first derivative with respect to :
- For , (monotonically increasing).
- For , (monotonically decreasing).
Because attains its global minimum at where , the estimator holds strictly for all possible token probabilities. This formulation eliminates negative KL divergence artifacts that arise from naive log-ratio sampling estimators, ensuring stable regularization throughout training.
Architectural Comparison: PPO vs. GRPO
The structural differences between PPO and GRPO translate into substantial shifts in computational efficiency, memory consumption, and training dynamics:
- Critic Model Requirement: PPO requires a full value network of equivalent parameter scale to the actor policy. GRPO eliminates the critic network entirely, reducing parameter count and backward graph overhead.
- Baseline Estimation Mechanism: PPO relies on parameterized state-value predictions across time steps. GRPO derives its baseline directly from the empirical group mean reward across sampled completions .
- Advantage Computation: PPO calculates Generalized Advantage Estimation (GAE) at every individual token step. GRPO uses a standardized z-score advantage applied uniformly across the completion tokens.
- Model Copies in Accelerator Memory: PPO typically requires keeping four distinct model instances (Policy, Reference, Reward, and Critic) in GPU cluster memory. GRPO operates with two or three (Policy, Reference, and optional rule-based Verifier).
- Optimizer Memory Overhead: PPO must maintain AdamW moment states for both the actor and critic (consuming 8x parameter size in FP32). GRPO only tracks optimizer states for the actor policy (consuming 4x parameter size in FP32).
- Cluster VRAM Savings: Removing the critic network and its optimizer states yields a 40% to 50% net reduction in total GPU memory requirements during training.
- Exploration Topologies: PPO relies on individual trajectory updates against a learned state value. GRPO evaluates a group cohort simultaneously, providing comparative rank-based credit across diverse reasoning paths.
Why GRPO Excels in Long-Form Reasoning Models
The widespread adoption of GRPO in models such as DeepSeek-R1 stems from several mathematical and structural synergies between group-relative baselines and chain-of-thought exploration:
1. Eliminating Value Network Bottlenecks in Long Sequences
In reasoning tasks where generation lengths reach 8,000 to 32,000 tokens of self-reflection and backtracking, training a value network to accurately predict intermediate step values across millions of tokens becomes computationally intractable. GRPO evaluates the full trajectory outcome, avoiding the need to fit an unstable intermediate value landscape.
2. Natural Self-Consistency Exploration
By sampling diverse outputs per question, GRPO mirrors the mechanics of self-consistency decoding during the training rollout phase. The model naturally explores alternative proof paths, arithmetic decompositions, and code structures. Trajectories that arrive at the verified solution are rewarded proportionally against those that fail within the same prompt context.
3. Length Normalization Prevents Verbosity Exploitation
In standard policy gradients, sequence-level rewards without length normalization introduce a positive bias toward overly long sequences. Longer sequences accumulate more token-level policy gradient updates for a positive advantage:
GRPO applies an explicit scalar factor across the token sum for each completion. This normalizes the gradient contribution across completions of varying lengths, ensuring that the model does not artificially inflate token count purely to amplify reward gradients.
Implementation Considerations and Edge Cases
Deploying GRPO in production training clusters requires addressing several practical edge cases:
Handling Zero-Variance Groups ()
When a prompt is either trivial (all rollouts pass verification, yielding ) or excessively difficult (all rollouts fail, yielding ), the sample standard deviation evaluates to .
In these scenarios, the numerator . The advantage evaluates to for all completions in the group. Consequently, the policy gradient contribution for this prompt is zero, effectively masking out non-informative queries from gradient updates. This automatic filtering ensures that training updates concentrate computational capacity on prompts at the model's active learning frontier.
Group Size Scaling ()
The choice of group size governs the trade-off between baseline estimator variance and rollout throughput:
- Small (): High variance in and , leading to noisy advantage estimates and potential training instability.
- Moderate to Large (): Provides a robust empirical estimate of the outcome distribution. In large-scale reasoning runs, setting or amortizes prompt prefill computation across multiple parallel decode workers, maximizing GPU arithmetic utilization.
Sources
- Shao, Z., et al. (2024). DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models. arXiv:2402.03300.
- Guo, D., et al. (2025). DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning. arXiv:2501.12948.
- Schulman, J., et al. (2017). Proximal Policy Optimization Algorithms. arXiv:1707.06347.
- Schulman, J., et al. (2016). High-Dimensional Continuous Control Using Generalized Advantage Estimation. arXiv:1506.02438.



