We terminated a TPU mid-training and it recovered in seconds: Introduction to elastic training with MaxText

· Source: Google Developers Blog - AI · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Cloud Computing & IT Infrastructure · Depth: Advanced, extended

Summary

The article introduces elastic training for large language models using MaxText, Pathways, and Orbax on Cloud TPUs, demonstrating rapid recovery from hardware failures. A live experiment showed a qwen3-0.6b model training across three TPU v5e-16 slices (48 chips) on Google Kubernetes Engine recovered from a force-killed worker pod in under two minutes. This in-process recovery, facilitated by a single controller architecture, caught the failure as a "JaxRuntimeError" and restored from the last valid Orbax checkpoint (step 3300) without a full job restart, losing only 88 steps. This approach avoids the significant overhead of rescheduling the entire workload, saving hundreds of seconds compared to traditional methods.

Key takeaway

For MLOps Engineers managing large-scale distributed training on Cloud TPUs, implementing elastic training with MaxText and Pathways significantly enhances resilience. You can avoid costly full job restarts by configuring "elastic_enabled=true" and "enable_single_controller=true", allowing in-process recovery from unplanned hardware failures. For models larger than 6.7 GiB, ensure "ENABLE_PATHWAYS_PERSISTENCE=1" to prevent proxy memory issues and leverage parallel checkpoint I/O. This approach minimizes downtime and preserves training progress, making your LLM development more robust.

Key insights

Elastic training enables rapid, in-process recovery from unplanned hardware failures in distributed LLM training.

Principles

Method

Pathways detects hardware failure as a "jax.errors.JaxRuntimeError". The "elastic_retry" decorator catches this, cleans partial state, and Orbax restores the last valid checkpoint, re-entering the training function.

In practice

Topics

Code references

Best for: Machine Learning Engineer, MLOps Engineer, AI Architect

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by Google Developers Blog - AI.