This page is a self-testing ladder. Each rung is harder than the last:
L1 Recognition — can you name the pieces?
L2 Application — can you plug numbers into the formulas?
L3 Analysis — can you explain why a step works and what breaks if you skip it?
L4 Synthesis — can you combine ideas (n-step, entropy, on-policy) into new reasoning?
L5 Mastery — can you design, debug, and prove?
Every problem hides its full solution inside a collapsible [!recall]- callout — read the problem, try it yourself, then reveal. Parent topic: Advantage Actor-Critic (A2C - A3C).
Before we start, one reminder of the symbols we will reuse (each was built in the parent note):
(a) → (ii): the actor chooses actions.
(b) → (i): the critic estimates a state's value.
(c) → (iii): the TD error is the surprise — did the action do better or worse than the critic predicted? A positive δt means "better than expected."
Recall Solution 1.2
The blank is V(s), the state value (the value averaged over actions). So A=Q−V measures "how much better is this specific action than the state's average action?" Subtracting a baseline that depends only on the state reduces variance without changing the expected gradient — this was proven in the parent note (Policy Gradient Theorem): ∑a∇θπθ(a∣s)=∇θ1=0.
Recall Solution 1.3
False. A2C/A3C are on-policy — every gradient must come from the current policy. They decorrelate data with parallel environments/workers, not a stale buffer. (See the parent-note mistake callout.)
δt=rt+γVϕ(st+1)−Vϕ(st)=3+0.95(8)−10=3+7.6−10=0.6.δt=0.6>0 → the action did better than expected, so the actor loss −logπ⋅0.6 pushes to make atmore likely.
Recall Solution 2.2
δt=−2+0.95(5)−10=−2+4.75−10=−7.25.
Strongly negative → the outcome was far worse than average from st, so the actor loss −logπ⋅(−7.25)=+7.25logπdecreases this action's probability. We steer away from at.
Recall Solution 2.3
A^t(3)=(∑k=02γkrt+k)+γ3Vϕ(st+3)−Vϕ(st).Why the γ3 on the bootstrap? Each reward is discounted by how far in the future it lands: rt by γ0, rt+1 by γ1, rt+2 by γ2. After using 3 real rewards, the next thing we count is the critic's estimate of everything from step t+3 onward — and step t+3 is three steps ahead, so its whole value must be discounted by γ3 to sit on the same footing as the rewards. Using γ instead of γ3 would treat a far-future estimate as if it happened right now.
Real rewards: 0.90(1)+0.91(0)+0.92(2)=1+0+1.62=2.62.
Bootstrap tail: 0.93(10)=0.729×10=7.29.A^t(3)=2.62+7.29−4=5.91.
Recall Solution 2.4
Uniform: H=−(0.5ln0.5+0.5ln0.5)=−ln0.5=ln2≈0.6931.
Peaked: H=−(0.99ln0.99+0.01ln0.01)≈−(0.99(−0.01005)+0.01(−4.6052))≈0.0100+0.0461=0.0560.
The uniform policy has much higher entropy (more exploration); the peaked one is nearly collapsed. The −βH bonus in the actor loss rewards the high-entropy state, keeping the door open.
First verify the scores form a valid gradient of logπ: they must satisfy ∑aπaga=0 because ∑aπa∇logπa=∇∑aπa=∇1=0.
Check: 0.6(1)+0.4(−1.5)=0.6−0.6=0. ✓
Now the baseline term: ∑aπabga=b∑aπaga=7×0=0.Interpretation: the baseline factors out and multiplies a sum that is structurally zero. That is why we can subtract V(s) for free — the parent-note proof, made concrete.
Recall Solution 3.2
A^(1) (1-step) uses one real reward and leans heavily on the critic Vϕ. If the critic is wrong, this estimate is biased, but it is low variance (only one random reward inside).
A^(3) (3-step) uses three real rewards. It trusts the (possibly noisy) environment more and the critic less → less bias, more variance.
They differ numerically because they are different points on the same bias–variance dial; Generalized Advantage Estimation (GAE) blends all n smoothly to get the best of both.
Recall Solution 3.3
With a stop-gradient, only Vϕ(st) moves toward a fixed target — genuine learning.
Without it, the optimizer can shrink the loss by moving both ends together: it can push Vϕ(st+1) (inside the target) toward Vϕ(st), minimizing the squared difference without either being correct. You'd be "moving the goalposts to meet the ball." The value function collapses toward a self-consistent but meaningless constant. Hence: treat the target as a constant.
The figure below makes the trade-off visible: the flat magenta line is the low-variance 1-step (critic) estimate, and the widening orange envelope is the growing spread of n-step returns as n increases. Read it as: the further into the future you sum real rewards, the wider the cloud of possible advantage values — that width IS the extra variance you pay for lower bias.
A2C average: gˉ=41(0.8−0.2+0.5+0.1)=41(1.2)=0.3. One synchronous step of size ∝0.3.
A3C is asynchronous: each worker pushes its own gradient to the shared network the moment it's ready — no waiting, no averaging. This gives speed on many CPUs but noisier, order-dependent updates. A2C = "A3C Awaiting All workers."
Recall Solution 4.2
Set n=1. The sum has a single term k=0: γ0rt=rt. The bootstrap becomes γ1Vϕ(st+1). So
A^t(1)=rt+γVϕ(st+1)−Vϕ(st)=δt.The n-step family contains the TD error as its simplest member — exactly the Temporal-Difference Learning connection.
Recall Solution 4.3
Increase β, the entropy coefficient. Mechanism:
A collapsed policy has near-zero entropy H.
The term −βH in the loss becomes a large penalty when H is small (minimizing −βH means maximizingH).
Gradient descent therefore pushes π back toward a spread-out distribution → the agent explores again and can escape the bad local optimum.
This is the parent-note "keeps the door open" idea, quantified.
Take the expectation over the reward and next state, holding st,at fixed:
E[δt∣st,at]=E[rt+γV(st+1)∣st,at]−V(st).
By the definition of the action-value function, E[rt+γV(st+1)∣st,at]=Q(st,at) (this is the Bellman expectation for Q: reward now plus discounted value of wherever we land). Hence
E[δt∣st,at]=Q(st,at)−V(st)=A(st,at).■
So δt is an unbiased advantage estimate when the critic is perfect — the theoretical justification for "the TD error IS the advantage."
Recall Solution 5.2
(a) A^t=4+0.9(5)−6=4+4.5−6=2.5.
(b) −log(0.3)×2.5=−(−1.20397)×2.5=1.20397×2.5=3.0099. Positive advantage → minimizing this loss increases logπ → action becomes more likely. ✓
(c) target =rt+γVϕ(st+1)=4+4.5=8.5. Loss =21(8.5−6)2=21(2.5)2=21(6.25)=3.125.
Critic pushes Vϕ(st) from 6 up toward 8.5.
Recall Solution 5.3
Algebra (telescoping). Write out the sum of discounted TD errors:
∑k=0n−1γkδt+k=∑k=0n−1γk(rt+k+γVϕ(st+k+1)−Vϕ(st+k)).
Split into three running pieces:
=real rewardsk=0∑n−1γkrt+k+"forward" valuesk=0∑n−1γk+1Vϕ(st+k+1)−"backward" valuesk=0∑n−1γkVϕ(st+k).
Now look at the two value sums. The forward sum, reindexed with j=k+1, runs over j=1…n giving terms γjVϕ(st+j). The backward sum runs over k=0…n−1 giving terms γkVϕ(st+k). Every interior value γmVϕ(st+m) for m=1…n−1 appears once with + (from forward) and once with − (from backward), so they cancel. What survives is only the two endpoints:
the forward sum's last term γnVϕ(st+n),
the backward sum's first term −γ0Vϕ(st)=−Vϕ(st).
Therefore
∑k=0n−1γkδt+k=∑k=0n−1γkrt+k+γnVϕ(st+n)−Vϕ(st)=A^t(n).■Numeric check (n=2). Directly:
A^(2)=1+0.9(2)+0.92(8)−5=1+1.8+6.48−5=4.28.
Via TD errors:
δt=1+0.9(3)−5=1+2.7−5=−1.3,δt+1=2+0.9(8)−3=2+7.2−3=6.2.δt+γδt+1=−1.3+0.9(6.2)=−1.3+5.58=4.28.✓
Both routes give 4.28 — the identity holds.
The figure below shows the same telescoping visually: two TD-error arcs whose interior value term cancels, leaving only the endpoints.
Recall One-line self-audit of every numeric answer