techlist.io

Proximal Policy Optimization

4 posts

OpenAI2019-09-164 min readCurated summary

Emergent tool use from multi-agent interaction

# Emergent Tool Use from Multi-Agent Hide-and-Seek OpenAI trained agents to play a team-based hide-and-seek game in a simulated physics environment, and they developed six distinct strategies and counterstrategies, including tool use that the designers had not anticipated. The agents received no incentive to interact with objects; the complex behavior arose from the competitive dynamics of the game alone. The authors argue that multi-agent competition is a more scalable route than intrinsic motivation to producing human-relevant skills without supervision, and that evaluating such agents requires new transfer-based tests. ## The Environment and Reward Structure - Hiders (blue) must avoid line-of-sight with seekers (red), while seekers must keep hiders in view. - Agents can grab and lock movable objects, and the map includes randomly generated immovable rooms and walls. - Hiders get a preparation phase in which seekers are immobilized, giving them time to run or rearrange the space. - The only supervision is a team-based reward: hiders receive +1 when all are hidden and -1 if any is seen, and seekers receive the opposite. - Agents are penalized for leaving the play area, and all agents receive zero reward during preparation. ## Autocurricula and Emergent Strategies - As agents train against each other, up to six strategies emerge, with each new one creating pressure for the next stage. - No direct incentive exists for object interaction or exploration. The behaviors result from an autocurriculum induced by multi-agent competition. ## Training Setup - The team reused the infrastructure and algorithms from OpenAI Five and Dactyl, with each agent acting independently on its own observations and hidden memory state. - The world is represented as entity-centric state, permutation invariant over objects and agents. - Each object is embedded and processed by a masked residual self-attention block, similar to transformers but attending over objects rather than time. Objects outside line-of-sight and in front of the agent are masked out. - Training uses self-play and Proximal Policy Optimization. The value function can use privileged information about obscured objects and agents. - Large-scale training was critical. Larger batch sizes drastically reduced wall-clock time to reach stage 4 (ramp defense) without greatly affecting sample efficiency at or above 32k. Batch sizes of 8k and 16k never reached stage 4 within the episode budget. ## Competition Versus Intrinsic Motivation - The team compared against count-based exploration, which rewards agents for visiting rarely seen states. - Count-based agents with a simple 2-D box-position state moved objects in seemingly undirected ways. With the full state, they had fewer meaningful object interactions as complexity grew. - Hide-and-seek agents produced more interpretable behavior, such as shelter construction. The authors expect competition to scale better as environments grow. ## Evaluating Agents Through Transfer - Reward alone is ambiguous in multi-agent settings, and ELO or TrueSkill cannot show whether gains come from new adaptations or from improving existing skills. Environment-specific statistics like object movement are also hard to interpret and costly to design as environments scale. - The authors propose a suite of domain-specific intelligence tests that measure transfer performance as a proxy for representation quality and skill. They compare against count-based pretraining and training from scratch. - The hide-and-seek agents transferred somewhat better on many tasks but did not show a dramatic improvement in performance or convergence time. The authors attribute this to entangled skill representations that are hard to fine-tune, and they open-sourced the evaluation tasks. ## Lessons From Surprising Behavior Building environments is difficult, and agents often exploit unintended quirks in the environment or physics engine. The authors suggest that agents can learn sophisticated tool use in a high-fidelity simulator, but that careful environment design remains essential.

OpenAI2018-07-294 min readCurated summary

Learning dexterity

