Temporal Difference Learning

2 min read

TD learning combines the model-free nature of Monte Carlo with the bootstrapping of dynamic programming.

TD(0) update:

V(St)V(St)+α[Rt+1+γV(St+1)V(St)]V(S_t) \leftarrow V(S_t) + \alpha\left[R_{t+1} + \gamma V(S_{t+1}) - V(S_t)\right]
  • Rt+1+γV(St+1)R_{t+1} + \gamma V(S_{t+1}) = TD target (estimated return using current value estimate)
  • Rt+1+γV(St+1)V(St)R_{t+1} + \gamma V(S_{t+1}) - V(S_t) = TD error δt\delta_t (surprise: how much better/worse than expected)
  • α\alpha = learning rate

Key insight: TD bootstraps — uses the current estimate V(St+1)V(S_{t+1}) instead of waiting for the full return. This introduces some bias but reduces variance compared to MC.

Advantages over MC:

  • Can learn from incomplete episodes (online, step-by-step)
  • Lower variance → faster convergence in practice
  • Works in continuing (non-episodic) tasks

TD(λ): blends MC and TD(0) via eligibility traces. λ=0\lambda = 0 is pure TD; λ=1\lambda = 1 is MC. The trace decays by γλ\gamma\lambda each step, giving recent states more credit.

The TD error is everywhere in RL:

See also: Monte Carlo Methods in RL, Q-Learning, SARSA

Linked from