Skip to content

Part 10 · Blueprint 68

Large-Scale Model Training & Checkpoint Infrastructure

15 min reading · Sources · Editorial review pending

Independent shard writes can produce a checkpoint that no consistent training step ever had.

More
20px
Reading list
Page details

Published date · Last edited:

Draft edition. Editorial review and supplementary reading recommendations are still being completed.

Format: Architecture walkthrough. Prerequisites: the beginner bootcamp. Chapter prerequisites: Replication, Consensus & Automated Failover, Distributed Task & Cron Scheduler (Temporal / Quartz Scale), Distributed Blob & Object Storage (Amazon S3 Scale).

Sixty-second mental model

Problem: Independent shard writes can produce a checkpoint that no consistent training step ever had.

Use: Publish only a verified manifest for one consistent step.

Design boundary: Recover distributed training from coherent model, optimizer, step and random/data-loader state. A file of weights alone may support inference but not equivalent training continuation.

Layer 1 · Intuition

Hypothetical scenario: Northwind is designing training checkpoints. Maya represents product requirements, Dev implementation and Priya reliability. The team must agree what one checkpoint shard means and which component owns the training step state.

Think of a synchronized construction crew preserving a consistent restart point. Separate the requester from training step state, then identify the retained evidence needed after failure.

Authority
The entitled state owner.
Invariant
A rule preserved across concurrency and failures.
Checkpoint
Saved execution or model state used as a recovery or continuation point. Analogy: A preserved game state from which work can resume.

Architecture and worked reasoning

Design boundary: Recover distributed training from coherent model, optimizer, step and random/data-loader state. A file of weights alone may support inference but not equivalent training continuation.

Responsibilities on the request path

Training checkpoints: responsibilities and request directionRecover distributed training from coherent model, optimizer, step and random/data-loader state. A file of weights alone may support inference but not equivalent training continuation.Training workersStep barrierCheckpoint shardsCommit manifest
Recover distributed training from coherent model, optimizer, step and random/data-loader state. A file of weights alone may support inference but not equivalent training continuation.

Workload and limiting resource

Hypothetical model weights are 20 GB and optimizer state is 40 GB: at least 60 GB before gradients, RNG and metadata. At a selected sustained 2 GB/s checkpoint path, writing those bytes takes at least 30 seconds before coordination and contention. Checkpointing every minute could consume half that path’s time under this simplified model.

Keep the units attached to each intermediate result. The assumptions above describe a hypothetical exercise, not observed vendor capacity. A real capacity decision also needs a measured service curve, skew, recovery traffic and an explicit admission policy for overload.

Mutation or publication path

Training checkpoints: mutation boundaryChoose a consistent checkpoint boundary. Then: Write required state shards with checksums/version. Then: Publish a complete manifest only after the chosen durability rule.Step 1
Choose a consistent checkpoint boundary.
Step 2
Write required state shards with checksums/version.
Step 3
Publish a complete manifest only after the chosen durability rule.
Choose a consistent checkpoint boundary. Then: Write required state shards with checksums/version. Then: Publish a complete manifest only after the chosen durability rule.
  1. Choose a consistent checkpoint boundary.
  2. Write required state shards with checksums/version.
  3. Publish a complete manifest only after the chosen durability rule.

Observation and recovery path

Training checkpoints: observation boundarySelect a committed complete checkpoint. Then: Restore model/optimizer and relevant progress state. Then: Validate topology/configuration compatibility before resuming.Step 1
Select a committed complete checkpoint.
Step 2
Restore model/optimizer and relevant progress state.
Step 3
Validate topology/configuration compatibility before resuming.
Select a committed complete checkpoint. Then: Restore model/optimizer and relevant progress state. Then: Validate topology/configuration compatibility before resuming.
  1. Select a committed complete checkpoint.
  2. Restore model/optimizer and relevant progress state.
  3. Validate topology/configuration compatibility before resuming.

Failure that changes the decision

Hypothetical scenario: A manifest references some shards from step 100 and others from step 101. A mixed checkpoint can be readable yet semantically invalid; bind all shards to one checkpoint identity/boundary.

Attempt this decision before reading the explanation

Can a faster checkpoint policy ignore optimizer state to preserve identical training continuation?

Not without changing the recovery contract. Missing optimizer or data/RNG state can alter subsequent updates; declare the intended continuation semantics.

Supporting mechanism analysis

Hypothetical scenario: Northwind. Maya represents product, Dev implementation and Priya reliability. The following workflow develops the underlying mechanism.

Hypothetical scenario. Northwind’s dataset has explicit lineage and splits. Dev starts an adaptation run on a model that already serves successfully, but the backward pass exhausts memory. Maya asks why fitting the weights was insufficient; Priya asks which training state actually caused the peak.

