Skip to content
StackDecode
AI & ML Atlas
Reinforcement LearningtechniqueAnimated walkthrough

Hindsight Experience Replay (HER)

Learns from failures by pretending the place you ended up was the goal.

The idea

With sparse rewards (only reaching the goal pays) most episodes teach nothing. HER relabels a failed trajectory: "suppose the goal had been where I actually finished", which makes the episode a success for that goal. The agent learns how to reach many goals, including the real one, from the same data.

Watch it run

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

  1. 1Run an episode with a goal; it fails.
  2. 2Store it in the replay buffer as usual.
  3. 3Also store copies with the goal replaced by a state actually reached.
  4. 4Recompute the rewards for those relabelled goals.
  5. 5Train from the buffer.
1/5

Step by step

  1. 1Run an episode with a goal; it fails.
  2. 2Store it in the replay buffer as usual.
  3. 3Also store copies with the goal replaced by a state actually reached.
  4. 4Recompute the rewards for those relabelled goals.
  5. 5Train from the buffer.

Where it is used

Robotic manipulation with sparse rewards.

Watch out for

Needs goal-conditioned policies and a way to compute reward for any goal.

Related