Skip to content
intermediate

Trace a Linear Counterexample to the Deadly Triad

Everyone repeats that the deadly triad diverges. Almost nobody watches it happen. So let's build a predictor small enough to update by hand, then watch the…

Published 2026-10-02Updated 2026-10-048 min read
Vibrant blue car speeding on an open road during a serene sunset.
Vibrant blue car speeding on an open road during a serene sunset. Photo by Cedé Joey on Pexels.

Everyone repeats that the deadly triad diverges. Almost nobody watches it happen. So let's build a predictor small enough to update by hand, then watch the parameters walk away from the fixed point while the predictions barely move.

This is a trace, not a proof. We will set up a linear value predictor, train it with semi-gradient TD(0) on off-policy samples, and compute the first few updates with real numbers. By the end you should be able to point at the exact term that lets the parameters grow, and you should know precisely how much the example does and does not claim.

What We Are Actually Building

We are solving a prediction problem, not a control problem. We estimate V(s)V(s), the value of a state under a fixed target policy, and we never touch policy improvement. That matters because it isolates the instability. If the parameters blow up here, no amount of action selection or exploration tuning explains it away.

The whole system is deliberately tiny: a handful of states, a linear parameter vector, one feature matrix. Small enough that you can check every number with a calculator.

I am assuming you already know the three ingredients individually — bootstrapping, function approximation, and off-policy learning — and that you have seen why a table behaves differently from a parameterized function. If that is shaky, read the triad overview and the tabular-versus-approximation comparison first; we will not re-derive them here.

The deliverable is a numeric trace of parameter updates, plus a clear statement of what the example proves and what it leaves untouched.

Notation and the Linear Prediction Setup

A three-stage sequence shows a sampled transition from s to s′ with reward r, the TD error δ = r + γV(s′; θ) − V(s; θ), and the update θ ← θ + αδφ(s). The current-state feature φ(s) is highlighted as the update direction; the bootstrapped target is not differentiated.
The semi-gradient update uses the current-state feature as its direction while the target includes the next-state estimate.

Define the value estimate as a linear combination of features:

V(s;θ)=θ⊤ϕ(s)V(s; \theta) = \theta^\top \phi(s)

where ϕ(s)∈Rd\phi(s) \in \mathbb{R}^d is the feature vector for state ss and θ∈Rd\theta \in \mathbb{R}^d is the parameter vector we are learning. Stack the state feature vectors as rows of a matrix Φ\Phi. The choice of Φ\Phi matters far more than the choice of step size in this example, and that is the whole point.

Two policies appear:

  • μ\mu, the behavior policy, which generates the transitions we actually observe.
  • π\pi, the target policy, whose value function we want to estimate.

They differ. That difference is the off-policy ingredient, and it is not cosmetic — it changes which states get visited and how often.

