Skip to content
StackDecode
AI & ML Atlas
Reinforcement LearningalgorithmAnimated walkthrough

Prioritised Experience Replay

Replays surprising transitions more often than boring ones.

The idea

Instead of sampling past experiences uniformly, each transition is sampled with probability proportional to its TD error: how wrong the network's prediction was. Surprising experiences teach the most. Importance-sampling weights correct the bias this introduces.

P(i) = pᵢ^α / Σ pₖ^α

Watch it run

The pipeline lights up one step at a time. Use the controls to pause or step through it.

  1. 1Store each transition with a priority (its TD error plus a small constant).
  2. 2Sample transitions with probability proportional to priority^α.
  3. 3Weight the loss by importance-sampling weights.
  4. 4Update the priorities with the new TD errors.

P(i) = pᵢ^α / Σ pₖ^α

1/4

Step by step

  1. 1Store each transition with a priority (its TD error plus a small constant).
  2. 2Sample transitions with probability proportional to priority^α.
  3. 3Weight the loss by importance-sampling weights.
  4. 4Update the priorities with the new TD errors.

Where it is used

Faster learning in DQN-style agents.

Watch out for

Extra complexity and a sum-tree data structure; adds hyper-parameters α and β.

Related