Order the pieces of state that must be restored to resume a training run bit-exactly
- 1Training-step counter and bookkeeping (epoch index, global step, gradient-accumulation micro-step counter)
- 2Learning-rate scheduler state (so warmup/decay continues from the right step, not step 0)
- 3Data sampler / DataLoader iterator position (so the very next batch is the one the run would have seen)
- 4RNG state across Python, NumPy, PyTorch CPU, and CUDA (so dropout, augmentations, and shuffles are reproducible)
- 5Optimizer state (Adam moments m and v, plus the global step counter)
- 6Model weights (the parameters themselves)
Restore weights, then optimizer state, then LR scheduler, then RNG, then data iterator, then step counters. Each missing layer breaks bit-exact resume in a different way.
Imagine pausing a long board game and coming back tomorrow. The pieces on the board are the model weights. The notes your players wrote about how aggressively each one was playing are the optimizer state. The timer showing how far into the tournament you are is the scheduler. The shuffled deck and the dice memory are the RNG. The exact spot in the playlist of question cards is the data iterator. And the scorecard with round numbers is the bookkeeping. If you reload only the pieces and lose the rest, the game continues but it is not the same game. Bit-exact resume means restoring every single one of those, in the right order, so the next move is identical to what tomorrow would have been.
Detailed answer & concept explanation~7 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
5 min: six resume layers in order + per-layer failure mode + RNG generators + DataLoader iterator state + grad-accumulation micro-step + framework support in 2026.
Real products, models, and research that use this idea.
- DeepSpeed's `save_checkpoint` / `load_checkpoint` bundles weights, optimizer, scheduler, RNG, and ZeRO sharding metadata so a preempted run on Llama 4 training can resume bit-exactly across thousands of ranks.
- Hugging Face Accelerate's `save_state` / `load_state` covers all six layers including DataLoader iterator state when the sampler is wrapped in `accelerate.DataLoaderShard`.
- PyTorch FSDP exposes `FSDP.full_optim_state_dict` so optimizer moments resume correctly under sharded training in 2026 production stacks.
- Mosaic Composer checkpoints include per-rank `numpy` and CUDA RNG snapshots so distributed dropout masks reproduce on resume.
- Anthropic and OpenAI publish post-mortems describing silent training divergence after a preemption when the data iterator was rebuilt from scratch instead of restored from state.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy does optimizer state often double the checkpoint size of the model weights alone?
QHow would you verify a checkpoint actually resumes bit-exactly rather than approximately?
QWhat changes under FSDP or DeepSpeed ZeRO-3 sharded checkpointing?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Saving only model weights and the optimizer, then assuming the resumed run will match the original. Without RNG and data-iterator state the next batch and the next dropout mask both diverge.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.