Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 51

GRPO: Group-Relative Advantage Estimation

Recommended resources

Introduction

Welcome to our next lesson in the "Alignment Paradigms" module. In our previous sessions, we've explored different strategies for aligning large language models. We saw how Proximal Policy Optimization (PPO) uses a full Reinforcement Learning (RL) setup with four distinct models—Actor, Critic, Reward Model, and Reference Model. Then, we examined Direct Preference Optimization (DPO), which cleverly reframes the problem to eliminate the reward model and the RL loop entirely, turning alignment into a simpler supervised learning task.

This lesson focuses on another powerful and efficient algorithm: Group Relative Policy Optimization (GRPO). GRPO sits between PPO and DPO. It retains the RL framework but introduces a key simplification that makes it much more efficient than PPO. This algorithm is central to the training of state-of-the-art reasoning models like DeepSeek-R1, which we'll study in depth.

Our learning outcome for this session is to explain how GRPO eliminates the critic network by estimating advantages from group-relative reward comparisons. We will dissect the problems associated with PPO's critic and see how GRPO's group sampling approach provides an elegant and practical solution.



The Problem with the Critic in PPO

To understand why eliminating the critic is a significant improvement, we must first recall its role in PPO. The critic is a learned value function, typically denoted as , whose job is to predict the expected future reward from a given state . This prediction serves as a baseline for calculating the advantage, which measures how much better a specific action was compared to the average action from that state.

While this actor-critic architecture is a cornerstone of modern RL, it introduces several challenges, especially in the context of LLMs.

  1. Computational Overhead: The critic is usually another large neural network, often a copy of the policy model itself. As the Understanding GRPO article notes, PPO requires four models in memory: the policy (actor), the critic, the reference model, and the reward model. This dramatically increases memory requirements and computational cost.
  2. Training Complexity: Training two large networks (actor and critic) simultaneously is complex and can be unstable. Practitioners face what one of our resources calls a "cognitive load," making the algorithm harder to understand and tune.
  3. Reward Signal Mismatch: For many LLM reasoning tasks (like math or code generation), we only receive a single, final reward indicating whether the entire answer was correct. The critic, however, is trained to estimate a value for every intermediate token's state. Training an accurate per-token value function with only a final reward signal is fundamentally difficult and often inaccurate.

The following video section provides an excellent intuitive breakdown of these challenges.

DeepSeek's GRPO (Group Relative Policy Optimization) | Reinforcement Learning for LLMs

This video explains the role of the actor-critic setup in PPO and highlights the computational and cognitive overhead that comes with training a separate critic model.

Please watch from 11:20 to 14:09. Pay close attention to the explanation of the critic (value function), its purpose as a baseline, and the disadvantages it introduces in terms of memory and complexity.

These problems motivate the search for a simpler way to estimate the advantage baseline—a way that doesn't require training another massive neural network.



GRPO's Solution: Replacing the Critic with Group Sampling

The core insight of GRPO is that the critic's value function is just one way to establish a baseline for advantage calculation. GRPO replaces this learned, predictive baseline with a direct, empirical one derived from sampling.

This process is straightforward and can be broken down into a few simple steps:

  1. Group Sampling: For a single prompt, instead of generating just one response, the policy generates a "group" of different responses (e.g., ).
  2. Reward Computation: A reward function (e.g., a rule-based checker for a math problem) assigns a scalar reward to each of the responses.
  3. Monte Carlo Baseline: The baseline is then calculated as the average reward of the group.

    This is a Monte Carlo estimate of the expected reward for that prompt. With a large enough group, this average converges to what a perfectly trained critic would predict, but without needing to train a model at all.
  4. Group-Relative Advantage Calculation: The advantage for a specific response is its reward compared to this group-average baseline. To improve stability across different prompts, GRPO normalizes this advantage by the standard deviation of the group's rewards.

The following image illustrates this critic-free advantage calculation perfectly.

Group Relative Advantage Formula for GRPO
This diagram shows the core mechanism of GRPO. For a given prompt (x), multiple outputs (y) are sampled. Their rewards (r) are used to compute a mean and standard deviation. The advantage for any single output is its reward, centered by the mean and scaled by the standard deviation.

This "group-relative" comparison is intuitive: it evaluates how good a response is, not in an absolute sense, but relative to other possible responses the model could have generated in the same situation.

This next reading provides a clear, step-by-step explanation of how PPO's critic is replaced by this group sampling method.

Understanding GRPO: PPO without the Critic

This article, 'Understanding GRPO: PPO without the Critic', directly addresses our learning outcome. It details the problems with PPO's critic and explains how GRPO's Monte Carlo baseline from group sampling serves as a powerful replacement.

Please read Section I ('The PPO Objective and the Critic Problem') and Section II ('Replacing the Critic with Group Sampling'). Focus on how the group's mean reward serves the same purpose as the critic's value prediction, but without the associated training overhead.

The diagram below provides a high-level architectural comparison, visually summarizing how GRPO simplifies PPO.

PPO vs. GRPO: Architectural Comparison
A side-by-side comparison of PPO and GRPO architectures. PPO (left) requires both an Actor (Policy) and a Critic (Value Function). GRPO (right) eliminates the Critic, using group sampling from a reference policy to calculate advantages directly.

By replacing the complex, learned critic with a simple, empirical group average, GRPO achieves a significant reduction in complexity and resource usage while maintaining the stability that makes PPO effective.



Conclusion

In this lesson, we have focused on the central innovation of Group Relative Policy Optimization: the elimination of the critic network. We saw that the critic in PPO, while theoretically sound, introduces significant computational overhead and training complexity, particularly for LLM fine-tuning where reward signals are often sparse.

Key Takeaways:

  • PPO's critic network is a learned value function used as a baseline to calculate advantage estimates.
  • Training this critic is expensive, complex, and ill-suited for tasks with only final-outcome rewards.
  • GRPO eliminates the critic by replacing its baseline with a Monte Carlo estimate derived from group sampling.
  • For each prompt, GRPO samples a group of responses and uses their mean reward as the baseline.
  • The advantage for a given response is then its own reward relative to the group's average reward, a method called group-relative reward comparison. This critic-free approach significantly reduces the memory and computational costs of RL-based alignment.

Preview of the Next Lesson:

Now that we understand how GRPO eliminates the critic to calculate advantages, our next lesson will formalize the complete algorithm. We will describe the full GRPO training loop, including the group sampling, reward computation, advantage normalization, and finally, the clipped policy update that uses this advantage to train the model. This will give us a complete picture of the algorithm used to train models like DeepSeek-R1.