Inference and training have different memory lifetimes. Training may retain activations for derivatives, store parameter gradients and maintain optimizer state. Precision policy can introduce additional representations of parameters. The weight file alone therefore does not describe a training allocation. Begin with an inventory of persistent and transient state, then choose a distribution strategy for the part that exceeds capacity.

Before you continue: The weight artifact fits on a worker, but the training step fails. Does adding ordinary replicated data-parallel workers automatically divide each worker’s model-state memory?

In the declared replicated setup, workers retain model replicas. Distributing examples does not itself divide persistent model state; it can leave the per-worker constraint unchanged.

This targets the observed allocation. Account for gradients, optimizer state, activations and transient gathers, then evaluate sharding or recomputation together with communication and resume requirements.

In a selected replicated data-parallel setup, each worker has a model replica and processes a different local batch. Workers combine gradient information so updates implement the intended global objective. Replicating a model across more workers does not divide its persistent parameter storage on each worker. It can increase aggregate training throughput while leaving an individual worker's model-state problem unresolved.

Define the global batch carefully. If four workers each process two examples per microbatch and accumulate four microbatches before an optimizer step, the selected global count is 4 × 2 × 4 = 32 examples per update. Token counts and scored positions can still differ among examples, so specify the loss normalization rather than assuming equal example counts mean equal objective weighting.

Gradient accumulation postpones the optimizer update while accumulating contributions from several microbatches. It can reduce the activations needed at one time relative to a larger simultaneous batch. It does not by itself shard model parameters or optimizer state. Changes to numerical precision and reduction order can also affect the exact numerical result.

Hypothetical scenario. A sharded trainer holds partitioned parameters, gradients and optimizer state but temporarily materializes additional tensors for computation. Dividing persistent bytes by device count cannot establish the peak.

Fully sharded data parallelism, or FSDP, partitions model state across workers. When a wrapped computation needs a parameter group, workers gather its required representation; after gradient computation, collective operations distribute the resulting gradient information. The grouping and scheduling determine how much is materialized at once and how communication overlaps computation.

Sharding is not tensor parallelism. Tensor parallelism divides operations within model layers; pipeline parallelism places stages on different workers. A real training system can combine methods, but each adds a different scheduling and communication relationship. Select them because of a measured constraint, not because additional parallelism necessarily improves efficiency.

Hypothetical scenario. Choose one billion trainable parameters. Assume two bytes per stored model parameter, two bytes per gradient, four bytes for a master parameter copy and two four-byte optimizer moments. This chosen mixed-precision accounting totals 2 + 2 + 4 + 4 + 4 = 16 bytes per parameter.

The selected persistent state is 1,000,000,000 × 16 = 16,000,000,000 bytes. Dividing by 1,073,741,824 gives approximately 14.90 GiB. Four replicated workers each still require that selected persistent state before activations and buffers. Four ideally balanced shards instead store a selected floor of 16,000,000,000 / 4 = 4,000,000,000 bytes, approximately 3.73 GiB per worker.

Now add assumed per-worker allocations: 3 GiB of activations, 1 GiB of simultaneously materialized parameter groups and 0.5 GiB of other working buffers. The illustrative total is 3.73 + 3 + 1 + 0.5 = 8.23 GiB, using rounded components. This selected allocation does not fit an 8 GiB worker even though the persistent shard alone does.

These values are a transparent example, not a framework specification. Actual optimizers can use different state, precision and offloading. Allocator reservations and fragmentation need inspection too. Count logical payload and measured allocation separately, and retain headroom appropriate to the actual workload instead of treating a rounded estimate as a capacity guarantee.

Choose a hypothetical collective transfer moving 2 GiB through a bottleneck whose effective useful bandwidth is 20 GiB per second. A simple payload-only lower bound is 2 / 20 = 0.1 seconds. If useful local computation takes 0.15 seconds and none of that transfer overlaps, the selected total is at least 0.25 seconds before other overhead.

If the transfer overlaps perfectly with that computation, the simplified bound becomes max(0.1, 0.15) = 0.15 seconds. Actual collective topology, contention, synchronization and launch behavior can prevent perfect overlap. These bounds explain what to measure; they are not benchmark results or evidence of linear speedup.

More workers can reduce shard payload while increasing coordination and changing communication volume. Small parameter groups can introduce many operations; large groups can raise materialization peaks. Measure step time and peak allocation together. A configuration that fits but spends most of its time waiting may be a useful feasibility step without being an efficient final design.

Variable-length sequences can create different amounts of useful work even with equal example counts. A slow worker or uneven batch can delay a collective that others need. Record sequence lengths, data-loading waits and communication timing before attributing every stall to the accelerator model.

Loss normalization also matters when scored token counts differ. Averaging each worker's local mean equally is not generally equivalent to a mean over all scored tokens when workers contribute different token counts. Specify the intended objective and scaling. A faster run that changes the training objective is a different experiment, not an uncomplicated speed improvement.