Fix a discount factor γ∈[0,1)\gamma \in [0, 1) and a step size α>0\alpha > 0. For a sampled transition (s,r,s′)(s, r, s'), the TD error is:

δ=r+γV(s′;θ)−V(s;θ)\delta = r + \gamma V(s'; \theta) - V(s; \theta)

The update rule is:

θ←θ+α δ ∇θV(s;θ)\theta \leftarrow \theta + \alpha \, \delta \, \nabla_\theta V(s; \theta)

Since V(s;θ)=θ⊤ϕ(s)V(s; \theta) = \theta^\top \phi(s), the gradient is just ϕ(s)\phi(s). So the update becomes:

θ←θ+α δ ϕ(s)\theta \leftarrow \theta + \alpha \, \delta \, \phi(s)

Look closely at that gradient. It is taken only on the current estimate V(s;θ)V(s; \theta), not on the bootstrapped target r+γV(s′;θ)r + \gamma V(s'; \theta). The target also depends on θ\theta, but we ignore its derivative. That single omission is the semi-gradient move, and it is where the trouble lives.

Knowledge check

Check your understanding

Answer this question before you continue.

For a sampled transition $(s,r,s')$, which feature vector directly scales the parameter update in the article's semi-gradient rule?
Single Choice

Focus: Identify which feature vector scales a semi-gradient TD update for a sampled transition.

Why the Feature Matrix Is the Trap

Here is the structural condition that makes this example diverge, and it is worth understanding before any arithmetic.

The feature vectors are arranged so that the parameter vector can grow while the represented value function stays nearly unchanged. In other words, there is a direction in parameter space along which Φθ\Phi \theta is almost constant. The data does not pin the parameters down; it only pins down the predictions.

Under on-policy sampling, the state distribution would weight updates so that this loose direction gets damped. Under off-policy sampling, the states that would correct the growing direction are visited less often than the states that amplify it. The correction never arrives.

Contrast this with a table. In a tabular representation, each state owns its own parameter. There is no shared direction for error to accumulate along, because no two states write to the same number. Function approximation couples states through shared weights, and off-policy sampling changes which couplings actually get corrected. That coupling is the hidden constraint worth remembering.

Knowledge check

Check your understanding

Answer this question before you continue.

Why can this setup's parameters grow while its represented values change only slightly?
Misconception Check

Focus: Explain how shared features can allow parameter growth without comparably large changes in predictions.

Tracing the First Updates by Hand

Now the numbers. I will use a compact version of the classic Baird-style construction: a set of states whose feature vectors share a common component, with a behavior policy that over-samples the states pushing the shared component up.

Set γ=0.99\gamma = 0.99 and α=0.1\alpha = 0.1. Initialize every parameter to 11. Suppose we have two states of interest with feature vectors:

ϕ(s1)=[2,0,1]⊤,ϕ(s6)=[0,2,1]⊤\phi(s_1) = [2, 0, 1]^\top, \qquad \phi(s_6) = [0, 2, 1]^\top

With θ=[1,1,1]⊤\theta = [1, 1, 1]^\top:

V(s1)=2(1)+0(1)+1(1)=3V(s_1) = 2(1) + 0(1) + 1(1) = 3 V(s6)=0(1)+2(1)+1(1)=3V(s_6) = 0(1) + 2(1) + 1(1) = 3

First transition: s1→s6s_1 \to s_6 with reward r=0r = 0.

δ=0+0.99⋅3−3=−0.03\delta = 0 + 0.99 \cdot 3 - 3 = -0.03

The gradient with respect to θ\theta is ϕ(s1)=[2,0,1]⊤\phi(s_1) = [2, 0, 1]^\top. Apply the update:

θ←[1,1,1]⊤+0.1⋅(−0.03)⋅[2,0,1]⊤=[0.994,1,0.997]⊤\theta \leftarrow [1, 1, 1]^\top + 0.1 \cdot (-0.03) \cdot [2, 0, 1]^\top = [0.994, 1, 0.997]^\top

Small correction. Fine.

Second transition: now suppose the behavior policy feeds us s6→s6s_6 \to s_6 with reward r=0r = 0, a self-loop that the target policy would rarely take.

V(s6)=0(0.994)+2(1)+1(0.997)=2.997V(s_6) = 0(0.994) + 2(1) + 1(0.997) = 2.997

δ=0+0.99⋅2.997−2.997=−0.02997\delta = 0 + 0.99 \cdot 2.997 - 2.997 = -0.02997

Update with ϕ(s6)=[0,2,1]⊤\phi(s_6) = [0, 2, 1]^\top:

θ←[0.994,1,0.997]⊤+0.1⋅(−0.02997)⋅[0,2,1]⊤=[0.994,0.994,0.994]⊤\theta \leftarrow [0.994, 1, 0.997]^\top + 0.1 \cdot (-0.02997) \cdot [0, 2, 1]^\top = [0.994, 0.994, 0.994]^\top

Notice what happened. The parameters moved together, and the value estimates barely budged — V(s1)V(s_1) is still about 2.982.98. The predictions are stable-looking. The parameters are not converging to anything meaningful; they are sliding along the loose direction I described earlier.

If you keep feeding self-loops and shared-feature transitions under this behavior policy, the shared component keeps absorbing updates. The norm of θ\theta climbs. The predictions drift slowly. The divergence lives in the parameters first.

Note: This is why watching the loss alone can fool you. A nearly flat value-error curve can hide a parameter vector that is quietly growing without bound.

Knowledge check

Check your understanding

Answer this question before you continue.

Starting from $\theta=[1,1,1]^\top$, apply the stated update to the transition $s_1\to s_6$ with $r=0$, $\gamma=0.99$, $\alpha=0.1$, $V(s_1)=V(s_6)=3$, and $\phi(s_1)=[2,0,1]^\top$. What is the resulting parameter vector?
Output Prediction

Focus: Compute the parameter vector after one semi-gradient TD update using the article's first transition.

Why the Updates Keep Growing

Connect the arithmetic back to the mechanism.

The target r+γV(s′;θ)r + \gamma V(s'; \theta) is built from the same θ\theta being updated. An error in θ\theta becomes part of the next target, which produces the next error. That is the bootstrapping feedback loop: the estimate feeds itself.

Because the behavior policy μ\mu differs from the target policy π\pi, the states that would pull the shared component back down are under-visited. The states that push it up are over-visited. Off-policy sampling keeps feeding the unstable direction.

And the semi-gradient ignores the derivative of the target. There is no term in the update that pulls the parameters back toward a fixed point. The update has no restoring force.

Compare tabular TD with on-policy sampling. There, the update is a contraction: each state's estimate moves toward a target that depends on other states' estimates, and the whole system contracts toward a reachable fixed point. Remove the table and the on-policy distribution, and the contraction argument no longer holds.

Knowledge check

Check your understanding

Answer this question before you continue.

In the article's explanation of continued growth, what role does the behavior policy's difference from the target policy play?
Scenario Interpretation

Focus: Relate off-policy state visitation to the correction of a growing shared parameter direction.

What This Example Does Not Prove

Bound the claim before you over-generalize.

Divergence here is a property of this update rule under these assumptions. It is not a universal law that all function-approximation RL diverges. Plenty of function-approximation methods converge under the right conditions.

This is a prediction problem with a fixed policy. It says nothing directly about control algorithms, and nothing about deep networks that carry stabilization machinery this example lacks — target networks, regularization, replay with bounded targets, or on-policy data collection.

Practical systems often stay stable precisely because of those mechanisms. The correct reading is a warning about assumptions, not a verdict on function approximation.

How to Use This as a Debugging Lens

Turn the theory into a diagnostic you can run.

When value estimates blow up, check the three ingredients in order:

  1. Is the target bootstrapped? If you replaced it with a Monte Carlo return, does the instability vanish?
  2. Is the representation shared across states? If you switch to a table for a small version of the problem, does it stabilize?
  3. Is the data off-policy? If you collect on-policy, does the growth stop?

Watch the parameter norm, not just the loss. A stable-looking loss can hide a growing parameter vector, as the trace above showed.

If you can switch to on-policy data or a tabular representation for a small version of the problem, do it and see whether the instability disappears. That isolates the cause instead of guessing. And evaluate across repeated runs and learning curves rather than trusting a single trajectory — one lucky seed can mask a structural problem.

The next step is concrete: reproduce this trace in a few lines of code, then deliberately remove one ingredient — make the sampling on-policy, or replace the shared features with a table — and watch the behavior change. When you see divergence in your own experiments, do not assume a bug. First ask which of the three ingredients is present, and whether your representation gives the parameters room to grow without changing the predictions.

Knowledge check

Final check

Finish the article by checking the ideas you just learned.

Which conclusion is warranted by the article's counterexample?
Question 1 of 2Comparison Reasoning

Focus: Distinguish the example's specific instability result from a universal claim about function approximation.

A run's value-error curve looks nearly flat, but you suspect instability is hidden in the representation. Which additional quantity does the article specifically recommend watching?
Question 2 of 2Scenario Interpretation

Focus: Choose a diagnostic that can reveal hidden parameter growth when value error appears stable.

References

  1. Breaking the Deadly Triad with a Target Networkproceedings.mlr.press
Practical resource

Build a stronger RL mental model

Use structured resources to connect equations, algorithms, and observable agent behavior.

Browse resources
Related sites

Continue across related AI foundations

Use LearnPyFast for Python foundations and LearnLLMFast for practical language-model and agent application concepts.

Python tutorialstutorial

LearnPyFast

Beginner-friendly Python tutorials, examples, and learning paths for practical programming foundations.

PythonProgrammingBeginners
Visit LearnPyFast
LLM tutorialstutorial

LearnLLMFast

Practical LLM tutorials for builders who want to understand prompting, workflows, agents, and AI applications.

LLMAIBuilders
Visit LearnLLMFast

Keep learning

Related reinforcement learning tutorials

Continue with nearby RL concepts, algorithms, and experiments that build on the same decision process.