I — Work and state
What additional devices buy
Start with the outcome you need: enough memory to execute the workload, less time to complete training, or more serving requests completed within their latency requirements. These goals are related but not interchangeable. Replicating a server can increase aggregate throughput without reducing the execution time of one request; partitioning a model can make it fit while adding communication to that request.
A device here is a numerical accelerator, usually a graphics processing unit, or GPU. A node is a machine containing one or more devices. Their combined memory is not automatically one equally accessible address space: workers must arrange access to remotely held values. Scale-up usually means enlarging resources within a machine or tightly connected system; scale-out adds machines. State the boundary explicitly, because those labels alone say little about communication cost.
A November 2025 multi-node inference study illustrates the distinction. For its fixed Llama 3.1 70B workloads, vLLM latency improved from four to eight GPUs, then generally flattened or increased. The system had four A100 GPUs per node, NVLink within nodes, and Slingshot-11 between nodes. This measured batch completion, not online tail latency. More arithmetic capacity did not reliably shorten the complete execution once communication became consequential.
The numerical state that must fit
A tensor is an indexed numerical array with a shape and element type. Model parameters are learned arrays. A forward pass applies them to inputs and produces intermediate activations. During training, a loss assigns a numerical penalty to the predictions. Backward computation produces gradients, derivatives describing how parameter changes affect that loss. An optimizer uses them to update parameters and may retain optimizer state, such as moving averages of earlier gradients. These arrays have different lifetimes and need not share the same device. From recorded text to parameter updates explains the learning process.
Serving keeps parameters fixed but introduces another growing allocation. Prefill processes the known input positions; decode advances the generated continuation. A key-value cache, or KV cache, retains attention representations derived from processed positions so they need not be recomputed. It is numerical request state, not the token text itself. See Prefill and decode and The KV cache for their mechanisms.
| State | Logical owner | Lifetime and growth |
|---|---|---|
| Parameters | Model | Persistent; grows with model size and representation width. |
| Optimizer state | Training update process | Persists across updates; depends on optimizer and parameter count. |
| Gradients | Current update | Retained through aggregation or accumulation; storage depends on the execution policy. |
| Activations | Current examples and operations | Intermediate results; retained for backward use or recomputed. |
| KV cache | Requests and compatible shared prefixes | Depends on active sequences, retained positions, architecture, and cache format. |
| Workspaces and communication buffers | Runtime operations | Persistent or temporary; can create peaks beyond the model's stored arrays. |
Memory feasibility concerns the peak simultaneous allocation, not the sum of parameter shards alone. For example, vLLM profiles non-KV consumption before assigning remaining capacity to caches. Allocator-reserved memory also differs from live tensor storage; adding both can double-count bytes. Keep a ledger of actual allocations and transient peaks, using the distinctions in Where operands live.
Workers and ownership
A worker executes an assigned portion of the job, commonly as a process controlling a device. A process group identifies participants that communicate together. A worker's rank identifies it within that group; the group's size is its world size. A communicator supplies the communication context for those participants. Rank is not a permanent machine identity: membership changes can assign new ranks.
Replication keeps equivalent copies; sharding assigns portions to owners. Sharded storage need not imply partitioned arithmetic: execution may gather the parameter shards.
| Axis | What is divided | What connects workers |
|---|---|---|
| Data parallelism | Examples processed by model replicas | Gradient contributions for corresponding parameters. |
| Tensor parallelism | Arithmetic inside a layer | Operands, output pieces, or partial sums. |
| Pipeline parallelism | The ordered sequence of layers | Forward activations and backward gradients at stage boundaries. |
These axes can coexist. A group may cooperate on each example through tensor and pipeline partitions while another group processes different examples. Before choosing a library setting, identify the owner of every required input and result. Missing local values explain the communication that the partition introduces.
Turning points in distributed execution
Distributed model execution combines two continuing lines of work: coordinating processors and arranging numerical work so that coordination is worthwhile. Earlier parallel-computing ideas supplied portable communication and whole-application reasoning. Deep-learning systems then developed partitions suited to large parameter arrays, repeated training updates, and stateful generation.
These developments addressed complementary constraints, not successive replacements for one universal design.
Complementary answers to distributed execution
1967AmdahlWhole-workload scaling limits: faster parallel arithmetic leaves other costs exposed.
Contributors: Gene Amdahl, IBM
What changed: The paper includes sequential work, data management, irregular computation, and memory contention in the scaling question.
June 1994MPI 1.0Portable communication contracts that implementations can optimize.
Contributors: Collaborating vendors, universities, laboratories, and industry
What changed: Applications gained a common message-passing interface. The linked MPI 1.1 specification, dated June 1995, documents and clarifies the earlier standard.
2012DistBeliefPartitioned models and independently progressing replicas.
Contributors: Google
What changed: Downpour SGD traded strict coordination for tolerance of variable worker progress. Gradients could use older parameters, and parameter-server shards could advance differently.
November 2018 preprint; 2019 paperGPipeMicrobatch pipelines across layer partitions expand executable model capacity.
Contributors: Yanping Huang and colleagues, Google
What changed: The NeurIPS paper combines computationally balanced stages, accumulated gradients, and rematerialization, with one update after the minibatch.
September 2019 preprintMegatron-LMPaired within-layer partitions avoid unnecessary intermediate exchanges.
Contributors: Mohammad Shoeybi and colleagues, NVIDIA
What changed: The linked March 2020 revision reports converged 8.3-billion-parameter models on 512 GPUs. Its scaling experiment enlarges the model rather than holding total work fixed.
October 2019 preprintZeRORemove duplicated training state while retaining substantial local computation.
Contributors: Samyam Rajbhandari and colleagues
What changed: Progressive state partitioning reduces persistent storage. Adding parameter sharding also requires parameter collection for forward and backward use.
2024Splitwise and DistServeSeparate serving phases, making KV movement and phase allocation explicit.
II — Communication
Collectives preserve numerical meaning
Point-to-point communication connects two participants. A collective operates across a group; a reduction combines corresponding values, for example by summing. The NVIDIA Collective Communications Library (NCCL) implements GPU collectives.
| Operation | Result ownership |
|---|---|
| All-reduce | Every rank receives the reduced array. |
| Reduce-scatter | Each rank receives a portion of the reduced array. |
| All-gather | Every rank receives the concatenated rank contributions. |
| Broadcast | Every rank receives the designated root's values. |
Reduce-scatter then all-gather produces all-reduce. Gathering concatenates in rank order; it does not sum. NCCL requires matching counts and datatypes.
Synchronization enforces a progress or data-readiness dependency; it need not be a global barrier. The MPI nonblocking-collective contract separates initiation from local completion. Initiation returns a handle; completion establishes safe local buffer access. It generally does not establish that every other participant has finished. Participants must initiate collectives in the same order on a communicator. GPU frameworks have their own stream and completion rules, so apply their documented boundary before consuming or overwriting buffers. This extends the producer/consumer reasoning in Safe sharing and reuse.
Communication on the critical path
The interconnect carries values between devices or nodes. The critical path is the dependency chain that determines completion: shortening work outside it may leave elapsed time unchanged. Communication becomes exposed when a dependent operation is ready to run except for missing remote data. Issuing a transfer asynchronously creates an opportunity for overlap, not proof that useful work overlaps it.
Consider an example with a 2 ms producer operation, a 6 ms transfer, and 4 ms of independent computation. Serial execution takes 12 ms. Starting the transfer when its producer finishes, alongside the independent computation, takes 8 ms; 2 ms of transfer remains exposed after that computation ends. The transfer still consumes bandwidth for 6 ms. Overlap changes elapsed time without eliminating data movement.
The same transfer, a shorter execution
Example timingsIndependent computation hides only part of the transfer.
Read the diagram as text
- Serialized execution. 0 to 12 ms; duration 12 ms.
- Produce payload. 0 to 2 ms; duration 2 ms. Parent: Serialized execution.
- Transfer payload. 2 to 8 ms; duration 6 ms. Parent: Serialized execution.
- Independent computation. 8 to 12 ms; duration 4 ms. Parent: Serialized execution.
- Overlapped execution. 0 to 8 ms; duration 8 ms.
- Produce payload. 0 to 2 ms; duration 2 ms. Parent: Overlapped execution.
- Transfer payload. Only its final two milliseconds remain uncovered. 2 to 8 ms; duration 6 ms. Parent: Overlapped execution.
- Independent computation. 2 to 6 ms; duration 4 ms. Parent: Overlapped execution.
Strong scaling holds total work fixed while adding processors; weak scaling holds work per processor fixed. Amdahl's fixed-work argument exposes the work that remains unaccelerated. John Gustafson's 1988 Reevaluating Amdahl's Law instead considered a larger problem completed in approximately the same time. Its scaled-speedup expression, , uses processor count and serial fraction measured on the parallel machine. It changes the workload and denominator; it does not overturn the fixed-work limit.
Also distinguish bytes sent by one worker, aggregate traffic, and traffic crossing a limiting shared link. NCCL Tests reports algorithm bandwidth as operation data size divided by time. Its bus bandwidth applies a collective-specific normalization; for all-reduce on ranks, the factor is . That derived metric is not a counter of physical-link traffic.
III — Training
Different examples, matching updates
In synchronized data-parallel training, replicas process different examples from matching starting parameters. Workers average gradients for corresponding parameters, then apply matching optimizer updates. With matching optimizer state and settings, the replicas remain one logical model. PyTorch's DistributedDataParallel, or DDP, performs this gradient synchronization through all-reduce; it does not redistribute newly updated weights after every step.
Ordinary replication still stores complete parameters, gradients, and optimizer state on each worker. It distributes example processing, not that storage burden. A local batch contains the examples assigned to one replica; the global batch contains those contributing across replicas. Two workers processing four distinct examples each contribute eight examples to an update. Doubling workers while keeping the local batch fixed therefore changes the global batch.
Input coverage requires its own policy. PyTorch's DistributedSampler partitions indices by rank. For uneven dataset lengths, it can drop the tail or add indices to equalize partition lengths. Equal-length partitions thus need not mean exactly-once coverage. Shared shuffle seeds and calling set_epoch before each epoch's iterator are also part of its contract.
Gradient communication need not wait for every layer. DDP groups gradients into buckets and starts a reduction when a bucket is ready during backward computation. Larger buckets amortize startup; waiting for their last gradient can delay overlap. Reductions follow consistent bucket order across ranks, and required reductions finish before synchronized gradients reach the optimizer.
Horovod made communication and integration a joint concern. Alexander Sergeev and Mike Del Balso's February 2018 Uber paper wrapped gradient averaging in an optimizer interface and introduced Tensor Fusion to pack ready, same-type tensors into larger reductions. It built on existing ring-all-reduce work, rather than inventing the algorithm. Cross-worker timelines revealed why reducing many small arrays separately could squander otherwise parallel computation.
Preserve the intended update
A microbatch is a smaller scheduled portion of a batch. Gradient accumulation combines several microbatch contributions before an optimizer update. It can reduce activation residency and, when intermediate synchronization is suppressed, communication frequency. Preserving the intended update requires fixed parameters during accumulation, correct normalization, and accounting for batch-dependent operations. It is not enough merely to process the same number of examples.
For example, two tokens with mean loss 1 and six with mean loss 3 produce a global mean of , not the unweighted mean 2. The shorter contribution must not receive equal weight merely because it occupied one worker or microbatch.
Bulk-synchronous parallel computation, proposed by Leslie Valiant in 1990, separates local computation, communication, and progress boundaries into supersteps. It provides a useful way to reason about waiting, without requiring every collective to be a barrier. Synchronous training pays for slow participants because the next update needs their contributions.
DistBelief's Downpour stochastic gradient descent used parameter servers: workers that held parameter shards and applied incoming gradient updates. Replicas independently fetched parameters and returned gradients, so others could continue when one failed. But those gradients could use older parameters, and server shards could advance differently. This staleness changes which contributions reach each update. It is a change to the learning process, not merely faster synchronized accumulation. Training schedules covers changes to the update policy.
Shard state, materialize for use
Replication wastes capacity when every worker holds state that only needs one owner during an update. Zero Redundancy Optimizer, or ZeRO, progressively removes that duplication. Workers still cooperate on the same logical parameters, but each retains and updates an assigned portion of training state.
| Arrangement | Persistently partitioned state |
|---|---|
| Replicated data parallelism | None of the principal model states. |
| ZeRO stage 1 | Optimizer state. |
| ZeRO stage 2 | Optimizer state and reduced gradients. |
| ZeRO stage 3 | Optimizer state, gradients, and parameters. |
The original ZeRO analysis used Adam, an optimizer retaining two arrays of gradient statistics, with different numerical precisions for different state. Parameters and gradients used 2 bytes each per parameter; a higher-precision master parameter copy and the two optimizer arrays used 4 bytes each. That totals 16 bytes per parameter before activations and workspaces. Sharding removes redundant copies, but parameter shards must be collected for forward and again for backward computation. Adding parameter sharding increased the modeled communication from to elements per step, where is parameter count. More transferred elements do not imply the same proportional increase in latency.
Fully Sharded Data Parallel (FSDP) keeps parameters sharded between uses. The FSDP2 configuration gathers each layer for forward and backward, then reduce-scatters gradients for shard-local updates. Other layers remain sharded; prefetching the next layer can overlap communication but increases simultaneous residency.
Yanli Zhao and colleagues' 2023 PyTorch FSDP paper explains why framework integration matters: initialization can fail before sharding is established, and allocator behavior controls transient peaks. That paper describes an earlier implementation, not every FSDP2 detail. Its broader contribution is showing that a memory ownership plan must survive initialization and scheduling as well as steady-state storage.
Other allocations need other remedies. Activation recomputation, often called activation checkpointing, discards selected intermediates and regenerates them during backward computation. Offloading moves retained values to host memory and brings them back before use. These exchange storage for computation or transfers; neither is a durable restart checkpoint. Long-context training often needs them even after parameter sharding has succeeded.
Partition a layer's arithmetic
Tensor parallelism keeps the arithmetic itself divided. For a linear layer, rows of represent input vectors and columns of select output features. Splitting output features creates complete, independent output pieces. Splitting the dimension summed over creates incomplete contributions that must be added.
An elementwise nonlinearity transforms each value separately and can process complete output pieces locally. It cannot generally precede an unfinished sum: ReLU replaces negative values with zero, so ReLU(−1+2)=1 but ReLU(−1)+ReLU(2)=2. Megatron's multilayer perceptron, or MLP, applies a first matrix, an elementwise function φ, then a second matrix. Pairing a column-split first matrix with a row-split second matrix keeps the intermediate features local; only the final partial outputs need summing.
Keep complete features local; sum partial outputs
ExampleThe nonlinearity precedes the second product, not its final reduction.
Read the diagram as text
- X: b×h.
- H₀ = φ(XW₀): b×(f/2).
- H₁ = φ(XW₁): b×(f/2).
- P₀ = H₀V₀: b×h.
- P₁ = H₁V₁: b×h.
- Y = P₀ + P₁.
- X: b×h → H₀ = φ(XW₀): b×(f/2): column block W₀.
- X: b×h → H₁ = φ(XW₁): b×(f/2): column block W₁.
- H₀ = φ(XW₀): b×(f/2) → P₀ = H₀V₀: b×h: row block V₀.
- H₁ = φ(XW₁): b×(f/2) → P₁ = H₁V₁: b×h: row block V₁.
- P₀ = H₀V₀: b×h → Y = P₀ + P₁: partial sum.
- P₁ = H₁V₁: b×h → Y = P₀ + P₁: partial sum.
Distributed linear algebra already treated ownership and operand movement together. Robert van de Geijn and Jerrell Watts' SUMMA, published in journal form in April 1997, arranged processors in a logical grid: workers retained output blocks while receiving input panels through row and column broadcasts. Blocking amortized repeated message startup. The same engineering tension remains: finer partitions reduce local arithmetic but can increase communication overhead. Equal partitions also require compatible dimensions; the chosen layout must specify how any remainder is handled.
Decode can make that tension acute because frequent exchanges accompany relatively small local operations. The multi-node study introduced earlier found that communication growth could offset reduced computation. Separately, changing reduction order can change floating-point results even when the algebra is equivalent. Compare against a defined numerical tolerance, following Specify the numerical result, rather than assuming either bitwise identity or that any discrepancy is acceptable.
Pipeline layers and microbatches
A pipeline stage owns consecutive layers. Forward activations move downstream; backward gradients return upstream. Microbatches overlap across stages. Pipeline bubbles are idle slots caused by dependencies, filling, draining, or imbalance.
GPipe updates once after all microbatches run forward then backward. Rematerialization rebuilds intermediates from boundary activations. Stages balance computation, not parameter counts. Batch normalization computes statistics per microbatch, so division can change the forward result.
Synchronous one-forward-one-backward (1F1B) alternates passes after warmup, retiring activations sooner while keeping parameters fixed until batch completion. In the Megatron paper's balanced-stage model, its fill/drain bubble matches GPipe's: relative to ideal computation, not total elapsed time, for stages and microbatches. The schedule comparison show shorter activation lifetimes without earlier completion.
Earlier activation release, same completion time
F / B = forward / backward; subscript = microbatch. Each operation takes one slot, transfers are negligible, and parameters stay fixed until the update.
Counts are outstanding microbatches, not bytes: include an activation after its forward completes until its backward completes. All counts return to zero at slot 6.
PipeDream, published at SOSP in October 2019, pursued continuous overlap across minibatches. Its weight stashing retained versions so a stage's backward pass used its forward-pass weights. That did not ensure a common version across all stages, and even optional cross-stage version alignment left stale gradients. Original PipeDream therefore had different update semantics from synchronous 1F1B. Schedule names alone do not specify consistency.
IV — Placement and composition
Physical links change the partition
Topology is physical connectivity, including shared links; placement assigns logical workers to it. Multiple transfers may contend for one uplink even when every device has a fast local connection. Oversubscription means aggregate downstream demand can exceed upstream capacity. Bandwidth across a cut dividing the network constrains exchanges between its sides. Counting devices or summing their link ratings does not reveal that constraint.
Remote direct memory access, or RDMA, supports transfers into registered remote memory without ordinary application-level copying at the receiving endpoint. GPUDirect RDMA lets a network adapter exchange payloads directly with GPU memory over PCI Express, or PCIe. Software still registers memory, initiates work, and manages lifetimes. GPU–network-interface affinity means choosing devices with suitable connecting paths: traffic through PCIe switches, CPU I/O infrastructure, or links between CPU sockets has different costs and support constraints. This illustrates nonuniform memory access, or NUMA: equally sized resources need not be equally close.
Collective algorithms choose routes for the same numerical contract. NVIDIA's NCCL 2.4 account describes bandwidth-efficient rings whose latency grows with participant count, complementary trees with logarithmic latency, and hierarchical arrangements combining within-node and between-node operations. Message size and topology determine the useful choice; no route is universally fastest.
NCCL PXN supplies a concrete topology-aware example. NVIDIA's February 2022 account describes moving payloads over NVLink to an intermediate GPU, then through that GPU's network interface controller, or NIC. In a rail-optimized arrangement, corresponding NICs across servers share a leaf switch. Choosing the destination's rail can avoid higher-level spine switches. An extra local hop can therefore simplify the external path. The Crusoe networking talk applies this reasoning to multi-GPU training; the internal hop must not be omitted when describing its external one-leaf path.
Close placement improves communication opportunities but can concentrate failure exposure. A failure domain groups resources affected by a shared failure, such as one node or zone. Spread complete independent replicas across appropriate domains when availability requires it; spreading individual shards is not equivalent to preserving a complete surviving replica. Hard placement constraints can also leave work unscheduled.
Compose an executable training job
A device mesh is a logical arrangement whose dimensions identify cooperating groups. Fix all coordinates except one to identify a group along that dimension. PyTorch's DeviceMesh manages these memberships and communicators; the logical arrangement does not establish physical connectivity.
For an example mesh with two data replicas, two pipeline stages, and two tensor workers per stage, write coordinates as (data, pipeline, tensor). Each coordinate is 0 or 1.
With pipeline stages, tensor workers, data replicas, microbatches and examples per microbatch, device count is , global batch . Only data replicas multiply examples. State sharding can reuse an existing mesh dimension.
Eight workers, two example subsets
Coordinates: (data, pipeline, tensor). Each outlined row is a tensor group working on the same examples.
Data replica 0 · example subset A
↓ Forward activations · ↑ Backward gradients
Corresponding tensor partitions across stages
Data replica 1 · example subset B
↓ Forward activations · ↑ Backward gradients
Corresponding tensor partitions across stages
| Pipeline, tensor | Data replica 0 | Data replica 1 |
|---|---|---|
| 0, 0 | (0,0,0) | (1,0,0) |
| 0, 1 | (0,0,1) | (1,0,1) |
| 1, 0 | (0,1,0) | (1,1,0) |
| 1, 1 | (0,1,1) | (1,1,1) |
2 × 2 × 2 = 8 devices. Global batch = b × m × d = 2bm examples. Pipeline and tensor workers cooperate on each subset; they do not multiply it.
One update follows those memberships: assign different example subsets to data replicas; carry each subset through tensor computations and pipeline stages; return backward contributions; combine corresponding gradients across data replicas; then update the owned parameters. Group initialization, matching model state, and compatible collective order are prerequisites, not consequences of having the right total device count.
Gang scheduling coordinates admission for processes that need to run together. Kueue distinguishes aggregate quota from physical fit: eight available GPUs across two four-GPU nodes cannot satisfy one Pod requiring eight GPUs on one node. A readiness timeout can requeue partially ready work, but does not prove that its model collectives execute. Admission, placement, initialization, and execution readiness are separate gates.
Operational inputs matter too. Krea described queue resource counts becoming stale as nodes entered maintenance; Snorkel described training waiting on shared-filesystem reads. These are different ways to starve an otherwise valid partition. Establish memory fit first, place frequent exchanges on suitable links, verify group execution, then measure whether input delivery sustains it.
Partition sequence-dependent work
Parameter sharding can leave long-context training limited by activations. The long-context training talk illustrates this shift: reducing model-state memory did not remove attention's allocations. The next partition must target sequence-dependent work rather than repeat the parameter-storage optimization.
Attention uses queries to match keys, then combines associated values; an attention head performs one such learned interaction. Matching and transmitted content supplies the model explanation. Dividing query positions does not make the required remote keys and values disappear, and their availability does not remove causal masks.
Some operations can run separately at each token position; attention also needs information from other positions. Megatron's terminology reflects that distinction. It calls partitioning selected activations in token-local operations, specifically Dropout and LayerNorm, sequence parallelism. Its context parallelism partitions inputs and activations across positions while exchanging the remote keys and values needed for attention. Other systems use sequence parallelism more broadly, so name the tensor axis and operation as well as the label.
DeepSpeed Ulysses (2023) uses all-to-all exchanges: each worker sends different slices to different peers. Position-partitioned queries, keys, and values become head-partitioned for full-sequence attention. A second exchange returns outputs to position ownership.
Ring Attention, introduced by Hao Liu, Matei Zaharia, and Pieter Abbeel in October 2023, instead retains local query blocks while circulating key/value blocks and accumulating attention contributions. Transfer can be hidden when block computation lasts at least as long as the corresponding communication. Faster arithmetic relative to the interconnect can therefore require larger blocks to maintain overlap. Increased executable sequence capacity still does not establish useful long-context behavior in a model.
Move head slices or circulate context
Ulysses · exchange position/head slices, then restore position ownership
| Slice | Input position owner | After all-to-all: attention owner | After all-to-all: output owner |
|---|---|---|---|
| A/H0 | U0 | U0 · A+B, H0 | U0 |
| A/H1 | U0 | U1 · A+B, H1 | U0 |
| B/H0 | U1 | U0 · A+B, H0 | U1 |
| B/H1 | U1 | U1 · A+B, H1 | U1 |
Each attention owner has all positions for its head subset. It applies the mask locally; the second exchange returns outputs to their original position owner.
Ring Attention · one rotation of paired K and V blocks
Further rotations bring the remaining context. Partial attention results require normalization-aware accumulation, not an unweighted sum. Queries stay local; all context is not permanently gathered on every worker.
Place experts under uneven demand
A mixture-of-experts, or MoE, layer contains several learned subnetworks called experts. A learned router selects a subset for each token position. Total parameter capacity can therefore exceed the parameters activated for one token. Experts need not have clean human-readable specialties, and sparse arithmetic does not guarantee low distributed latency.
With expert parallelism, experts live on different workers. Dispatch sends token representations to selected destinations; return traffic brings expert outputs back for weighted combination at their original positions. All-to-all is useful because each destination needs a different slice. Equal expert counts per worker do not imply equal load: many tokens may select the same few experts.
GShard, published as a June 2020 preprint, bounded expert buffers by limiting the tokens each expert could accept. Its top-two router selected at most two experts per token. If both destinations overflowed, the token followed the residual connection, the path carrying input around the expert computation, without receiving an expert contribution. This capacity policy changed which computation occurred; it is not a universal property of MoE.
FasterMoE addressed uneven demand differently. Jiaao He, Tiago Antunes, and Jidong Zhai's 2022 account describes expert shadowing: broadcast selected popular expert weights so other workers can execute that expert, trading extra weight movement and storage for less concentration of token work. A performance model guides the choice. Its topology-aware expert-selection proposal is a separate intervention because it changes which expert is chosen, not merely how unchanged results travel.
Bring expert weights to some of the work
Weight copy: W0’s E0 → W1’s shadow of E0
The original remains on W0; the shadow consumes additional weight storage on W1.
| Token; fixed weight | Original token → compute → output | With shadow: token → compute → output |
|---|---|---|
| a; αa | W1 → W0: E0(a) → W1:a | W1 → W0: E0(a) → W1:a |
| b; αb | W1 → W0: E0(b) → W1:b | W1: E0(b) → W1:b (local) |
| c; αc | W1 → W0: E0(c) → W1:c | W1: E0(c) → W1:c (local) |
Table arrows carry tokens and expert outputs; the separate arrow above copies weights. Every selected E0 contribution is computed once and combined at its original position with the same α. No router decision or overflow policy changes.
Evaluate dispatch, expert computation, and return together under the actual token assignment. Faster transfers cannot compensate for arbitrarily concentrated expert work; replication cannot help without paying to make weights available. Token-to-expert routing is internal model execution, distinct from choosing a model endpoint or orchestrating several independent agents.
V — Serving
Replicas and cooperating serving groups
A serving replica is a complete executable model instance, potentially spanning several workers. Independent dense-model replicas can process different request batches without synchronizing training gradients. Within a tensor- or pipeline-parallel replica, however, workers cooperate on the same requests and must agree on the request positions and computation they are executing. The complete dependency group determines usable capacity.
| Allocation | Request ownership | Tradeoff |
|---|---|---|
| Four replicas of two devices | Four independently scheduled request groups and caches. | More independent serving groups; each group has less aggregate memory. |
| Two replicas of four devices | Two independently scheduled request groups and caches. | Larger cooperating groups; different per-request arithmetic and communication costs. |
Do not infer throughput from this count. Continuous batching determines how requests share execution, while KV capacity bounds their retained state. Decode repeatedly pays the communication pattern for successive tokens; pipeline concurrency across requests does not remove one sequence's dependencies. In some vLLM MoE arrangements, shared expert layers even couple otherwise separate data-parallel engines, requiring aligned forward passes and dummy work from idle participants.
Dispatch among equivalent replicas can consider both load and prefix locality: compatible cached state for the request's exact preceding tokens. NVIDIA Dynamo, a distributed-serving system, combines reusable prefix overlap with projected work. A less busy worker without that cached prefix can win over a cache-rich congested worker. Workers report cache creation and release to update the routing index; separate transfer mechanisms move state when needed. This chooses where an equivalent model executes, unlike model or provider selection.
The same boundary explains cross-datacenter reinforcement-learning rollouts. A rollout is a generated trajectory used for learning; a policy version identifies the generating model state, as introduced in Post-training. Nan Jiang's cross-datacenter design keeps tightly coupled training local while serving islands exchange versions and completed trajectories externally. Each island may still need fast internal links. Requests and responses name policy versions so independently advancing islands do not hide staleness.
Move cache between serving phases
Prefill–decode disaggregation assigns prompt processing and continuing generation to separately scheduled pools. The phase distinction matters because their resource demands differ: prompt work can delay ongoing decoding, while one allocation need not suit both phases. Separation removes some interference but introduces another queue and a transfer of the KV state needed to continue.
Splitwise's 2024 implementation overlaps layerwise cache transfers with later prompt computation; the destination waits on a completion semaphore. The study used BLOOM-176B and Llama2-70B with eight-way tensor parallelism. Figure 14 covered batched prompt sizes through 2048 tokens and reported roughly 8 ms of exposed transfer on A100 with 200-Gbps InfiniBand, and 5 ms on H100 with 400-Gbps InfiniBand. These are remaining delays after overlap, not total transfer durations or an isolated GPU-generation comparison; the figure does not separate model curves. DistServe additionally searched phase-specific parallelism and placement under memory, workload, and network constraints.
A handoff must preserve more than a model name. The documented NixlConnector compatibility checks include model dimensions, numerical types, attention backend, cache layout, software version, and protocol. Different tensor-parallel degrees or cache block sizes work only under supported conversion rules. Configuration compatibility is not proof that both sides loaded identical weight artifacts. The destination must establish that its required cache is complete and interpretable before dependent decode consumes it.
Source release is a separate obligation. vLLM 0.15.0 documents failure or recomputation after KV-load failure; recomputing introduces prompt work into the decode pool. It also documents temporary source-cache retention after some aborts until a timeout. Successful dispatch or receipt of cancellation therefore does not establish that both endpoints have released their allocations.
Disaggregation helps only when removed interference and improved allocation exceed transfer, conversion, buffering, and queueing costs. Short prompts can leave little interference to remove; an unsuitable pool ratio starves one phase or overloads the other. In the local heterogeneous-serving demonstration, unintended Wi-Fi routing made cache movement a bottleneck. The general lesson is to verify the path actually carrying the bytes, not merely the interfaces installed on the machines.
VI — Failure and recovery
Detect missing execution progress
A live process can be unable to complete useful model work. A straggler progresses unusually slowly; a watchdog monitors expected progress; a timeout reports that a completion expectation was missed. None alone identifies the cause. A participant may be delayed before entering communication, stuck on the GPU, executing an incompatible collective, or unable to reach peers.
PyTorch's March 2026 Flight Recorder account explains cross-rank diagnosis using group identity, collective sequence, type, shapes, datatypes, stacks, and scheduled/started/completed states. Align the same logical operation before comparing participants. The reporting rank can merely be the first to notice another participant's problem. Missing trace output remains unknown, not proof of a hardware fault.
| Aligned observations | Discriminating next check |
|---|---|
| Rank 0 entered sequence 42; rank 1's latest available record is 41. | Inspect rank 1's intervening execution and telemetry coverage. |
| Both entered sequence 42, but their tensor counts differ. | Find the divergent shape or call path before blaming link speed. |
Correlate logical records with physical placement. Krea reported cross-node InfiniBand and within-node NVLink telemetry revealing failures that ordinary GPU health views missed. MegaScale described stragglers that appeared normal in isolated matrix tests but slowed distributed execution. Shared node, link, and storage observations help explain why several ranks stall together. Use execution reconstruction to keep observations separate from inferred causes.
When communication cannot complete, NCCL supports detecting asynchronous errors and aborting the affected communicator. Recreating that communication context does not restore lost parameters, optimizer state, or request caches. Determine the recovery unit from the dependencies that can no longer proceed, then restore the corresponding application state.
Restore a coherent training state
A resumable checkpoint contains more than weights: optimizer, scheduler, random-generator, input-progress, and other state can determine the next update. A checkpoint is more than weights defines that inventory. Distribution adds a consistency requirement: all saved portions must describe corresponding progress. A completed-update boundary is a straightforward choice; saving mid-accumulation additionally requires preserving or deliberately discarding the unfinished contributions.
Asynchronous checkpointing separates copying a stable snapshot from writing it to storage. PyTorch's asynchronous example exposes staging and upload completion separately. It waits for staging before the next parameter mutation and for upload before another checkpoint or final cleanup. This permits overlap while protecting the copied state. Custom mutable buffers need equivalent protection, and staging consumes host memory and CPU resources.
In PyTorch Distributed Checkpoint, ranks write their assigned data and the coordinator finishes metadata after collecting write results. DCP’s coordinated exception handling prevents that finish when a participating operation reports failure. This establishes a reported-success gate, not independent shard-integrity verification or bounded detection of a process that disappears.
Publishing a checkpoint tells loaders that a save is available; crash durability concerns whether it survives a system failure. The DCP local filesystem writer, with its default file synchronization enabled, synchronizes data files, writes and synchronizes temporary metadata, then renames it to the final filename loaders open. A fresh incomplete directory without final metadata cannot be loaded through that path. However, replacing existing metadata does not guarantee that a crash leaves either the old or the new checkpoint available. Nor does the sequence establish a crash-durable transaction across the directory. Storage-backend guarantees and recovery tests must address those failures separately.
Protect the snapshot, then publish the save
- Every participating write reports success: coordinator finish can proceed.
- A participating operation reports failure: coordinated exception handling blocks finish.
- A write is unfinished or a process disappears: completion remains unknown; this gate does not promise bounded detection.
Restart policy is another layer. Under documented torchrun behavior, worker failure or membership change stops and reforms the worker group. Loading can reshard tensors into a different topology, but the application must revisit global batch size, random state, and input assignment. TorchData's StatefulDataLoader coordinates local loading subprocesses, not distributed ranks. Successfully loading every tensor therefore does not establish unchanged data coverage or the same update sequence after a world-size change.
Checkpoint frequency balances saving cost against repeated work after failure. John Daly's 2006 analysis treats useful computation, checkpoint writing, lost work, and restart separately. Its stochastic assumptions do not automatically fit correlated failures or asynchronous staging. Measure your saving and recovery costs rather than copying an interval formula without its failure model.
A bounded verification method is to compare an uninterrupted run with one stopped during staging or writing and restored from the last completed checkpoint. Check the selected update boundary, tensor and optimizer state, next input identities, and subsequent updates under declared numerical tolerances. Test changed membership separately: it changes more than the location of tensor shards.
Restore capacity without inventing continuity
Serving recovery has two separate goals: restore executable capacity and determine what happens to interrupted requests. Discovery tells dispatchers which endpoints exist; readiness concerns eligibility for work; draining stops new admission while allowing existing work to finish. Replacing failed workers can restore future service without recovering any particular stream.
A frontend can answer health checks while no model worker is available. Dynamo's development health reference allows this and offers active canaries: small inference requests that exercise the engine. They test more than process reachability, but not performance under representative load. Routing eligibility is another boundary. The operator implementation described here registers workers separately from Kubernetes readiness probes and leaves active health checks disabled by default. A readiness probe therefore does not establish that inference was tested or that routing will exclude an unusable worker; verify both mechanisms in the deployed version and configuration.
| Boundary | Required result |
|---|---|
| Discovery and group management | Remove unusable endpoints; restore the configured cooperating group. |
| Execution readiness | Compatible model state and communication can actually execute inference. |
| Request replay | Retained input and continuation state are sufficient for the supported request type. |
| Client delivery | Know which output can be repeated or continued without contradicting committed output. |
| Cancellation and cleanup | Confirm backend work has stopped and transfer-owned resources are eventually released. |
Replay uses retained request information to rebuild execution elsewhere. Dynamo's documented migration retains prompt and generated tokens, with attempt and sequence-length limits. It excludes multi-choice requests and structured-output continuation. In the latter, replaying tokens as context does not advance the replacement engine's constraint state machine—the state that restricts legal next tokens. Constrained decoding explains that additional state. A retained prefix is therefore not a universal continuation checkpoint.
The described Dynamo migrator records returned token IDs before forwarding them upstream, appends them to the replay request, and subtracts them from the remaining generation budget. Its boundary is tokens observed by the migrator, not client-acknowledged delivery. Rebuilding KV state may permit further generation, but this path neither transfers backend random-generator state nor establishes reconnect deduplication. Apply safe repetition contracts before promising an uninterrupted, duplicate-free stream.
Observed tokens are not acknowledged delivery
Observed tokens condition the replacement; they are not automatically re-emitted as a prefix. This path carries neither backend random-generator state nor a client acknowledgment cursor. It does not establish identical samples or reconnect deduplication, and structured-output continuation needs additional constraint state.
Cancellation has a similar boundary. Linked request contexts can propagate a stop signal, but the engine must observe it and abort computation. Dynamo's cancellation metric counts received signals, not confirmed engine aborts. During an interrupted cache transfer, retained source blocks can outlive the signal. Recovery tests must observe execution and resource release as well as control messages.
VII — Measurement
Find the useful scaling limit
Choose a feasible baseline before calculating speedup. If one device cannot execute the model, compare against a credible multi-device configuration rather than an imaginary single-device time. Freeze the model, precision, input distribution, output policy, and semantic requirements. Then change the smallest partition or placement decision predicted to shorten the critical path. Measure completed work, not submission, and benchmark the workload, not one convenient tensor shape.
| Change | Inspect | Accept only when |
|---|---|---|
| Larger gradient buckets | Readiness delay, message count, exposed reductions. | Completed updates improve with intended normalization unchanged. |
| Earlier parameter prefetch | Gather overlap and peak simultaneous residency. | Useful execution improves without exceeding memory. |
| Higher tensor-parallel degree | Local operation sizes and repeated communication. | The fixed workload completes sooner, not merely on more devices. |
| Separate serving phases | Interference removed, transfer tail, and both queues. | More requests meet the declared latency requirements. |
| Different checkpoint interval | Saving cost, lost work, and recovery duration. | Useful training completion improves under the relevant failures. |
For training, separate step throughput from completion at a quality target. MLPerf Training measures wall-clock time to a specified quality on a specified dataset and repeats runs to account for variability. Increasing the global batch changes the learning experiment unless deliberately controlled. Production completion also includes checkpointing and recovery; MegaScale's coordinated diagnostics, node replacement, and checkpoint restore illustrate work omitted by a healthy-step benchmark.
For serving, define goodput here as completed requests satisfying configured latency objectives per benchmark second. State offered load, prompt/output distributions, errors, and completion accounting. Time to first token, or TTFT, needs a start and first-content boundary. Average time per output token, or TPOT, describes pace after the first token; it is not the distribution of individual gaps. AIPerf calls its per-request average ITL and separately reports inter-chunk gaps. Its request-latency boundary ends at the last content response, which need not be a later terminal event. Latency compliance also does not establish answer correctness.
Use per-rank progress, peak memory, transfer measurements, imbalance, and failure behavior to explain the result. Network microbenchmarks help isolate a mechanism, but the final question remains whether the model workload finishes usefully sooner. More parallelism stops helping when its communication, coordination, or recovery costs outweigh the declared gain. Full cost attribution belongs to AI Cost and Performance Engineering; the execution decision begins with ownership and ends with completed outcomes.
Open questions
Elastic recovery needs a contract for more than tensor resharding. Changing membership also changes input assignment and potentially batch composition. Progress would mean tested preservation of declared data coverage and update semantics, including unfinished accumulation and application state.
Portable stream recovery requires agreement on committed output and continuation state across the client, migrator, and engine. Token replay alone misses constraint machines and delivery acknowledgements. Progress would include explicit replay boundaries and failure tests covering disconnects, partial transfers, and cancellation.
Automatic partition selection must predict transient memory and exposed communication under changing workloads, not just static parameter fit. Useful progress would be a placement policy whose predictions remain calibrated across prompt lengths, contention, and hardware changes, with safe responses when estimates fail.
Sparse expert placement must respond to demand without making weight movement more expensive than the congestion it removes. The hard boundary is between relocating unchanged computation and changing expert selection. Progress would compare both under controlled routing distributions and report end-to-end completion alongside memory and traffic.















