In our previous lesson, we established a solid understanding of the PPO clipped surrogate objective, which stabilizes policy updates by preventing drastic changes. Central to that objective was the advantage estimate, . Today, we will delve into how this term is constructed and why it plays a pivotal role beyond just weighting the update.
This lesson will explain the function of the advantage estimator and the value-function baseline in PPO. We'll explore why simple policy gradient methods can be inefficient due to high variance in their gradient estimates and how a carefully chosen baseline, namely the state-value function, dramatically improves learning speed and stability. This is the final piece of the PPO puzzle we need before we can contrast it with GRPO's innovative, critic-free design.
The Problem of High-Variance Gradients
Let's begin with a core challenge in policy gradient methods. The simplest form of the policy gradient algorithm, REINFORCE, updates the policy by weighting the gradient by the total return of the episode, . The idea is to make action sequences that lead to high returns more likely.
However, the total return can have very high variance. Two trajectories starting from the same state can have wildly different outcomes due to stochasticity in the environment or the policy itself. This makes the gradient estimate noisy and unreliable.
To see why this is a problem, watch the following video. It provides an excellent illustration of how an agent can struggle to learn if all its rewards are positive, even if some actions are clearly better than others.
Policy Gradient Methods | Reinforcement Learning Part 6
This video from the Mutual Information channel clearly demonstrates the issue with using raw returns in policy gradient methods.
Pay attention to the example where a constant is added to all rewards (starting from this section). Notice how this simple change, which doesn't alter the optimal policy, can significantly slow down learning because the agent tries to reinforce all actions, struggling to differentiate the good from the great.
As the video explains, if all returns are positive, the policy increases the probability of every action it takes. Learning becomes a slow process of waiting for the truly optimal actions to "overwhelm" the merely good ones. What we really want is to encourage actions that are better than average and discourage actions that are worse than average. This is where a baseline comes in.
Variance Reduction with a Baseline
The solution to the high variance problem is to subtract a baseline, , from the return. Instead of using the raw return, we use to weight our update. This simple change has a profound impact.
The key is that the baseline should only depend on the state, , not the action, . With this condition, subtracting a baseline does not change the expected value of the gradient, meaning it doesn't introduce bias. You may recognize this as an application of control variates, a variance reduction technique you've likely encountered in your statistics courses. For any state-dependent baseline , the expected value of the term we subtract is zero:
Since the baseline term adds nothing on expectation, it leaves the gradient direction unbiased. However, by choosing a good baseline, we can dramatically reduce the variance of the gradient estimator, leading to faster and more stable convergence.
The following video provides a more formal justification for this technique.
L3 Policy Gradients and Advantage Estimation (Foundations of Deep RL Series)
This lecture by Pieter Abbeel explains the mathematical intuition behind baseline subtraction.
Watch the section on baseline subtraction. The key insight is that while the baseline's contribution is zero on expectation, for a finite batch of samples it centers the rewards, allowing the gradient to differentiate between above-average and below-average outcomes.
The Value Function as the Optimal Baseline
What is the best choice for a baseline ? Intuitively, we want to compare the return we got with the return we expected to get from that state. This "expected return" is precisely the definition of the state-value function, :
When we use an estimate of the value function, , as our baseline, the term we use to scale the gradient becomes the advantage function:
The advantage tells us how much better or worse the actions taken from state turned out to be compared to the average expectation from that state. In actor-critic architectures like PPO, the policy is the "actor," and the value function approximator is the "critic." The critic's job is to provide this baseline to help the actor learn more efficiently.
The video below elaborates on why the value function is such an intuitive and powerful choice for a baseline.
L3 Policy Gradients and Advantage Estimation (Foundations of Deep RL Series)
This section of Pieter Abbeel's lecture discusses different baseline choices and why the value function stands out.
Watch the segment from state-dependent baselines. It highlights that using the value function as a baseline frames the learning problem as updating the policy based on whether an action performed better or worse than expected. It also touches upon the need to learn this value function, setting the stage for the next topic.
Generalized Advantage Estimation (GAE)
We now have an advantage estimator, , where is the empirical (Monte Carlo) return. This estimator is unbiased (if is perfect) but still has high variance because itself is calculated from a single, noisy trajectory.
At the other extreme, we could use a one-step lookahead, known as the Temporal Difference (TD) error:
This estimator has low variance (it only depends on a single reward and the critic's estimates) but is biased, because it relies heavily on the current, imperfect critic .
This presents a classic bias-variance trade-off. PPO uses a sophisticated technique called Generalized Advantage Estimation (GAE) to navigate this trade-off. GAE computes the advantage as an exponentially weighted average of k-step advantage estimators, blending the low-variance TD error with the low-bias Monte Carlo return.
The GAE formula is defined using the TD error :
Here, is a hyperparameter that controls the trade-off:
- : . This is the high-bias, low-variance TD error.
- : , which telescopes to the high-variance, low-bias Monte Carlo estimator, .
By tuning (a typical value is ~0.95), we can find a sweet spot that balances bias and variance for efficient and stable learning.
For a concise summary of these concepts, please study the following slide deck extract and image.
Variance Reduction for Policy Gradient Methods
These lecture slides from UC Berkeley provide a clear, mathematical summary of advantage estimation.
First, review the section "Value Functions in the Future", which defines the family of k-step advantage estimators from \hat{A}^{(1)}_t (low variance, high bias) to \hat{A}^{(\infty)}_t (high variance, low bias). Then, read the section "TD(λ) Methods: Generalized Advantage Estimation". It shows how GAE elegantly unifies these estimators as an exponentially weighted sum of TD errors, \delta_t.

Conclusion
In this lesson, we dissected the advantage estimator and its critical function in modern policy gradient methods like PPO.
Here are the key takeaways:
- High Variance: Simple policy gradient estimates that use raw returns are noisy and inefficient, slowing down learning.
- Baselines for Variance Reduction: Subtracting a state-dependent baseline (a control variate) centers the rewards, allowing the agent to distinguish between better-than-average and worse-than-average actions without introducing bias.
- The Critic: The state-value function, , is the ideal baseline. In actor-critic methods, a "critic" network is trained to approximate .
- Generalized Advantage Estimation (GAE): GAE provides a powerful mechanism to estimate the advantage by balancing the bias-variance trade-off between noisy Monte Carlo returns and biased function-approximated values, controlled by the hyperparameter.
You now have a complete picture of the main components of PPO: the clipped objective for stable updates and the GAE-based advantage estimator for efficient, low-variance updates.
With this foundation, we are perfectly positioned for the next module. We will begin by examining GRPO's main innovation: a critic-free approach. You will learn how GRPO cleverly calculates a relative advantage directly from a batch of model generations, entirely sidestepping the need to train and maintain a separate critic network.
Can't find a good explanation? Sign up and we'll make it for you
Sign up