techlist.io

Imitation Learning

7 posts

OpenAI2022-06-224 min readCurated summary

Learning to play Minecraft with Video PreTraining

# Learning to Play Minecraft with Video PreTraining OpenAI trained a neural network to play Minecraft using Video PreTraining (VPT), a semi-supervised imitation learning method that combines a massive unlabeled video dataset with a small amount of labeled contractor data. The approach lets the model learn complex behaviors from internet videos, including crafting diamond tools, a task that takes proficient humans over 20 minutes. Because the model uses the native keyboard and mouse interface, the authors see it as a step toward general computer-using agents. ## Why Internet Video Lacks Action Labels - Internet videos show what happened but not the exact keypresses and mouse movements that produced it. - In language, the "action label" is simply the next word, but video offers no equivalent, which blocks building large-scale foundation models from video the way GPT was built from text. ## How VPT Works - Contractors play Minecraft while the team records both video and the actions they take. - An inverse dynamics model (IDM) is trained on this small labeled set to predict the action at each step. Because it can look at both past and future frames, this task is much easier and needs far less data than predicting actions from past frames alone. - The trained IDM labels a much larger set of online videos, and a behavioral cloning (BC) model learns to act from those pseudo-labeled videos. ## Zero-Shot Behavior from the Foundation Model - The team chose Minecraft because it is widely played, so it has abundant free video, and it is open-ended, which resembles real-world computer use. - The agent works at 20Hz using the native mouse and keyboard, unlike prior work that simplified the action space. - Trained on 70,000 hours of IDM-labeled video, the model chops trees, crafts planks and a crafting table (about 1,000 actions for a proficient human), swims, hunts and eats animals, and performs "pillar jumping." ## Fine-Tuning with Behavioral Cloning - Contractors built houses in new Minecraft worlds over 10 minutes, and the model was fine-tuned on this dataset. - Fine-tuning markedly improved reliability on early-game skills and pushed the agent further up the tech tree, to wooden and stone tools. - Occasionally the agent built rudimentary shelters and searched villages, including raiding chests. ## Data Scaling Results - The authors trained foundation models on 1 to 70,000 hours of data. Models under 2,000 hours used ground-truth contractor labels, while larger ones used IDM-labeled internet data. - Crafting ability generally improved with more data, and stone tool crafting emerged only at the largest scale. - The central hypothesis is that using contractor data to train an IDM is far more effective than training a BC model directly on the small contractor dataset. ## Fine-Tuning with Reinforcement Learning - Random exploration is inefficient for hard tasks, and a human-like VPT model should be a better prior than random actions. - The agent was rewarded for each subtask on the way to a diamond pickaxe. - An RL policy trained from scratch barely earned any reward, never learning to collect logs and rarely collecting sticks. - The VPT-initialized policy crafted diamond pickaxes in 2.5% of 10-minute episodes and matched human-level success on the intermediate items. The authors describe this as the first demonstration of a computer agent crafting diamond tools in Minecraft. ## Conclusion VPT offers a path to learning behavioral priors from the vast number of internet videos, which goes beyond the representational priors that generative video or contrastive methods provide. The authors believe the approach can extend to other domains with generic interfaces, such as computer use. They are open-sourcing the contractor data, environment, model code, and weights, and partnered with the MineRL NeurIPS competition, which lets contestants fine-tune the models.

OpenAI2018-07-034 min readCurated summary

Learning Montezuma’s Revenge from a single demonstration

