---
title: Generalized Advantage Estimation
url: https://www.emergentmind.com/topics/generalized-advantage-estimation
type: topic
---

# Generalized Advantage Estimation

Generalized Advantage Estimation (GAE) is an exponentially weighted estimator of the advantage function used in policy-gradient and actor–critic reinforcement learning. It combines temporal-difference residuals over multiple future steps to reduce the variance of policy-gradient estimates while controlling bias through the parameters \(\gamma\) and \(\lambda\). For a value-function approximation \(V\), the standard finite-horizon estimator is
\[
\hat A_t^{\mathrm{GAE}(\gamma,\lambda)}
=
\sum_{l=0}^{T-t-1}(\gamma\lambda)^l
\delta_{t+l}^{V},
\qquad
\delta_t^{V}=r_t+\gamma V(s_{t+1})-V(s_t).
\]
GAE is used in algorithms including TRPO, PPO, and related actor–critic methods, while subsequent work has extended or modified it for non-exponential discounting, distributional critics, multi-agent credit assignment, truncated rollouts, data augmentation, and long-context language-model reinforcement learning.

## 1. Definition and motivation

A stochastic policy-gradient method updates policy parameters according to an expectation of score-function terms,
\[
\nabla_\theta J(\theta)
=
\mathbb E\left[
\sum_t \Psi_t\nabla_\theta\log\pi_\theta(a_t\mid s_t)
\right],
\]
where \(\Psi_t\) is a learning signal associated with the action. Using the complete trajectory return produces an unbiased estimator, but its variance can be high because an action’s score is multiplied by rewards occurring far in the future, including rewards only weakly related to that action.

The ideal learning signal is the advantage function,
\[
A^\pi(s,a)=Q^\pi(s,a)-V^\pi(s),
\]
where \(Q^\pi(s,a)\) is the expected return after taking action \(a\) in state \(s\), and \(V^\pi(s)\) is the expected return under the policy from that state. Positive-advantage actions should become more probable, whereas negative-advantage actions should become less probable.

A state-dependent baseline does not alter the expected policy gradient:
\[
\mathbb E_{a\sim\pi_\theta(\cdot\mid s)}
\left[
b(s)\nabla_\theta\log\pi_\theta(a\mid s)
\right]
=
0.
\]
The value function is therefore a useful baseline: it removes the state-dependent average return while retaining information about whether the selected action was unusually good or bad. Exact \(Q^\pi\) and \(V^\pi\) functions are generally unavailable, so GAE addresses the problem of estimating advantages using an imperfect learned value function while avoiding the variance of full Monte Carlo returns. The original formulation introduced GAE together with trust-region optimization for both policy and value networks and evaluated it on high-dimensional simulated locomotion tasks [1506.02438].

The one-step temporal-difference residual,
\[
\delta_t^V=r_t+\gamma V(s_{t+1})-V(s_t),
\]
is a natural one-step advantage estimate. If \(V=V^{\pi,\gamma}\), then
\[
\mathbb E[\delta_t^V\mid s_t,a_t]
=
A^{\pi,\gamma}(s_t,a_t).
\]
With an imperfect value function, however, the residual can be biased.

## 2. Multi-step construction and recursion

Summing \(k\) discounted temporal-difference residuals produces the \(k\)-step advantage estimator
\[
\hat A_t^{(k)}
=
\sum_{l=0}^{k-1}\gamma^l\delta_{t+l}^{V}.
\]
Expanding and telescoping the value terms gives
\[
\hat A_t^{(k)}
=
-V(s_t)
+
\sum_{l=0}^{k-1}\gamma^l r_{t+l}
+
\gamma^kV(s_{t+k}).
\]
Thus, a \(k\)-step advantage is a \(k\)-step bootstrapped return minus the baseline \(V(s_t)\).

For \(k=1\),
\[
\hat A_t^{(1)}=\delta_t^V.
\]
As \(k\) increases, the estimator depends more on observed rewards and less on intermediate value predictions. This generally reduces bias caused by an inaccurate value function but increases variance. In the infinite-horizon limit,
\[
\hat A_t^{(\infty)}
=
\sum_{l=0}^{\infty}\gamma^l r_{t+l}-V(s_t),
\]
which is the Monte Carlo return minus the learned value baseline.

