Compatible Features & Two-Timescale Actor–Critic
When a critic leaves the gradient unbiased, and why actor–critic converges.
A critic that approximates badly would seem to doom the actor to a wrong gradient. Not necessarily: if the critic's features are the actor's own score functions and its weights solve a least-squares problem, the gradient is exact, and the weights themselves are the natural gradient. This lesson proves both facts, then turns to the stochastic-approximation theory that explains why an actor and a critic learning at the same time converge, and to what finite-time analyses add.
What you’ll learn
- State and prove the compatible function approximation theorem, and explain why only the projection of onto the span of the score functions matters.
- Show that compatible critic weights are the natural gradient , and describe natural actor–critic algorithms.
- State the two-timescale stochastic approximation theorem and the Konda–Tsitsiklis convergence result for actor–critic, with their conditions.
- Summarize finite-time sample-complexity results for actor–critic and what they assume.
When a critic leaves the gradient exact
Write for the score and for the on-policy state–action distribution, with inner product . The discounted policy gradient theorem is then a set of inner products:
Konda and Tsitsiklis drew the consequence. lives in a space with one dimension per state–action pair, yet the gradient sees it only through its inner products with the score functions, one per policy parameter. Any function with the same projection onto gives the same gradient, so a critic need only learn that projection, a much smaller object.
At the minimizer the residual is orthogonal to every feature, the normal equations of least squares:
Rearranged, they say the critic and have the same inner products with the scores. The critic may be wrong everywhere; its error is orthogonal to the only directions the gradient looks at.
Three consequences.
- A compatible critic estimates advantages. Because , every has mean zero under the policy in each state. It can represent advantage-like functions but not , so its least-squares fit to is also its fit to , and in practice it is paired with a separate state-value function for bootstrapping and baselines.
- For a Gaussian policy it is local and linear. With mean and fixed , , so is linear in : a first-order model of the advantage around the mean action, the object the deterministic policy gradient differentiates.
- TD learning does not minimize this error. The theorem needs the least-squares fit of under , which Monte Carlo regression on samples from provides. TD(λ) with converges elsewhere, to the fixed point of a projected Bellman equation (The Projected Bellman Equation & LSTD). The gap returns in the convergence theorems below.
Compatible weights are the natural gradient
The normal equations say more. Expanded, they read , and the matrix on the left is the policy's Fisher information averaged over states.
One state, two actions, , values and . The scores are and , so
Hence , whatever , and the fitted critic is exactly the advantage :
The plain gradient shrinks like as the policy becomes deterministic; the natural gradient does not, because dividing by the Fisher information undoes exactly that shrinkage. For a tabular softmax policy the same computation gives equal to the advantages up to a constant in each state: the multiplicative-weights update of Global Convergence of Policy Gradients.
Natural actor–critic. Peters and Schaal (2008) built natural actor–critic algorithms on this identity: estimate the compatible weights by least squares, with LSTD-Q(λ) or, in the episodic version eNAC, by regressing returns on summed scores, and step the actor along them. Bhatnagar, Sutton, Ghavamzadeh and Lee (2009) gave four incremental natural actor–critic algorithms with two-timescale convergence proofs for the average-reward criterion. Thomas (2014) later showed that several discounted natural actor–critics, including NAC-LSTD and eNAC, drop the factor and so are biased estimates of the discounted natural gradient (The Policy Gradient Theorem in Depth).
Why is a compatible critic usually paired with a separate state-value function?
- Because compatible features are too expensive to compute
- Because the compatible critic gives a biased gradient
- Because has mean zero under the policy in every state, so it can represent advantages but not , which bootstrapped targets and baselines need
- Because the natural gradient needs two critics
Show the answer
C. Because has mean zero under the policy in every state, so it can represent advantages but not , which bootstrapped targets and baselines need
. The compatible critic therefore spans only advantage-like functions. A TD critic needs values to bootstrap from, and those come from a separate , which, being a function of the state alone, does not change the gradient.
Two timescales
The compatible-features theorem assumes the critic has converged for the current policy. In an actor–critic both learn at once. Two-timescale stochastic approximation makes the intuitive fix rigorous: let the critic run on a faster timescale (the ODE method behind it is introduced in Convergence of TD: Stochastic Approximation).
Seen from the slow actor, the critic has always just converged, so the actor follows ; seen from the fast critic, the actor stands still. For actor–critic the slow ODE is approximately gradient ascent on a non-concave objective, which has no globally stable equilibrium in general, so the conclusions weaken to statements about stationary points.
Freeze the actor at . A TD(1) critic converges to the least-squares projection onto its features, and by the compatible-features argument that projection yields the exact gradient:
A TD(λ) critic with converges instead to the fixed point of a projected Bellman equation, which differs from unless lies in the span of the features. The actor then follows a perturbed gradient, with a perturbation that shrinks as :
Use as a Lyapunov function. Along the actor's ODE it decreases whenever exceeds , so trajectories keep returning to the region where the gradient is at most the perturbation. Translating this from the ODE back to the stochastic iterates gives a statement whose gap closes only as .
Bhatnagar et al. (2009) extended this line to TD(0) critics and natural gradients. Their guarantees take the same conditional form: when the critic's approximation error is small enough, the actor converges almost surely to a small neighborhood of the local maxima of the average reward.
Finite-time results, and the gap to practice
Asymptotic theorems say nothing about how many samples are needed. Since about 2019, finite-time analyses of actor–critic have appeared, typically for linear critics and Markovian sampling. Two examples:
- Wu, Zhang, Xu and Gu (2020): two-timescale actor–critic reaches an -stationary point, up to the critic's approximation error, with samples.
- Xu, Wang and Liang (2020): with mini-batches and several critic updates per actor step, actor–critic needs samples to reach an -stationary point, and natural actor–critic samples to come within of the global optimum, up to the approximation errors of the actor's and the critic's function classes.
The natural actor–critic result is a global one because natural gradients inherit the gradient-domination structure of Global Convergence of Policy Gradients, with an extra error term for how well the compatible features can represent the advantage.
Key takeaways
- The policy gradient sees only through its projection onto the span of the score functions; a critic linear in the scores and fitted by least squares under gives the exact gradient.
- Compatible critics have mean zero under the policy, so they estimate advantages, and their weights are the natural gradient, : following them is natural actor–critic.
- Two-timescale stochastic approximation lets a fast critic track a slow actor. Konda and Tsitsiklis proved with a TD(1) critic, and with TD(λ) for near 1.
- Finite-time analyses give polynomial sample complexities, such as for two-timescale actor–critic, for linear critics under Markovian sampling; deep actor–critics meet such conditions only loosely.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
Under which conditions does the compatible function approximation theorem make the critic-based policy gradient exact?
- The critic is any neural network trained by TD(0)
- The critic is linear in the score features (or in features whose span contains them) and is the least-squares fit of under the on-policy state–action distribution
- The critic is exact in every state
- The policy is deterministic
Show the answer
B. The critic is linear in the score features (or in features whose span contains them) and is the least-squares fit of under the on-policy state–action distribution
The proof uses only the normal equations of that least-squares problem: the residual is orthogonal to every score function, which is all the gradient sees. An exact critic would also do, but it is far more than needed.
In the two-action example with and a logistic parameterization, what are the compatible critic's least-squares weights ?
- , whatever the value of
Show the answer
D. , whatever the value of
and , so . It is the natural gradient, and unlike the plain gradient it does not vanish as or .
In two-timescale actor–critic with step sizes for the critic and for the actor, which condition says that the actor is the slower learner?
- for all
Show the answer
A.
If , then over any stretch in which the critic moves an appreciable amount, the actor barely moves, so the critic can track for an effectively frozen policy. Both sums must still diverge, so that each learner can travel arbitrarily far.
Why does Konda and Tsitsiklis's result for a TD(λ) critic with guarantee only , for near 1?
- Because TD(λ) diverges for
- Because the step sizes cannot satisfy the two-timescale conditions when
- Because TD(λ) with converges to a projected Bellman fixed point rather than the least-squares projection of , so the actor follows a perturbed gradient whose error vanishes only as
- Because the average cost is not differentiable
Show the answer
C. Because TD(λ) with converges to a projected Bellman fixed point rather than the least-squares projection of , so the actor follows a perturbed gradient whose error vanishes only as
The compatible-features argument needs the least-squares projection, which TD(1) computes. For the critic's fixed point is biased unless lies in the feature span, and that bias perturbs the actor's ODE by an amount that shrinks as .
Further reading
- R. S. Sutton, D. McAllester, S. Singh & Y. Mansour, "Policy gradient methods for reinforcement learning with function approximation," NIPS 12 (2000).
- V. R. Konda & J. N. Tsitsiklis, "On actor-critic algorithms," SIAM Journal on Control and Optimization 42(4), 1143–1166 (2003).
- S. M. Kakade, "A natural policy gradient," NIPS 14 (2001).
- V. S. Borkar, "Stochastic approximation with two time scales," Systems & Control Letters 29(5), 291–294 (1997).
- S. Bhatnagar, R. S. Sutton, M. Ghavamzadeh & M. Lee, "Natural actor–critic algorithms," Automatica 45(11), 2471–2482 (2009).