# Learning Dexterity: Training a Robot Hand Entirely in Simulation OpenAI's Dactyl system trains a Shadow Dexterous Hand to reorient physical objects using a reinforcement learning policy learned entirely in simulation, with no fine-tuning on the real robot. The core idea is domain randomization: rather than trying to make the simulator physically accurate, the policy is trained across a wide distribution of randomized physical and visual parameters, so that the real world becomes just one more variation it has already seen. The result is a robot that rediscovers human-like grasps and manipulates blocks and other shapes on hardware, reaching up to 46 to 50 consecutive rotations with vision or motion-tracking feedback. ## The Problem - Dexterous manipulation has lagged behind locomotion in robotics, and the Shadow hand has 24 degrees of freedom compared to 7 for a typical arm. - The robot must handle noisy, delayed sensor readings, occluded fingertips, and unobservable properties such as friction and slippage. - Reinforcement learning works well in simulation but has produced limited results on physical robots. ## Why Not Simulate Realistically or Train on Hardware - Simulators can generate enough data to train complex policies, but manipulation physics (contact, deformable fingertips, tendon stretching, rolling resistance) is hard to model accurately. - Training directly on hardware would take years of real experience for a task like object reorientation. - Domain randomization sidesteps this tradeoff: the simulator prioritizes variety over realism, so policies generalize to the real world. ## Control and Vision Architecture - **Control policy:** An LSTM lets the network infer environment dynamics from its history. It achieved about twice as many rotations as a memoryless policy. Training used Rapid, the scaled PPO implementation from OpenAI Five, on 6,144 CPU cores and 8 GPUs, collecting about 100 years of experience in 50 hours. - **Vision network:** A convolutional network takes three RGB camera views and estimates the object's pose. It was trained only on simulated images rendered in Unity with randomized visual properties. Multiple cameras resolve occlusion and ambiguity. - The two networks are independent and combined at deployment, so the hand can manipulate an object by seeing it. ## Emergent Strategies - Dactyl discovered grasp types from the GRASP taxonomy (tip pinch, palmar pinch, tripod, quadpod, power grasp, and five-finger precision grasp) without being taught them explicitly. - For tip pinches, it favored the thumb and little finger, whereas humans typically use the index or middle finger. The robot's extra little-finger degree of freedom likely explains this choice. ## Results - Randomized policies achieved far more rotations than non-randomized ones. A non-randomized policy managed a median of 0 successes, while the fully randomized policy reached a median of 11.5 with vision and 13 with motion tracking, and a maximum of 46 and 50 respectively. - Vision-based pose estimation performed nearly as well as direct motion-tracking readings. - Without randomization, a policy needed about 3 years of simulated experience to rotate an object. Full randomization required about 100 years, and most of the training time went into robustness to dynamics. ## Surprises and Negative Results - **Tactile sensing was unnecessary.** The policy used only fingertip locations and object pose, ignoring the available touch sensors, because a limited sensor set was easier to model in simulation. - **Randomizations transferred across shapes.** Randomizations designed for a block worked on an octagonal prism without modification. A sphere performed poorly, likely because rolling behavior was not randomized. - **Systems engineering mattered as much as algorithms.** One engineer's faster laptop masked a timing bug that hurt performance for everyone else. - **Faster control did not help.** Reducing the action interval from 80 ms to 40 ms increased training time without improving real-world performance. - **Real data did not help vision.** Simulator-only training matched the accuracy of mixed sim-and-real training, and real tracking data suffered from latency, measurement error, and fragility to configuration changes. ## Conclusion Dactyl demonstrates that scaling domain randomization and recurrent reinforcement learning can solve dexterous manipulation tasks that were previously out of reach for robotics, using a simulation-first pipeline. The authors frame it as one step in a cycle of developing a learning algorithm, scaling it on hard simulated tasks, and transferring the result to the real world.

OpenAI2018-06-245 min readCurated summary

OpenAI Five

