Evaluation lab · San Francisco · London · Zürich
Reinforced Labs Request a briefing
Glossary

TD error

Also called: temporal-difference error, delta, δ, reward prediction error

The TD error δ = r + γV(s') − V(s) measures how much better or worse a step turned out than the agent's value estimate predicted.

The temporal-difference (TD) error is the difference between what an agent expected from a state and what it got one step later, measured with its own value estimates. A positive TD error means the step went better than predicted; a negative one means worse.

Definition

is the observed reward, the current value estimate and the discount factor. If the episode ends at , its value is taken as 0. When equals the true , the TD error has zero mean under in every state, which is just the Bellman equation rearranged.

Worked example

The agent estimates . It acts, receives reward 1 and lands in with . With , . The outcome beat expectations, so TD learning with step size raises to .

Three roles of the TD error

  • Learning signal for critics. Value networks are trained to minimise with the target held fixed.
  • Advantage estimate for actors. If , then , the advantage. One-step actor-critic uses directly as the advantage, and GAE uses a discounted sum of them: .
  • Bridge to Monte Carlo. For a fixed , the Monte Carlo error decomposes into TD errors: .

A note from neuroscience

The firing of dopamine neurons in primates looks strikingly like a TD error: they respond to unexpected rewards, shift their response to cues that predict reward, and dip when a predicted reward is omitted. This finding made the TD error one of the best-known links between machine learning and biology.

Why it matters

The TD error is the most compact diagnostic in RL training. Large, persistent TD errors mean the critic is not tracking the policy; errors that grow without bound often signal divergence. Because advantage estimates are built from TD errors, a poor critic directly corrupts policy updates, including in language-model RL with a learned value head.

Sources

  1. Richard S. Sutton, Andrew G. Barto. Reinforcement Learning: An Introduction (2nd edition), 2018. incompleteideas.net
  2. Wolfram Schultz, Peter Dayan, P. Read Montague. A Neural Substrate of Prediction and Reward, 1997. doi.org

Know the number before you ship.

A 45-minute working session with an evaluation engineer. Bring one use case; leave with a threat model, a draft eval plan with sample sizes, and an honest read on where you stand.