Semi-Gradient Methods with Function Approximation

Imagine a robot arm with continuous joint angles. Or imagine a game with more states than atoms in the observable universe. Tabular Temporal Difference Learning simply cannot store a value for every state. So we must approximate the value function with a parametric model. This could be linear features, a neural network, or anything with far fewer parameters than states. The natural instinct is to treat this like supervised learning. Define a loss, take its gradient, and descend. But TD methods bootstrap. They build their own targets from the very estimates they are updating. This creates a subtlety that trips up almost everyone the first time they see it. The TD target itself depends on the weight vector. This is because it is built from an approximate value function. A "true" gradient-descent update would differentiate through that dependency. But doing so turns out to hurt more than it helps in practice. It also complicates the update rule. Semi-gradient methods make a deliberate, well-motivated approximation. They differentiate only the current estimate. The bootstrapped target is treated as if it were a fixed constant. This is not sloppiness. It is a considered design choice with real consequences for convergence. Understanding it precisely is essential to using TD methods safely at scale. This article gives you the exact update rules for semi-gradient TD(0), semi-gradient Sarsa, and semi-gradient TD(λ) with eligibility traces. These apply under linear and general function approximation. We derive why the "semi" gradient is not a true gradient of any single fixed objective. We explain the projected Bellman error framework, which does have a well-defined fixed point. We state precisely when convergence is guaranteed (linear, on-policy). We also state when it can fail spectacularly (nonlinear or off-policy). This sets up the article's natural sequel: what happens when function approximation, bootstrapping, and off-policy data appear together — the deadly triad. Every modern deep reinforcement learning algorithm — DQN, actor-critic methods, PPO's value baseline — is, underneath, a semi-gradient method. Understanding exactly what approximation is being made is essential. So is understanding why it is usually fine but occasionally catastrophic. This is what separates someone who can debug a diverging value network from someone who can only rerun the same broken experiment with a different random seed.

Key takeaways
  • TD targets depend on the current weights, but semi-gradient methods differentiate only the prediction, not the target — an intentional approximation, not a bug.
  • The semi-gradient TD(0) update is w←w+α δt ∇v^(St,w)\mathbf{w} \leftarrow \mathbf{w} + \alpha\,\delta_t\,\nabla \hat v(S_t,\mathbf{w}), with δt\delta_t the ordinary TD error.
  • Semi-gradient Sarsa and Q-learning extend the same idea to control, using ∇q^(St,At,w)\nabla \hat q(S_t,A_t,\mathbf{w}).
  • With linear function approximation and on-policy sampling, semi-gradient TD(0) provably converges to a well-defined fixed point (the projected Bellman equation), though not the minimizer of squared value error.
  • Combine off-policy data, bootstrapping, and function approximation and semi-gradient methods can diverge — this combination is called the deadly triad.
  • Eligibility traces extend semi-gradient TD(0) to semi-gradient TD(λ), interpolating smoothly between one-step bootstrapping and full Monte Carlo returns.
The core insight

Semi-gradient TD methods update weights using the gradient of the value estimate only, deliberately ignoring that the bootstrapped target also depends on those same weights.

The idea

In tabular TD(0), the update V(St)←V(St)+α[Rt+1+γV(St+1)−V(St)]V(S_t) \leftarrow V(S_t) + \alpha[R_{t+1} + \gamma V(S_{t+1}) - V(S_t)] nudges one table entry using an error computed from another table entry. With function approximation, VV is replaced by v^(s,w)\hat v(s,\mathbf{w}), a parameterized function — linear in features, or a deep network — and a single weight update changes the value estimate at every state simultaneously. This is what makes function approximation powerful (generalization across states) and dangerous (interference between states) at the same time. If we wanted to write TD as true gradient descent on some objective, we would need a loss function whose gradient produces the TD update. The natural candidate is the mean squared TD error,

TDE‾(w)=E[(Rt+1+γv^(St+1,w)−v^(St,w))2].\overline{\text{TDE}}(\mathbf{w}) = \mathbb{E}\big[(R_{t+1} + \gamma \hat v(S_{t+1},\mathbf{w}) - \hat v(S_t,\mathbf{w}))^2\big].

