Unit 3 of 11 · about 4 hours · implement

Checkpoint manifests, schema versions and name and optimizer compatibility

Silent name or shape mismatches resume successfully and train the wrong model. The manifest turns that into a loud refusal or a logged remap.

You'll be able to

  • Write a checkpoint manifest with schema version, topology, config and code identity, and refuse resume on mismatch.
  • Handle renamed parameters and missing or extra optimizer keys with explicit strict versus lax loading and a logged decision per key.

Covers

Checkpoint manifests, schema and version compatibilityParameter-name and optimizer-state compatibility
1

Read

In this order, only the parts listed

0 of 3 done

  1. Nanotron serialization format and its limitsNanotron - Distributed Serialization

    Distributed serialization mechanism: checkpoint_metadata.json with version and topology, per-rank optimizer, scheduler and random shards, model safetensors; checkpoints are NOT topology agnostic because of random_states and sharded tensors, with the checkpoint_reshape plan

  2. Keys, versions and partial loadingTorchTitan - Checkpointing

    EXCLUDING SPECIFIC KEYS FROM CHECKPOINT LOADING with exclude_from_loading for dataloader, lr_scheduler and ema plus the cold-start warning; Creating a seed checkpoint; Conversion support for HuggingFace and Torch formats

  3. Minimal manifest probe and strictness choicesTorchFeather - Distributed Checkpoint Manager

    _find_load_step: step-* directories count only with a .metadata probe; ModelWrapper.load_state_dict uses StateDictOptions(strict=False) and rebuilds its cache; load with step == 0 loads model weights only

2

Focus on

  • A manifest answers four questions before training resumes: which schema version, which topology produced this, which config and code, and which keys with which shapes. Anything less is directory discovery, not a manifest.
  • strict=False is a policy, not a default to copy. TorchFeather uses it for model weights so renamed runs still load, but every skipped or remapped key must be logged, and optimizer state needs stricter handling because a dropped moment silently restarts adaptation.
  • Seed checkpoints separate initialization from training. TorchTitan builds weights once on one device and DCP-reshards them anywhere, so layout never leaks into the initial weights.
  • Nanotron's format shows why manifests must record topology. Per-rank optimizer and RNG shards have no defined meaning under a new TP, DP or PP layout, so the honest manifest refuses rather than guesses.
Common mistakes · 3
  • Trusting file names as a manifest. step-12 without a .metadata probe is an interrupted write; TorchFeather's loader skips it, and yours must too.
  • Excluding a key from loading and forgetting to remove the exclusion. TorchTitan's EMA note shows the failure: every later resume cold-starts the EMA and discards its history.
  • Reloading optimizer state whenever shapes match. Changed betas or eps keep shapes but change the update, so record hyperparameters in the manifest and refuse or warm-start explicitly.
3

Try it yourself

Closed-book, before checking anything

Write a three-key manifest (schema version, topology, config hash) for a toy checkpoint, then demonstrate all three refusals: bump the schema, rename one parameter under strict loading, and delete .metadata. Each must fail loudly with the cause named. Catch a failed dcp.load as CheckpointException: in PyTorch 2.14.1 it derives from BaseException, so except Exception lets it through.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.A checkpoint directory contains step-9 with shards but no .metadata, plus a complete step-8. Which step loads, and why?Answer

    Step 8. Without the manifest probe the newer directory is an interrupted write, so the loader takes the newest complete checkpoint.

  2. 2.After enabling EMA mid-run, resume fails on a missing ema key. What is the one-resume fix, and what must happen right after?Answer

    Exclude ema from loading once so it cold-starts from the loaded weights, then remove the exclusion so later resumes keep the EMA history.

  3. 3.A renamed layer loads with strict=False and training continues. What two records make this safe instead of silent?Answer

    The manifest's map from old to new key names, and a load log of every skipped, remapped and shape-changed key. Unlogged lax loading is silent corruption.

  4. 4.Why does Nanotron record topology in checkpoint_metadata.json instead of attempting cross-topology loads?Answer

    Its per-rank optimizer and RNG shards are only defined under the saving layout. The metadata states that assumption, so a changed mesh fails loudly instead of misassigning state.

5

Practice

  • TorchTitan CPU checkpoint suite

    Run tests/unit_tests/cpu/test_checkpoint.py: save, load, load_step selection and purge cases on CPU

    Run in the repo's dev environment on CPU; the full trainer needs GPUs. Read the case names as the manifest contract: latest-complete selection, key exclusion, stale cleanup.

You're done when

Your loader refuses a version bump, a renamed parameter under strict mode, and a manifest-less directory, each with a message naming the cause; lax loads log every remapped key.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 10 more in the section
  • TorchFeather - Distributed Checkpoint ManagerTorchFeather · required

    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.

  • Nanotron - Distributed SerializationHugging Face · support

    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.

  • TorchTitan - CheckpointingPyTorch · support

    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.

Also in this section

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

    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 · required

    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.

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

    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 · required

    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 · support

    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.

  • PyTorch Elastic Run DocumentationPyTorch · support

    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 · support

    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.

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

    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.

  • Bumblebee - DCP and Checkpoint Smoke TestsBumblebee · depth

    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.

  • OLMo-core CheckpointerAi2 · support

    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.