Skip to content

About

[Arxiv 2026] ReactiveGWM: Flexible Control and NPC Reactivity in Game World Models

Topics

Resources

Stars

103 stars

Watchers

4 watching

Forks

Repository files navigation

ReactiveGWM v2: Flexible Control and NPC Reactivity in Game World Models

Project Page arXiv HuggingFace Model HuggingFace Dataset

Zeqing Wang12, Danze Chen12, Zhaohu Xing4 , Zizhao Tong15 , Yinhan Zhang16 , Xingyi Yang3 , Yeying Jin12
1 Tencent, 2 National University of Singapore, 3 The Hong Kong Polytechnic University
4 The Hong Kong University of Science and Technology (Guangzhou), 5 University of Chinese Academy of Sciences, 6 The Hong Kong University of Science and Technology

main contains the v2 HNM and Street Fighter III: New Generation (SF3) main training and inference code. The original SF2 / Street Fighter Alpha 3 release, including its bidirectional and Causal Forcing training, is preserved on v1. The project website remains on the unchanged page branch.

⭐ Updates

  • [Sep 29, 2026]: v2 HNM and SF3 training and inference code is released, with Hugging Face model/data support, custom character controls, and role reassignment. The original release remains available on the v1 branch.

📚 Introduction

ReactiveGWM assigns control roles to individual characters at rollout initialization. Spatial Role Binding grounds learned handles in initial-frame instance masks. Unified Agency Conditioning binds each character's external action sequence or conditional NPC rule to the same handle. Causal self-attention lets characters respond to the current and preceding video context.

ReactiveGWM v2 method: Spatial Role Binding, Unified Agency Conditioning, and causal self-attention
ReactiveGWM v2 combines character-specific spatial binding and agency conditioning with causal video context.

🛠️ Setup

Python 3.12 and a CUDA GPU are recommended. Install from this repository's root:

python -m venv .venv
source .venv/bin/activate
pip install -e .

The package includes the shared model and data adapters and pins the reference DiffSynth dependency. No separate DiffSynth checkout is needed.

🚀 Quick start

Prepare a small HF sample selection, download the VAE, then generate a clip:

python scripts/prepare_hf_dataset.py --game hnm --split val --limit 1 \
  --output data/hnm-example

hf download Wan-AI/Wan2.2-TI2V-5B Wan2.2_VAE.pth --local-dir checkpoints/base

python inference/inference.py \
  --checkpoint INV-WZQ/ReactiveGWM-v2-Models --model-subfolder HNM/main \
  --data data/hnm-example/samples.csv --split val --indices 0 \
  --vae checkpoints/base/Wan2.2_VAE.pth --gpus 0 --output outputs/hnm-example

For SF3, prepare --game sf3 and select --model-subfolder SF3/main. Use --sample-id to choose a particular published sample. Dataset archives are about 2 GiB each; prepare_hf_dataset.py --dry-run lists the selected archive sizes before downloading. The helper produces the portable CSV used by both training and inference. Complete dataset downloads are only selected with --all.

Inference also accepts your own initial image, ordered masks, and a JSON file assigning actions or NPC prompts to each character. See inference/README.md for custom inputs, new text encoding, role reassignment, local checkpoints, and the Python API.

🏋️ Training

Both game recipes default to 20,000 optimizer updates and effective batch 8. Steps, batch size, gradient accumulation, learning rate, devices, and output paths are configurable through YAML or CLI arguments. Automatic accumulation adapts the reference batch to the selected GPU count.

python scripts/prepare_hf_dataset.py --game hnm --split train val --all --output data/hnm

python training/train.py --config training/configs/hnm.yaml \
  --data data/hnm/samples.csv \
  --init-checkpoint INV-WZQ/ReactiveGWM-v2-Models --model-subfolder HNM/main \
  --gpus 0,1,2,3,4,5,6,7 --output outputs/hnm

HF weights initialize a new fine-tuning run. They do not contain complete optimizer or sampler state. Training from Wan2.2 base shards and exact/full-state resume from newly saved checkpoints are documented in training/README.md.

The code follows the current HF data release: HNM train/val/test = 20,000/187/192 and SF3 = 20,000/200/200. HNM differs from the paper's 200/200 evaluation split counts because the published version excludes the extra perfect-block strategy. Train/val caches are provided; test inference encodes only the initial frame and does not read future ground-truth frames.

🧪 Layout and verification

  • training/: training/cache entrypoints and the two configurable recipes.
  • inference/: CLI, public pipeline re-export and input examples.
  • src/selective_agency/: shared v2 model, loss, data adapters and runtime.
  • scripts/prepare_hf_dataset.py: HF archive-to-CSV preparation.
  • tests/: model behavior, data interfaces, numerical parity and resume checks.

See VERIFICATION.md for actual test scope and results.

🤓 Acknowledgments and model assets

ReactiveGWM builds on Wan2.2 and DiffSynth-Studio. Downloaded models and data retain the licenses and third-party notices in their respective Hugging Face repositories. The original release's acknowledgments and citation remain available on the v1 branch.

About

[Arxiv 2026] ReactiveGWM: Flexible Control and NPC Reactivity in Game World Models

Topics

Resources

Stars

103 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages