Checkpointing and Fault Tolerance

A fast job that cannot resume correctly is not a training system. Recovery must preserve model, optimizer, scheduler, RNG and data position while surviving partial writes, changed layouts and rank failure.

Section 9 of 10 · 11 units · about 46 hours

0/11

By the end you can Kill a sharded training job at multiple save boundaries, reject corrupt or incomplete checkpoints, resume to the reference trajectory, and restore one checkpoint under a changed legal layout with an audit trail.

Units

Build it

Mini project · about 14 to 20 hours

Atomic sharded checkpoints with kill-tested recovery

Extend trainlab ckpt/ and faults/ with sharded DCP checkpoints, manifests, atomic publish and changed-layout restore. Prove recovery with kill-at-every-boundary campaigns, corruption refusal and a per-incident audit trail, so restarts resume the same experiment instead of a shifted one.

  1. 1Port the DCP recipe to CPU gloo: save a sharded model plus optimizer state through get_state_dict, reload bit-exactly after mutation, convert to a single file, and resume sampler position with RNG streams intact.
  2. 2Add versioned manifests with topology, config and code identity plus strict-versus-lax key policy, and pass the TorchTitan CPU checkpoint suite with every refusal and remap logged.
  3. 3Publish through a temporary directory with barrier discipline, manifest-last commit and per-shard checksums; corrupt one byte to prove refusal, and keep retention that never deletes the last known good.
  4. 4Coordinate one outstanding asynchronous save, adding the DefaultStager variant for staging-before-step discipline, and time it against synchronous saves on CPU, then work the MLSys checkpoint-tax boxes to set interval, RPO and RTO.
  5. 5Restore a sharded checkpoint onto a changed world size with full-parameter equality, then rehearse the Stas preemption trap and a bounded crash restart under the elastic-run reference from global step.
  6. 6List every kill window in the save and load cycle from the code, kill in each one, and show every kill resumes to the reference trajectory or refuses loudly with a manifest and audit entry.
What you hand in
  • The ckpt/ sharded save, manifest, atomic publish and changed-layout restore with refusal tests.
  • Sync-versus-async timings, the interval derivation with RPO and RTO, and retention plus watchdog evidence.
  • The kill campaign matrix with reference-trajectory results and the per-incident failure manifest plus recovery audit.
How to check it
How it's graded

Resume identity

Pass: Mid-epoch resume reproduces batches, RNG draws and weights exactly on CPU, with every stream named.

Great: Dropping any single stream fails a named test, and cross-size restore keeps moments aligned.

Publish integrity

Pass: Interrupted publishes never appear on the load path, and tampered shards are refused by checksum with fallback kept.

Great: Retention holds the last known good under corruption, and the watchdog names byte rate and headroom.

Recovery proof

Pass: Every kill window is tested, each kill resumes to the trajectory or refuses with an audit entry.

Great: The audit names kept and refused artifacts per incident, and preemption exits inside a derived budget.

Resources

  • Machine Learning Systems Volume II - Chapter 7 Fault ToleranceML Systems Textbook

    Read Failure Analysis at Scale, Hardware Fault Taxonomy, Check-and-Verify, Fault Injection Tools and Frameworks, Checkpointing, Failure Detection and Recovery, Elastic Recovery and Distributed Debugging and Observability. Turn them into a failure matrix before implementing the PyTorch DCP lab.

  • PyTorch Distributed Checkpoint RecipesPyTorch

    Complete the distributed checkpoint recipe with a tiny sharded model on CPU, then dcp.async_save from the 2.14 reference at https://docs.pytorch.org/docs/2.14/distributed.checkpoint.html. The recipe saves model and optimizer only: add scheduler, scaler, RNG and dataloader state yourself, then inject partial directories, missing shards and a changed world-size restore.

  • TorchFeather - Distributed Checkpoint ManagerTorchFeather

    Trace components/checkpoint.py through state wrappers, DCP save and load, asynchronous mode, retention and cleanup. Write a failure table for every barrier, future, temporary artifact and deletion boundary.

  • Machine Learning Engineering Open Book - Checkpoints, Storage and Fault ToleranceStas Bekman

    Read training/fault-tolerance/README.md (frequent checkpoints, kill and save switches, watchdogs, preemption) and the "Don't forget the checksums" and benchmark sections of storage/README.md. Turn them into an operational save, verify, publish, retain and recover runbook.

  • Distributed Training Guide - Sharded Checkpoints, Determinism and Elastic TrainingLambda Labs

    Run related-topics/elastic-training/toy.py with two CPU processes (hide any GPU so it uses Gloo) to see a crash-and-restart loop, then read the determinism related topic and the Chapter 4 sharded save and load. Prove the same next batches and updates after one interrupted run.

  • Picotron - Checkpoint StateHugging Face

    Inspect picotron/checkpoint.py and every call site in train.py. List which state is saved, how ranks participate and which DT-1 reproducibility requirements need to be added in your project.

  • Nanotron - Distributed SerializationHugging Face

    Read the serialization section of docs/docs.md (metadata, per-rank optimizer and RNG shards) and its statement that checkpoints are not topology agnostic, then the reasons in src/nanotron/serialize/. Use it as the worked example of why resharding is hard.

  • PyTorch Elastic Run DocumentationPyTorch

    Use failure modes and membership changes to understand agent, worker group, rendezvous and restart semantics. Implement only bounded local restart tests; elasticity is not a substitute for checkpoint correctness.

  • torchftPyTorch

    Read the README and train_ddp.py: per-step quorum through the lighthouse, fault-tolerant DDP and HSDP, and live peer recovery. Compare per-step healing with restart-from-checkpoint.

  • TorchTitan - CheckpointingPyTorch

    Read docs/checkpoint.md and the checkpointer component at a pinned commit: intervals, model-only and export saves, asynchronous modes and keys excluded from loading.

  • The Llama 3 Herd of Models - Reliability and Operational ChallengesLlama Team, Meta (2024)

    Read the reliability section and its interruption table (root causes of unexpected interruptions over a 54-day snapshot) and use it to set failure rates in your checkpoint-interval model.

  • OLMo-core CheckpointerAi2

    Read src/olmo_core/train/checkpoint.py (_temporary_wd, _get_tmp_dir, _teardown_tmp_dir, _save_metadata) for temp-directory atomic publish with barrier discipline, and src/test/train/checkpoint_test.py (run_checkpointer) for the save, find and reload assertions.

  • Bumblebee - DCP and Checkpoint Smoke TestsBumblebee

    Only as a possible capstone target: read primitive/ckpt/dcp.py and the checkpoint smoke tests in a clean checkout. Its own roadmap lists reshardable optimizer state as a gap.