Search

Search papers and lessons

Genie: Generative Interactive Environments

Jake Bruce, Michael Dennis, Ashley Edwards et al. · 2024

Genie learns playable 2D worlds from unlabelled internet videos, inventing its own discrete action codes and predicting each next frame from the last frame and the chosen action.

On this page

  • Colour = topic mix
  • Probability
  • Calculus
  • Linear algebra
  • Neural network basics
  • Architectures
  • Generative models
  • Sign in to see your progress

TL;DR

Genie's main model is trained only on unlabelled internet videos of 2D platform games (a smaller model is also trained on robot videos). It learns its own small set of discrete "actions" from frame-to-frame changes, then predicts each next frame from the previous frames and the chosen action. A user can start from an image, a sketch or a photo and step through the generated world one action at a time.

The paper reports an 11B-parameter model. The main claim is that controllable worlds can be learned without any action labels.

Where you'll see it: research on world models and on training agents inside generated environments, and the question of how much of a game engine can be learned from video.

The problem

Action-conditioned world models are useful. An agent can practise inside a learned simulator instead of the real environment, as covered in World Model and Model-Based Reinforcement Learning. But training one needs data that says which action was taken at each step. Such data is expensive to collect for games, robots and the open world. Internet video is plentiful, but it has no action labels. A frame-to-frame video model can generate plausible video, yet the user cannot steer it.

So the problem the paper addresses is this: how do you get a model that responds to controls when the only data is video without controls?

Earlier video generators conditioned on text or on past frames, and some playable-video methods used latent actions, but the paper argues these were limited to a single domain with static examples. The paper's aim is a general method that creates new environments from a prompt.

Key idea

Infer the action from the video itself. A small model looks at a pair of consecutive frames and produces a discrete code, one of a small vocabulary. That code is meant to capture what changed between the two frames, such as the character moving right. The code is then used as the action that conditions the next-frame predictor.

Two parts make this work. The action vocabulary is kept small, so the codes are easy for a human to use, like the buttons on a controller. And the inferred actions are learned together with the video model, so the codes end up meaning consistent things across different scenes.

At play time the action labels from the video model are thrown away. The user chooses one of the discrete codes, and the dynamics model treats that choice as the action.

The method

