Distributed checkpointing is the practice of saving and restoring the full training state of a model that is sharded across many accelerators, with each process writing and reading its own portion in parallel. In AI infrastructure, it is the mechanism that lets a multi-week training run on thousands of GPUs survive hardware failures, resume after preemption and change cluster size without starting over.
A checkpoint for a large language model contains far more than the weights. It includes optimizer states, learning-rate scheduler position, random number generator states and data loader progress, and for mixed-precision training with Adam the optimizer states alone are often two to three times the size of the weights. Writing that state from a single process would take too long and would not fit in one node’s memory, so the work is distributed.
How distributed checkpointing writes sharded state
Each rank in the job writes only the tensor shards it owns, together with metadata that records which global tensor, offset and shape every shard belongs to. A coordinator, usually rank zero, writes a global metadata file that maps logical parameter names to physical files, so the checkpoint can be reassembled later.
The typical save sequence follows a small number of well-defined phases, and modern frameworks overlap several of them with training to reduce stall time.
| Phase | What happens | Typical cost driver |
|---|---|---|
| Planning | Ranks agree on which shards each writes and deduplicate replicas | Number of ranks and tensors |
| Staging | Shards are copied from GPU memory to host memory | PCIe bandwidth and tensor size |
| Persisting | Host buffers are written to the storage system | Storage throughput and file count |
| Commit | Metadata is finalized and the checkpoint is marked complete | Coordination latency |
The commit step is essential for correctness. A checkpoint that lacks a completed metadata record must be treated as invalid, because a crash during persisting can leave some shards written and others missing.
Checkpoint formats and resharding
Checkpoint formats differ mainly in whether they can be loaded on a different parallel layout. This capability, called resharding or topology-independent loading, matters whenever a job restarts on a different number of GPUs or switches between tensor, pipeline and data parallelism settings.
| Layout | Description | Resharding support | Typical use |
|---|---|---|---|
| Consolidated | One full state dictionary gathered on one rank | Easy but slow to produce | Small models, final export |
| Rank-local sharded | Each rank saves its own shard as-is | Only on the identical topology | Fast fault recovery |
| Topology-independent sharded | Shards saved with global offsets and metadata | Load on any compatible layout | Large runs with elastic training |
Frameworks such as PyTorch Distributed Checkpoint, the checkpointing utilities in Megatron-style training stacks and DeepSpeed universal checkpoints implement the topology-independent approach. When FSDP or ZeRO partitions optimizer states, the loader must map each saved shard onto the new partitioning, which requires accurate global offsets in the metadata.
Synchronous, asynchronous and in-memory checkpointing
The main engineering trade-off is between training stall time and recovery guarantees. A synchronous save blocks every rank until data reaches durable storage, which is simple but can pause a large job for minutes.
| Strategy | Training stall | Durability | Trade-off |
|---|---|---|---|
| Synchronous to storage | Full write duration | High once complete | Simple but slow at scale |
| Asynchronous to storage | Only the staging copy | High after background write | Needs spare host memory |
| In-memory peer replication | Seconds | Survives single-node loss | Lost if many nodes fail |
| Tiered | Seconds for frequent saves | Combines both levels | More complex orchestration |
Asynchronous checkpointing is now the common default for large runs: training resumes once tensors are copied to pinned host memory, and a background thread persists them. Tiered schemes keep frequent in-memory snapshots for fast recovery and less frequent durable copies on a parallel file system or object storage.
Choosing checkpoint frequency and storage
Checkpoint interval is a cost optimization between lost work and save overhead. A widely used first-order approximation, attributed to Young and Daly, sets the optimal interval near the square root of two times the save cost times the mean time between failures.
- Measure the mean time between failures of the actual cluster, because it falls as the GPU count grows.
- Measure the true stall time per save, not only the total write time.
- Size storage for burst bandwidth, since thousands of ranks write simultaneously.
- Keep several recent checkpoints, because the newest one may contain corrupted state or a loss spike.
- Prefer fewer, larger files on object storage to avoid metadata bottlenecks.
On clusters with thousands of accelerators, failures can occur several times per day, so intervals of tens of minutes are common for frontier training, while smaller jobs may save every few hours.
Failure modes and verification
Most checkpoint incidents come from incomplete, inconsistent or unverified saves rather than from the storage system itself. A recovery path that has never been exercised should be considered untested and unreliable.
| Symptom | Likely cause | Mitigation |
|---|---|---|
| Load fails with missing shards | Crash before commit | Atomic commit marker and retention of prior checkpoint |
| Loss jumps after resume | Data loader or RNG state not restored | Save sampler position and seeds |
| Save stalls the cluster | Storage bandwidth saturated | Asynchronous writes and staggered persistence |
| Cannot resume on new GPU count | Rank-local format | Topology-independent format |
Mature teams run regular restore drills and compare the loss curve after resume with the uninterrupted run, which confirms that the training trajectory is bit-for-bit or statistically identical.
Stripped to the essentials
Training a large AI model can take weeks on thousands of chips. Sooner or later, one of those chips breaks. Without a saved copy, all that work would be lost.
Distributed checkpointing is a regular save point for the whole job. Each chip saves its own piece at the same time, like a team where every member files their own pages. A shared index records where every piece belongs. After a crash, the job reloads the pieces and continues from the last save.
Where it is applied
A research team trains a 70-billion-parameter language model on 1,024 GPUs using tensor, pipeline and data parallelism. With Adam optimizer states in mixed precision, one checkpoint is close to one terabyte. Early in the run, the cluster loses a node roughly twice a day.
The team configures asynchronous sharded checkpoints every 30 minutes to in-memory peer replicas and a durable copy to object storage every two hours. Each save now stalls training for about ten seconds instead of several minutes.
When a network switch fails and 64 GPUs drop out, the job restarts on 960 GPUs with a smaller data-parallel degree. Because the format is topology-independent, the loader reshards the state automatically, and the run loses under half an hour of progress.