techlist.io

Behavioral Cloning

2 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.

OpenAI2016-12-044 min readCurated summary

Universe

# Universe: A Platform for Training AI on General Computer Tasks OpenAI's Universe is a software platform for measuring and training AI agents across the full range of tasks a human can perform on a computer. Instead of relying on special APIs or access to program internals, Universe lets an agent view screen pixels and operate a virtual keyboard and mouse, the same way a person does. The release includes roughly a thousand environments, from Flash games and browser tasks to commercial games, with the goal of building a single agent that can quickly master unfamiliar tasks, a step toward general intelligence. ## Motivation: Narrow AI and the Lack of Transferable Experience - Existing systems such as AlphaGo achieve superhuman performance in one domain but cannot apply that knowledge elsewhere. - Standard RL training starts agents from scratch and relies on tens of millions of random trials, so experience does not carry over between tasks. - Progress toward general intelligence requires agents to train on a wide variety of tasks so they can build reusable world knowledge and problem-solving strategies. ## Universe Infrastructure - Each environment runs inside a Docker container that exposes a VNC server for pixels and keyboard/mouse input, plus a WebSocket server that sends rewards and auxiliary information and accepts control messages. - The `universe` Python library acts as a VNC client and wraps each environment as a standard Gym environment, so any program can be turned into one without access to its source code. - Performance target: a single Python process drives 20 environments in parallel at 60 frames per second. A batch-oriented VNC client written in Go and loaded as a shared library keeps frame transfer efficient, reaching about 100ms latency, mostly from server-side encoding. - Debugging and demonstrations are simple: an observer can attach a VNC client to watch training, and human demonstrations can be recorded by saving VNC traffic. These demonstrations can seed agents through behavioral cloning before RL fine-tuning. ## Environment Types - **Atari games:** Run asynchronously over the network, so agents must handle realistic lag (about 20ms observation and 10ms action lag on a cloud LAN, higher over the public internet). - **Flash games:** About 1,000 are included (100 with reward functions), distributed with rightsholder consent. Selenium launches Chrome and clicks through menus automatically. - **Reward extraction:** Since game memory formats vary widely, rewards are read from on-screen scores using a convolutional neural network OCR model. Off-the-shelf OCR like Tesseract struggled with game fonts and animated backgrounds. - **Browser tasks:** Mini World of Bits is an 80-environment benchmark, analogous to MNIST, ranging from clicking a button to replying to an email. Realistic flight-booking tasks use cached site recordings to avoid live bookings. ## Validation Experiments - **Pong:** The agent learned to reach a score of +17 (out of 21) in about an hour, while humans on the same version averaged -11, showing that the variable latency still allows precise, fast reactions. - **Racing Flash games:** RL worked after standard techniques such as reward normalization. - **Browser tasks:** Some tasks with hard exploration problems were solved through behavioral cloning from human demonstrations. - **slither.io:** Agents controlled 32 environments at 5 frames per second. Average reaction time was about 150ms over the public internet, compared with roughly 250ms for humans. ## Running Universe - Install Docker and the `universe` library, then start a runtime such as `universe.flashgames`, which exposes VNC on port 5900 and WebSocket on port 15900. - The Gym interface is used the same way as in other Gym environments, with `env.reset()`, `env.step()`, and `env.render()`. - For large-scale use, an allocator service provisions runtimes on a Kubernetes cluster on demand. ## Future Plans and Community Involvement - A transfer learning benchmark was planned, to measure whether agents actually improve at general problem solving. - The authors compared the project to ImageNet, whose error rate fell from 28% in 2010 to 3% in 2016. They hope Universe can follow a similar path of rapid progress. - Planned contributions include granting permission for games and apps, training agents on Universe tasks, integrating new environments with forthcoming tools, and contributing human demonstrations. - Partners include EA, Valve, Microsoft, NVIDIA, and many independent game studios. Microsoft's Project Malmo team was also planning an integration. ## Practical Takeaway Universe makes it possible to train and evaluate one agent across a broad set of real computer programs using only pixels and input events. Researchers who want to test general problem-solving ability, rather than narrow game performance, can start with the Docker runtimes and the Gym interface.