The system has three parts (the paper's Figure 2).

Video tokenizer

The tokenizer turns each frame into discrete tokens. It is a VQ-VAE (see Vector Quantization): an encoder produces a continuous latent for each patch, which is snapped to the nearest entry of a codebook, so every frame becomes a grid of token indices. The paper uses a spatiotemporal transformer in both encoder and decoder, so each token sees neighbouring frames as well as neighbouring patches. The architecture is built from vision transformer blocks.

The paper's training details: 200M parameters, patch size 4, a codebook of 1024 codes with embedding size 32, and 16-frame clips at 10 frames per second.

Latent action model

The latent action model (LAM) takes the past frames and the next frame and outputs a continuous latent action for each step. That latent is quantised to one of ∣A∣=8|A| = 8 codes. A decoder then tries to rebuild the next frame from the past frames and the quantised action. The decoder exists only to give the LAM a training signal. Once training is done, everything in the LAM except the codebook is discarded.

The small codebook is the important constraint. With few codes, the action has to carry the most important change between frames. The paper says it chose 8 actions for playability and controllability. Its appendix notes a benefit from more codes, at the cost of reduced playability for humans and AI agents.

The LAM has 300M parameters, patch size 16, and the same code embedding size of 32.

Dynamics model

The dynamics model predicts the next frame's tokens. It is a decoder-only transformer trained in the style of MaskGIT (a masked token-prediction model in the spirit of Masked Language Modeling): during training some input tokens are masked at a random rate between 0.5 and 1, and the model predicts the true tokens with Cross-Entropy Loss. Each frame's tokens are conditioned on the latent actions for earlier steps.

The paper trains with causal masking in the temporal layers, so one forward pass gives predictions for every next frame in the clip. This is autoregressive in time, in the sense of Autoregressive Model.

Generating a new world

At inference a player gives one image. It is tokenised, the user selects one of the 8 action codes, the code is looked up in the codebook, and the dynamics model predicts the next frame's tokens. The tokens are decoded back to pixels. The paper samples each frame with 25 masked-decoding steps at temperature 2, using random sampling.

The paper observes that an action keeps the same effect across different starting images, which is why a user can treat the codes like buttons on a new controller.

Example
How one step is produced

Take a 16-frame context at 10 frames per second, as the paper uses.

  1. The prompt image is tokenised into a grid of discrete tokens, one grid per frame.
  2. The user picks action 3 out of the 8 available codes.
  3. The codebook returns the latent vector for action 3, which conditions the dynamics model.
  4. The dynamics model fills in the next frame's token grid over 25 masked steps.
  5. The new token grid is decoded to an image.
  6. Repeat with the new frame as context, and with the user's next choice.

The per-frame cost is therefore 25 transformer passes. At the paper's reported rate of about one frame per second, the cost of generation is the main limit on interaction, as the conclusion notes.

Interpretation: the user never supplies a physics rule or a label. Every step is a short sequence of token predictions conditioned on past tokens and one of eight learned codes.

Results

The paper reports three kinds of evidence.

Scaling. The paper trains dynamics models from 40M to 2.7B parameters and finds that a larger model gives a lower final training loss at a steady rate. It also studies batch size on a 2.3B model with batches of 128, 256 and 448, which correspond to 1.9M, 3.8M and 6.6M tokens. The final model is a 10.1B dynamics model trained with batch size 512 for 125k steps on 256 TPUv5p chips. With the tokenizer and LAM, the paper gives a total of 10.7B parameters trained on 942B tokens. The abstract and introduction round this to 11B.

Generation quality and controllability. The paper reports two numbers. FVD measures video fidelity, and lower is better. The change in PSNR when the frame is generated from the true latent actions versus from random ones, called Δt\Delta_tPSNR, measures how much the actions matter, and higher is better. On the Platformers data the pixel-input LAM (the Genie design) gets FVD 40.1 and Δt\Delta_tPSNR 1.91. A token-input variant gets FVD 38.8 and 1.33. The paper says the pixel input is better for controllability on both datasets. On the robotics data, the pixel-input model gets FVD 136.4 against 257.8 for the token-input variant.

Tokenizer design. A spatial-only ViT tokenizer gets FVD 114.5 at 230M parameters. C-ViViT gets 272.7 at 225M. The paper's ST-ViViT gets 81.4 at 205M parameters with 0.9 GB memory, and its Δt\Delta_tPSNR is 1.66, which is the best of the three.

Agents. The paper trains a policy on the frozen LAM labels in CoinRun, a procedurally generated platform game. It reports that the policy trained on latent actions matches an oracle behavioural-cloning model that sees the true actions, once given as few as 200 expert samples to map latent codes to real controls. The random agent is the lower bound. These are the paper's own experiments, on one game.

The paper also shows qualitative results: images from text-to-image models, hand-drawn sketches and real photos can all be made playable, and the same latent action moves characters consistently across prompts.

Why it mattered

The paper states its own goal: a foundation world model that could be used to train generalist agents, and a route to more diverse environments, which the paper calls a key limit in reinforcement learning. Its conclusion says the approach could be trained on a larger share of internet video.

The paper is also candid about limits, and these shape how the result should be read. Genie can hallucinate unrealistic futures. Its memory is 16 frames, which makes long-horizon consistency hard. It runs at about 1 frame per second, which is far from interactive play. The paper treats these as open problems rather than solved ones.

Reading guide

  1. Introduction and Figure 1: the claim that the model is playable from many prompt types, and that it is trained with no action labels. Needs World Model.
  2. Section 2.1, the latent action model: how a continuous action is quantised to 8 codes with a VQ objective. Needs Vector Quantization and Latent Variable Model.
  3. Section 2.1, video tokenizer: why frames are turned into token grids, and why the spatiotemporal blocks matter. Needs Vision Transformer (ViT) and Attention Mechanism.
  4. Section 2.1, dynamics model: masked token prediction with cross-entropy loss, and the causal temporal masking. Needs Masked Language Modeling, Cross-Entropy Loss and Autoregressive Model.
  5. Section 2.2, inference: how a user action becomes a code and then a frame. Needs Autoregressive Model.
  6. Section 3.1, scaling: how loss changes with model size and batch size. Needs Neural Scaling Laws and World Model.
  7. Section 3.3, agents: the CoinRun transfer experiment. Needs Model-Based Reinforcement Learning.
  8. Section 3.4 and the appendices: the ablations and training details, in that order.

Check yourself

QuestionRecall: why is the action vocabulary kept very small (8 codes) in the latent action model?Show answer

A small codebook forces the action to capture only the most important change between frames, which makes it controllable by a human. The paper notes that more codes improve reconstruction but reduce playability for humans and agents.

QuestionComputation: the LAM quantises to 8 codes and the dynamics model uses 25 masked steps per frame. If one frame takes 25 steps and each step is one pass, how many passes are needed for 10 generated frames?Show answer

10×25=25010 \times 25 = 250 passes, assuming one pass per masked step and no caching across frames. The paper's own measured rate is about one frame per second, so the count matters for interaction.

QuestionWhy: why does the LAM's decoder get thrown away after training, and what is kept?Show answer

The decoder only exists to give the LAM a training signal that rewards actions that help rebuild the next frame. At play time the user supplies the action, so the encoder and decoder are not needed. Only the codebook of action vectors is kept, since it is what the dynamics model is conditioned on.

QuestionApplied: you want to use Genie-style training on a new game with no action logs. Which result in the paper would you check before trusting the learned actions, and why?Show answer

Check the controllability measure, Δt\Delta_tPSNR, on held-out videos: whether generating with the inferred actions changes the frame more than random actions do. Also check the transfer experiment, since the paper's evidence that latent actions carry real meaning is the policy that matches the oracle with few expert samples. A high FVD alone would not show that the actions are controllable.

Sources

Read the full paper

Jake Bruce, Michael Dennis, Ashley Edwards et al., 2024. arXiv:2402.15391