# Learning Montezuma's Revenge from a Single Demonstration OpenAI trained an agent to score 74,500 on Montezuma's Revenge from a single human demonstration, a result better than any previously published. The method starts each reinforcement learning episode from a state in the demonstration and gradually moves the starting point back to the beginning of the game, optimizing the game score directly with PPO. This turns one hard exploration problem into a curriculum of short, easier subtasks. ## Why Exploration Is the Bottleneck - Model-free methods like policy gradients and Q-learning explore by taking random actions, which only works when rewards are frequent enough. - Games like Montezuma's Revenge require long, precise action sequences before any reward appears. If each of N actions has a fixed probability, the expected time to the first reward grows exponentially in N. - Getting the first key, for example, requires a chain of steps (down ladders, down a rope, jump a skull, climb a ladder), so the overall probability is far smaller than any single step's. ## Curriculum Built from Demonstration States - Each episode starts from a recorded demonstration state. Early in training, the agent starts near the end of the demonstration, where the remaining task is short. - Once the agent matches or beats the demonstrator's score on the remaining segment in at least 20% of rollouts, the starting point moves earlier in time. - This continues until the agent plays from the true start of the game without using the demonstration. - Because each stage is only slightly harder than the last, the agent's chance of success stays high, and the required exploration scales linearly rather than exponentially with the length of the action sequence. - The authors note that earlier work had proposed resetting to demonstration states, but the gradual backward curriculum was essential to getting a benefit from the demonstration. ## Comparison with Imitation Approaches - Prior DeepMind work imitated demonstrations, either by reproducing states from a YouTube video or by combining Q-learning with a likelihood term on demonstrated actions. - Those methods need less environment control, but this approach requires resetting the environment to arbitrary states and access to full game states from the demonstration. - Optimizing the game score directly avoids overfitting to a possibly suboptimal demonstration and allows the agent to discover strategies the demonstrator did not use. The authors also suggest this could help in multiplayer settings where opponents differ from the demonstrator. ## Remaining Challenges - **Generalization:** The agent rarely reproduces the exact demonstrated states because of frameskip differences and action randomness, so it must generalize to near-identical states. This works well for Montezuma's Revenge but much less well for Gravitar and Pitfall, which likely need better vision. - **Exploration–exploitation balance:** The PPO entropy coefficient, learning rate, and reward scaling required careful tuning. Gravitar and Pitfall never found workable hyperparameters for the full curriculum, and some runs for Montezuma's Revenge failed to converge. - **Robustness:** The trained policy does not yet generalize as well as a human. With sticky actions (repeat probability 0.25) it averages 10,000 points, and with random actions (probability 0.01) it averages 8,400. Humans also degrade under such perturbations, but less so. These perturbed scores still exceed previously published results. - **Start-state variation:** Starting with 0 to 30 random no-ops did not significantly hurt performance, with most rollouts reaching the demonstration's final score. ## Takeaway Decomposing a long-horizon sparse-reward problem into a curriculum of subtasks, seeded by demonstration states and optimized for the true reward, can solve tasks that pure random exploration cannot. The authors hope future RL algorithms will be more robust to noise and hyperparameter choices.

OpenAI2018-06-161 min readCurated summary

Learning policy representations in multiagent systems

Modeling agent behavior is central to understanding complex phenomena in multiagent systems, but prior work has mostly been task-specific and reliant on hand-engineered, domain-specific knowledge. The authors propose a general framework that models agent behavior from only a handful of interaction data by treating the problem as representation learning. They show that it works across a high-dimensional competitive continuous-control environment and a cooperative communication environment. ## A General Framework for Agent Modeling - The approach applies to any multiagent system rather than a single task or domain. - It needs only a small amount of interaction data. - Agent modeling is cast as a representation learning problem, in which each agent's policy is encoded as a learned representation. ## A Novel Objective and Unsupervised Learning Algorithm - The objective combines ideas from imitation learning and agent identification. - An algorithm learns representations of agent policies without labeled supervision. ## Empirical Evaluation - **Competitive environment:** a high-dimensional continuous-control setting. - **Cooperative environment:** a setting where agents communicate. - **Tasks:** the learned representations are tested on supervised predictive tasks, unsupervised clustering, and policy optimization with deep reinforcement learning.

OpenAI2017-05-152 min readCurated summary

Robots that learn

# Training Robots in Simulation to Learn Tasks from a Single Demonstration OpenAI describes a robotics system trained entirely in simulation that can learn a new task after watching one human demonstration, then reproduce that task on a physical robot from a different starting configuration. The approach combines domain randomization for vision with a one-shot imitation learning network, so the robot never needs real-world training images or real demonstrations for its core learning. ## Domain Randomization for Vision - The vision network takes a camera image and outputs a state representation of object positions. - It is trained on hundreds of thousands of simulated images with randomized lighting, textures, backgrounds, and object appearance. - It never sees a real image during training, yet transfers to the physical robot. ## One-Shot Imitation Learning - A human demonstrates the task in VR, and the imitation network infers the task's intent from that single demonstration. - The network then performs the same task from a new starting configuration, so it must generalize rather than replay the exact motions. - Training uses dozens of tasks with thousands of demonstrations each. Each example is a pair of demonstrations of the same task: the network sees the full first demonstration plus one observation from the second, and uses supervised learning to predict the action taken at that observation. - To predict actions well, the network must learn which parts of the first demonstration matter for the task. ## Block Stacking Experiment - The task of stacking color-coded blocks into towers was simple enough to solve with a scripted policy in simulation, which generated the imitation network's training data. - Training pairs started from different initial states but produced towers in the same order, so the network learned to match the demonstrator's block ordering and tower sizes without depending on the towers' relative locations. - Despite never seeing messy human data during training, the network parsed real human demonstrations at test time. - Soft attention over the demonstration trajectory lets the system handle demonstrations of variable length. - Attention over individual block locations lets it imitate longer sequences than it saw in training and build towers with more blocks than any training demonstration. - Injecting modest noise into the scripted policy's outputs was necessary. It forced the demonstrations to include recovery from mistakes, and without it the imitation network usually failed to complete the stacking task.

