Temporal-Difference Update¶
Sequential-learning update method — instantiates Predictive Residual Processing
Treats the signed gap between expected and realized value as a teaching signal, nudging value or policy estimates one step at a time as outcomes unfold — without waiting for the final result.
A Temporal-Difference Update learns the long-run value of situations from a stream of experience by treating a prediction error as a teaching signal. At each step it holds an expected value for the current state; then it observes the immediate reward plus its own newly-updated estimate of the next state, and the signed difference between the two — the TD error — is what it learns from. Its defining move, the one that separates it from every estimator that waits for a verdict, is bootstrapping: it corrects a prediction using a later prediction rather than the eventual true outcome, so it can learn online, mid-episode, before any final result is in. The signed residual between successive expectations is the entire teacher.[1]
Example¶
A retailer runs a pricing agent for perishable stock that must learn the value of each inventory-and-days-remaining state — roughly, the revenue-to-go it can expect from here. It cannot wait until the season ends to learn; it has to improve as it sells. Each day the agent has an expected value for today's state. The next day it observes the realized revenue and its fresh estimate of tomorrow's state value. If reward-plus-next-estimate comes in above what it expected today, the TD error is positive and the agent nudges today's state value up — and the pricing action that led there grows more attractive; if it falls short, the value is nudged down. Over a season the agent bootstraps a value estimate for every state and a better pricing policy, learning from the surprise at each step rather than from any single end-of-season tally. The predictable, on-track days teach it almost nothing; the days that deviate from expectation are where it moves.
How it works¶
- Form the temporal-difference error. Take reward plus the estimated value of the next state, subtract the estimated value of the current state; that signed gap is the residual that teaches.
- Bootstrap from your own later estimate. The target uses the next prediction, not the final return, so learning happens every step without waiting for an outcome.
- Nudge by a fraction of the error. The current estimate moves toward the target by a learning-rate step — small, incremental corrections rather than wholesale replacement.
- Propagate credit backward over time. Repeated updates carry value information from rewarding states back to the earlier states and actions that led to them.
Tuning parameters¶
- Learning rate (α) — how far each estimate moves per error. High rates learn fast but chase noise and can diverge; low rates are stable but slow to reflect real change.
- Bootstrapping depth (TD(0) → TD(λ) → Monte Carlo) — how many real steps to observe before leaning on the estimate. Shallow bootstrapping is low-variance but biased by its own predictions; deep is less biased but noisier.
- Discount factor (γ) — how much future value counts, which sets the effective planning horizon; near 1 values the long run, lower is myopic.
- Reward / value signal definition — what counts as reward. A mis-specified signal is learned faithfully and confidently toward the wrong objective, so this is the highest-stakes choice.
When it helps, and when it misleads¶
Its strength is learning to value sequential situations when you can't wait for the end: it updates online from each step's surprise, assigns credit across time, and needs no model of the environment's dynamics to do it. For decision problems that unfold step by step, it is the canonical learner — and it has a striking biological echo in dopamine reward-prediction-error signalling.[1]
It misleads through the same bootstrapping that makes it powerful. Because each estimate is corrected toward other estimates, error in one can propagate into many, and with aggressive learning rates or function approximation the whole process can become unstable. A reward signal that is really a proxy will be optimised literally, driving behaviour that scores well on the signal while missing the intent. The classic misuse is reading a learned value as the true worth of a state when it is a bootstrapped estimate from a possibly-biased signal, and trusting it without ever checking it against realised returns. The discipline is to validate the reward definition against what you actually want, tune the learning rate and bootstrapping depth for stability, and periodically compare learned values to the outcomes that eventually arrive.
How it implements the components¶
This method owns the archetype's sequential value-learning slice:
update_rule— the TD update, nudging an estimate by a learning-rate fraction of the temporal-difference error, is this mechanism's core; it is an update rule.expected_behavior— the predicted value of the current state, one side of the teaching gap.actual_behavior— the realized reward plus the observed next-state value, the other side against which expectation is corrected.
It does not perform uncertainty-weighted estimation of a noisy hidden state — that is the Innovation Residual Filter's prediction_comparator and confidence_and_uncertainty_state — nor a Bayesian posterior update over model parameters (Bayesian Model Update), nor the layered routing of errors (Hierarchical Prediction-Error Loop).
Related¶
- Instantiates: Predictive Residual Processing — the learner that turns each step's prediction error into an incremental correction of value or policy.
- Consumes: stored transitions from a Prediction-Error Replay Buffer can be replayed to drive its updates offline.
- Sibling mechanisms: Innovation Residual Filter · Prediction-Error Replay Buffer · Bayesian Model Update · Hierarchical Prediction-Error Loop · Anomaly Detection Model
Notes¶
The Temporal-Difference Update and the Innovation Residual Filter both turn a residual into an update, and are easy to confuse. The filter estimates a current hidden state from noisy measurements, weighting the correction by explicit uncertainty; TD learns the long-run value of states by bootstrapping from its own successive predictions. One asks "where am I now, given noisy sensors"; the other asks "what is being here ultimately worth" — different questions, and different residuals.
References¶
[1] Temporal-difference learning (Sutton, 1988) updates a value estimate toward reward-plus-next-estimate rather than the final return, which is what "bootstrapping" names. The temporal-difference error has a well-documented neural correlate: phasic dopamine responses track reward prediction error (Schultz and colleagues), a real and widely-replicated finding cited here as a genuine parallel, not a claim about any specific system. ↩