IIntroduction to AI Systems Performance EngineeringTechnical textbook
Chapter 16

Fault Tolerance and Checkpointing

Measure failures, checkpoints, restart, and recovery

Calculate expected lost progress, design sharded portable checkpoints, distinguish a hang from a slow rank, and allocate resources for long-duration recovery objectives.

Imagine a seven-day training job that uses 512 devices, where each device is a graphics processing unit (GPU). One central processing unit (CPU) process controls each GPU. A healthy optimizer step takes 1.2 seconds, but one worker stops responding after 19 hours. The remaining workers wait in a collective for 11 minutes before a watchdog ends the job. Replacement allocation, process startup, and checkpoint restore take another 17 minutes, and the job repeats 43 minutes of training completed after its last usable checkpoint.

An incident timeline makes every interval observable. The launcher records process exit and replacement times. Application progress markers record the last completed step. NCCL reliability, availability, and serviceability status can identify an unresponsive process or inconsistent communicator state. Checkpoint metadata identifies the latest version whose shards were completely written and verified. The next valid optimizer step marks the end of recovery.

Healthy-step throughput excludes all of those intervals. Calendar progress includes checkpoint interference, failure detection, replacement, restore, warm-up, and repeated work. The job-level interruption rate must also be measured from completed jobs or incidents because one shared switch, storage service, or software rollout can interrupt many otherwise healthy devices at once.

This chapter turns the incident record into a checkpoint interval model, a portable state design, a progress-detection policy, and a resource budget. The final quantity is correct completed training work per allocated accelerator-hour over a representative operating period.

Prerequisites

Learning objectives

  • Calculate expected calendar waste from checkpointing and interruptions
  • Design and test a complete distributed checkpoint continuation contract
  • Detect missing progress, preserve diagnostic evidence, and recover a valid worker group
Lessons

Study this chapter

  1. 16.1
    Failure cost model

    Calculate checkpoint overhead, expected repeated work, and recovery waste across candidate useful-training intervals between checkpoint pauses and measured incident ranges

    Begin lesson →
  2. 16.2
    Sharded, portable checkpoints

    Map rank-local shards to logical tensor keys, publish only complete versions, and verify restore in a fresh process group without one-rank assembly

    Begin lesson →
  3. 16.3
    Hangs, health, and elastic restart

    Use progress markers and phase-specific timeouts to distinguish a hang from a valid straggler, capture the first divergence, and choose group recovery behavior

    Begin lesson →
  4. 16.4
    Reliability resource budget

    Compare reliability designs using correct completed work per charged calendar allocation and explicit prevention, detection, recovery, and integrity objectives

    Begin lesson →
Chapter projects

Extended exercises

Complete these projects after the lesson-level practice tasks. Each project combines several mechanisms from the chapter.

01
Check

Checkpoint interval

Evaluate useful-training intervals of 10, 20, 40, 60, and 120 minutes between checkpoint pauses across low, central, and high job-interruption estimates.

Evidence: A sensitivity table that defines I consistently and includes exposed save, expected repeated work, detection, replacement, restore, and total fractional calendar waste.

02
Practice

Restore drill

Save a sharded model, optimizer, random state, completed-step number, and data position, then terminate the original processes and restore into a fresh group.

Evidence: Complete-version manifest, automated logical-state comparison, next-step behavior, temporary-memory peak, and time to first valid post-restore step.

03
Challenge

Failure injection

Kill one worker and separately stall one worker during declared phases of a toy eight-rank training job.

Evidence: Progress-marker timeline, first captured divergence, timeout decision, communicator status, launcher behavior, restored step, and exact repeated-work calculation.

References

Sources and further reading

The lesson explanations synthesize primary papers and official references. Follow the originals for proofs, exact APIs, architecture details, and version-sensitive behavior.

  1. PyTorch Distributed Checkpoint
  2. torchrun Elastic Launch
  3. NCCL RAS