techlist.io

Hindsight Experience Replay

4 posts

OpenAI2018-02-251 min readCurated summary

Multi-Goal Reinforcement Learning: Challenging robotics environments and request for research

This technical report introduces a suite of challenging continuous control benchmarks for robotics, built on existing hardware and integrated with OpenAI Gym. It also argues for further research into reinforcement learning (RL) methods, especially multi-goal RL and Hindsight Experience Replay. ## Robotics Benchmark Suite - The tasks use a Fetch robotic arm for pushing, sliding, and pick-and-place. - They use a Shadow Dexterous Hand for in-hand object manipulation. - Every task has sparse binary rewards, so the agent receives feedback only on success or failure. - The tasks follow a Multi-Goal RL framework, in which the agent receives an additional input specifying what it should accomplish. ## Research Directions - The second part of the report proposes concrete ideas for improving RL algorithms. - Most of these ideas relate to multi-goal RL and Hindsight Experience Replay, a technique that relabels failed attempts with the goals they actually achieved so the agent can learn from them.

OpenAI2018-02-253 min readCurated summary

Ingredients for robotics research

# Ingredients for robotics research OpenAI's robotics team released eight simulated robotics environments for Gym, built on the MuJoCo physics simulator, along with a Baselines implementation of Hindsight Experience Replay (HER). The environments are substantially harder than the existing MuJoCo continuous control tasks and use realistic models of real robots, and HER makes it possible to learn them from sparse rewards alone. The post also lists a set of open research directions for extending HER. ## Environments - Eight tasks in total: four using the Fetch research platform and four using the ShadowHand robot. - Tasks are goal-based, such as sliding a puck to a target position or rotating a block to a desired orientation. - The default reward is sparse: -1 until the goal is reached (within a tolerance), then 0. A dense-reward variant is also included, but the authors recommend the sparse version as more realistic for robotics. - The environments were used to train models that work on physical robots. ## Hindsight Experience Replay - Standard RL algorithms learn little from failed attempts when every reward is the same constant (-1). - HER relabels failed episodes by treating the goal the agent actually achieved as if it were the intended goal, which gives a useful learning signal. - Replaying these relabeled experiences with goals chosen after the episode ends is what gives the method its name. - HER works with any off-policy algorithm, such as DDPG (written as "DDPG + HER"). ## Results - On the new tasks, DDPG + HER substantially outperforms vanilla DDPG, which mostly fails to learn. - DDPG + HER with sparse rewards performs best. It learns a successful policy on HandManipulateBlockRotateXYZ from sparse rewards alone. - DDPG + HER with dense rewards learns but reaches lower performance, a trend the authors report as generally true across environments. - Full results are in the accompanying technical report. ## Open Research Directions The authors propose several extensions: - **Automatic hindsight goal creation:** learning the goal-substitution strategy instead of hard-coding it. - **Unbiased HER:** goal substitution distorts the experience distribution, which could be corrected with importance sampling. - **HER + hierarchical RL:** applying substitution to a higher-level policy's actions or subgoals. - **Richer value functions:** conditioning on inputs such as discount factor or success threshold. - **Faster information propagation:** alternatives to target networks, which slow training. - **HER + multi-step returns:** difficult today because the relabeled experience is highly off-policy. - **On-policy HER:** combining HER with stable on-policy algorithms like PPO, possibly via importance sampling. - **RL with very frequent actions:** designing algorithms that keep their performance as the action frequency increases. - **Combining HER with recent RL advances:** such as prioritized experience replay, distributional RL, entropy regularization, or reverse curriculum generation. ## Using the Environments - Goal-based environments use a `gym.spaces.Dict` observation space with three keys: `desired_goal`, `achieved_goal`, and `observation`. - The reward function is exposed, so rewards can be recomputed for substituted goals, which HER-style algorithms require. - Existing Gym-compatible algorithms such as Baselines can use these environments after flattening the dict observation with `gym.wrappers.FlattenDictWrapper`.

OpenAI2017-10-182 min readCurated summary

Generalizing from simulation

Robot controllers can now be trained entirely in simulation and deployed on physical robots, where they react to unplanned changes in the environment while solving simple tasks. The simulator doesn't need to match the real world in appearance or dynamics. Instead, relevant aspects such as friction, action delays, and sensor noise are randomized during training, and the policy needs only a small amount of real-world self-calibration. The authors argue that randomizing the simulator will be the most important route to general-purpose robots. ## Dynamics Randomization - Training randomizes 95 properties that govern the environment's dynamics, including each link's mass, the friction and damping of the manipulated object, the height of the table, action latency, and observation noise. - An LSTM-based policy trained this way can push a hockey puck around a table. Feed-forward networks fail at the task, while LSTMs use past observations to infer the world's dynamics and adjust their behavior. ## Vision-to-Action Control with Reinforcement Learning - A robot was trained end-to-end in simulation with reinforcement learning, then deployed on hardware. The resulting system maps visual input directly to actions without special sensors and adapts to visual feedback. - Conventional RL works well only when small changes in action produce incremental reward changes, which suits tasks like walking. Most manipulation tasks lack such rewards. A dense reward for block stacking would have to encode arm-to-block proximity, approach orientation, lift height, and distance to the target. - After months of failed attempts at pick-and-place with conventional RL, the team developed Hindsight Experience Replay (HER). HER learns from a binary success/failure reward by treating a failed trajectory as if it had been the intended goal, so every attempt still produces useful learning signal. - The implementation uses an actor-critic setup with asymmetric information. The critic sees the full simulator state and estimates future rewards, while the actor sees only RGB and depth images, which are available on the real robot. The critic's accurate feedback thus trains an actor that relies only on real-world sensor data. - Domain randomization on visual shapes produces a vision system robust enough for the physical world. ## Computational Costs - Dynamics randomization slows training by about 3x. - Learning from images instead of state is about 5–10x slower.

OpenAI2017-07-042 min readCurated summary

Hindsight Experience Replay

The paper introduces Hindsight Experience Replay (HER), a technique that lets reinforcement learning agents learn efficiently from sparse, binary rewards without hand-engineered reward functions. HER works with any off-policy RL algorithm and acts as a form of implicit curriculum. The authors test it on robotic arm manipulation and show that policies trained in simulation can complete the same tasks on a physical robot. ## The Sparse Reward Problem - Sparse rewards are one of the main obstacles in reinforcement learning, since an agent receives little useful feedback until it succeeds. - The usual workaround is reward engineering, which is labor-intensive and can distort the learned behavior. - HER is designed to avoid this by making binary success or failure signals sufficient for learning. ## Hindsight Experience Replay - HER is a replay-based method that can be combined with an arbitrary off-policy RL algorithm. - It enables sample-efficient learning from binary rewards, which indicate only whether the task was completed. - The authors describe it as an implicit curriculum, meaning it structures the learning process without requiring an explicit sequence of progressively harder tasks. ## Robotic Manipulation Experiments - The method is evaluated on three object-manipulation tasks with a robotic arm: pushing, sliding, and pick-and-place. - In every task, the only reward signal is whether the task was completed. - Ablation studies show that HER is essential, since training in these challenging environments is not feasible without it. ## Transfer to a Physical Robot - Policies trained in a physics simulation are deployed on a real robot. - The physical robot successfully completes the tasks, which indicates that the learned policies transfer from simulation to reality. Where reward design is hard or success is easy to define but hard to shape, HER offers a way to train with simple binary success signals and avoid elaborate reward engineering.