Inferensys

Glossary

Temporal Difference (TD) Learning

Temporal Difference (TD) Learning is a class of model-free reinforcement learning methods that update value estimates based on the difference between successive predictions.
ML engineer managing model training cluster on laptop, GPU utilization visible, technical deep learning setup.
REINFORCEMENT LEARNING ALGORITHM

What is Temporal Difference (TD) Learning?

A core model-free algorithm for learning value functions by bootstrapping from subsequent estimates.

Temporal Difference (TD) Learning is a foundational, model-free reinforcement learning method that updates its estimate of a state's or action's value based on the difference between successive predictions. It blends concepts from Monte Carlo methods and dynamic programming, learning directly from raw experience without a model of the environment. The core update rule, derived from the Bellman equation, adjusts the current value estimate toward a more accurate target that combines immediate reward and the discounted value of the next state.

This bootstrapping mechanism enables online learning, where updates occur after every time step, unlike Monte Carlo methods that wait until the end of an episode. Key algorithms like Q-Learning and SARSA are TD methods. TD Learning is fundamental to Deep Q-Networks (DQN) and Actor-Critic architectures, providing the stable, incremental updates necessary for learning optimal policies in complex, high-dimensional environments like robotic control.

ALGORITHM CATALOG

Key TD Learning Algorithms and Extensions

Temporal Difference (TD) Learning is not a single algorithm but a family of methods. This catalog details the core algorithms and their modern extensions that form the backbone of model-free reinforcement learning.

01

TD(0) & TD(λ)

TD(0) is the foundational one-step algorithm. It updates the value estimate for a state based on the immediate reward and the estimated value of the next state (the TD target).

TD(λ) generalizes this with eligibility traces. It provides a spectrum between one-step TD (λ=0) and Monte Carlo methods (λ=1), allowing credit for rewards to be assigned more efficiently back through a sequence of states. The parameter λ controls the decay rate of the eligibility trace.

02

SARSA (On-Policy TD Control)

SARSA (State-Action-Reward-State-Action) is an on-policy TD control algorithm. It learns the action-value function Q(s,a) for the policy it is currently executing.

  • Update Rule: Q(S_t, A_t) ← Q(S_t, A_t) + α [ R_{t+1} + γQ(S_{t+1}, A_{t+1}) - Q(S_t, A_t) ]
  • It uses the actual next action (A_{t+1}) taken by the current policy to form the TD target.
  • This makes it inherently conservative, as it evaluates and improves the policy it follows, which can be advantageous in safety-critical or online learning scenarios.
03

Q-Learning (Off-Policy TD Control)

Q-Learning is the canonical off-policy TD control algorithm. It directly learns the optimal action-value function Q*(s,a) independent of the policy being followed.

  • Update Rule: Q(S_t, A_t) ← Q(S_t, A_t) + α [ R_{t+1} + γ max_a Q(S_{t+1}, a) - Q(S_t, A_t) ]
  • The TD target uses the maximum Q-value of the next state, representing the value of the greedy policy.
  • This separation between the behavior policy (for exploration, e.g., ε-greedy) and the target policy (the greedy policy) is key to its power and convergence guarantees to the optimal policy.
04

Expected SARSA

Expected SARSA is a variation that, like Q-Learning, forms its TD target based on an expectation over actions, but uses the expected value under the current policy rather than the maximum.

  • Update Rule: Q(S_t, A_t) ← Q(S_t, A_t) + α [ R_{t+1} + γ Σ_a π(a|S_{t+1}) Q(S_{t+1}, a) - Q(S_t, A_t) ]
  • It eliminates the variance introduced by the random selection of A_{t+1} in standard SARSA.
  • It can be used as either an on-policy or off-policy algorithm. When the policy is greedy, it becomes identical to Q-Learning. It often provides more stable learning than SARSA.
05

Double Q-Learning

Double Q-Learning addresses a significant overestimation bias inherent in standard Q-Learning due to the max operator. This bias can lead to suboptimal policies and unstable learning, especially with function approximation.

  • Mechanism: It maintains two separate Q-value estimates, Q1 and Q2. To perform an update, one network selects the greedy action (argmax), and the other provides its value estimate for that action.
  • Update (for Q1): A* = argmax_a Q1(S_{t+1}, a); Q1(S_t, A_t) ← Q1(S_t, A_t) + α [ R_{t+1} + γ Q2(S_{t+1}, A*) - Q1(S_t, A_t) ]
  • This decoupling of action selection from evaluation removes the positive bias, leading to more accurate value estimates and more reliable performance.
06

TD Learning with Function Approximation

Applying TD methods to complex problems requires function approximation (e.g., neural networks) to estimate value functions over vast state spaces.

  • Core Challenge: The interplay between bootstrapping (TD updates) and function approximation can lead to instability and divergence, unlike in the tabular case.
  • Key Techniques that enable stable learning include:
    • Gradient TD Methods: Algorithms like TDC (TD with gradient correction) that guarantee convergence under linear function approximation.
    • Experience Replay: Storing and randomly sampling past transitions to break temporal correlations.
    • Target Networks: Using a slowly updated copy of the value network to generate stable TD targets, a cornerstone of Deep Q-Networks (DQN).
  • This extension is what enables TD learning to scale to real-world problems like robotics and game playing.
VALUE ESTIMATION

TD Learning vs. Other RL Estimation Methods

A comparison of core methods for learning value functions or policies in reinforcement learning, highlighting the unique characteristics of Temporal Difference (TD) Learning.

Feature / CharacteristicTemporal Difference (TD) LearningMonte Carlo (MC) MethodsDynamic Programming (DP)

Core Update Mechanism

Bootstraps: updates estimates using other estimates

Uses complete episode returns (no bootstrapping)

Uses full model of dynamics (bootstraps via model)

Model Requirement

Model-free

Model-free

Model-based (requires P(s'|s,a) & R(s,a))

Online / Offline Capability

Fully online; updates after each step

Strictly offline; must wait for episode termination

Offline; requires sweeps over entire state space

Handles Non-Terminating Tasks

Update Variance

Lower variance due to bootstrapping

High variance due to full stochastic return

Deterministic (no variance from returns)

Primary Use Case

Learning from incremental, sequential interaction

Learning from complete episodic outcomes

Planning with a perfect environment model

Sample Efficiency

High; efficient use of experience

Low; requires many complete episodes

N/A (uses model, not samples)

Computational Focus

Per-step computation

Per-episode computation

Per-sweep computation over state space

TEMPORAL DIFFERENCE LEARNING

Frequently Asked Questions

Temporal Difference (TD) Learning is a foundational class of model-free reinforcement learning algorithms. It enables agents to learn value estimates by bootstrapping from their own subsequent predictions, blending the sampling of Monte Carlo methods with the iterative updates of dynamic programming. This FAQ addresses its core mechanisms, applications, and distinctions from related methods.

Temporal Difference (TD) Learning is a model-free reinforcement learning method that updates estimates of the value of states or state-action pairs based on the difference between temporally successive predictions. Unlike Monte Carlo methods that wait until the end of an episode, TD methods learn online by bootstrapping—using current estimates to update other estimates. The core update rule, the TD error, is: δₜ = Rₜ₊₁ + γV(Sₜ₊₁) - V(Sₜ), where γ is the discount factor. This error signal drives learning by correcting predictions to be more consistent with later, more informed predictions.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.