GIT-STORM: Masked Generative Priors Improve World Models Sequence Modelling Capabilities (Best Paper at ICLR2025 World Models Workshop)
Official implementation of GIT-STORM, a novel approach to world modeling for model-based reinforcement learning that leverages MaskGIT as a generative prior for learning stochastic world models.
Building on the Efficient Stochastic Transformer-based World Models (STORM) architecture, we replace the traditional MLP prior with a Masked Generative Prior (e.g., MaskGIT Prior) and introduce GIT-STORM. We evaluate our model on two downstream tasks: reinforcement learning and video prediction. GIT-STORM demonstrates substantial performance gains in RL tasks on the Atari 100k benchmark.
Paper: GIT-STORM Arxiv Link
The model architecture consists of:
- Encoder: CNN-based encoder that processes visual observations into latent representations
- MaskGIT Transformer: Masked generative model for learning stochastic latent dynamics
- World Model: Transformer-based dynamics model that predicts future latent states
- Actor-Critic Agent: Policy network trained in imagination using the learned world model
- Python 3.10+
- CUDA-compatible GPU (recommended)
- Conda or virtualenv
# Create and activate the environment
conda env create -f environment.yml
conda activate STORM# Create a virtual environment
conda create -n STORM python=3.10
conda activate STORM
# Install dependencies
pip install -r requirements.txt# Clone the repository
git clone <repository-url>
cd GIT-STORM
# Install the environment (choose one of the options above)
conda env create -f environment.yml
conda activate STORMTrain a model using the default configuration:
# Train STORM on Atari Boxing
python train.py BasicSettings.env_name="ALE/Boxing-v5"
# Train GIT-STORM on Atari Boxing
python train.py \
BasicSettings.config_path="config_files/GITSTORM.yaml" \
BasicSettings.env_name="ALE/Boxing-v5"For convenience, use the provided training script:
# Usage: ./train.sh <env_name> <seed> <config>
./train.sh Boxing 0 STORM # Train STORM
./train.sh Boxing 0 GITSTORM # Train GIT-STORMThe training behavior can be customized through YAML configuration files located in config_files/:
STORM.yaml: Configuration for baseline STORM modelGITSTORM.yaml: Configuration for GIT-STORM model with MaskGIT prior
Training logs are written to TensorBoard:
tensorboard --logdir runs/Metrics logged include:
- Episode rewards and lengths
- World model losses (reconstruction, reward prediction, termination prediction)
- Agent losses (policy loss, value loss, entropy)
- Imagination rollouts (videos)
Evaluate a trained model across multiple episodes:
# Basic evaluation
python eval.py \
-config_path="config_files/STORM.yaml" \
-env_name="ALE/Boxing-v5" \
-run_name="Boxing-STORM-seed_0"# Usage: ./evals.sh <env_name> <run_name> <config>
./evals.sh Boxing Boxing-STORM-seed_0 STORMTo evaluate multiple experiments at once, use the evaluation manager:
# Edit eval_manager.sh to specify environments and seeds
./eval_manager.shThe script will evaluate all checkpoints for each experiment and save results to outputs/eval_result/<run_name>.csv.
The evaluation script computes:
- Mean episode return across 20 episodes (default)
- Performance across all saved checkpoints
- Results are saved in CSV format for easy analysis
To reproduce the results from the paper:
# Train on multiple Atari games with different seeds
for game in Boxing Hero MsPacman Pong Breakout; do
for seed in 0 1 2; do
python train.py \
BasicSettings.env_name="ALE/${game}-v5" \
BasicSettings.Seed=${seed} \
BasicSettings.config_path="config_files/GITSTORM.yaml" \
BasicSettings.n="${game}-GITSTORM-seed_${seed}" \
JointTrainAgent.SampleMaxSteps=102000
done
doneGIT-STORM/
├── config_files/ # Configuration files
│ ├── STORM.yaml # STORM baseline config
│ └── GITSTORM.yaml # GIT-STORM config
├── sub_models/ # Model implementations
│ ├── world_models.py # World model architectures
│ ├── transformer_model.py
│ ├── attention_blocks.py
│ ├── functions_losses.py
│ └── torch_maskgit/ # MaskGIT implementation
├── agents.py # Actor-critic agent
├── replay_buffer.py # Experience replay buffer
├── env_wrapper.py # Environment wrappers
├── train.py # Main training script
├── eval.py # Evaluation script
├── utils.py # Utility functions
├── requirements.txt # Python dependencies
├── environment.yml # Conda environment
└── assets/ # Images and figures
If you use this code in your research, please cite:
@article{gitstorm2024,
title={GIT-STORM: Masked Generative Priors Improve World Models Sequence Modelling Capabilities},
author={[Authors]},
journal={arXiv preprint arXiv:2410.07836},
year={2024}
}This implementation builds upon:
