Seed
0.0 s

SimForge Gym is the one place to train driving models on SimForge. Pick a recipe, run its one command on your own GPU, and score the result in closed loop the way SimForge cloud evaluation scores it.

Recipes

Starter

Four scenarios to a fine-tuned Qwen Drive 1 4B, and a before/after closed-loop report card.

GPU
Measured on 96 GB
Time
59.1 min
python -m simforge_gym.recipes.starter --scenarios cut-in-brake,lead-hard-brake,queue-tail,opposing-turn-encroachment \
  --base Qwen-Drive-1.0-4B/ --out starter/

The fine-tuned model collides less (4 to 2) and leaves the road less (6 to 1), but its driving score is about the same as base: 0.694 against 0.710, better on 4 of 12 held-out drives.

Measured how, and licence

Training fits 16 GB with the prefill cache (9.5 GiB peak). The whole run was measured on a 96 GB RTX PRO 6000; a full run on a smaller card has not been measured.

One RTX PRO 6000, default settings: 10.4 min to render 48 training drives, 12.6 min to train, 34.4 min to drive the 12 held-out variants with both planners.

Qwen Drive 1 4B (Qwen/Qwen-Drive-1.0-4B) is Apache-2.0.

Supervised fine-tuning

Train on SimForge renders: Qwen Drive on one GPU or several, or Alpamayo 1.5 stage 2.

GPU
16 GB
Time
50 min + 10 min per epoch
python -m simforge_gym.train.sft --data qwen-drive-data/ --base Qwen-Drive-1.0-4B/ --out runs/sft --steps 500
Measured how, and licence

9.5 GiB peak with the prefill cache (about 140 MB of disk per window). Prefilling online instead needs 24 GB and no disk.

5,000 windows on an RTX 5080: about 50 min to prefill the cache once, then 10 min per epoch.

Qwen Drive 1 4B (Qwen/Qwen-Drive-1.0-4B) is Apache-2.0.

Reinforcement learning

PPO on state observations with no GPU, or closed-loop GRPO of Qwen Drive from an SFT checkpoint.

GPU
No GPU
Time
37.5 min
python -m simforge_gym.examples.ppo --tasks richmond-field-station --runtime --num-envs 32 \
  --total-timesteps 1228800 --eval-every 10 --seed 0 --out run/

Mean held-out return rose from 0.79 to 2.74, against 0.71 for the scenarios' authored driving; it beats that driving on 12 of the 24 tasks and still crashes on some.

Measured how, and licence

State observations need no GPU.

1,228,800 environment steps on a 24-core CPU host.

No pretrained weights: the policy trains from scratch.

Every recipe runs on your own machine and nothing is billed. Training on SimForge cloud comes later.

Before you start

simforge login
simforge runtime install --accept-license
pip install simforge-gym

Starter, Qwen Drive fine-tuning and GRPO also need the training extras and the Qwen Drive weights:

pip install 'simforge-gym[train]' 'flash-linear-attention>=0.5.1' 'opencv-python-headless>=4.10' 'matplotlib>=3.8' 'tqdm>=4.66'
pip install --no-deps "qwen_drive @ git+https://github.com/QwenLM/Qwen-Drive-1.0@28091c1532e869bc7aee91fc0aef6b3e6fd0b2e0"
huggingface-cli download Qwen/Qwen-Drive-1.0-4B --local-dir Qwen-Drive-1.0-4B
  • Local closed-loop evaluation (Starter, GRPO) needs simforge-gym 0.3.0 or later and the next runtime release.
  • Starter needs two or more maps with their 3D packs (simforge maps pull NAME --for 3d --accept-license) and simforge assets pull.
  • Alpamayo 1.5 trains in NVIDIA's recipe environment; the setup is in the docs.

The environment

  • The Gymnasium API. reset, step and a seed; your training code does not need to know it is driving a simulator.
  • Deterministic seeds. The same seed and the same actions give byte-identical observations.
  • Reactive traffic. Other road users yield, avoid and obey signals, so a hard brake or a late merge has consequences.
  • Sensor-only mode. The policy gets rendered camera passes and the clock, and no engine state.

State observations need no GPU. Sign in, install the package, the runtime and a map, then step eight episodes at once from Python:

simforge login
pip install 'simforge-gym[ppo]'
simforge runtime install --accept-license
simforge maps pull richmond-field-station@v9 --accept-license
from simforge_gym import RuntimeSessions, ScenarioSet, make_vector_env

tasks = ScenarioSet.bundled("richmond-field-station")
with RuntimeSessions(tasks, "--no-sensors", workdir="work") as sessions:
    envs = make_vector_env(tasks, sessions.transports(), num_envs=8)
    obs, info = envs.reset(seed=0)
    obs, reward, terminated, truncated, info = envs.step(envs.action_space.sample())
Read the docs
Install guide