GAE forms an exponentially weighted combination of these multi-step estimators:
\[
\hat A_t^{\mathrm{GAE}(\gamma,\lambda)}
=
(1-\lambda)
\sum_{k=1}^{\infty}
\lambda^{k-1}\hat A_t^{(k)}.
\]
Rearranging yields the operational form
\[
\boxed{
\hat A_t^{\mathrm{GAE}(\gamma,\lambda)}
=
\sum_{l=0}^{\infty}
(\gamma\lambda)^l\delta_{t+l}^{V}
}.
\]
For a finite trajectory,
\[
\hat A_t
=
\sum_{l=0}^{T-t-1}
(\gamma\lambda)^l\delta_{t+l}^{V}.
\]

The estimator is usually computed backward through the recursion
\[
\hat A_t
=
\delta_t^V+\gamma\lambda\hat A_{t+1},
\]
with \(\hat A_T=0\) at the end of a relevant trajectory segment. At a genuine terminal state, the bootstrap term is normally masked or \(V(s_T)\) is set to zero. If a trajectory is merely truncated by a finite rollout horizon, the final value estimate can instead be used for bootstrapping.

GAE is closely analogous to TD\((\lambda)\). TD\((\lambda)\) uses exponentially weighted temporal-difference errors to estimate a value function, whereas GAE applies a residual trace to estimate an advantage function for policy-gradient learning.

## 3. The roles of \(\gamma\) and \(\lambda\)

The discount factor and trace parameter appear jointly in the coefficient \(\gamma\lambda\), but they have different meanings.

The original objective may be the undiscounted total reward,
\[
J(\pi)=\mathbb E_\pi\left[\sum_{t=0}^{\infty}r_t\right].
\]
In that formulation, \(\gamma\) is an algorithmic parameter rather than part of the task definition. The discounted value function is
\[
V^{\pi,\gamma}(s_t)
=
\mathbb E_\pi\left[
\sum_{l=0}^{\infty}\gamma^l r_{t+l}
\mid s_t
\right].
\]
Therefore, changing \(\gamma\) changes the scale and definition of the value and advantage functions themselves.

A smaller \(\gamma\) emphasizes near-term consequences, generally reduces variance, and suppresses delayed rewards. Relative to an undiscounted objective, it introduces bias even when the value function is learned perfectly. The effective temporal range is described as roughly \(1/(1-\gamma)\), although the useful value depends on how long action effects persist.

The parameter \(\lambda\) controls reliance on bootstrapping from the value function:

- \(\lambda=0\) gives the one-step TD residual,
  \[
  \mathrm{GAE}(\gamma,0)=\delta_t^V.
  \]
  This has relatively low variance but is sensitive to value-function error.

- \(\lambda=1\) gives
  \[
  \mathrm{GAE}(\gamma,1)
  =
  \sum_{l=0}^{\infty}\gamma^l\delta_{t+l}^V
  =
  \sum_{l=0}^{\infty}\gamma^l r_{t+l}-V(s_t).
  \]
  The value terms telescope, producing a Monte Carlo return minus a baseline. It is unbiased for the \(\gamma\)-discounted advantage regardless of the accuracy of \(V\), but can have high variance.

- Intermediate \(\lambda\) values interpolate between one-step TD and Monte Carlo estimation.

The two parameters should not be treated as interchangeable. \(\gamma<1\) changes the policy-gradient target relative to an undiscounted objective, whereas \(\lambda<1\) primarily introduces bias through reliance on an imperfect value function. The original experiments reported that the best \(\lambda\) was generally lower than the best \(\gamma\), with approximate best regions of \(\gamma\in[0.96,0.99]\), \(\lambda\in[0.92,0.99]\) on cart-pole and \(\gamma\in[0.99,0.995]\), \(\lambda\in[0.96,0.99]\) for 3D biped locomotion [1506.02438].

## 4. Integration with policy optimization

Given estimated advantages, a policy-gradient estimate is
\[
\hat g
=
\frac{1}{N}
\sum_{n=1}^N
\sum_t
\hat A_t^{(n)}
\nabla_\theta
\log\pi_\theta(a_t^{(n)}\mid s_t^{(n)}).
\]

