Off-Policy Methods and the Deadly Triad
Off-policy learning with function approximation is where the convergence guarantees of reinforcement learning fail. We extend the tabular off-policy updates to semi-gradient form with per-step importance sampling, show Baird's counterexample driving the weights to infinity, and identify the cause: the deadly triad of function approximation, bootstrapping, and off-policy training — any two are safe, all three can diverge.
╌╌╌╌
Off-policy learning was almost free in the tabular case. Q-learning bootstrapped toward the greedy target while a behavior policy explored, and the value table converged. Add function approximation and that convenience collapses. The combination of learning off-policy, updating from an existing estimate, and generalizing across states with a parameter vector can make the weights diverge to infinity — not on a contrived pathology, but on a seven-state Markov process with a linearly independent feature set. This lesson is about why, and about the two families of methods that repair it.1
The challenge splits cleanly in two. The first part is correcting the target of each update: the behavior policy samples actions the target policy would not, so the update must be reweighted by an importance-sampling ratio. That part carries over from the tabular case unchanged. The second part is that the distribution of updates no longer matches the on-policy distribution, and that mismatch is what breaks stability. The bulk of this lesson is the second part.
Semi-gradient off-policy methods
Converting a tabular off-policy algorithm to function approximation is mechanical: replace the update to a table entry ( or ) with an update to the weight vector , using the approximate value and its gradient .2 Every per-step off-policy method uses the importance-sampling ratio
the relative probability that the target and behavior policies take the action actually taken. The one-step state-value method, semi-gradient off-policy TD(0), takes the on-policy rule and multiplies in :
The ratio scales the whole update by how much the target policy favored this transition. When would never take , and the transition contributes nothing; when favors it more than did, and the update is amplified.
These methods are called semi-gradient because contains a bootstrapped estimate that also depends on , yet the gradient is taken only of the current-state term . The update follows part of the gradient of the squared error, not all of it. In the tabular case they are provably convergent; the trouble is what the missing half does once features are shared across states.
The action-value case is analogous: semi-gradient Expected Sarsa uses no importance sampling in its one-step form, because the only action sampled is and its target already averages over ; the multi-step generalizations of both state- and action-value methods reintroduce products of ratios .
Examples of off-policy divergence
To see the instability in miniature, take the smallest possible example.3 Two states have estimated values and under a single scalar weight — the feature vectors are the numbers and . One action is available in the first state, deterministically transitioning to the second with reward .
The reward is zero, (only one action, so both policies must take it), and the TD error on the transition is
The semi-gradient TD(0) update is therefore
Each step multiplies by the constant . Whenever that constant exceeds , and grows without bound regardless of how small is — the step size sets the rate of divergence, not whether it happens. The mechanism is off-policy: this transition can occur over and over without being pulled back by the transitions out of the state, because the behavior policy takes actions there that the target policy never would. The promised future value is never checked against real outcomes.
Put numbers on it. Take , , and start from . The multiplier is , so the weight is a geometric sequence : it reaches , , , . The estimated values and climb together, and because the reward is zero and the true value is zero, the value error grows in lockstep. Halving the step size to only changes the multiplier to and slows the climb — instead of — without ever turning the growth around. Drop to and the multiplier is exactly : the weight sits still, neither converging nor diverging, the boundary below which the fragment is safe.
Baird's counterexample
The fragment is suggestive but incomplete. Can a full MDP actually diverge? Yes — Baird's counterexample is the standard demonstration.4 It is an episodic seven-state, two-action MDP. The dashed action sends the system to one of the six upper states with equal probability; the solid action sends it to the seventh (lower) state. The behavior policy picks dashed with probability and solid with , making the next-state distribution uniform. The target policy always takes solid, so its on-policy distribution is concentrated on the seventh state. Every reward is zero and .
The state values use an over-parameterized linear form: the six upper states are and the seventh is , with weight vector . Because all rewards are zero, the true value is everywhere, exactly representable by . The feature vectors are linearly independent. By every conventional measure this is a favorable case for linear approximation — and it diverges anyway.
Apply semi-gradient off-policy TD(0) and the weights diverge to infinity for any positive step size. The divergence is not caused by sampling noise or asynchrony. If the expected update is done synchronously across all states — a dynamic-programming update, no randomness at all —
it still diverges. The only unconventional ingredient is that the update distribution is uniform (the behavior distribution) rather than on-policy. Restore the on-policy distribution and convergence returns.
The point of Baird's counterexample: semi-gradient TD and a DP-style expected update are among the simplest, best-understood bootstrapping methods, and linear approximation is the simplest, best-understood function approximator, yet their combination under an off-policy update distribution is unstable. Similar counterexamples exist for Q-learning, whose tabular convergence guarantees are otherwise the strongest of any control method.
The deadly triad
The danger can be named precisely. Instability and divergence arise whenever three elements are combined; Sutton calls them the deadly triad.5
The framing is useful because it identifies what could be given up. Consider each:
- Function approximation cannot be surrendered. Problems too large to tabulate are the entire point of approximation; state aggregation and nonparametric methods are either too weak or too expensive, and least-squares methods like LSTD are — prohibitive at scale.
- Bootstrapping can be given up (that is Monte Carlo), at real cost in data and computational efficiency. Bootstrapping learns faster because it exploits the state property — recognizing a state on return — and it lets data be processed once and discarded rather than stored to the end of an episode. It is worth keeping.
- Off-policy training can sometimes be given up: Sarsa instead of Q-learning, on-policy control instead of off-policy. But off-policy learning is what enables learning many things in parallel from one stream of experience — many target policies and predictive questions sharing a single behavior policy — a capability we would very much like to keep for building predictive world models.
Two clarifications matter. The danger is not specific to control or generalized policy iteration; it appears in the simpler prediction case whenever the triad is complete. And it is not caused by learning or by uncertainty about the environment: it occurs just as strongly in planning with a fully known model, as Baird's synchronous DP update shows.
The triad reappears in deep Q-networks: DQN keeps all three ingredients — a neural-network approximator, TD bootstrapping, and off-policy replay — but stabilizes them with a slowly-updated target network and an experience-replay buffer that between them break the correlations driving the instability.
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, with no sampling noise required.
Naming the failure does not fix it. Why the triad diverges — and the two families of methods that stop it without giving up any leg of the triad — needs a geometric picture of what TD methods are minimizing. That continues in value-function geometry and Gradient-TD methods.
Footnotes
- Sutton & Barto, Reinforcement Learning: An Introduction (2nd ed.), Ch. 11 — introduction: the two-part challenge of off-policy learning with function approximation (correcting the target with importance sampling, and correcting the update distribution), and the observation that semi-gradient methods address the first part but may diverge on the second. ↩
- Sutton & Barto, §11.1 — Semi-gradient Methods: converting tabular off-policy algorithms to weight-vector updates, the per-step importance-sampling ratio (11.1), semi-gradient off-policy TD(0) (11.2)–(11.4), semi-gradient Expected Sarsa (11.5) without importance sampling, and the -step and tree-backup generalizations (11.6)–(11.8). ↩
- Sutton & Barto, §11.2 — Examples of Off-policy Divergence: the -to- fragment, the TD error , the update multiplier , and the argument that repeated off-policy updates without compensating transitions send to infinity whenever . ↩
- Sutton & Barto, §11.2, Figure 11.1 and Figure 11.2: Baird's counterexample — the episodic seven-state, two-action MDP with the / linear parameterization, behavior probabilities dashed and solid, , and the demonstration that both semi-gradient off-policy TD and the synchronous DP update (11.9) diverge though the true value is zero and exactly representable. ↩
- Sutton & Barto, §11.3 — The Deadly Triad: function approximation, bootstrapping, and off-policy training as the three ingredients whose combination risks divergence; the argument that any two are safe; that the danger is not specific to control and not caused by learning or environmental uncertainty; and the case-by-case discussion of which leg could be given up. ↩
╌╌ END ╌╌