OpenAI2017-03-202 min readCurated summary

One-shot imitation learning

Researchers propose one-shot imitation learning, a meta-learning approach that lets a robot learn a task from a single demonstration and then perform new instances of that task. Current imitation learning typically needs careful feature engineering or many samples for each task, which is far from the goal of robots that generalize instantly from very little data. The authors argue that training on a broad enough range of tasks could eventually produce a general system that turns any demonstration into a working policy. ## Problem Setting - Existing imitation learning usually solves each task in isolation. - It depends on hand-crafted features or large numbers of demonstrations. - The goal is a robot that learns from very few demonstrations and adapts to new situations of the same task without task-specific engineering. ## Task Structure and Training Data - The authors consider a large set of tasks, where each task has many instances that differ in initial states. - Example tasks include stacking all blocks on a table into one tower, or arranging them into two-block towers. - At training time, the model sees pairs of demonstrations for a subset of tasks. ## Model and Training Objective - A neural network takes as input one demonstration and the current state, which starts as the initial state of the paired demonstration. - It outputs an action, and the goal is for the resulting sequence of states and actions to match the second demonstration as closely as possible. - The model uses soft attention, which the authors credit with generalizing to conditions and tasks not seen during training. ## Test-Time Behavior - At test time, the model receives one demonstration of a single instance of a new task. - It is then expected to perform well on other instances of that same task. ## Outlook - The authors expect that training on a much wider variety of tasks and settings could yield a general system that converts any demonstration into a robust policy for a broad range of tasks.

OpenAI2017-03-052 min readCurated summary

Third-person imitation learning

Reinforcement learning depends on a reward function that is hard to specify, and imitation learning is the traditional workaround. This paper argues that existing imitation methods need first-person demonstrations, which are costly to collect, and proposes an unsupervised method that learns from third-person demonstrations instead. The method uses domain confusion to extract domain-agnostic features, and the authors validate it on simple control tasks. ### Limits of First-Person Imitation Learning - Prior imitation learning methods require demonstrations in the first person, meaning a sequence of states along with the actions the agent should have taken. - Collecting first-person demonstrations is a relatively hard problem, which limits how far these methods scale. - Humans avoid this constraint by watching others perform a task, inferring the goal, and then accomplishing it themselves. ### Unsupervised Third-Person Imitation - The agent learns to achieve a simple goal in a simple environment from a demonstration by a teacher who pursues the same goal from a different viewpoint. - The learning is unsupervised: the agent receives only the third-person demonstrations and no correspondence between teacher states and student states. - The central insight is that recent domain confusion techniques can produce domain-agnostic features, which the training process depends on. ### Experimental Validation - The method is tested on learning from third-person demonstrations in three domains: a pointmass, a reacher, and an inverted pendulum. - The abstract reports successful results in all three domains.

OpenAI2016-11-102 min readCurated summary

A connection between generative adversarial networks, inverse reinforcement learning, and energy-based models

Generative adversarial networks (GANs), inverse reinforcement learning (IRL), and energy-based models (EBMs) are usually studied separately, but this post argues they are closely linked. The authors show that a sample-based algorithm for maximum entropy IRL is mathematically equivalent to a GAN in which the generator's density can be evaluated and fed to the discriminator. They then argue that GAN training can be understood as training an energy-based model, and they hope making these links explicit will help researchers transfer techniques for stabilizing and scaling these methods. ## Learning Cost Functions in Generative Modeling and Control - In a GAN, the generator is trained against a cost function that a discriminator learns at the same time. - Learning cost functions has a longer history in control and reinforcement learning, mainly for imitation learning from demonstrations. - In those fields, recovering the cost that explains observed behavior is called inverse reinforcement learning or inverse optimal control. ## Equivalence Between Maximum Entropy IRL and GANs - The authors show that certain IRL methods are not just analogous to GANs but mathematically equivalent to them. - The specific match is a sample-based algorithm for maximum entropy IRL and a GAN whose discriminator also receives the generator's density as an additional input. ## Connection to Energy-Based Models - Maximum entropy IRL is a special case of an energy-based model. - Because of this, GAN training can be interpreted as a way to train energy-based models. - The paper relates this view to other recent work that connects GANs and EBMs. ## Implications for Stability and Scalability - Stability and scalability are named as major open challenges in all three areas. - The authors suggest that ideas can move between the communities once the formal connections are clear, especially methods aimed at more stable and scalable training.