The PyTorch FSDP2 tutorial describes distributed parameter handling and the collectives used around computation. It is a concrete implementation of state sharding rather than a claim that Northwind or the author ran a large training cluster. Use the primary documentation to check version-specific behavior and the toy ledger to identify which allocations still need measurement.

Layer 3 · Internals

Distributed training partitions work across data, tensor or pipeline dimensions. Data parallel workers contribute updates from different batches; tensor and pipeline partitioning split portions of model computation. The chosen layout determines which communication links carry collective operations and which failures interrupt progress. A statement about cluster reliability needs component failure assumptions and measurements; GPU count alone does not establish a universal mean time between failures.

A restartable checkpoint can require model parameters, optimizer state, learning-rate schedule, random-number state and data progress, not merely weights. PyTorch distributed checkpointing coordinates state stored across ranks, with compatibility and consistency responsibilities still explicit. An asynchronous staging copy must represent one consistent training step before later mutations make it ambiguous. Publish a manifest only after all required shards are durable and verified. Restart should select a complete committed manifest; a directory containing most expected shard files is not sufficient. Checkpoint frequency balances copying cost against expected lost work under the declared failure model.

Trade-offs and limits

ApproachProvidesRequires
Synchronous complete checkpointMakes the pause and durability boundary explicit.Training waits for the slowest required persistence path.
Consistent staging plus asynchronous flushCan move storage work outside the main compute pause.Staging memory, mutation isolation and manifest completeness become essential.

Recovery decision

Hypothetical scenario: A manifest references some shards from step 100 and others from step 101. A mixed checkpoint can be readable yet semantically invalid; bind all shards to one checkpoint identity/boundary.

Not without changing the recovery contract. Missing optimizer or data/RNG state can alter subsequent updates; declare the intended continuation semantics.

Write your design before revealing the review

Can a faster checkpoint policy ignore optimizer state to preserve identical training continuation?

Evidence you can explain in your own design

Drafts and self-review are stored only in this browser. They are separate from reading completion.

Compare your decision

Not without changing the recovery contract. Missing optimizer or data/RNG state can alter subsequent updates; declare the intended continuation semantics.

A manifest references some shards from step 100 and others from step 101. A mixed checkpoint can be readable yet semantically invalid; bind all shards to one checkpoint identity/boundary.

Check your understanding

Can a faster checkpoint policy ignore optimizer state to preserve identical training continuation?

Not without changing the recovery contract. Missing optimizer or data/RNG state can alter subsequent updates; declare the intended continuation semantics.

How would you recover from this failure: A manifest references some shards from step 100 and others from step 101. A mixed checkpoint can be readable yet semantically invalid; bind all shards to one checkpoint identity/boundary.

Start with the exact boundary that failed. Choose a consistent checkpoint boundary. Write required state shards with checksums/version. Publish a complete manifest only after the chosen durability rule. Then recover evidence through the observation path: Select a committed complete checkpoint. Restore model/optimizer and relevant progress state. Validate topology/configuration compatibility before resuming. Preserve the distinction between a confirmed state change and an unavailable response.

Which assumption in the worked calculation would a burst or concentrated tenant invalidate first?

Hypothetical model weights are 20 GB and optimizer state is 40 GB: at least 60 GB before gradients, RNG and metadata. At a selected sustained 2 GB/s checkpoint path, writing those bytes takes at least 30 seconds before coordination and contention. Checkpointing every minute could consume half that path’s time under this simplified model. Recompute the affected resource rather than multiplying unrelated storage and network budgets by the same factor. Recover distributed training from coherent model, optimizer, step and random/data-loader state. A file of weights alone may support inference but not equivalent training continuation.

Which component in this topology could be removed from a smaller first deployment?

Training workers, Step barrier, Checkpoint shards, Commit manifest name responsibilities, not a requirement for separate processes. Co-locate responsibilities when their transaction, trust and capacity boundaries permit it. Choose a consistent checkpoint boundary.

What evidence must a caller have before relying on the observation path?

Select a committed complete checkpoint. Restore model/optimizer and relevant progress state. Validate topology/configuration compatibility before resuming. Not without changing the recovery contract. Missing optimizer or data/RNG state can alter subsequent updates; declare the intended continuation semantics.

45-minute interview rubric

  1. 00–05: scope checkpoint shard and training step state.
  2. 05–12: identify the limiting resource and derive the domain workload above, retaining units and assumptions.
  3. 12–28: draw training step state, numbered writes and reads.
  4. 28–40: challenge recovery: Publish only a verified manifest for one consistent step.
  5. 40–45: defend run_id placement, observations and remaining assumptions.

Go deeper

Decision log

Publish only a verified manifest for one consistent step.

Preserve checkpoint shard identity and training step state ownership.

Revisit changed workload, observations or recovery objectives.