REINFORCE scaled every update by the raw return — a noisy number that depends on everything that happened for the rest of the episode. What if something else, learned alongside the policy, could tell it "that was better than expected" or "worse than expected," instead of just "here's a number"?
Back to the familiar gridworld, but now two things learn at once: an actor (a softmax policy, one preference per action per state, just like REINFORCE) and a critic (a table, updated the same TD way as the value-function chapters). Step through a trace and watch both bar charts move together — every single step, off the exact same number.
The critic learns by ordinary one-step TD, producing a TD error:
The actor then uses that same as its advantage estimate, in place of REINFORCE's raw return :
- — the TD error: how much better or worse the actual outcome was than the critic's own expectation.
- — the critic's current value estimate for state .
- — the actor's current probability of action , from the softmax over its preferences.
- Same update shape as REINFORCE, different scale
The term is identical to the REINFORCE chapter. The only thing that changed is what multiplies it: a baseline-subtracted advantage instead of a raw return.
- Why this reduces variance
can swing wildly step to step, purely from randomness far in the future. only measures the gap between one real step and the critic's own prediction — a much smaller, steadier number to scale a gradient step by, even though it points in the same useful direction on average.
- Two learners, one shared signal
The critic isn't "used" and then discarded — it's trained by its own TD update every step, using the exact same the actor consumes. Neither one needs to fully converge before the other starts learning from it.
Before any updates, is a coin flip between left and right — nothing has been learned yet. After six steps, "right" has pulled ahead, driven entirely by the critic's own value estimates, which shifted right alongside it.
With for both actor and critic, , starting from an all-zero critic and a uniform actor:
- Step 1 — no signal yet, so the update is uninformative but harmless
From , "right" lands on with reward ; still, so . . With the policy still uniform ( each way), the actor update gives:
Discouraging the very action just taken, purely because the critic (still near-zero everywhere) rated the outcome as worse than expected.
- Step 3 — a real mistake, correctly penalized
From , taking "left" moves away from the goal, landing on (whose value, by now, is already , from step 2's own critic update). — a bigger penalty than step 1's, because this time the critic has real (negative) information about where "left" leads. With 's policy still uniform:
Already favoring "right" with more than half the probability, after a single update.
- Step 5 — reaching the goal spikes the advantage
From , "right" reaches the goal directly: reward , and at that point (from step 3's own critic update), so — far larger than anything seen so far. The critic updates . The actor, starting from step 3's (policy ), updates to — the actor and critic correcting course together, in the same step.
Step forward until you're standing at state 2 and the actor favors "right" with more than half the probability.
Actor-critic keeps REINFORCE's direct policy gradient but replaces its noisiest ingredient — the raw return — with a TD error computed by a value function learned alongside it. Both halves are simple, familiar algorithms from earlier chapters, run in parallel and coupled through one shared number. The next chapter takes this same clipped-nowhere update and adds one more piece of machinery: a hard limit on how far a single gradient step is allowed to move the policy at all.