Temporal-Difference Learning

Temporal-Difference (TD) learning is a central approach in Reinforcement Learning (RL) that combines ideas from both Monte Carlo Methods and Dynamic Programming. It is a model-free learning method where an agent learns to predict a value function by bootstrapping from its current estimate of that value function, updating predictions incrementally after each step rather than waiting for the end of an episode.


Core Characteristics

1. Model-Free

TD methods do not require a model of the environment’s dynamics (i.e., state transition probabilities or reward functions). The agent learns solely through direct interaction and raw experience.

2. Bootstrapping

Unlike Monte Carlo methods, which wait until the end of an episode to update state values based on the actual total return, TD learning updates estimates based on other learned estimates. It updates predictions using the immediate reward and the discounted estimated value of the subsequent state.

3. Online & Incremental Updates

Because updates occur step-by-step during an episode, TD learning can be applied to continuous or very long tasks (infinite horizon) where episodes might not have a defined end.


Core Formulas

TD(0) Prediction

The simplest form of TD learning, TD(0), updates the estimated state-value function as follows:

Where:

  • is the learning rate (step-size parameter).
  • is the discount factor ().
  • is the reward received after transitioning from state .
  • is the TD Error, which measures the discrepancy between the estimate at time and the better estimate at .

On-Policy Control: SARSA

SARSA (State-Action-Reward-State-Action) is an on-policy control method that updates the action-value function using the action actually chosen by the current policy:

Off-Policy Control: Q-Learning

Q-learning is an off-policy control method that updates the action-value function by assuming the optimal action will be chosen in the next state, regardless of the agent’s behavior policy:


  • Markov Decision Process (MDP): The formal mathematical framework for modeling decision-making in reinforcement learning.
  • Dynamic Programming (DP): A collection of algorithms used to compute optimal policies given a perfect model of the environment.
  • Monte Carlo Methods: Methods that learn value functions and optimal policies from sample paths/episodes without bootstrapping.
  • Eligibility Traces (TD()): A generalization of TD learning that bridges TD(0) and Monte Carlo methods using a decay parameter .
  • Function Approximation: The use of models (e.g., neural networks in deep reinforcement learning) to estimate value functions in large or continuous state spaces.