Generalized advantage estimation
One dial between noisy truth and smooth guess
The advantage is defined; now we have to measure it, and we only have two flawed instruments. We can watch what actually happened, the real rewards of the rollout. That’s honest but jittery: a single noisy outcome standing in for an expectation. Or we can ask the critic what it predicts. That’s calm, since the critic averages over everything it has seen, but it’s calm even when it’s wrong.
Weather gives the right instinct. To judge today, you can look out the window (true, but one noisy day) or read the seasonal forecast (smooth, but systematically off if the forecaster is bad). The best estimate blends both, and how far you lean toward the window is a dial, not a fixed answer. This chapter is that dial.
The unit of surprise: the TD error
The blend is built from a small, local quantity. At each step, compare what the critic predicted before the step with what the world just revealed, namely the reward received plus the (discounted) value of wherever you landed:
Read aloud: the temporal-difference error at step is the reward you just got, plus times the value of where you ended up, minus the value of where you were. It’s a one-step surprise: positive when the step went better than the critic expected, negative when it went worse. ( is the usual discount on the future, kept close to .)
Walk through a rollout and watch each surprise get computed, and then folded into an advantage estimate:
GAE: sum the surprises, with fading trust
Generalized Advantage EstimationGAEGeneralized Advantage Estimation — a way to trade bias against variance in advantage estimates using a decay parameter λ. The standard advantage signal inside PPO.See in glossary → (GAE, Schulman 2016) estimates the advantage at step by summing that step’s surprise and the surprises after it, each weighted a bit less than the one before, a geometric fade controlled by a knob between and . Nearby surprises count fully; distant, noisier ones fade out. The two endpoints of the knob recover exactly our two flawed instruments:
- : keep only the immediate surprise , leaning entirely on the critic. Low variance, but it inherits the critic’s bias.
- : never fade, summing every surprise, which works out to the full observed return minus the baseline. Unbiased (at this end the critic only enters as a subtracted baseline, so its errors cancel in expectation), but as noisy as the rollout itself.
- , the usual RLHF setting: keep most of the variance reduction while paying only a little bias.
Try it: the GAE dial
Below, the same rollout as the step-through above, but with and on dials. Crank toward 1 and the advantage estimates get spikier (high variance); pull it toward 0 and they smooth out toward the critic’s one-step view (low variance, more bias). This single picture is the heart of why PPO is stable.
Where this is heading
Baselines, a critic, and GAE give us a low-variance advantage signal . But we still haven’t fixed the other failure mode of naive policy gradients: taking a step so large that it wrecks the policy in a single update. That is the problem trust regions and clipping solve, and it brings us to the algorithm at the center of RLHF: PPOPPOProximal Policy Optimization (Schulman, 2017) — nudges the policy toward higher reward in small, clipped steps with a KL leash to a reference model. The RLHF workhorse: stable, simple, widely used.See in glossary →, in the next chapter.