In trust-region policy optimization, the importance-weighted surrogate objective uses
\[
L(\theta)
=
\frac{1}{N}
\sum_{n,t}
\frac{\pi_\theta(a_t^{(n)}\mid s_t^{(n)})}
{\pi_{\mathrm{old}}(a_t^{(n)}\mid s_t^{(n)})}
\hat A_t^{(n)},
\]
subject to a constraint on the average policy KL divergence. GAE supplies the action-quality estimates, while the trust region limits the size of each policy update. The trust region does not remove estimator bias, but can prevent imperfect advantage estimates from causing excessively large policy changes.

In PPO, GAE is inserted into the clipped surrogate objective,
\[
L^{\mathrm{CLIP}}(\theta)
=
\mathbb E_t
\left[
\min\left(
\rho_t(\theta)\hat A_t,
\operatorname{clip}(\rho_t(\theta),1-\epsilon,1+\epsilon)
\hat A_t
\right)
\right],
\]
where
\[
\rho_t(\theta)
=
\frac{\pi_\theta(a_t\mid s_t)}
{\pi_{\mathrm{old}}(a_t\mid s_t)}.
\]
The advantage determines whether the probability of the sampled action should be increased or decreased.

The value function is used as a baseline and bootstrap predictor, not as the policy. In the original algorithm, the policy update uses the old value function \(V_{\phi_i}\) to compute advantages, after which the value function is updated. Updating the value function first can introduce additional bias. If the value function is overfit to sampled transitions so that
\[
r_t+\gamma V(s_{t+1})-V(s_t)\approx0,
\]
the resulting policy-gradient estimate can also become nearly zero.

The value network is commonly fitted by regression to discounted empirical returns:
\[
V_t^{\mathrm{target}}
=
\sum_{l=0}^{\infty}\gamma^l r_{t+l},
\]
using an objective such as
\[
\min_\phi
\sum_n
\left(
V_\phi(s_n)-V_n^{\mathrm{target}}
\right)^2.
\]
The original work reported no performance difference between a TD\((\lambda)\)-style value target and a \(\lambda=1\) Monte Carlo-style target for value regression. Advantage normalization is common in later implementations, but it was not presented as part of the reported original GAE algorithm [1506.02438].

## 5. Empirical scope, limitations, and variants

The original evaluation combined GAE with TRPO, neural value fitting, large batches, and trust-region value optimization. It covered cart-pole and MuJoCo continuous-control tasks, including 3D bipedal locomotion, quadrupedal locomotion, and bipedal standing up from the ground. Neural policies mapped directly from raw kinematics to joint torques. The reported experiments used approximately \(50{,}000\) timesteps per biped locomotion batch and \(200{,}000\) timesteps per quadrupedal locomotion and standing batch. These results established that the combined method could learn stable locomotion and stand-up behaviors, but did not establish a universal optimal \((\gamma,\lambda)\) or attribute all improvement to GAE alone.

Later work has examined several limitations of the standard construction.

**Truncated rollouts.** Fixed-length PPO segments may end before environmental termination. Advantage estimates near the artificial boundary have access to fewer future rewards and can be strongly affected by the bootstrap convention. Partial GAE computes ordinary truncated GAE but retains only an initial portion of the segment for the PPO update, discarding estimates close to the artificial boundary. This was evaluated in MuJoCo and \(\mu\)RTS, where partial GAE improved empirical results relative to standard truncated GAE [2301.10920].

**Alternative aggregation.** GAE is a linear combination of multi-step estimates. Order-statistics methods replace this linear aggregation with maximum, minimum, maximum-absolute-value, or intermediate order-statistics operators. The maximum estimator is intended to preserve promising partial behaviors in sparse-reward tasks; the minimum estimator is intended to penalize actions with catastrophic downstream consequences; and maximum-absolute-value estimation exaggerates strong positive or negative evidence. These methods are deliberately biased and are not equivalent to robust MDP optimization or formal risk-sensitive reinforcement learning. Their reported performance was environment-dependent [1909.06851].

