Scaling and checkpoint recovery
Quick answer
Scaling efficiency describes speedup relative to added workers. Checkpoint recovery restores an agreed training state, not just weights. Correctness and recoverability must be verified before interpreting distributed performance. Examples use small synthetic inputs and Python or local CPU PyTorch. ByteMind execution is unverified.
Calculate strong scaling efficiency
Expected output (locally tested): 2.5 0.625. Four workers deliver 2.5x speedup and 62.5% efficiency.
How it works
For strong scaling, hold workload fixed: speedup S=T1/Tp and efficiency E=S/p for p workers. Weak scaling holds per-worker workload fixed and uses a different comparison. Measure warmup, communication, input stalls, synchronization and the slowest worker; report global samples processed and effective batch. Timing must use the same workload and appropriate device synchronization. Larger global batches can change convergence and learning-rate behavior. Store model parameters, optimizer and scheduler state, step, data order/cursor, RNG states, scaler state when relevant, configuration, dataset and code lineage. A committed checkpoint must be complete; a local atomic rename is not a distributed consensus protocol. Verify trusted digest, compatibility and finite state before resume. On failure, stop all affected ranks through the approved launcher, use bounded timeouts and restart from a committed version rather than letting survivors enter collectives alone. Do not load untrusted executable checkpoint formats. The milestone uses deterministic JSON weights and momentum on a single CPU, and simulates recovery without launching workers.
Momentum is part of checkpoint
def step(w,v,g): v=0.5*v+g return w-0.1*v,vw,v=step(0.,0.,2.)print(tuple(round(x,2) for x in step(w,v,2.)))print(tuple(round(x,2) for x in step(w,0.,2.)))Expected output (locally tested): (-0.5, 3.0) (-0.4, 2.0). Restoring only weights changes the next update.
Common mistakes
Do not claim linear speedup from worker count alone or compare different total workloads. Resetting optimizer momentum can change the training trajectory even when weights match. A checksum from the same untrusted source does not authenticate an artifact.
Practice and next steps
Compare a 100 ms single-worker run with a 40 ms four-worker run, then remove momentum from the lab checkpoint and compare the resumed trajectory.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Scaling and checkpoint recovery — knowledge check
Apply scaling and checkpoint recovery to small examples and debugging scenarios.
What stays fixed in strong scaling?
What is efficiency for 2.5x speedup on four workers?
Why restore optimizer state?
What should happen after a rank fails mid-collective?
What does a trusted digest verify?