techlist.io

Ddpg

3 posts

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-07-263 min readCurated summary

Better exploration with parameter noise

# Better Exploration with Parameter Noise Adding adaptive noise to the parameters of reinforcement learning policies, rather than to their actions, often improves performance. The method is simple to implement, rarely hurts results, and lets agents learn tasks much faster. On the HalfCheetah environment, a policy trained with parameter noise reached a score of about 3,000 after 20 episodes, while one trained with traditional action noise reached about 1,500. ## How Parameter Noise Differs from Action Noise - Traditional reinforcement learning explores by adding noise to the action space, which changes the probabilities of actions from one moment to the next. - Parameter noise instead perturbs the weights of the neural network policy, so the agent's decisions still depend fully on what it currently senses. - The approach sits between evolution strategies, which perturb parameters but not actions during rollouts, and methods like TRPO, DQN, and DDPG, which perturb actions but leave parameters untouched. - The authors believe the advantage comes from consistency: deliberate parameter perturbations produce exploration that persists across timesteps, while action noise produces erratic exploration unrelated to the agent's parameters. - Earlier work applied parameter noise to policy gradients, but this research extends it to deep neural network policies and to both on-policy and off-policy algorithms. ## Solving the Three Main Challenges - **Varying layer sensitivity:** Different layers respond differently to perturbations. Layer normalization keeps each perturbed layer's output within a similar distribution, so the next layer receives stable inputs. - **Shifting sensitivity over training:** The weights' sensitivity changes as training progresses, making behavior hard to predict. An adaptive scheme resizes the perturbations by measuring their effect on actions and comparing the resulting action-space noise level to a target. - **Choosing the noise scale:** Parameter noise is hard to interpret intuitively. The adaptive scheme moves the scale decision into action space, which is easier to reason about. ## Baselines and Benchmarks - The release includes baseline code for DQN, Double DQN, Dueling DQN, Dueling Double DQN, and DDPG with parameter noise. - Benchmarks compare DDQN with and without parameter noise on a subset of Atari games. - Benchmarks also compare three DDPG variants on a range of continuous control tasks in the MuJoCo simulator. ## Development Lessons - In early experiments, perturbing the DQN Q-function sometimes was so extreme that the agent repeated the same action. The team added a separate explicit policy head, as in DDPG, to work around this. - Later experiments showed the policy head was unnecessary. Changing how the noise was rescaled had likely fixed the underlying problem, so the simpler version performed comparably. - The authors note that reinforcement learning algorithms can fail silently and subtly, which can lead engineers to build workarounds around bugs they never noticed. ## Practical Takeaway Parameter noise is worth trying on any reinforcement learning problem. It is simple to add, rarely reduces performance, and can speed up learning considerably, especially when paired with layer normalization and adaptive scaling.

OpenAI2017-06-073 min readCurated summary

Learning to cooperate, compete, and communicate

# Multi-Agent Reinforcement Learning with MADDPG OpenAI's MADDPG (Multi-Agent Deep Deterministic Policy Gradient) is a reinforcement learning algorithm for training multiple agents that must cooperate or compete in shared environments. The authors argue that multiagent environments are important stepping stones toward AGI because they generate a natural curriculum and never settle into a stable equilibrium. Their approach, centralized training with decentralized execution, lets agents learn coordinated and adversarial behaviors that traditional decentralized methods fail to learn. ## Why Multiagent Environments Matter - The difficulty of the environment scales with the skill of competitors, so agents face a natural curriculum. Competing against clones of oneself produces an environment matched exactly to one's own skill level. - No stable equilibrium exists, so there is constant pressure to improve regardless of how capable an agent already is. ## How MADDPG Works - MADDPG extends DDPG and draws on actor-critic reinforcement learning. - Each agent is an "actor" that selects actions, while a "critic" evaluates those actions by predicting expected future reward, which is more stable than using raw rewards directly. - Each critic can access the observations and actions of all agents during training, enabling globally coordinated behavior. - At test time, agents act only on their own observations plus predictions of others' behavior, so the central critic is not needed during execution. - Because each agent's critic is learned independently, the method also handles arbitrary reward structures, including fully adversarial ones. ## Experimental Results - MADDPG outperformed DDPG on every task tested. - Demonstrated behaviors include two agents learning to split up to hide their intended destination from an opponent, one agent communicating a landmark's name to another, and three agents coordinating to reach landmarks without colliding. - In a predator-prey setup, four red agents learned to team up to chase a single green agent, while green agents learned to split up and use the water to evade them. ## Limitations of Traditional Decentralized RL - Each agent must simultaneously predict others' actions while learning its own, which makes the environment non-stationary and hard to learn, especially in competitive settings. - Policy gradient methods show high variance when rewards are inconsistent. Adding a critic improved stability but still failed on tasks like cooperative communication, suggesting that modeling other agents' actions during training is essential for cooperation. - In early experiments, listener agents learned to ignore speakers that sent inconsistent messages, setting the speaker's weights to zero. Once this happened, the speaker received no feedback and could not recover. Forcing listeners to attend to the speaker did not help, because the speaker still had no signal about which messages were relevant. The centralized critic addresses this by letting speakers learn which utterances matter to other agents' actions. ## Future Directions - Agent modeling has a long history in AI, but earlier work mostly considered games with few time steps and small state spaces. - Deep learning handles complex visual inputs, and RL handles long-horizon behavior. Combined, they allow training multiple agents without requiring knowledge of environment dynamics. - The authors suggest this opens the door to problems involving communication and language learned from high-dimensional environment data.