Skip to content
StackDecode
AI & ML Atlas
Reinforcement LearningalgorithmInteractive simulation

TD(λ)

Blends all n-step returns with a decay λ, using eligibility traces.

The idea

TD(λ) averages the 1-step, 2-step … n-step returns with geometrically decaying weights, controlled by λ between 0 (TD(0)) and 1 (Monte Carlo). The backward view implements this with eligibility traces: every recently visited state keeps a fading trace and shares in each TD error.

V(s) ← V(s) + α δ e(s), e ← γλ e

Watch it run

This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.

GOAL +1PIT −1start0000000000000-0.020000
  • positive value
  • negative value
  • agent

TD(λ): the surprise (-0.04) is shared with every recently visited state, weighted by its eligibility trace (orange dots).

episode:
1
1/78

The agent wanders randomly; we are only measuring how good each cell is.

Step by step

  1. 1Keep a trace e(s) for every state.
  2. 2After each step, compute the TD error δ.
  3. 3Update every state's value by α·δ·e(s).
  4. 4Decay all traces by γλ and bump the current state's trace.

Where it is used

Faster credit assignment than TD(0).

Watch out for

More computation per step; λ must be chosen.

Related