**Direct advantage modeling.** Direct Advantage Estimation models a centered advantage function directly rather than obtaining it indirectly as a difference between estimated \(Q\)- and \(V\)-functions or from TD residuals. Its objective minimizes the variance of a transformed return subject to the centering constraint
\[
\sum_a\pi(a\mid s)\hat A(s,a)=0.
\]
DAE does not require an explicit value function in its basic Monte Carlo form, although a bootstrapped extension can incorporate one. In discrete-control experiments, DAE outperformed GAE on a majority of the evaluated environments, while remaining sensitive to data volume, function-approximation capacity, and the on-policy setting [2109.06093].

**Data augmentation.** Bootstrap Advantage Estimation averages \(k\)-step advantage estimates computed from the original observation and semantically transformed observations before applying the GAE-style weighting:
\[
A_t^{(k,b)}
=
\frac{1}{m+1}
\sum_{i=0}^{m}A_t^{(k,i)}.
\]
It is intended to reduce sensitivity to nuisance variation in image and vector observations. BAE retains the original rewards and action distribution and uses augmentation only for advantage computation. Experiments in Procgen, DeepMind Control, and PyBullet reported improved sample efficiency and generalization relative to GAE-PPO, although the benefit depends on the transformation preserving reward semantics [2210.07312].

## 6. Extensions beyond scalar single-agent GAE

GAE has also been generalized by changing the value representation, temporal discounting, or credit-assignment structure.

**Non-exponential discounting.** Universal Generalized Advantage Estimation extends GAE to an arbitrary discount sequence \(\Gamma^{(t)}\), replacing the geometric weighting \(\gamma^t\) with direct reward and bootstrap weights. For generalized \(k\)-step advantages,
\[
\tilde A_t^{(k)}
=
-V(s_t)
+
\sum_{l=0}^{k-1}\Gamma^{(l)}r_{t+l}
+
\Gamma^{(k)}V(s_{t+k}),
\]
UGAE forms
\[
\tilde A_t^{\mathrm{UGAE}(\Gamma,\lambda)}
=
(1-\lambda)
\sum_{k=1}^{\infty}
\lambda^{k-1}\tilde A_t^{(k)}.
\]
When \(\Gamma^{(t)}=\gamma^t\), UGAE reduces exactly to standard GAE. Beta-weighted discounting provides a continuous family between exponential and hyperbolic discounting. UGAE is generally computed through vectorized sums rather than the standard one-pass recursion and has \(O(T^2)\) cost without truncation [2302.05740].

**Distributional critics.** Distributional GAE replaces scalar TD residuals with a signed comparison between return distributions using a Wasserstein-like directional metric. The resulting DGAE estimator is
\[
\widehat{\mathpzc A}^{\gamma,\lambda}_{\mathrm{DGAE},t}
=
\sum_{k=0}^{T-t-1}
(\gamma\lambda)^k
\delta_{t+k}^{\widehat G},
\]
where \(\delta_t^{\widehat G}\) compares the Bellman-updated return distribution with the current distributional value estimate. DGAE preserves the familiar backward recursion, but its directional metric may collapse to a signed mean difference when the transport cost is linear. Consequently, it does not necessarily capture differences in variance, skewness, or tail risk [2507.17530].

**Multi-agent credit assignment.** Multi-agent methods modify the baseline rather than necessarily changing the trace mechanism. Marginal advantage estimation averages counterfactual advantages over the policies of other agents, while approximately synchronous advantage estimation constrains policy changes so that current partner policies approximate future partner policies [2012.03488]. Generalized Per-Agent Advantage Estimation retains the exponentially weighted residual structure of GAE but replaces the global value with
\[
\overline{EQ}^{\,i}(s_t,\boldsymbol a_t^{-i})
=
\mathbb E_{a_t^i\sim\pi^i}
\left[
Q^{\boldsymbol\pi}(s_t,a_t^i,\boldsymbol a_t^{-i})
\right].
\]
Its per-agent residual is
\[
\delta_t^{i}
=
r_t+\gamma\overline{EQ}^{\,i}_{t+1}
-\overline{EQ}^{\,i}_{t},
\]
and the resulting trace is
\[
\widehat A_t^{i}
=
\sum_{l=t}^{\infty}
(\gamma\lambda)^{l-t}\delta_l^{i}.
\]
In the single-agent case, GPAE reduces to standard GAE. Its off-policy version introduces double-truncated importance sampling to balance sensitivity to an agent’s own policy change against non-stationarity caused by other agents [2603.02654].

**Critic-free grouped estimators.** GAGPO substitutes a non-parametric grouped value proxy for a learned critic. For state \(s\), it averages sampled returns across occurrences of that state in a rollout group:
\[
\bar V(s)
=
\frac{1}{|\mathcal G(s)|}
\sum_{(j,u)\in\mathcal G(s)}
\hat R_u^{(j)}.
\]
It then computes
\[
\delta_t
=
r_t+\gamma\bar V(s_{t+1})-\bar V(s_t)
\]
and applies the standard GAE-style recursion. GAGPO therefore retains temporal bootstrapping without training a parametric value network, but depends on repeated state occurrences and exact textual state matching in its reported implementation [2605.13217].

**Trajectory-level LLM estimators.** BASIS addresses a different problem from GAE: estimating a prompt-level terminal-reward baseline for LLM reasoning when only one rollout is sampled per prompt. It uses offline prompt-level value estimates and rewards from other prompts in the batch to form a leave-one-out baseline. BASIS does not use temporal-difference residuals, tokenwise value functions, \(\gamma\), \(\lambda\), or temporal bootstrapping. It is therefore a critic-free trajectory-level baseline estimator rather than a GAE approximation [2605.13217].

**Long-context reasoning.** Segmental Advantage Estimation modifies where GAE applies trace decay in sparse-reward language-model reasoning. It identifies low-probability tokens as heuristic segment boundaries, applies no decay within a segment, and applies \(\lambda\) only when the trace crosses a boundary. Its recursion is
\[
A_t^{\mathrm{SAE}}
=
\delta_t+\lambda_{\mathrm{SAE}(t)}A_{t+1}^{\mathrm{SAE}},
\]
where \(\lambda_{\mathrm{SAE}(t)}\) is \(1\) within a segment and \(\lambda\) at a segment boundary. Experiments on mathematical, code, and STEM reasoning reported improvements over token-level GAE baselines, although the semantic-boundary assumption remains heuristic [2601.07320].

## 7. Implementation and computational considerations

The standard implementation computes TD residuals and then scans backward:
\[
\delta_t=r_t+\gamma m_tV(s_{t+1})-V(s_t),
\]
\[
\hat A_t=\delta_t+\gamma\lambda m_t\hat A_{t+1},
\]
where \(m_t\) masks true terminal transitions. The distinction between true termination and artificial rollout truncation is essential. At termination, the bootstrap term is disabled; at a nonterminal rollout boundary, the final value estimate can be retained.

The rewards-to-go or value target is often formed as
\[
\hat R_t=V(s_t)+\hat A_t,
\]
and the critic is trained toward this target. GAE itself is not the complete PPO algorithm: it is the intermediate computation connecting rollout collection and critic inference to actor and critic losses.

The backward dependency in the recursion has also motivated hardware implementations. HEPPO uses an FPGA-based parallel, pipelined architecture for the GAE stage of PPO. It employs trajectory-aligned memory, first-in-last-out access, multiple processing elements, and \(k\)-step lookahead to mitigate the loop-carried dependency in
\[
\hat A_t=\delta_t+\gamma\lambda\hat A_{t+1}.
\]
The reported design combines dynamic reward standardization, block standardization for values, and 8-bit uniform quantization. Its architectural claims include a fourfold memory-usage reduction, an approximately \(30\%\) PPO speed increase, and throughput improvements based on hardware estimates; the reported speedups are not all end-to-end measurements [2501.12703].

GAE remains sensitive to value-function error, reward scale, terminal-state handling, rollout length, \(\gamma\), and \(\lambda\). Quantization errors, delayed rewards, and inaccurate intermediate values can accumulate through the factor \((\gamma\lambda)^l\). Extensions such as partial, segmental, distributional, per-agent, grouped, and non-exponential estimators address specific failure modes, but none establishes that standard GAE is universally suboptimal. Its central role is the controlled aggregation of multi-step temporal-difference information into an advantage signal suitable for policy optimization.

Source: https://www.emergentmind.com/topics/generalized-advantage-estimation