A linear value function is with . The agent moves from to with , where and . With and , compute the semi-gradient TD(0) update, and compare with the residual-gradient update. Why is TD(0) called a "semi-gradient" method?
Reinforcement learning, Function approximation
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.
What's being asked
Whether you can apply TD(0) with function approximation and know that it ignores the dependence of the target on .
Key idea
Semi-gradient TD(0) is with . It treats the target as a constant. The residual gradient also differentiates through , giving .
Steps
- Compute the values: and .
- TD error: .
- Semi-gradient: .
- Residual gradient: , so .
- Explain "semi". The loss depends on through both and the target. Semi-gradient differentiates only through and treats the target as a fixed number, so it is not the gradient of any fixed objective.
- State the consequences: semi-gradient TD usually learns faster and converges (on-policy, linear case) to the TD fixed point. The residual gradient is a true gradient method but converges more slowly and to a different answer.
Common mistakes
- Using in place of as the update direction. The semi-gradient uses the features of the state being updated.
- Forgetting the weight vector entirely and updating directly, as in the tabular case.
- Calling the semi-gradient a true gradient. It does not minimise a fixed loss, which is part of why off-policy versions can diverge.
How long your answer should be
Half a page; 4–5 minutes.
Last checked on 4 December 2026.
Read this
Previous in Reinforcement learning: Two Bernoulli arms start with uniform priors. Arm A has been pulled times with successes and failure. Arm B has been pulled once with success. Give each arm's posterior, mean and variance. What is the probability that Thompson sampling picks B next? Why is this different from a greedy choice?
Next in Reinforcement learning: Show that generalised advantage estimation , with , equals when and the Monte Carlo advantage when . How do these limits explain the bias–variance role of ? How do you check your claim on rewards and values with ?