Value-Function Geometry and Gradient-TD Methods
Why does the deadly triad diverge, and how do you stop it? This lesson develops the geometry that explains the failure: value functions as vectors, the projection operator onto the representable subspace, and the split between the Bellman error, the value error, and the projected Bellman error: the three objectives have different minimizers.
╌╌╌╌
This builds on off-policy methods and the deadly triad, which showed that function approximation, bootstrapping, and off-policy training together can send the weights to infinity — on a seven-state problem with linearly independent features, no less. That lesson named the failure but did not explain it. This lesson does, by picturing value functions as points in a vector space, and from that picture builds the two families of methods that make off-policy learning stable.
Linear value-function geometry
To understand why the triad diverges and how to fix it, it helps to picture value functions as vectors.1 Enumerate the states ; then any value function is the vector in an -dimensional space. The whole space holds every conceivable value function; most correspond to no policy at all.
A linear approximator with parameters can only reach a -dimensional subspace of that space — the plane of all representable by some weight vector. The true value of a policy generally lies outside this subspace, too complex to represent exactly.
To measure how far apart two value functions are, Euclidean distance is wrong: some states matter more because they are visited more often. Weight each state by the distribution (typically the on-policy distribution) and use the -norm
The projection operator takes any value function to the representable one closest in this norm:
where stacks the feature vectors as rows and is the diagonal matrix of the weights . The projection of the true value, , is the best representable approximation in the value-error sense, and the point Monte Carlo methods converge to.
Bellman error versus projected Bellman error
TD methods aim somewhere else. The Bellman operator applies one sweep of the Bellman equation:
Its unique fixed point is the true value: , which is just the Bellman equation rewritten. For any representable , the difference is the Bellman error vector — the expectation of the TD error at each state — and its squared -norm is the mean square Bellman error:
Here is the geometric crux. Applying to a representable value function generally produces one outside the subspace (the gray arrow leaving the plane in the figure). In pure dynamic programming, without approximation, you follow repeatedly and converge to . With approximation you cannot: after one Bellman step you must project back into the subspace to have a representable function, then step out again, then project back. The quantity TD methods drive to zero is the residual inside the subspace — the projected Bellman error:
The three objectives generally have different minimizers: is minimized at , at some other point, and at the TD fixed point . Semi-gradient TD, when it converges, converges to — but under off-policy training it need not converge at all.
A tempting fix is to do true gradient descent on the Bellman error itself (the residual-gradient algorithm), which is a genuine SGD method and converges. But two results rule it out as a general approach. First, on the A-split example it converges to the wrong values, minimizing a temporal-smoothing surrogate rather than accuracy. Second, and more fundamentally, the is not learnable: two Markov reward processes can produce identical data yet have different -minimizing weight vectors, so no algorithm working from feature vectors, actions, and rewards alone can minimize it.2 That leaves the , which is learnable, as the objective worth pursuing.
Gradient-TD methods
Gradient-TD methods perform true stochastic gradient descent on the .3 Because they follow an actual gradient, they inherit SGD's robust convergence — stable even under off-policy training and nonlinear approximation — at cost per step, only about double that of semi-gradient TD.
The derivation expands the in matrix form and differentiates. The key point in the algebra: the gradient factors into three pieces, and two of them share a random quantity (), so sampling each independently and multiplying would double-count the noise. Gradient-TD works around that one obstacle.
The gradient turns out to be a product of three expectations,
and the trouble is that the first and last factors both depend on the next feature , so sampling them independently and multiplying gives a biased estimate — the same double-sampling problem that afflicts the residual-gradient method. The Gradient-TD solution is to estimate and store the product of the last two factors as a second parameter vector ,
which is the solution to a least-squares problem and is learned by an importance-weighted LMS rule on a second, faster step size :
Given , the main weight vector is updated by a rule that is if the inner product is formed first. Two members of the family:
TDC (TD with gradient correction) is the semi-gradient TD update plus a correction term that supplies the missing half of the gradient. That single correction is the difference between divergence and convergence.
On Baird's counterexample TDC does exactly what the theory promises: the decays to zero and the weights stop growing. Notice the components do not all reach zero, so the value error stays near — the fixed point is not the best approximation in the sense — but the divergence is gone. GTD2 and TDC are two-time-scale methods: the correction estimate (fast, step size ) must track ahead of the primary weights (slow, step size ), which the convergence proofs formalize as a cascade requiring and . Gradient-TD is currently the best-understood and most widely used family of stable off-policy methods, with extensions to action values, control, and eligibility traces.
A note on emphatic-TD
Gradient-TD attacks the second part of the problem — the wrong update distribution — by building a true gradient method. Emphatic-TD attacks it differently: keep the simple, computationally cheap semi-gradient update, but reweight the states so the update distribution recovers the on-policy properties that make linear semi-gradient TD stable.4 Linear semi-gradient TD is stable on-policy precisely because the state distribution matches the transitions under ; emphatic-TD manufactures that match by scaling each update with an emphasis that accumulates responsibility for the current state through a recursive trace,
with the interest specifying how much we care about accurately valuing each state. In expectation, emphatic-TD converges to zero value error on Baird's counterexample; in practice its variance is so high that consistent results are hard to obtain, which is why the next section turns to variance-reduction techniques for all of these methods.
Reducing variance
Stability is only half the problem. Gradient-TD and emphatic-TD keep the weights from diverging, but off-policy learning is inherently higher-variance than on-policy learning, and that variance is what makes these methods slow and their results erratic in practice.5 The intuition is plain: if the data you receive is only loosely related to the policy you are trying to evaluate, you should expect to learn less about it. In the extreme you learn nothing — you cannot learn to drive by cooking dinner. Only when the target and behavior policies visit similar states and take similar actions is real progress possible.
Yet that overlap is what off-policy learning is for: any policy has many neighbors, similar-but-not-identical policies with considerable overlap, and the whole reason to learn off-policy is to generalize across that vast family of related policies from one stream of experience. So the variance cannot simply be avoided; it has to be managed.
Where the variance comes from
The specific source is the importance-sampling ratio. As we saw, off-policy targets are corrected by products of per-step ratios . Each ratio is in expectation, and successive ratios are uncorrelated, so their products are in expectation too — but their values swing from zero up to very large numbers, and a product of such terms has very high variance.5
A worked case shows how fast the product blows up. Let the behavior policy be uniform over two actions, , while the target policy is nearly deterministic, and . The per-step ratio is then when the behavior policy happens to sample and when it samples ; each occurs with probability , and the mean is , as it must be. Over a horizon of steps the cumulative ratio is a product of ten such draws. Its mean stays exactly , but its spread is enormous: an all- trajectory (probability ) carries , while a trajectory with even one is scaled down by the factor, and a mostly- trajectory carries a ratio near . The variance of the product grows geometrically in : a rare trajectory contributes a step roughly times the nominal size, and that single step dominates the average of thousands of ordinary ones.
The damage is done because these ratios multiply the step size in the SGD update: a large means a large step, which stochastic gradient descent cannot tolerate. SGD relies on averaging many small, noisy steps to estimate the true gradient; an occasional enormous step can move the parameter vector into a region of the space with a completely different gradient, and the averaging argument breaks. The obvious defense — shrinking the step size until no single step is dangerous — makes the expected step tiny and learning slow.
Five ideas for taming it
No single technique suffices, but several complementary strategies each reduce the variance.5
- Weighted importance sampling. Chapter 5 already showed that weighted importance sampling is far better behaved than the ordinary kind — its updates have much lower variance because the largest weight any sample can carry is bounded. The catch is that adapting weighted importance sampling to function approximation is genuinely hard, and can probably only be done approximately, at cost.
- Avoiding ratios entirely. The tree-backup algorithm performs off-policy learning without any importance-sampling ratios at all, by backing up the expected value under the target policy rather than correcting sampled actions. Extending that idea to the function-approximation case yields stable and more efficient methods, since where there are no ratios there is no ratio-variance.
- Momentum and averaging. Because the trouble is occasional large, uncorrelated steps, optimizer machinery that smooths the update sequence helps directly: momentum, Polyak–Ruppert averaging (averaging the iterates rather than trusting the latest one), and their extensions all damp the effect of a single outlier step.
- Adaptive, per-component step sizes. Rather than one global step size
limited by the worst-case ratio, methods that set a separate,
adaptively-tuned step size for each component of the parameter vector — and
importance-weight-aware
updates designed with these products in mind — let the learning rate respond to the local variance instead of being throttled globally. - Constraining the target toward the behavior. A complementary strategy defines
the target policy partly by reference to the behavior policy, so that it can
never differ enough to create huge ratios in the first place.
Recognizer
-style constructions cap how far may stray from , trading a little generality for a lot of stability.
None of these is decisive on its own, and the chapter is candid that off-policy
variance will probably always remain a challenge.
Which of these methods combine
effectively with the stable Gradient-TD and emphatic-TD updates is still an open
question — the whole area is young. But the framing is what matters: stability and
variance are separate problems. Gradient-TD and emphatic-TD solve the first;
these techniques address the second; and a usable off-policy method under function
approximation generally needs both.
The triad in deep reinforcement learning
Sutton and Barto present the triad as a theoretical hazard demonstrated on small linear problems. The obvious question — does it actually break the deep networks that now dominate practice? — was answered empirically after the second edition, and the answer is more nuanced than the theory alone suggests.
Van Hasselt, Doron, Strub, Hessel, Sonnerat, and Modayil (2018, Deep Reinforcement Learning and the Deadly Triad
) ran a controlled study on the 57-game Atari suite,
varying the ingredients of the triad in a deep Q-network and measuring how often the
action-value estimates blew up.6 With rewards clipped to and
, the largest possible true action value is about ;
they flagged any estimate that exceeded roughly that bound as soft divergence.
Their findings sharpen Sutton and Barto's picture on four points.
- Unbounded divergence is rare in practice. Soft divergence — estimates growing well past the reachable range — did occur, but the values essentially never ran off to infinity (floating-point NaN). The deep networks in current use apparently sit in a regime where the triad distorts the estimates without making them diverge, which is why DQN works at all despite carrying all three ingredients.
- Longer multi-step returns diverge less. Increasing the bootstrapping horizon (using -step returns instead of one-step targets) reduced both the frequency of soft divergence and the number of unstable runs, and improved control performance. More of the target comes from real returns and less from the bootstrapped estimate, weakening the leg of the triad that drives instability.
- Correcting overestimation helps. Target networks and double Q-learning — which was designed to cut the maximization bias in the Q-learning target — were the most stable variants. Reducing overestimation and decoupling the bootstrap target from the weights being updated both damp the runaway feedback.
- Bigger networks are not automatically safer. The intuition that a higher-capacity approximator, closer to tabular, should be more stable did not hold: larger networks showed more soft divergence, even though they also reached the best final performance. Capacity and stability trade off rather than align.
These results reconcile the theory with practice. The triad's danger is real — van Hasselt's own linear controls still diverge to infinity — but the specific architecture of deep Q-learning (target networks, experience replay, clipped rewards, multi-step returns) keeps the deep case in the soft-divergence regime where learning, though sometimes unstable, does not explode.
On the theory side, two lines extend Sutton and Barto's stable methods. Sutton, Mahmood, and
White (2016, An Emphatic Approach to the Problem of Off-policy Temporal-Difference Learning,
JMLR) gave the emphatic-TD method of §11.8 its formal footing: they proved
that emphasizing linear TD()'s updates by the emphasis weighting makes the
expected update stable under off-policy training, with a single learned weight
vector and a single step size — simpler than the two-time-scale Gradient-TD family,
at the cost of the higher variance the lesson already flagged.7 More
recently, Zhang, Yao, and Whiteson (2021, Breaking the Deadly Triad with a Target Network,
ICML) proved that a target network — the same trick DQN uses
heuristically — combined with a projection or ratio clipping yields a genuinely
convergent off-policy prediction and control algorithm under linear approximation,
turning DQN's empirical stabilizer into a method with a convergence guarantee.8
Together these results close much of the gap between Sutton and Barto's cautionary
counterexamples and the systems that run in production: the triad is still dangerous,
but there are now several principled ways to avoid its divergence.
Where this leaves us
Off-policy learning with approximation is the point where the clean guarantees of tabular RL give out. The first part of the challenge — correcting update targets with importance sampling — is routine, if variance-prone. The second part — the instability of bootstrapping under an off-policy update distribution — is the deadly triad, and it is real enough to send a linearly-independent seven-state problem to infinity. Two responses restore stability without abandoning any leg of the triad: Gradient-TD methods, which do true SGD on the projected Bellman error at cost, and emphatic-TD methods, which reweight updates back toward the on-policy distribution. Both remain relatively young and unsettled. The most consequential practical answer arrives later: deep Q-networks keep function approximation, bootstrapping, and off-policy replay all at once, and stabilize the triad empirically with a target network and a replay buffer rather than by giving anything up.
Footnotes
- Sutton & Barto, §11.4 — Linear Value-function Geometry, and Figure 11.3: value functions as vectors, the -dimensional representable subspace, the -norm (11.11), the projection operator (11.12) and its matrix form (11.14)–(11.16), the Bellman operator (11.20) with fixed point (11.21), the Bellman error vector (11.17)–(11.19), and the projected Bellman error (11.22) with its TD fixed point . ↩
- Sutton & Barto, §11.5 — Gradient Descent in the Bellman Error (the naive residual-gradient algorithm (11.23), the A-split and A-presplit examples showing minimization finds the wrong values), and §11.6 — The Bellman Error is Not Learnable: two MRPs generating identical data with different -minimizers, so cannot be estimated from feature vectors, actions, and rewards alone, while and are learnable (Figure 11.4). ↩
- Sutton & Barto, §11.7 — Gradient-TD Methods: SGD on the , the matrix expansion (11.25)–(11.27), the product-of-expectations gradient and its double-sampling obstacle, the stored auxiliary vector (11.28) learned by an importance-weighted LMS rule, the GTD2 and TDC / GTD(0) updates (11.29 and following), Figure 11.5 showing TDC drive the to zero on Baird's counterexample, and the two-time-scale / cascade convergence argument. ↩
- Sutton & Barto, §11.8 — Emphatic-TD Methods: reweighting states to recover the on-policy distribution's stability under semi-gradient TD, the emphasis and interest , the one-step emphatic-TD update, Figure 11.6 showing convergence in expectation on Baird's counterexample, and the high-variance caveat that motivates the variance-reduction methods of §11.9. ↩
- Sutton & Barto, §11.9 — Reducing Variance: off-policy learning as inherently higher-variance than on-policy (
you can't learn to drive by cooking dinner
); the raison d'être of generalizing to related-but-not-identical policies; the source of variance in products of policy ratios (mean 1 by (5.13), uncorrelated, but of high variance) multiplying the SGD step size and producing occasional very large steps; and the surveyed remedies — weighted importance sampling with its -approximation difficulty (Mahmood and Sutton, 2015), the tree-backup route to ratio-free off-policy learning (Munos et al., 2016; Mahmood, Yu and Sutton, 2017), momentum and Polyak–Ruppert averaging, adaptive per-component and importance-weight-aware step sizes (Jacobs, 1988; Karampatziakis and Langford, 2010), and constraining the target to the behavior viarecognizers
(Precup et al., 2006). ↩ ↩2 ↩3 - H. van Hasselt, Y. Doron, F. Strub, M. Hessel, N. Sonnerat, and J. Modayil,
Deep Reinforcement Learning and the Deadly Triad,
arXiv:1812.02648 (2018). A controlled study on the 57-game Atari suite measuring how the triad's ingredients affect divergence of a deep Q-network: unbounded divergence is rare (soft divergence, above the reachable value bound , is common but values stay finite); longer multi-step returns reduce instability; target networks and double Q-learning are the most stable; and larger networks show more soft divergence though they perform best. Grounds the claim that DQN's architecture keeps the deep triad in a soft-divergence regime. ↩ - R. S. Sutton, A. R. Mahmood, and M. White,
An Emphatic Approach to the Problem of Off-policy Temporal-Difference Learning,
Journal of Machine Learning Research 17(73):1–29 (2016). Proves that emphasizing linear TD()'s updates makes its expected update stable under off-policy training, with one learned weight vector and one step size — simpler than Gradient-TD; the formal basis for the emphatic-TD method of §11.8. ↩ - S. Zhang, H. Yao, and S. Whiteson,
Breaking the Deadly Triad with a Target Network,
Proceedings of the 38th International Conference on Machine Learning (ICML 2021). Shows that a target network combined with a projection / ratio truncation gives a provably convergent off-policy prediction and control algorithm under linear function approximation, supplying a convergence guarantee for the target-network trick that DQN uses only heuristically. ↩
╌╌ END ╌╌