Layout
One v7x 2x2x1 host has 4 chips with 2 TensorCores each, so 8 devices. The trainer runs as 4 ranks on devices 0-3 and the engine serves on devices 4-7. Both jobs share the host’s slice, so weights move from trainer to engine over ICI (--update-weight-transfer-mode ici) without touching disk.
Image
The engine and the trainer share one Python environment, built bydocker/Dockerfile.tpu on
sglang-torchtpu’s release image. CI rebuilds it next to the CUDA image and publishes it as
radixark/miles:dev-tpu (and latest-tpu). To build it yourself:
scripts/tpu/README.md.
Launch training
The TPU launchers live underscripts/tpu/, one per model family: Qwen3-4B, Qwen3-30B-A3B, a 4-layer
GLM-4.7-Flash, and run_qwen3_5_torchtitan.py for Qwen3.5 / Qwen3.6 / Qwen3.8, which picks its row with
--model-name (Qwen3.5-4B, Qwen3.5-27B, Qwen3.6-35B-A3B or Qwen3.8-27B). Each launcher has a prepare, a sglang and a train command. prepare fetches the model and
datasets. Start the engine in its own shell, then start training a minute or two later without waiting for the
engine’s /health: the engine compiles only after the trainer has joined the slice.
Next steps
scripts/tpu/README.md— the full recipe and operating notes.- Docker build — the TPU Dockerfile, variants, and tags.