# OpenAI Five: Reaching Amateur-Level Dota 2 with Scaled Self-Play OpenAI's team of five neural networks, OpenAI Five, had begun beating amateur human teams at Dota 2 by June 2018, with a planned match against top professionals in August. The post argues that Dota 2, with its long time horizons, partial observability, and vast action and observation spaces, is a meaningful step beyond games like Chess and Go. It concludes that large-scale self-play with a modern policy-gradient algorithm can produce long-horizon planning without fundamentally new RL methods. ## Why Dota 2 Is Hard - **Long time horizons:** A typical game runs about 45 minutes at 30 frames per second, or roughly 80,000 ticks. The model observes every fourth frame, producing about 20,000 decisions per game, compared with fewer than 40 moves in a typical chess game and around 150 in Go. - **Partial observability:** Units see only their immediate surroundings, and the rest of the map is hidden by fog of war. Strong play requires inferring enemy positions and predicting opponent strategy. - **Large action space:** Each hero has dozens of actions, many of which target units or ground positions. The team discretized this into 170,000 possible actions per hero, with about 1,000 valid at any tick, compared with 35 in chess and 250 in Go. - **Large observation space:** The model receives about 20,000, mostly floating-point, values through Valve's Bot API, compared with roughly 70 enumeration values for a chess board and about 400 for Go. - **Complex, changing rules:** The game logic spans hundreds of thousands of lines of code, takes milliseconds per tick to execute, and receives updates about every two weeks. ## Training Approach - OpenAI Five uses a scaled-up version of Proximal Policy Optimization, trained on 256 GPUs and 128,000 CPU cores. Each hero has its own LSTM, and no human data is used. Training starts from random parameters. - The system plays about 180 years of games against itself each day. - The discount factor γ was annealed from 0.998, a half-life of about 46 seconds, to 0.9997, a half-life of about five minutes. For comparison, the longest horizons in the PPO, Rainbow, and Observe and Look Further papers had half-lives of 0.5 seconds, 4.4 seconds, and 46 seconds, respectively. - Each network has a single 1024-unit LSTM that outputs actions through several independent heads, such as action delay, action selection, and grid coordinates. - Although the model cannot see shrapnel zones, which are visible to human players, it learned to walk out of them by observing its health dropping. ## Exploration and Reward Design - Training is 80% self-play against current versions and 20% against past versions, which prevents strategy collapse. - Learned behavior progresses over time. Within hours, laning and farming emerge. Within days, the agents follow basic human strategies such as stealing runes and rotating across the map. With further training, they learn high-level tactics like five-hero pushes. - Domain randomization, which varies unit health, speed, and starting level during training only, forced the agent to explore strategy space. A "lane assignment" randomization penalizes straying from assigned lanes until a random point in the game. - The reward is based on metrics humans track, including net worth, kills, deaths, assists, and last hits. Each agent's reward has the opposing team's average subtracted to discourage positive-sum outcomes. - Item and skill builds are hardcoded and chosen randomly from a set. ## Coordination Without Communication - The heroes have no explicit communication channel. Instead, a "team spirit" hyperparameter, annealed from 0 to 1 during training, weights each hero's individual reward against the team average. ## Results - The system beat a team of OpenAI employees, Valve employees, and amateur and semi-pro teams with restricted hero pools. - The June 6 version decisively won against three teams and won two of three informal scrimmage games against two others. - Observed strategies included sacrificing the safe lane to control the enemy's safe lane, accelerating the early-to-mid transition through ganks and coordinated tower pushes, and giving support heroes early resources. - The team reports two surprising findings. A binary win/loss reward trained far more slowly and plateaued, and creep blocking emerged in a 2v2 model without any explicit reward. ## Caveats and Differences from Humans - The AI has advantages in reaction time (80ms on average) and perfect information access, since it reads exact values that humans must check manually. Its action rate is around 150 to 170 per minute, with a theoretical maximum of 450. - The restricted version used for testing excludes wards, Roshan, invisibility, summons, and several items, and it uses a fixed mirror matchup of five heroes. The team states these restrictions are temporary and planned for removal. - The team noted that the bot's objective prioritization resembled professional strategy, though its last-hitting was only around median. ## Conclusion The authors suggest that long-horizon planning can emerge from scaled reinforcement learning without new algorithmic breakthroughs. They plan to measure success by applying similar methods to real-world tasks.

OpenAI2017-10-102 min readCurated summary

Competitive self-play

# Competitive Self-Play in Simulated 3D Environments OpenAI researchers found that simulated robots trained purely through competition against copies of themselves can learn physical skills such as tackling, ducking, faking, kicking, catching, and diving, without the environment being explicitly designed for them. Because self-play continually matches each agent against opponents of appropriate difficulty, it creates a learning curriculum that human designers would otherwise have to craft by hand. Combined with their earlier Dota 2 results, the work suggests self-play will be a core component of powerful AI systems. ## Experimental Setup - Simulated 3D robots compete in basic games such as sumo wrestling, pushing an opponent out of a ring, reaching the opposite side while blocking the other agent, and soccer-style goal scoring. - Each agent is given only simple goals, and the strategies that emerge are analyzed afterward. - Each agent's neural network policy is trained independently using Proximal Policy Optimization (PPO). ## Reward Shaping and Annealing - Agents first receive dense rewards that encourage exploration, such as standing and moving forward. - These dense rewards are gradually reduced to zero, leaving only the win/loss signal. - In sumo, the team took a walking reward from earlier work, removed the velocity term, and added a negative L2 distance from the ring's center as the exploration reward. - This shaping lets agents learn complex competitive behavior without hand-designed skill objectives. ## Emergent Skills and Transfer Learning - Agents learned tackling, ducking, faking, kicking, catching, and diving through competition alone. - Human-designed environments can only produce behaviors that designers anticipate, while self-play lets agents keep bootstrapping against successively stronger versions of themselves. - A sumo-trained agent kept its balance under "wind" forces it had never encountered, while standard RL-trained walkers fell immediately, suggesting the learned skills generalize. ## Avoiding Overfitting to Specific Opponents - Agents initially co-adapted to counter particular opponents and failed against new ones. - The fix was to train each agent against a diverse pool of opponents, including policies from parallel training runs and earlier checkpoints. - Diversity forces agents to learn general strategies rather than exploits tailored to a single opponent. ## Conclusion The researchers released the MuJoCo environments and trained policies so others can build on this work. The results indicate that self-play, paired with reward annealing and opponent diversity, can produce robust, transferable skills without requiring humans to specify those skills in advance.