Pre-training Contextualized World Models with In-the-wild Videos for Reinforcement Learning

Jialong Wu, Haoyu Ma, Chaoyi Deng, Mingsheng Long

Introduction

In Model-Based Reinforcement Learning (MBRL), agents utilize a world model—a learned internal simulator—to predict the outcomes of their actions. While this approach allows for "imagined" planning, training these models from scratch for every new environment is computationally expensive and sample-inefficient. A promising alternative is pre-training on the vast corpus of unlabelled "in-the-wild" internet videos. However, real-world video data is characterized by complex backgrounds and varying textures that often distract standard world models, leading them to prioritize pixel-perfect reconstruction of static scenes over the essential underlying dynamics.

This paper introduces Contextualized World Models (ContextWM), a framework designed to learn the "physics" of the world by explicitly disentangling static context from temporal dynamics. By leveraging diverse video datasets, ContextWM enables agents to acquire transferable world knowledge that significantly accelerates learning on downstream tasks.

Methodology: Disentangling Context and Dynamics

The core innovation of ContextWM is its "divide and conquer" strategy for visual information, inspired by the dual-pathway architecture of the human visual system. The model separates information into two distinct streams:

  1. Context Separation: A dedicated Context Encoder captures time-invariant features—such as the color of a table, the texture of a floor, or the specific geometry of a room—from a randomly sampled frame within a video sequence.
  2. Latent Dynamics: A parsimonious dynamics model focuses exclusively on temporal changes, or the "motion" within the scene.
  3. Multi-scale Cross-Attention Decoder: To reconstruct the visual state, the model employs a cross-attention mechanism that integrates static context directly into the decoder. This allows the dynamics model to offload the representation of static details, focusing its capacity on predicting how objects and agents interact over time.
  4. Dual Reward Predictors: During the fine-tuning phase, the agent utilizes two reward predictors: one for the task-specific goal and another for an intrinsic exploration bonus, ensuring robust performance and curiosity-driven learning.

Experimental Evaluation

The researchers pre-trained ContextWM on three diverse datasets: Something-Something-v2 (SSv2) (human-object interactions), Human3.6M (human motion), and YouTube Driving (real-world driving footage). The model's performance was then evaluated across three challenging benchmarks:

  • Meta-world: Robotic manipulation tasks requiring precise control.
  • DMC Remastered: A version of the DeepMind Control Suite featuring complex, distracting backgrounds.
  • CARLA: A high-fidelity simulator for autonomous driving.

Key Findings

1. Enhanced Sample Efficiency

ContextWM demonstrated superior sample efficiency compared to leading baselines like DreamerV2 and APV. In Meta-world tasks, the pre-trained model reached high success rates significantly faster, suggesting that the "world physics" learned from human videos (e.g., pushing objects) effectively transfers to robotic control.

2. Robustness to Visual Distractors

In the DMC Remastered environment, where backgrounds are intentionally cluttered, ContextWM significantly outperformed standard models. By effectively filtering out static background noise through its context-separation mechanism, the model remained focused on the task-relevant dynamics.

3. Compositional Decoding

A notable capability of ContextWM is compositional decoding. The model can synthesize coherent "imagined" trajectories by combining the dynamics of one video with the context (visual style) of another. This provides strong evidence that the model has successfully disentangled the "what" (context) from the "how" (dynamics).

4. Real-world Transfer

Pre-training on YouTube Driving videos provided a clear advantage in the CARLA simulator. The agent learned to navigate complex scenarios, such as "Wet Sunset" conditions, more rapidly than models trained without such prior exposure, highlighting the value of "in-the-wild" data for real-world applications.

Conclusion and Future Work

ContextWM represents a significant step toward general-purpose world models for RL. By offloading static context, the model becomes a more efficient learner of dynamics. Future research directions include addressing the limitations of single-frame context for longer video sequences, scaling the architecture to Transformers, and exploring contrastive learning objectives to bypass the computational costs of pixel-level reconstruction.

Summary updated

BibTeX
@inproceedings{wu2023pre,
  author = {Jialong Wu and Haoyu Ma and Chaoyi Deng and Mingsheng Long},
  title = {{Pre-training Contextualized World Models with In-the-wild Videos for Reinforcement Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=8GuEVzAUQS},
}
Figure