Skip to content

About

RealtimeWAM: OpenWAM inference with parallel execution, selective FFN reuse and motion-adaptive 2F/4F. Code for arXiv:2610.10079.

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Latest commit

 

History

15 Commits

Folders and files

Repository files navigation

RealtimeWAM: How Fast Can I Run
My World Action Model?

OpenWAM inference with parallel execution, token reuse and adaptive refinement

Huanan Liu, Ye Li, Kangye Ji, Xiaoyu Chen, Hanyun Cui, Yutian Shen,
Yuan Meng, Chenglei Wu, Jingyan Jiang, Bo Li, and Zhi Wang

Tsinghua University · YuanxingGuangnian Robotics · Nanjing University

Paper Project Code License

Paper · Project page · Method · Quick start · 中文源码导读

RealtimeWAM accelerates existing World Action Models through parallel execution, selective observation FFN reuse and motion-adaptive refinement, without additional training.

This repository implements all three components for OpenWAM as an external runtime: it shares the original model and weights and requires no upstream source edits. Parallel execution is always enabled; the two approximate methods have independent switches. FastWAM and the full closed-loop evaluation suite are outside this release.

Method

RealtimeWAM: parallel computation, selective observation FFN reuse and motion-adaptive Transformer refinement.

Overview from Figure 4 of the paper.

Component Implementation Control
Parallel execution Branch scheduling, input preparation Always enabled
Cross-observation token reuse Selection and history, FFN execution reuse_tokens=True
Motion-adaptive refinement Budget decision, sampling and residual reuse adaptive_2f4f=True

Parallel execution. Overlap independent input preparation and Video/Action branch phases, joining at joint attention. Observation and future-video rows batch compatible operations; observation K/V from the first evaluation is reused within the request. Compiled phases, fused operators and CUDA Graph replay reduce execution overhead.

Token reuse. RGB changes mark mandatory observation positions. After a dense first layer, feature changes fill the chosen refresh capacity. Later layers reuse only unrefreshed observation FFN outputs; attention, current residual gates, future-video and Action computation remain fresh. The default capacities are 16/80/120, with zero reserve. 80 means refreshing 80 and reusing 40 of 120 observation positions.

Adaptive refinement. Both paths retain ten Euler updates and share full Transformer evaluations at updates 0 and 3. The coarse prediction then selects 2F for motion above 8 cm, or adds evaluations at 6 and 9 for 4F. Other updates reuse Transformer residuals while computing current embeddings and output heads.

Token reuse and adaptive refinement introduce approximation. Both are disabled by default.

Quick start

Installation