Differentiating this fully with respect to w\mathbf{w} requires differentiating both occurrences of w\mathbf{w} — the one inside v^(St,w)\hat v(S_t,\mathbf{w}) and the one inside the target v^(St+1,w)\hat v(S_{t+1},\mathbf{w}). The resulting "true gradient" or "residual gradient" update is mathematically valid, always converges (it is literally gradient descent), but empirically learns much more slowly and, worse, does not converge to a useful fixed point — it targets minimizing the noise in one-step predictions rather than tracking the actual value function. Semi-gradient methods make a different choice: treat v^(St+1,w)\hat v(S_{t+1},\mathbf{w}) as a fixed target, exactly as it appears in the current update, and differentiate only the leading v^(St,w)\hat v(S_t,\mathbf{w}) term. The word "semi" signals that we take a gradient with respect to only part of the expression that actually depends on w\mathbf{w}. This is the same design principle underlying TD(lambda) and Eligibility Traces and it is what makes bootstrapped learning with function approximation fast, online, and incremental — at the cost of losing the guarantee that we are descending any single fixed objective function.

How it works

Semi-gradient TD(0) prediction. Given a fixed policy π\pi to evaluate, at each step we observe (St,Rt+1,St+1)(S_t, R_{t+1}, S_{t+1}), compute the TD error using the current weights for both the value at StS_t and the bootstrapped value at St+1S_{t+1}, and then take a gradient step using only ∇v^(St,w)\nabla \hat v(S_t,\mathbf{w}):

δt=Rt+1+γv^(St+1,wt)−v^(St,wt)\delta_t = R_{t+1} + \gamma \hat v(S_{t+1}, \mathbf{w}_t) - \hat v(S_t, \mathbf{w}_t)
wt+1=wt+α δt ∇v^(St,wt)\mathbf{w}_{t+1} = \mathbf{w}_t + \alpha\,\delta_t\,\nabla \hat v(S_t, \mathbf{w}_t)

For terminal transitions, the bootstrap term is dropped: δt=Rt+1−v^(St,wt)\delta_t = R_{t+1} - \hat v(S_t,\mathbf{w}_t), matching the convention that v^(terminal)=0\hat v(\text{terminal}) = 0.

Semi-gradient Sarsa (control). Replace the state-value function with an action-value function q^(s,a,w)\hat q(s,a,\mathbf{w}) and bootstrap from the action actually taken next (on-policy):

δt=Rt+1+γq^(St+1,At+1,wt)−q^(St,At,wt)\delta_t = R_{t+1} + \gamma \hat q(S_{t+1}, A_{t+1}, \mathbf{w}_t) - \hat q(S_t, A_t, \mathbf{w}_t)
wt+1=wt+α δt ∇q^(St,At,wt)\mathbf{w}_{t+1} = \mathbf{w}_t + \alpha\,\delta_t\,\nabla \hat q(S_t, A_t, \mathbf{w}_t)

Semi-gradient Q-learning (off-policy control). Bootstrap from the greedy action instead:

δt=Rt+1+γmax⁡a′q^(St+1,a′,wt)−q^(St,At,wt)\delta_t = R_{t+1} + \gamma \max_{a'} \hat q(S_{t+1}, a', \mathbf{w}_t) - \hat q(S_t, A_t, \mathbf{w}_t)

This is the same core equation used inside DQN, with q^\hat q a deep network and w\mathbf{w} its parameters (DQN adds a separate slowly-updated target network to stabilize wt\mathbf{w}_t used inside the max — a practical patch to the instability discussed below).

Semi-gradient TD(λ) extends this with eligibility traces z\mathbf{z}, which accumulate gradient directions weighted by recency, allowing credit to propagate to features seen several steps in the past without waiting for multiple sweeps: ``` Algorithm: Semi-Gradient TD(λ) for estimating v_pi (linear or nonlinear) Input: policy pi, differentiable value function v_hat(s, w), step size alpha in (0,1], trace decay lambda in [0,1], discount gamma Initialize: weight vector w arbitrarily (e.g., zero) for each episode: initialize S z <- 0 # eligibility trace, same shape as w loop for each step of episode: A <- action given by pi for S take action A, observe R, S' grad <- gradient of v_hat(S, w) with respect to w z <- gamma lambda z + grad # accumulate trace if S' is terminal: delta <- R - v_hat(S, w) else: delta <- R + gamma v_hat(S', w) - v_hat(S, w) w <- w + alpha delta * z # semi-gradient update using trace S <- S' if S is terminal: break ``` When λ=0\lambda = 0, the trace z\mathbf{z} collapses to the single current gradient ∇v^(St,w)\nabla \hat v(S_t,\mathbf{w}) and the algorithm reduces exactly to semi-gradient TD(0). When λ=1\lambda = 1 (with γ=1\gamma=1), it becomes equivalent, in expectation, to gradient Monte Carlo — no bootstrapping at all, only real returns. The crucial "semi" step is identical in every case: ∇v^(S′,w)\nabla \hat v(S',\mathbf{w}) never appears anywhere in the update, only ∇v^(S,w)\nabla \hat v(S,\mathbf{w}) feeding the trace.

Figure
Where the gradient is taken — semi-gradient vs. true gradient
TD error: δ = R + γ·v̂(S′,w) − v̂(S,w) Semi-gradient TD(0) ∇w treats γ·v̂(S′,w) as CONSTANT update uses only ∇v̂(S,w) fast, online, may not follow a true objective True gradient (residual) ∇w differentiates BOTH v̂ terms descends MSTDE exactly always converges, but slow / poor targets Update rule w ← w + α·δ·∇v̂(S,w) used by Sarsa, Q-learning, DQN, actor-critic Update rule w ← w + α·δ·[∇v̂(S,w) − γ∇v̂(S′,w)] rarely used in deep RL practice

Complexity & correctness

Time and space complexity. With linear function approximation v^(s,w)=w⊤x(s)\hat v(s,\mathbf{w}) = \mathbf{w}^\top \mathbf{x}(s) over dd features, each step requires computing x(s)\mathbf{x}(s), a dot product, and a vector update — O(d)O(d) time and O(d)O(d) space, independent of the number of states. This is the entire point of function approximation: tabular TD needs O(∣S∣)O(|\mathcal S|) space, while semi-gradient TD needs only O(d)O(d), and dd can be orders of magnitude smaller than ∣S∣|\mathcal S|. With a neural network of PP parameters, one update costs O(P)O(P) for the forward pass plus O(P)O(P) for backpropagation (in general, backprop cost is proportional to the number of edges in the computational graph, which is Θ(P)\Theta(P) for standard feedforward architectures). Eligibility traces add another O(d)O(d) (or O(P)O(P)) vector to maintain and update per step, so semi-gradient TD(λ) has the same asymptotic per-step cost as TD(0); the trace does not change the complexity class, only the constant.

Why "semi" is not a true gradient — and why that is acceptable. Consider the mean squared TD error objective introduced above. Its true gradient with respect to w\mathbf{w} is

−12∇TDE‾=E[δt (∇v^(St,w)−γ∇v^(St+1,w))].-\tfrac{1}{2}\nabla \overline{\text{TDE}} = \mathbb{E}\big[\delta_t\,(\nabla \hat v(S_t,\mathbf{w}) - \gamma \nabla \hat v(S_{t+1},\mathbf{w}))\big].

The semi-gradient update uses only the first term, E[δt∇v^(St,w)]\mathbb{E}[\delta_t \nabla \hat v(S_t,\mathbf{w})], dropping the −γ∇v^(St+1,w)-\gamma\nabla\hat v(S_{t+1},\mathbf{w}) contribution entirely. This is not an approximation to the same quantity — it is the gradient of a genuinely different, better-behaved target: the mean squared projected Bellman error PBE‾\overline{\text{PBE}}. Define the Bellman operator TπT^\pi and the projection Π\Pi onto the space of representable value functions (for linear v^\hat v, projection in the weighted L2L^2 norm under the on-policy state distribution). The semi-gradient TD(0) fixed point wTD\mathbf{w}_{TD} satisfies

ΠTπv^wTD=v^wTD,\Pi T^\pi \hat v_{\mathbf{w}_{TD}} = \hat v_{\mathbf{w}_{TD}},

i.e., applying the Bellman operator and then projecting back onto the representable function class returns you to where you started. This is a well-defined, meaningful fixed point — it is the best representable approximation consistent with the Bellman equation — even though it is not the minimizer of mean squared value error ∥v^w−vπ∥2\|\hat v_\mathbf{w} - v_\pi\|^2 in general.

Convergence guarantee (linear, on-policy). For linear v^(s,w)=w⊤x(s)\hat v(s,\mathbf{w})=\mathbf{w}^\top\mathbf x(s), states sampled from the on-policy stationary distribution dπd_\pi, and a Robbins–Monro step-size schedule, semi-gradient TD(0) converges with probability 1 to the unique wTD\mathbf{w}_{TD} solving AwTD=b\mathbf{A}\mathbf{w}_{TD}=\mathbf{b}, where

A=Edπ[x(St)(x(St)−γx(St+1))⊤],b=Edπ[Rt+1x(St)].\mathbf{A} = \mathbb{E}_{d_\pi}\big[\mathbf{x}(S_t)(\mathbf{x}(S_t)-\gamma \mathbf{x}(S_{t+1}))^\top\big], \qquad \mathbf{b} = \mathbb{E}_{d_\pi}[R_{t+1}\mathbf{x}(S_t)].

The proof sketch (Tsitsiklis & Van Roy, 1997) shows that the key matrix A\mathbf{A} is positive definite precisely because states are weighted by the on-policy distribution — the same distribution the Markov chain naturally settles into under π\pi. Positive definiteness of A\mathbf{A} guarantees the mean ODE associated with the stochastic update is globally stable, which by stochastic approximation theory implies convergence of the actual iterates. The bound on the resulting error is also known explicitly:

∥v^wTD−vπ∥dπ≤11−γ min⁡w∥v^w−vπ∥dπ,\|\hat v_{\mathbf{w}_{TD}} - v_\pi\|_{d_\pi} \le \frac{1}{1-\gamma}\,\min_{\mathbf{w}}\|\hat v_{\mathbf{w}} - v_\pi\|_{d_\pi},

so the TD fixed point can be worse than the best possible linear approximation by a factor of up to 11−γ\frac{1}{1-\gamma} — a real cost of bootstrapping, but a bounded one.

Where the guarantee breaks. The positive-definiteness argument depends critically on sampling states according to dπd_\pi — the on-policy distribution. If the weighting distribution changes (off-policy sampling, as in Q-learning with a replay buffer, or importance-sampling-corrected updates), A\mathbf{A} can become indefinite, and the ODE can become unstable. Combined with a nonlinear function approximator (where the linear-algebra argument for A\mathbf{A} does not even apply) and bootstrapping, semi-gradient methods can diverge — weights growing without bound even though every individual update looked reasonable. This is exactly the setup foreshadowed by The Deadly Triad: function approximation, bootstrapping, and off-policy training together remove the safety net that on-policy linear semi-gradient TD enjoys.

Worked example

Consider a tiny 5-state random walk (a linearized version of Sutton & Barto's classic example): states A,B,C,D,EA,B,C,D,E in a line, terminal on both ends, reward +1+1 on the right exit and 00 elsewhere, γ=1\gamma=1. Use linear function approximation with a single scalar feature per state — state-aggregation-style one-hot features, so v^(s,w)=ws\hat v(s,\mathbf{w}) = w_s (this reduces to the tabular case, useful for tracing the arithmetic transparently before moving to compressed features). Initialize all ws=0.5w_s = 0.5. Suppose one episode visits C→D→E→terminal (reward 1)C \to D \to E \to \text{terminal (reward 1)}, with α=0.1\alpha = 0.1.

StepStS_tSt+1S_{t+1}Rt+1R_{t+1}v^(St)\hat v(S_t)v^(St+1)\hat v(S_{t+1})δt\delta_tUpdate to wStw_{S_t}
1CD00.50.50+0.5−0.5=0.00+0.5-0.5=0.0wC←0.5+0.1(0.0)=0.500w_C \leftarrow 0.5+0.1(0.0)=0.500
2DE00.50.50+0.5−0.5=0.00+0.5-0.5=0.0wD←0.5+0.1(0.0)=0.500w_D \leftarrow 0.5+0.1(0.0)=0.500
3Eterminal10.50 (terminal)1−0.5=0.51-0.5=0.5wE←0.5+0.1(0.5)=0.550w_E \leftarrow 0.5+0.1(0.5)=0.550

Notice: only wEw_E moved. This is exactly the semi-gradient mechanic in action — the update to v^(E)\hat v(E) used the observed reward at the terminal transition, not a bootstrapped value, so it is trustworthy immediately. States CC and DD saw zero TD error this episode because their bootstrapped targets (v^(D)=v^(E)=0.5\hat v(D)=\hat v(E)=0.5) still matched their own current estimate; the useful signal (that the right side is good) has not yet propagated backward from EE. Now trace a second episode, B→C→D→E→terminalB \to C \to D \to E \to \text{terminal}, using the updated weights (wE=0.55w_E = 0.55, others still 0.50.5):

StepStS_tSt+1S_{t+1}Rt+1R_{t+1}v^(St)\hat v(S_t)v^(St+1)\hat v(S_{t+1})δt\delta_tUpdate
1BC00.5000.5000.000wB=0.500w_B = 0.500
2CD00.5000.5000.000wC=0.500w_C = 0.500
3DE00.5000.5500+0.550−0.500=0.0500+0.550-0.500=0.050wD=0.500+0.1(0.05)=0.505w_D = 0.500+0.1(0.05)=0.505
4Eterm10.55001−0.550=0.4501-0.550=0.450wE=0.550+0.1(0.45)=0.595w_E = 0.550+0.1(0.45)=0.595

This shows the signature behavior of one-step bootstrapping under function approximation: information about the terminal reward diffuses backward one state per episode, at a rate controlled by α\alpha and the trace decay λ\lambda. If we instead ran semi-gradient TD(λ) with λ=0.9\lambda = 0.9, the eligibility trace from step 1 would already be nonzero (decayed by γλ\gamma\lambda each step) by the time the terminal reward arrives at step 4, so wBw_B and wCw_C would also receive a fraction of that terminal error within the same episode — this is precisely why traces accelerate credit assignment relative to λ=0\lambda=0.

Common pitfalls & traps

PitfallWhy it happensFix
Differentiating through the targetTreating v^(St+1,w)\hat v(S_{t+1},\mathbf w) as depending on w\mathbf w when coding backpropDetach / stop-gradient the bootstrapped target explicitly in code
Assuming semi-gradient TD minimizes squared value errorConfusing PBE‾\overline{\text{PBE}} fixed point with VE‾\overline{\text{VE}} minimizerRemember the 11−γ\frac{1}{1-\gamma} bound — TD's fixed point can be worse than the best linear fit
Off-policy replay + bootstrapping + nonlinear net with no safeguardIgnoring that convergence proofs assume on-policy sampling and linearityUse target networks, restricted step sizes, or off-policy corrections (importance sampling, Gradient-TD methods)
Forgetting to zero the value of terminal statesBootstrapping past episode end inflates targetsExplicitly special-case terminal transitions: δt=Rt+1−v^(St,w)\delta_t = R_{t+1} - \hat v(S_t,\mathbf w)
Not resetting eligibility traces between episodesStale trace carries credit across unrelated trajectoriesReset z←0\mathbf z \leftarrow 0 at the start of every episode
Step size too large for the feature scaleDivergence mistaken for a bug rather than an instabilityNormalize features; tune α\alpha relative to feature vector norm, e.g., α=c/∥x∥2\alpha = c/\|\mathbf x\|^2

Pioneers & history

Origins · 1 minRichard S. Sutton and how this was discovered
RS
Richard S. Sutton
born 1957 · Developed temporal-difference learning and, with collaborators, the theory and practice of function-approximation-based reinforcement learning

Richard Sutton's work established TD learning as a distinct paradigm from both Monte Carlo methods and dynamic programming, and his collaboration with Andrew Barto produced the foundational textbook formalizing semi-gradient methods, eligibility traces, and the deadly triad as a unified conceptual framework for the field.

History
1988
Sutton introduces temporal-difference learning and TD(λ), the precursor to all semi-gradient methods.
1997
Tsitsiklis and Van Roy prove convergence of linear TD(0) under on-policy sampling and diagnose divergence under off-policy sampling.
2009-2010
Sutton, Maei, Szepesvári and collaborators develop Gradient-TD methods (GTD, TDC) that provably converge under off-policy linear function approximation.
2015
Mnih et al. publish the Deep Q-Network, applying semi-gradient Q-learning with a neural network, experience replay, and a target network to Atari games.
2018
Sutton and Barto's second edition formalizes "the deadly triad" as the named unifying explanation for instability across this literature.

Where this matters

Semi-gradient TD and its control variants underlie essentially all value-based deep reinforcement learning. DQN and its descendants (Double DQN, Dueling DQN, Rainbow) all compute a bootstrapped target from a neural network and update weights with exactly the semi-gradient rule, with a frozen target network standing in as a practical stabilization of the "treat the target as constant" idea. Actor-critic methods (A3C, PPO, SAC) use a semi-gradient critic to estimate a baseline or advantage function, feeding it into the policy gradient. TD(λ) with linear function approximation, and its semi-gradient update rule, was the mechanism behind TD-Gammon, one of the earliest large-scale successes of reinforcement learning, and remains a standard tool wherever features are engineered by hand rather than learned end-to-end, such as some robotics and industrial control applications where interpretability and sample efficiency of linear models are valued over the flexibility of deep networks. Understanding exactly which gradient terms are dropped, and under what conditions the remaining update is still safe, is a prerequisite for diagnosing training instability in any of these systems — instability that shows up as value estimates silently diverging while the loss curve looks deceptively smooth.

Ask the tutor: How exactly does an off-policy replay buffer break the positive-definiteness argument that makes on-policy semi-gradient TD(0) provably stable?

Why not just use the "true gradient" of the TD error and avoid the whole issue?

The true gradient (sometimes called the residual gradient) differentiates through both the prediction and the bootstrapped target, and it does converge, since it is literally gradient descent on a well-defined objective. In practice, though, it converges far more slowly and to a less useful answer: it minimizes the variance of one-step TD errors rather than tracking the actual value function well. Empirically, semi-gradient methods learn faster and produce better value estimates for control despite lacking a clean objective, because the projected Bellman fixed point they converge to is a better proxy for the true value function than the residual-gradient minimizer. The tradeoff is convergence guarantees (strong for residual gradient, conditional for semi-gradient) versus practical performance (much better for semi-gradient).

Is semi-gradient TD(0) doing gradient descent on any objective at all?

Not in the usual sense — there is no single fixed loss function L(w)L(\mathbf{w}) whose gradient equals the semi-gradient TD update, because the update depends on wt\mathbf{w}_t appearing inside a target that is treated as fixed at each step, a moving target. However, its expected fixed point does correspond to solving the projected Bellman equation, which can be characterized as the zero of a well-defined operator (the "Bellman residual after projection"), even though that operator is not the gradient of a scalar loss for nonlinear function approximation. This is why researchers developed Gradient-TD methods (GTD2, TDC), which explicitly minimize the mean squared projected Bellman error as a true objective, restoring convergence guarantees even off-policy.

How does this connect to the deadly triad?

The deadly triad names three ingredients — function approximation, bootstrapping, and off-policy learning — that are each useful alone but jointly dangerous. Semi-gradient methods are exactly where bootstrapping and function approximation meet: the update ignores the weight-dependence of the bootstrapped target, which is safe when sampling is on-policy (because the resulting update matrix is provably stable) but can lose that safety net once the sampling distribution is decoupled from the policy being learned about, as in off-policy Q-learning with replay. Semi-gradient methods are not the cause of the deadly triad, but they are the mechanism through which the triad's instability manifests, since it is the semi-gradient approximation whose stability argument specifically requires on-policy weighting.

Do eligibility traces fix the divergence risk of semi-gradient methods?

No — eligibility traces control the bias-variance tradeoff between one-step bootstrapping and full Monte Carlo returns, and larger λ generally makes the fixed point closer to the true value function, but they do not change the fundamental linear-algebra argument governing convergence. Semi-gradient TD(λ) still relies on the update matrix analog of A\mathbf A being positive definite, which again depends on on-policy state sampling. Off-policy TD(λ) with linear function approximation can diverge for the same structural reasons as TD(0), and needs the same fixes (importance-sampling corrections, Gradient-TD-style objectives, or restricting to on-policy data) to be made safe.

Why does DQN work in practice despite lacking convergence guarantees?

DQN combines several engineering mitigations that make divergence less likely without proving it away: a target network that freezes the bootstrapped target's weights for many steps (reducing the moving-target problem that the semi-gradient approximation exploits), experience replay that decorrelates consecutive samples and approximates a more stable data distribution, reward clipping, and gradient clipping, all of which reduce the effective magnitude and correlation of the destabilizing updates. None of these guarantee convergence the way the linear on-policy proof does; they are empirically validated stabilizers, and divergence or performance collapse mid-training remains a known, documented failure mode in deep RL research.

What is the practical difference between semi-gradient Sarsa and semi-gradient Q-learning?

Both use the identical semi-gradient update rule and identical weight-update mechanics; they differ only in how the bootstrapped target is constructed. Sarsa uses q^(St+1,At+1,w)\hat q(S_{t+1}, A_{t+1}, \mathbf w), the value of the action actually selected next under the current behavior policy, making it on-policy. Q-learning uses max⁡a′q^(St+1,a′,w)\max_{a'}\hat q(S_{t+1}, a', \mathbf w), the value of the greedy action regardless of what is actually taken next, making it off-policy. This single difference is exactly what reintroduces deadly-triad risk into Q-learning with function approximation, while semi-gradient Sarsa retains the same convergence guarantees as semi-gradient TD(0) prediction under linear approximation and on-policy sampling.

Before this

Where this leads