GoogleLuke Baumann, Abhinav Singh, Ivan NardiniTutorial
We terminated a TPU mid-training and it recovered in seconds: Introduction to elastic training with MaxText
Summary
Distributed training on multiple TPU machines normally fails as a whole when one worker disappears: collective communication times out, processes exit, and the job restarts from a checkpoint. The article demonstrates elastic training with JAX, MaxText, PathwayS, Orbax, and Cloud TPUs on GKE, using a single CPU-side controller that remains alive while TPU workers execute compiled programs. A Pathways elastic_retry wrapper catches the failure, cleans up partial state, restores the last viable checkpoint, and re-enters the training function without relaunching the workload; the demo returned to training in under two minutes, with no JobSet restarts, after losing 88 steps. It also contrasts pause-and-resume with replica resize, explains direct checkpoint persistence through ENABLE_PATHWAYS_PERSISTENCE=1, and describes planned snapshot-based recovery from host memory.
Context
In multi-node training, model weights are sharded and each step relies on an all-reduce involving every participant. If one machine disappears, the collective waits until a timeout, all processes exit, and schedulers typically relaunch the entire workload from the last checkpoint, losing subsequent steps and incurring full restart overhead.
Approach / What changed
The workflow uses MaxText with JAX on Cloud TPUs, PathwayS as the orchestration layer, and Orbax for checkpointing. A single CPU-side controller stays alive when a TPU worker fails; elastic_retry catches the exception, cleans up partial state, waits for recovery, restores the last viable checkpoint, and reruns the training function in the same process. Replica resize can instead continue on surviving slices.
Takeaways
PathwayS uses one persistent Python controller while TPU hosts run a thin worker binary, allowing a hardware failure to surface as a Python exception rather than terminating every process.
Pause-and-resume recovered the demo without a JobSet restart, reaching the next training step in under two minutes; 88 steps were lost because the last committed checkpoint was at step 3300.
Setting ENABLE_PATHWAYS_PERSISTENCE=1 makes TPU hosts read and write their own checkpoint shards directly to Cloud Storage, avoiding controller memory pressure and enabling parallel checkpoint I/O.
Source and freshness
- Source
- developers.googleblog.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.