Start from a fresh Python 3.10 or 3.11 environment on Linux with an NVIDIA GPU and a driver compatible with CUDA 12.8. Use a GPU with at least 48 GiB for the full checkpoint below. Tested hardware includes an A100 80 GiB and an RTX 4090 with 48 GiB (not the standard 24 GiB card). Install a C++ compiler and the CUDA 12.x development toolkit before continuing (tested with toolkit 12.4 and PyTorch's 12.8 runtime).

git clone https://github.com/Na2Ssss/RealtimeWAM.git
cd RealtimeWAM
python3.10 -m venv .venv
source .venv/bin/activate
export CUDA_HOME=/usr/local/cuda  # Point to your CUDA 12.x toolkit.
export PATH="$CUDA_HOME/bin:$PATH"
python -m pip install --upgrade pip
python -m pip install torch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1 \
  --index-url https://download.pytorch.org/whl/cu128

git clone https://github.com/OpenWAM-Official/OpenWAM.git ../OpenWAM
git -C ../OpenWAM checkout 898e2f96c02c172f078c17ff85a055a6bbd419a2
python -m pip install -e ../OpenWAM -e '.[test]'

This installs the public upstream source without modifying it, plus Ninja and the test dependencies. PyTorch supplies matching Triton and nvidia.cublas; its wheel does not supply the system CUDA development toolkit. Supported models use CUDA BF16, head_dim=128, Wan22Ti2v, joint_self_attn, first-frame-causal attention and the native Wan VAE.

Public checkpoint and runnable example

Download the official RoboTwin checkpoint, including its configuration, tokenizer and normalization statistics (about 25 GB). No private checkpoint or additional Wan download is needed.

hf download OpenWAM/OpenWAM-Alpha-Sim-RoboTwin-Full \
  --revision 04b96af53eeeb111c64631f822efcbb82f4b186e \
  --local-dir assets/openwam-robotwin

# Default parallel execution; both approximate switches are off.
python examples/smoke.py --checkpoint assets/openwam-robotwin
# The switches work independently or together.
python examples/smoke.py --checkpoint assets/openwam-robotwin --reuse-tokens
python examples/smoke.py --checkpoint assets/openwam-robotwin --adaptive-2f4f
python examples/smoke.py --checkpoint assets/openwam-robotwin --reuse-tokens --adaptive-2f4f

The example creates a synthetic RGB image and a raw 20-dimensional state for this checkpoint. It checks finite 32×20 actions, full refresh followed by 16/120 refreshed positions when reuse is enabled, and both 2F and 4F routes when adaptation is enabled. Its fixed motion callbacks are only for route testing; real deployment needs the robot-specific metric below. It does not measure task quality or reproduce paper timings. First calls compile kernels and capture CUDA Graphs and can take several minutes.

Basic inference

Use an RGB observation and raw proprioception in the checkpoint's coordinate order. Returned actions are denormalized NumPy arrays.

import numpy as np
from PIL import Image
from realtimewam import OpenWAM

prompt = "Pick up the red block."
image = Image.open("observation.png").convert("RGB")  # 320 W × 384 H
state = np.load("proprio.npy")

model = OpenWAM("assets/openwam-robotwin")
result = model.generate(prompt, image, proprio=state)
actions = result["actions"]
model.close()

Defaults: 384×320 image, 9 video frames, 32 output actions, ten Euler updates, seed 42. Set decode_video=True to return video. Keep one model alive across requests; the first call includes compilation and graph capture.

Enable token reuse and adaptive 2F/4F

Supply a motion metric that converts predicted actions into end-effector displacement in metres. For the public RoboTwin EEF checkpoint above, actions and raw state use left XYZ in columns 0:3 and right XYZ in 10:13. This metric takes the maximum displacement over both arms and all 32 predictions:

def displacement(actions, raw_proprio):
    xyz = [0, 1, 2, 10, 11, 12]
    delta = actions[:32, xyz] - np.asarray(raw_proprio)[..., xyz]
    return float(np.linalg.norm(delta.reshape(-1, 2, 3), axis=-1).max())

model = OpenWAM(
    "assets/openwam-robotwin",
    reuse_tokens=True,
    adaptive_2f4f=True,
)
result = model.generate(
    prompt, image, proprio=state,
    motion_metric=lambda actions: displacement(actions, state),
)
print(model.architecture.last_stats)
model.close()

The metric receives the denormalized coarse prediction after the second full evaluation. Other checkpoints may use different layouts: joint actions require forward kinematics, and delta actions require the controller's accumulation and scaling. Use the XYZ example only for the stated action representation.

The switches are independent: token reuse alone needs no motion callback. Adaptive refinement requires ten Euler updates and a callback returning a finite, nonnegative displacement.

Parameter Default Meaning
reuse_tokens False Reuse observation FFN outputs across requests
adaptive_2f4f False Choose 2F/4F from predicted motion
refresh_buckets (16, 80, 120) Prepared observation refresh capacities
reserve_fraction 0.0 Additional refresh allowance outside mandatory RGB positions
motion_threshold 0.08 Displacement threshold in metres

The online capacities follow Figure 6 / Appendix E.3 and its evaluation configuration. To use the separate fixed-80 profiling configuration in Appendix C.4, set refresh_buckets=(80, 120), reserve_fraction=0.0. It selects 80 when at most 80 positions are mandatory, otherwise full refresh. Initialization always refreshes every observation position.

Call model.reset() when starting a new episode or changing the camera/preprocessing. Prompt, weight and input-geometry changes invalidate incompatible history automatically. Cache history is committed only after a successful request. Calls on one model are serialized; parallelism occurs within each request.

Wrap an already loaded OpenWAM architecture
from realtimewam import accelerate

fast = accelerate(architecture, reuse_tokens=True)
result = fast.generate(
    schedule, prompt,
    first_frame_image=image,
    proprio=architecture.normalize_deploy_proprio(state),
    action_num_frames=33,
)
architecture = fast.close()

accelerate accepts the same switches. This lower-level interface takes the native synchronous schedule and an already normalized state. OpenWAM handles checkpoint loading and normalization for you.

Benchmark and tests

python -m realtimewam.benchmark \
  --checkpoint /path/to/checkpoint \
  --input /path/to/request.npz \
  --prompt-file /path/to/prompt.txt

The NPZ contains image (HWC uint8 RGB) and proprio (raw state). Add --reuse-tokens independently, or --adaptive-2f4f --motion-metric motion_metric:displacement. For the latter, save your robot-specific metric in motion_metric.py; the CLI callback accepts (actions, raw_proprio). The benchmark measures repeated-input CPU-to-CPU inference after warmup.

PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -m pytest \
  -c realtimewam/pytest.ini realtimewam/tests -q -p no:cacheprovider

See CODE_GUIDE.md for a walkthrough of the 10 core Python files.

Migration from WAMInfer

The project is now RealtimeWAM, with Python imports under realtimewam. Update from WAMInfer import ... to from realtimewam import ..., and CLI calls to python -m realtimewam.benchmark. Older tags retain the original package name.

Citation

If you use this code, please cite RealtimeWAM. See also CITATION.cff.

@misc{liu2026realtimewam,
  title         = {RealtimeWAM: How Fast Can I Run My World Action Model?},
  author        = {Huanan Liu and Ye Li and Kangye Ji and Xiaoyu Chen and Hanyun Cui and Yutian Shen and Yuan Meng and Chenglei Wu and Jingyan Jiang and Bo Li and Zhi Wang},
  year          = {2026},
  eprint        = {2610.10079},
  archivePrefix = {arXiv},
  primaryClass  = {cs.RO},
  doi           = {10.48550/arXiv.2610.10079},
  url           = {https://arxiv.org/abs/2610.10079}
}

License and acknowledgements

Code is released under Apache-2.0. RealtimeWAM builds on OpenWAM; its external-addon organization was informed by BAC. See NOTICE for provenance. Upstream weights and datasets retain their respective terms.

The method figure is reproduced from RealtimeWAM, Figure 4 under the paper's CC BY 4.0 license.

About

RealtimeWAM: OpenWAM inference with parallel execution, selective FFN reuse and motion-adaptive 2F/4F. Code for arXiv:2610.10079.

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages