The policy gradient needs one number per action: how much better was at than
the policy's average at st. The raw Monte Carlo return answers this but with
huge variance. Actor-critic learns a value function to serve as a baseline, and
Generalized Advantage Estimation turns that baseline into a tunable dial between
a low-variance biased estimate and a high-variance unbiased one.
The advantage function and baselines
The policy gradient can be written with any per-step weight Ψt,
∇θJ(θ)=Eτ∼πθ[t∑∇θlogπθ(at∣st)Ψt].
Subtracting a state-only baseline b(st) from Ψt leaves the expectation
unchanged, because at each state
The variance-reducing choice is b(s)=Vπ(s), which turns the weight into the
advantage1
Aπ(s,a)=Qπ(s,a)−Vπ(s),Ea∼π[Aπ(s,a)]=0.
It measures how much action a beats the state's average, and it is centered at
zero, so good actions get pushed up and bad ones down.
Actor-critic: the critic is the baseline
The actor is the policy πθ; the critic is a learned
Vϕ≈Vπ, fit by regressing on returns or TD targets. The actor
update uses the critic to form an advantage estimate A^t,
∇θJ(θ)≈E[t∑∇θlogπθ(at∣st)A^t].
The critic slashes variance relative to the raw return. The price is bias: when
Vϕ=Vπ, that error leaks into A^t.
The TD error estimates the advantage
The one-step temporal-difference error is
δt=rt+γV(st+1)−V(st).
If the critic is exact, V=Vπ, then conditioning on (st,at),
So δt is an unbiased one-sample estimate of the advantage, using only
the current reward and one bootstrapped value. If the critic is wrong, δt
inherits its bias.
Generalized Advantage Estimation
Summing TD errors gives the k-step advantage estimator
Small k leans on the bootstrap V(st+k): low variance, high bias. Large k
leans on sampled rewards: high variance, low bias. GAE is their
exponentially weighted average with decay λ,1
which collapses to a one-line backward recursion,
A^t=δt+γλA^t+1. The two ends are the familiar
estimators:
λ=0:A^t=δt(TD(0), low variance / biased),λ=1:A^t=l≥0∑γlrt+l−V(st)(Monte Carlo, unbiased / high variance).
The weight (γλ)l decays with an effective horizon 1/(1−γλ)
steps: that is how far downstream reward is trusted before the critic takes over.
Worked example
Take a six-step episode with γ=0.9, a single reward
r=(0,0,0,0,0,1) at the end, and an imperfect critic
V=(0.4,0.5,0.6,0.7,0.8,0.9) with V(terminal)=0. The TD errors
δt=rt+γV(st+1)−V(st) are
δ=(0.05,0.04,0.03,0.02,0.01,0.10),
for instance δ0=0.9(0.5)−0.4=0.05 and
δ5=1+0.9(0)−0.9=0.10. Now read the advantage at t=0 through the
dial A^0=∑l=05(γλ)lδl:
At λ=1 the sum telescopes to the Monte Carlo return minus the baseline,
confirming the identity. The effective horizon grows from 1/(1−0)=1 step
through 1/(1−0.45)=1.82 to 1/(1−0.9)=10: as λ rises, the eventual
reward at step 5 flows further back into A^0, climbing from 0.05 (the
critic's local bootstrap) to 0.190 (the actual discounted return).
TD error, GAE advantage, and the bias-variance dialinteractive
δ ₜ (TD error)Aₜ (GAE)±1σ over noisy returns
A₀(λ)
0.078
eff. horizon 1/(1−γλ)
1.82
std(A₀) · variance
0.100
|A₀(λ)−A₀(1)| · bias
0.112
λ = 0 is TD(0): short horizon, low variance, biased by the critic. λ = 1 is Monte Carlo: unbiased, but the whiskers blow up. Slide λ to trade one for the other.
The six-step episode above: muted bars are the TD errors δ_t, accent bars are the GAE advantages A_t, and the yellow whiskers are ±1σ of A_t across noisy returns. At λ = 0 the accent bars equal the TD errors and the whiskers are short. Raise λ toward 1 and A_t swells to the Monte Carlo return while the whiskers blow up. The readouts split the tradeoff: bias |A₀(λ)−A₀(1)| falls to zero as the estimate becomes unbiased, while std(A₀) and the effective horizon climb. Push σ up to make the variance dominate.
Reading the two readouts together is the whole story: bias shrinks and variance
grows along one knob. This is the dial inside PPO, which computes its
clipped-objective advantages with GAE at roughly γ≈0.99 and
λ≈0.95, buying most of Monte Carlo's low bias while the critic
keeps the variance in check.1 The same value baseline that made the plain
policy gradient usable2 becomes, through λ, a continuous choice about
how far to trust the world versus the critic.