---
title: "Efficient Training of Large Language Models on Distributed"
description: "Duan and colleagues survey how to train large language models across GPU clusters, from dividing the work to recovering from failures."
canonical: "https://research.elamur.ai/free/en/papers/duan-2024-efficient-training-large-language-models/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/duan-2024-efficient-training-large-language-models/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2024](https://md.research.elamur.ai/free/en/papers/2024/) / Efficient Training of Large Language Models on Distributed Infrastructures: A Survey

# Efficient Training of Large Language Models on Distributed Infrastructures: A Survey

Paper · 2024 · Jiangfei Duan, Shuo Zhang, Zerui Wang et al.

**Authors:** [Jiangfei Duan](https://md.research.elamur.ai/free/en/authors/jiangfei-duan/), [Shuo Zhang](https://md.research.elamur.ai/free/en/authors/shuo-zhang/), Zerui Wang, Lijuan Jiang, [Wenwen Qu](https://md.research.elamur.ai/free/en/authors/wenwen-qu/), Qinghao Hu, [Guoteng Wang](https://md.research.elamur.ai/free/en/authors/guoteng-wang/), [Qizhen Weng](https://md.research.elamur.ai/free/en/authors/qizhen-weng/), [Hang Yan](https://md.research.elamur.ai/free/en/authors/hang-yan/), [Xingcheng Zhang](https://md.research.elamur.ai/free/en/authors/xingcheng-zhang/), [Xipeng Qiu](https://md.research.elamur.ai/free/en/authors/xipeng-qiu/), [Dahua Lin](https://md.research.elamur.ai/free/en/authors/dahua-lin/), [Yonggang Wen](https://md.research.elamur.ai/free/en/authors/yonggang-wen/), [Xin Jin](https://md.research.elamur.ai/free/en/authors/xin-jin/), [Tianwei Zhang](https://md.research.elamur.ai/free/en/authors/tianwei-zhang/) and [Peng Sun](https://md.research.elamur.ai/free/en/authors/peng-sun/) · **Year:** 2024 · **Venue:** arXiv:2407.20018 · **Licence:** [CC BY 4.0 (arXiv)](http://creativecommons.org/licenses/by/4.0/)

[Cited by **16** papers in our library of more than 163,000 papers whose bibliographies we read](https://md.research.elamur.ai/free/en/papers/duan-2024-efficient-training-large-language-models/cited-by/) · [licence](http://creativecommons.org/licenses/by/4.0/)

- [PDF](https://arxiv.org/pdf/2407.20018)
- [arXiv 2407.20018](https://arxiv.org/abs/2407.20018)

## Summary

Training a large language model can keep a GPU cluster occupied for weeks. During that time, the machines must do more than run calculations. They have to exchange intermediate results, retrieve training data, save enough state to resume after a fault, and keep moving at approximately the same pace. In one example discussed by Jiangfei Duan and colleagues, LLaMA-3 pretraining experienced 466 job interruptions over 54 days on 16,384 H100 GPUs. The survey asks how the design of the entire training system affects its ability to scale, use its hardware efficiently, and sustain progress. [Large language models](https://md.research.elamur.ai/free/en/concepts/large-language-models/)

Much of the paper concerns how to divide a training step among devices. The work can be partitioned by example, by layer, within a layer, along the sequence of tokens, or across expert subnetworks. Each choice changes what must travel over the network and when an accelerator needs the result. Splitting a layer, for example, can make it fit across several GPUs, but the devices then have to combine partial results while the layer is running. Splitting a stack of layers into pipeline stages reduces the frequency of those exchanges and creates a different problem. Some devices sit idle while waiting for work from another stage. Production systems combine several kinds of parallelism and assign their most demanding exchanges to the fastest connections.

The authors trace similar tradeoffs through calculation, memory, and recovery. Tiled attention can compute the same mathematical operation while cutting traffic to and from GPU memory. Sharding stores fewer copies of parameters and other training state, at the cost of retrieving some of that state when it is needed. Activation recomputation frees memory by repeating selected forward calculations during the backward pass. Checkpointing also trades resources across time. More frequent saves can preserve more recent progress, while saving to remote storage can interrupt the work that the checkpoint is meant to protect.

The evidence comes from systems studies, hardware specifications, traffic measurements, and reports from production runs. The paper’s own traffic visualization follows an InternLM-2 pretraining iteration and shows how different kinds of parallelism give rise to different groups of communicating devices. The production reports show another side of efficiency. The survey gives LLaMA3 a reported utilization of 38% to 41% on 16K GPUs, while the OPT training account illustrates how failures can lengthen the elapsed run well beyond what utilization during training would suggest. The paper brings these observations together and discusses reconfigurable optical networks and optical computing as research directions.

## Deep dive: Efficient Training of Large Language Models on Distributed Infrastructures: A Survey

Duan and colleagues survey how to train large language models across GPU clusters, from dividing the work to recovering from failures. · about 37 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### Why a training job becomes a cluster problem

The paper starts from a change in what a datacenter is asked to do. Earlier deep-learning workloads frequently trained a system for a particular task and used an architecture suited to it. The survey mentions recurrent networks and convolutional networks as examples of that variety. In the setting Duan and colleagues study, many language systems share the transformer architecture. This makes recurring operations worth optimizing for a particular kind of hardware. The same convergence also concentrates demand. Many projects need large amounts of the same kinds of computation, memory, and network capacity. [Transformer and attention](https://md.research.elamur.ai/free/en/concepts/transformer/)

Pretraining also changes where a job fits in the development process. The survey describes self-supervised pretraining on a large corpus as the stage that produces a broadly reusable system. Adaptation and assessment bring further work, including fine-tuning and periodic evaluation. These accompanying jobs may be small beside the main pretraining run, but their timing matters. An evaluation result can arrive while a run is in progress, and a tuning job may be able to use resources that a pretraining pipeline leaves idle. The paper treats placement and scheduling as part of the development workflow as well as part of running a training step. [Language models & pretraining](https://md.research.elamur.ai/free/en/topics/language-models/) · [Fine-tuning](https://md.research.elamur.ai/free/en/concepts/fine-tuning/)

Scale changes the meaning of an idle device. An individual GPU can finish its assigned calculation and still be unable to proceed. It may need gradients from other participants, output from an earlier pipeline stage, or parameters stored on another machine. In synchronous training, a slow participant can delay work across a group. A machine that hangs can hold up the run even when other machines remain healthy. The relevant unit for many decisions is therefore the set of devices that must make progress together.

The authors organize these concerns around scalability, efficiency, and reliability. Scalability concerns the ability to extend one job across many more devices while preserving correct training and the quality of the result. Efficiency concerns the share of computing capacity that contributes to the job. Reliability concerns useful progress over the lifetime of a run, including the time spent detecting faults and restoring operation. The three concerns interact. Sharding can allow a larger job to fit while increasing its dependence on the network. A slower but frequent checkpoint can reduce work lost after a crash while adding overhead to every period of otherwise healthy training. [GPU & parallel computing](https://md.research.elamur.ai/free/en/topics/gpu-parallel-computing/)

#### What earlier systems already offered

Replicated data parallelism gave researchers a straightforward starting point. Each worker held a copy of the trainable system and processed part of the batch. Workers then combined their gradients, the quantities that guide changes to the parameters. PyTorch Distributed and Horovod illustrate this approach in the survey. They also show that the timing of the exchange matters. Gradients become available during the backward pass, so a communication library can start sending groups of ready gradients while the device is still calculating others. Replication becomes expensive when each device has to hold a full copy of the parameters, gradients, and optimizer state. [PyTorch Distributed](https://md.research.elamur.ai/free/en/papers/li-2020-pytorch-distributed-experiences-accelerating-data/)

Earlier work also adapted collective operations to the physical network. A collective is an exchange involving a defined group of participants. AllReduce, for example, combines values from all members and returns the combined result to each. In the hierarchical approach described by Jia and colleagues, devices first reduce values inside a server. An exchange between servers follows, and the result is then distributed locally. The operation has the same purpose as a flat AllReduce, but each phase uses a connection appropriate to its scope. The survey carries this distinction between local and remote traffic into its discussion of how to place entire training workloads. [Highly Scalable Deep Learning Training System with Mixed-Precision](https://md.research.elamur.ai/free/en/papers/jia-2018-highly-scalable-deep-learning-training/)

Other earlier systems addressed different planning decisions. Megatron divided work within transformer layers. DeepSpeed reduced redundant state kept by replicas. Alpa searched across ways of splitting both individual operators and groups of operators. At the cluster level, systems such as Gavel already considered that different GPU generations could suit different jobs. The survey explains why large language workloads make these decisions interdependent. A scheduler that gives a job more devices also changes the possible ways to divide the computation. Assigning equally many devices to two jobs can leave them with different effective resources if their devices communicate over different links. [Heterogeneity-Aware Cluster Scheduling Policies for Deep Learning Workloads](https://md.research.elamur.ai/free/en/papers/narayanan-2020-heterogeneity-aware-cluster-scheduling-policies/)

The authors place their work alongside surveys with broader or different emphases. Some cover efficient language systems through changes to architecture and data. Others cover deployment from training through inference, or study distributed deep learning across many architectures. Reviews of automatic parallelism had already examined how to search for efficient ways to divide general neural computations. Duan and colleagues concentrate on the systems that execute transformer training. That focus brings together accelerator design, datacenter networking, storage, job placement, and the execution of the training step. It also brings fault handling into the same account as throughput. A system has to maintain its progress long enough for an improvement inside the training step to matter.

### The method, step by step

#### From text to a parameter update

This is a survey of training systems. Its organizing procedure follows the requirements of a distributed run from the underlying infrastructure through parallel execution and recovery. The authors describe different implementations at each point. A representative synchronous iteration provides a way to see where their decisions enter. Training data is loaded for the workers, the forward pass produces intermediate values, and the backward pass uses those values to calculate gradients. Workers exchange the results needed by other parts of the calculation. The optimizer uses the resulting gradients to update parameters. Over the course of the run, the system also saves recoverable training state.

Work and state in distributed transformer training The steps in order.

The paper distinguishes preparing a corpus from delivering it to the accelerator. Preparation can include crawling and cleaning, with experimentation over what survives into the final corpus. The prepared text is divided into tokens. An embedding layer associates the tokens with vectors, and positional information carries their order into the transformer. During training, workers need a continuous supply of these inputs. A cache can serve that purpose even if the run generally encounters a token only once. Prefetching moves upcoming data out of slower storage before a worker requests it. Sharing cached data between jobs addresses a separate source of repeated reads. [Tokenization](https://md.research.elamur.ai/free/en/concepts/tokenization/)

The survey uses WanJuan-CC to illustrate the work upstream of training. The preparation effort handles a much larger body of text than the final token collection. This matters when assessing storage needs. The size of the data a running job reads is only one part of the demand. Preparing and experimenting with corpora generates a different pattern of access, and writing checkpoints creates another. A training cluster may therefore need fast reads for inputs, scalable storage for preprocessing, and the ability to absorb large writes while a job is active. [WanJuan-CC](https://md.research.elamur.ai/free/en/papers/qiu-2024-wanjuan-cc-safe-high-quality/)

Inside a transformer layer, attention uses information from other token positions, and a feed-forward network processes the resulting representations. The survey describes decoder-only architectures that modify these components for efficiency. Multi-query and grouped-query attention change how query heads share key and value representations, while multi-latent attention is another variant discussed by the authors. The feed-forward portion may also use a mixture of experts. A routing function sends a token to a subset of the available expert networks, so increasing the set of experts need not increase the calculation for every token by the same amount. The choice of attention and feed-forward design can change the best way to place a workload on the cluster.

#### The attention calculation and the work it creates

The paper introduces attention using the sequence of token representations as its input.

```
X = [x₁, x₂, …, xₙ]
```

Here X is the sequence of input vectors and xᵢ is the input vector at token position i. The subscripts run from 1, the initial position, to n, the number of positions. The ellipsis denotes the intervening vectors in their original order. Linear transformations produce the query, key, and value tensors from the input.

```
Attention(Q, K, V) = softmax((QKᵀ) / √d) V
```

Attention denotes the resulting tensor of output vectors. Q contains query vectors, K contains key vectors, and V contains value vectors. The superscript ᵀ transposes K so matrix multiplication pairs queries with keys. The product QKᵀ contains the query–key scores. The divisor √d is the square root of the key dimension d. The softmax function converts scores for a query into normalized weights. Multiplying by V sums the value vectors with those weights.

For its discussion of efficient operators, the survey also writes the calculation for an individual query. In this account of the operation, the scores are expressed as dot products.

```
s′ᵢ = dot(q, kᵢ)
```

The query vector is q and the key at position i is kᵢ. The dot function takes their dot product. The prime marks s′ᵢ as a score before normalization. The index i identifies the key and its corresponding value among the n positions.

```
sᵢ = e^(s′ᵢ) / Σⱼ e^(s′ⱼ)
```

Here sᵢ is the normalized weight for position i, e is the base of the natural exponential, and s′ᵢ is its unnormalized score. The sum Σⱼ runs over the key positions j for this query, with s′ⱼ the score at each such position. The denominator therefore uses all the scores entering the normalization. The caret denotes exponentiation.

```
o = Σᵢ vᵢ sᵢ
```

The vector o is the attention output for q. Each vᵢ is the value associated with key kᵢ, and sᵢ is the weight just calculated for that position. The sum Σᵢ combines the weighted values across the positions used by the query. In the survey’s single-query description, q and the individual key and value vectors have d real-valued components.

The matrix form helps explain why long inputs matter for distributed training. A straightforward implementation calculates a score for every query–key pair it considers. With self-attention, both the query set and the key set grow with the sequence, so the dense calculation grows quadratically with sequence length. Storing all the intermediate scores is a separate choice. The survey discusses a lazy softmax formulation that postpones division until the needed sum has been accumulated. Keeping a running scalar for that sum requires constant space. It cites a logarithmic auxiliary memory bound for computing all query outputs sequentially with query indexing. The memory argument concerns intermediate state and leaves the pairwise calculation itself in place.

#### Match the exchanges to the machines

The survey begins its infrastructure account with the accelerators because they shape which operations are cheap to execute and which are expensive to feed. GPUs have groups of parallel execution units, specialized matrix arithmetic, shared on-chip memory, and high-bandwidth device memory. The computing units can perform matrix operations quickly when the operands are available. An operator that repeatedly transfers intermediates through device memory may still spend much of its time moving data. Supported arithmetic formats also affect execution. The Hopper Transformer Engine, for example, provides a way to use FP8 and FP16 within transformer computation. Other platforms have different execution and memory arrangements, and adapting the kernel can be necessary to exploit them.

The paper distinguishes links inside a server from the network between servers. Within a server, accelerators may communicate through a PCIe tree, dedicated point-to-point links, or a switch fabric. A switched fabric can provide high bandwidth between different pairs within a node. Direct links give communication a topology of their own, such as a mesh or a torus, and the route depends on which devices need to exchange data. These differences determine which groups can afford frequent synchronization. Adding an accelerator on a slower connection may increase available memory or calculation capacity while increasing the elapsed time of exchanges on the critical path.

Between servers, remote direct memory access allows data to move between machines’ memory with little host involvement. GPUDirect-RDMA extends that arrangement to exchanges involving GPU memory. The survey describes InfiniBand and RDMA over Converged Ethernet, or RoCE, as common choices. It also distinguishes a backend training network from the frontend that handles traffic such as storage access and job management. The distinction clarifies why an infrastructure description needs more than a single bandwidth figure. Network placement and the purpose of each connection determine whether different kinds of work share a bottleneck.

A conventional Clos design uses layers of switches to connect racks and groups of racks. A rail-optimized design links devices in matching positions across servers through common leaf switches. That organization can improve collective exchanges when communication groups match those paths. The paper also discusses a rail-only proposal in which separate rails have their own networks. Cross-rail exchanges can be forwarded over connections inside the server. The advantage depends on the traffic pattern. If only a small share of pairs need to exchange substantial data directly, a fabric designed for that pattern can reduce the need for expensive connectivity between rails.

Traffic balance remains important even when the total advertised capacity is ample. Training can produce a few large flows in periodic bursts. Hash-based routing across equal-cost paths can put several of those flows on the same link. The survey describes creating multiple flows per pair, assigning paths to large flows explicitly, and spreading a flow’s packets across parallel links. Spreading packets can require network interfaces to handle out-of-order arrival. Congestion control addresses a related question once paths have been selected. A pause can prevent packet loss, but a queue-level pause can delay traffic that would otherwise make progress. In shared clusters, coordinating the communication phases of different jobs is another way to reduce contention.

#### Decide which state each device will hold

With replicated data parallelism, each worker processes its assigned examples with the same weights. Once gradients for a group of parameters are ready, workers combine them and use the synchronized result for the update. Sharded data parallelism changes where the parameters, gradients, or optimizer state reside. A device can hold a subset, receive the data needed for an upcoming operation, and release the gathered copy once the operation has used it. At one extreme, every worker stores a full replica. At the other, the group collectively holds the state in shards.

```
1 ≤ F ≤ W
```

The symbol F is the number of devices across which the parameters are split, and W is the total number of devices. The inequalities include F equal to 1 for full replication and F equal to W for full sharding. Values strictly between those endpoints describe hybrid sharding. The lower endpoint means that each replica’s parameter storage is contained on an individual device.

```
N × M
```

This is the device mesh used to describe the hybrid arrangement. N is the size of the dimension along which a replica is sharded. M is the size of the dimension across which that layout is replicated. The multiplication sign denotes the two axes of the mesh. Within a sharding group, workers can use AllGather to reassemble data before they need it. ReduceScatter combines contributions while leaving each participant with its own portion of the result. AllReduce returns the entire combined result to all members. A system’s choice among these operations determines both the resulting placement of data and the cost of synchronizing it.

The motivation becomes concrete in the survey’s mixed-precision memory accounting. A training system can hold narrow versions of parameters and gradients for computation while retaining a higher-precision parameter copy and optimizer statistics. The paper keeps the bookkeeping for those persistent quantities separate from activations and temporary buffers.

```
16Φ bytes
```

Here Φ counts parameters, and 16Φ is the paper’s total storage for the training state under its mixed-precision accounting. Parameters and gradients in 16-bit format occupy 4Φ bytes together. The 32-bit parameter copy, momentum, and variance each use 4Φ bytes and together account for 12Φ bytes. The expression describes these state arrays. Activations, buffers used by operations, and space lost to fragmentation contribute additional memory demands.

ZeRO applies sharding in stages. The first stage distributes the optimizer state and divides the work of updating parameters. After the update, workers gather the updated parameters for use in subsequent computation. The second stage also distributes gradients. The third distributes parameters too, so workers gather parameter pieces when an operation needs them. In the formulas for ZeRO, the paper uses N for the size of the data-parallel group over which the state is sharded.

```
12Φ/N
```

This is the per-device optimizer-state storage in bytes after ZeRO-1 shards the 12Φ bytes counted in the survey. Φ is the parameter count and N is the number of members of the data-parallel group. The slash denotes division across those members.

```
2Φ/N
```

This is the per-device gradient storage in bytes under ZeRO-2. The same Φ and N denote the parameter count and group size. The paper counts 2Φ bytes of gradients before this sharding step.

```
16Φ/N
```

This is the per-device storage in bytes for the parameter, gradient, and optimizer-state shards under ZeRO-3. Φ again counts parameters and N counts the devices in the data-parallel group. The calculation describes the retained shares of that state. It is consistent with temporary gathering of full parameters during execution, which has a separate effect on peak memory.

Partial sharding chooses how far those exchanges extend. MiCS and FSDP can keep replicas of the same sharded layout in several subgroups. The state within a subgroup remains distributed, but gathering it can involve fewer devices and fewer remote links. ZeRO++ uses a different compromise. It retains a global partition and keeps a secondary parameter partition within a smaller group for backward computation. AMSP and PaRO allow different components of the training state to use different sharding arrangements. The underlying question is whether the memory saved by spreading an array more widely justifies retrieving parts of it over a larger network.

#### Partition layers, tokens, and experts

Tensor parallelism splits work within a layer. In the Megatron-LM example, adjacent weight matrices are partitioned along different axes. Each device computes with a portion of the weights, and collective operations combine contributions to keep the layer’s input and output available in the required layout. The exchanged values include intermediate activations. Since subsequent computation can depend directly on the result, there may be little useful work to do while the exchange is outstanding. The survey explains why this form of parallelism is commonly placed inside a server with fast accelerator links. Other schemes split the relevant tensors along additional dimensions to change their memory and communication costs.

Pipeline parallelism places consecutive layers on successive stages. A stage forwards activations at its boundary and, during the backward pass, receives the gradients it needs from the stage after it. This produces fewer points of communication than splitting work throughout individual layers. The paper therefore discusses pipelines as a way to extend training across nodes, including geographically separated resources with limited connectivity. The immediate constraint is causality. A stage cannot work on a particular input before the preceding stage produces it. Dividing a batch into smaller micro-batches lets stages work on different inputs concurrently.

The schedule determines how much time is lost while the pipeline fills, drains, or waits for available work. GPipe separates the forwards and backwards into successive phases. PipeDream’s 1F1B schedule interleaves forward and backward operations as their dependencies allow. Interleaving multiple stages on each GPU gives the scheduler more choices and can also increase communication and peak memory. Zero Bubble further divides the backward work. Computing a gradient for the preceding stage can unblock that stage, while computing a weight gradient serves the eventual update. Scheduling the weight-gradient work in otherwise idle slots can reduce idle time while leaving other data live for longer.

Stage placement also determines where activation memory accumulates. An early stage may finish the forward pass for multiple micro-batches before their backward work reaches it. Those activations have to remain available or be recoverable. BPipe and MPress move activations from heavily loaded devices to ones with spare memory. Chimera places stages from pipelines running in opposing directions on the same GPU, which balances some of the memory demand and duplicates weights. AdaPipe varies recomputation choices by stage as part of its search for balanced execution. The survey treats idle time and peak memory as related objectives because the available memory sets a limit on how many micro-batches can be active.

Sequence parallelism becomes important when the input itself is too long for the desired execution plan. The devices each start with a share of the token sequence. A query may still need keys and values held by another device, so the partition creates exchanges inside attention. Ring-based methods send blocks between devices in a recurring order and accumulate output as the required keys and values arrive. Blockwise Ring Attention performs the calculation in smaller blocks. BurstAttention uses separate buffers so a device can receive further data while attention is running on the current block. The scheduling opportunity comes from matching communication with work that already has its operands.

Causal attention adds a load-balancing issue. A token can attend to earlier positions, so contiguous chunks can give devices different amounts of allowable attention work. Megatron Context Parallel redistributes parts of chunks between paired devices. Striped Attention distributes positions across the sequence so a device can receive tokens from different regions. DeepSpeed-Ulysses takes another route. Its All-to-All exchange changes the partition from sequence positions to attention heads, giving devices responsibility for distinct heads. The number of available heads limits this approach, especially with grouped or shared key and value heads. LoongTrain and USP combine head-based and ring-based groups so the partition can use both dimensions.

Expert parallelism distributes the feed-forward expert networks. For each token, a gating network chooses the destination experts. An All-to-All exchange can then send different amounts of token data to different workers. GShard establishes a distributed form of that arrangement. Switch Transformer routes each token to its top-1 expert, while GShard uses top-2 routing. The survey connects this architectural choice to execution. The routing decision influences how much work is activated and where token data must travel. Routes can also concentrate computation on a popular expert, making the execution time depend heavily on the busiest device.

The systems surveyed tackle this concentration in several ways. MegaBlocks supports different amounts of work per expert within a kernel, reducing the need to pad or drop tokens to enforce identical input sizes. FasterMoE can distribute copies of a heavily used expert to share its traffic and computation. Tutel pipelines communication with expert computation by operating on groups of inputs. Lina looks at the interaction between expert exchanges and gradient synchronization. When both use the same bandwidth, allowing them to run simultaneously can delay the All-to-All that the expert computations are waiting for. Giving that exchange priority can put the network to better use along the critical path.

#### Choose a plan for the actual cluster

Hybrid parallelism combines several of these partitions in a single run. In the arrangement the paper calls 3D parallelism, data parallelism divides examples, tensor parallelism divides work within layers, and pipeline parallelism places groups of layers on successive stages. Each device participates in several groups. A worker can belong to one local group that combines partial activations and a different group that synchronizes gradients with peers in other nodes. Sequence and expert parallelism can introduce further groups. Placement determines which transfers share links and which can proceed independently.

Automatic parallelism turns the selection into a search problem. A framework defines the legal ways to split operators or stages, estimates the time and memory consequences of each candidate, and looks for a workable plan with good predicted performance. PipeDream and DAPPLE treat pipeline partitioning in terms of stage costs. The slowest stage restricts how fast the pipeline can accept work after it fills. FlexFlow explores a broader space that includes ways of dividing the tensors entering or leaving operators. An execution simulator ranks candidates without requiring a full training run for each. Alpa distinguishes between partitioning inside an operator and partitioning across operators, using that distinction to organize the planning problem.

The paper also describes abstractions that make plans executable. A device mesh gives each device a position along named dimensions, and a tensor layout says which tensor dimensions are split, replicated, or partial. These descriptions connect the conceptual plan to the operations that redistribute values. GSPMD supplies tensor sharding annotations. OneFlow describes layouts through splitting, broadcasting, and partial values. Slapo separates optimization schedules from the original definition of the computation. These tools address a practical constraint on automated search. A framework needs both a way to discover a plan and a runtime capable of implementing its different layouts and transitions.

On mixed hardware, balancing by parameter count or number of layers can leave stages with very different runtimes. Some systems estimate throughput for each type of accelerator and allocate work accordingly. Others account jointly for link speeds and stage costs. PipePar, for instance, incorporates both GPU and network heterogeneity into its pipeline partition search. SWARM deals with unstable, poorly connected resources by routing work among peers and moving devices between stages when needed. These systems make the same distinction at different scales. An accelerator’s usefulness depends on the portion of the calculation it receives and the time it takes to exchange the required data.

The paper extends that reasoning to training with human preferences. In the reinforcement learning stage it describes, an actor generates a response to a query. A critic, a reward system, and a reference system contribute quantities used by the update. Subsequent training updates the actor and critic. Generation and parameter updates have different execution and memory patterns, and the work includes multiple sets of parameters. DeepSpeed-Chat can switch how those parameters are partitioned between generation and training. OpenRLHF places components on different devices. ReaLHF redistributes parameters to use different parallel arrangements in different parts of the procedure. The survey’s focus here is the cost of moving between the work of producing training experience and the work of learning from it. [Training language models to follow instructions with human feedback](https://md.research.elamur.ai/free/en/papers/ouyang-2022-training-language-models-follow-instructions/)

#### Reduce the cost of local calculation and memory

FlashAttention organizes exact attention into tiles that can be processed using fast on-chip memory. Its online softmax tracks the maximum score and the running normalization statistics as it processes blocks. The kernel can then combine matrix multiplication, normalization, and accumulation without repeatedly writing and reading large score arrays in high-bandwidth device memory. The attention output is still defined by the original operation. The changes are to how intermediates are represented, where they live while in use, and when they are discarded.

FlashAttention-2 increases available parallel work along the sequence and changes how threads share data within a block. FlashAttention-3 uses features of H100 hardware to overlap matrix operations, softmax work, and transfers more effectively. Variable-length sequences pose a related problem for what the hardware executes. Padding a batch to match its longest sequence creates extra positions. ByteTransformer records where the valid tokens go in a packed representation and uses grouped matrix multiplication to operate on those inputs. Through these examples, the survey illustrates that how a kernel’s input workload is shaped can matter just as much as which arithmetic instruction is chosen. [FlashAttention-2](https://md.research.elamur.ai/free/en/papers/dao-2023-flashattention-2-faster-attention-better/)

Compiler optimizations extend this approach beyond a manually designed attention kernel. Systems such as Triton help express tiled calculations and choose memory placement for intermediate values. A compiler can also look across operators and fuse work that would otherwise make repeated transfers through device memory. Welder represents the computation at tile granularity and considers where neighboring operators can reuse a tensor. The survey describes automatic pipelining of loads and computation as another technique. A load can start ahead of time, allowing arithmetic from an earlier tile to proceed while the next block of data is in transit.

Mixed precision changes the amount of data an operation moves and the hardware arithmetic it can use. In the FP16 scheme described by the authors, the forward and backward computations use reduced-precision values while the optimizer retains a single-precision copy of the weights for accumulation. Loss scaling helps preserve gradients whose magnitudes might otherwise be too small to represent. BF16 covers the same range of values as FP32, which makes the range issue different from FP16. The survey also describes FP8 approaches that use different formats or scaling policies for forward and backward computation. A training scheme can assign precision separately to weights, activations, gradients, and optimizer state. Its name alone gives an incomplete picture of the arithmetic.

Low-bit fixed-point work illustrates the same distinction. Jetfire stores and moves values in INT8 while carrying out some operations in wider formats. BitNet uses 1-bit weights for operations in transformer blocks and retains higher-precision state for parameter updates. BitNet b1.58 uses weights that take the values −1, 0, and 1 following scaling and rounding. These examples place the numerical decision at particular points in the calculation. A narrow value in one array says little by itself about the format used for accumulation or what must survive the next optimizer step. [Efficient models & compression](https://md.research.elamur.ai/free/en/topics/efficient-models/)

Activation recomputation addresses values with short but potentially overlapping lifetimes. During the forward pass, a framework can retain selected intermediate outputs and release others. During the backward pass, it reconstructs the missing values using saved inputs. Static approaches choose the boundaries ahead of time. Dynamic policies choose which values to evict as memory use changes. For long-sequence attention, the placement of these boundaries is especially consequential. DistFlashAttn saves the output of the attention kernel so backward computation can avoid repeating the whole attention forward operation. LoongTrain retains the output and softmax statistics for selected modules. In both cases the goal is to preserve intermediates that would be expensive to reproduce.

There are also memory pressures that arithmetic and sharding alone cannot resolve. Gradient exchanges and other operations may need temporary, contiguous buffers. Free memory can be dispersed across regions too small for a request. GMLake uses virtual address mapping to make separate physical blocks available as a larger virtual region, limiting the need to copy data simply to assemble that space. Offloading addresses capacity by moving data or work to host memory or SSDs. ZeRO-Offload stores certain training state in CPU memory and performs optimizer updates on the CPU. ZeRO-Infinity also uses NVMe storage for state. Each slower tier creates transfers whose timing matters. Prefetching and pipelining can make the extra capacity usable by making data arrive before the GPU needs it.

#### Schedule movement and preserve progress

The survey ties communication schedules to when an operation’s result is needed. Sending every gradient immediately may produce many small transfers. Combining them in buckets allows larger exchanges, but a ready gradient may wait for the rest of the bucket. A first-in, first-out schedule follows readiness during backward computation. A priority-based schedule can favor the arrays that will unblock the next computation sooner. PACE splits a collective into pieces so urgent work can proceed between them, and DeAR splits AllReduce into ReduceScatter and AllGather so the two phases can overlap different parts of training. The dependencies on the critical path determine the benefit of that flexibility.

The paper also examines how a network can help perform the calculation. In-network aggregation uses switches or attached devices to combine data while it is in transit. SwitchML processes parts of a gradient vector as a stream because a complete update can exceed the switch’s capacity. The paper describes its conversion of floating-point values to 32-bit integers for aggregation. SHARP, in the InfiniBand setting surveyed by the authors, uses dedicated hardware for collective operations and supports floating-point reductions. These are examples of reducing the work left to the endpoints. Their applicability depends on the hardware, the arithmetic it supports, and how the training framework reaches it.

Cluster scheduling introduces decisions beyond the communications of one job. Crius considers both hardware affinity and the parallelism of jobs competing for resources. CASSINI interleaves phases of high bandwidth demand. Hydro uses smaller surrogates for hyper-parameter search and can place tuning work into otherwise idle parts of a pretraining pipeline. The survey also discusses energy as a scheduling objective. Zeus searches over batch size and the GPU power limit. EnvPipe uses idle time in a pipeline to let some computation run more slowly at lower device frequency. These systems expose choices that a measure of active-step speed alone would miss. [Zeus](https://md.research.elamur.ai/free/en/papers/you-2022-zeus-understanding-optimizing-gpu-energy/)

For long runs, the system also needs to recognize when progress has stopped or slowed. The authors describe monitoring processes that send heartbeats and counters to a central service. Disappearing heartbeats can indicate a failed participant, while GPU and network statistics can help diagnose a device that is still responding. Communication traces provide further context. A timeout seen by many workers may originate in an individual node or link. Proactive validation answers a different question by testing the cluster before it accepts work or while devices are idle. More extensive checks can catch additional problems and use time the cluster could otherwise spend training.

Checkpoint recovery protects completed work. In a persistent checkpoint, training state is first copied to host memory and then written to durable storage. A synchronous save can stall both phases. A snapshot-stall design pauses for a consistent copy, then writes it from host memory while training continues. Fully asynchronous approaches try to overlap both phases with subsequent computation and have to finish reading state before an update can invalidate the saved version. CheckFreq schedules copying around the next iteration and can adjust save frequency. Keeping checkpoints in memory, as Gemini and REFT do, reduces storage overhead and changes the failures the saved copy can survive.

Checkpoint-free approaches use state already present in the running job. Live migration reassigns work to surviving or replacement devices and transfers the current state to the new arrangement. Oobleck prepares pipeline templates that can be instantiated after a failure. Module redundancy gives the computation a second place to run. Bamboo uses idle pipeline time to perform redundant work on a neighboring device. SlipStream draws on redundant stages in other data-parallel pipelines. Each method depends on the state that remains available after the fault and on the ability to rearrange execution quickly enough to retain the benefit.

### Experiments and results

#### What the measurements cover

The paper brings together several kinds of evidence. Its communication heatmap describes a particular pretraining iteration. Its utilization and failure figures come from reported runs. Hardware specifications characterize available connections, and the analysis of memory gives conditional estimates for state placement. There is no common corpus, training and test split, or accuracy leaderboard across these examples. The closest thing to a baseline changes with the question. Replicated data parallelism provides a baseline for state sharding, earlier interconnect generations for bandwidth, and an idealized training-time estimate for the production failure case.

The survey reports that LLaMA3 reaches 38% to 41% model FLOPs utilization on 16K GPUs. Model FLOPs utilization, or MFU, measures how much of the available floating-point computing capability is used for the training calculation. The range describes the run at that scale. It does not assign individual parts of the shortfall to pipeline idle time, memory transfers, collectives, or other sources of delay. It provides a scale reference for the practical problem the survey addresses. The authors also describe the training data for LLaMA 3 as over 15 trillion tokens, with a reported footprint of roughly 30 TB. That figure is about prepared inputs, while MFU is about the use of computing capacity.

WanJuan-CC illustrates a different data measure. The survey describes roughly 68 billion documents at the extraction stage, approximately 1 trillion tokens in the resulting collection, and 2 TB of final data after 99% of raw material was discarded. These are reported stages of dataset creation. They help explain why a storage system sized solely around the final token files could face much heavier demand during preparation. The paper separately cites a 980GB checkpoint for a 70B-parameter system. That example puts a single checkpoint write into perspective, especially when recovery may require many workers to fetch state at once.

#### Where traffic goes in an InternLM-2 iteration

The communication heatmap follows InternLM-2 102B pretraining on 128 GPUs. It covers a single iteration. Tensor parallelism has size 8, pipeline parallelism size 4, and data parallelism and ZeRO-1 each have size 4. The placement gives priority to tensor-parallel groups, then to the data-parallel and ZeRO groups, and then to pipeline groups. The collective operations in the visualization use ring algorithms.

The dense square patterns along the diagonal represent traffic within nodes. The tensor-parallel AllReduce uses the local NVSwitch fabric and accounts for much of this pattern. The data-parallel and ZeRO exchanges run ReduceScatter and AllGather and also produce traffic between nodes. Some of those exchanges occur within nodes and occupy the same squares as the tensor-parallel transfers. Pipeline sends and receives have comparatively low volume and appear as thin lines. A cell can therefore reflect more than one type of communication, and the volume alone does not measure the time a transfer adds to the iteration.

This traffic case connects an execution plan to a physical hierarchy. The most intensive exchanges in the illustrated placement occur in limited groups, and traffic further out follows a different pattern. The paper cites a separate analysis of GPT/OPT-175B training in which 99% of GPU pairs carried no traffic and less than 0.25% of pairs handled the pipeline/tensor and data-parallel traffic identified by that study. The pair count describes how concentrated exchanges were in that workload. It helps explain the rationale for rail-only networks, whose design depends on a restricted set of GPU pairs needing direct cross-node paths.

The following comparison shows the bidirectional bandwidth the survey reports across NVSwitch generations. The DGX-2 figure is for the switched connection between GPU pairs. The chart describes the interconnect specifications cited in the survey.

Reported bidirectional GPU interconnect bandwidth across NVSwitch generations The latest generation in the comparison offers the highest bandwidth.

**The numbers**

| System or setting | GB/s |
| --- | --- |
| NVSwitch in DGX-2 | 300 |
| NVSwitch 2.0 | 600 |
| NVSwitch 3.0 (this paper) | 900 |

The star marks the highest-bandwidth setting shown. In the traffic example, the significance of a fast local switch comes from the placement of the tensor-parallel group. A hardware comparison measures an available connection rate. Training performance also depends on the group size, the collective algorithm, and how much of the transfer can overlap useful calculation.

#### Training time and failures in production

The survey cites the OPT logbook for an example in which the baseline is an estimate based on MFU. For the 175B OPT job, the estimated ideal training duration was about 25 days, and elapsed training took approximately 57 days. The survey attributes 56% of the total time to handling failures. The same account records over 40 interruptions within a two-week period on 992 A100 GPUs. The runtime baseline gives a sense of how much active-step performance leaves out when a job repeatedly stalls and recovers.

The LLaMA3 production account offers a different combination of scale and duration. It reports 466 job interruptions in 54 days of pretraining on 16,384 H100 GPUs and attributes 78% of reported failures to hardware issues. Acme records failures on average every 1-2 days during training with over 1,000 A100 GPUs. MegaScale reports over 100 failures in several weeks using 12,288 Ampere GPUs. BLOOM’s cited report measures a narrower event, averaging 1-2 GPU failures per week on 384 GPUs. The numbers document different types of interruptions and failure observations. Their value is in showing what long-running systems had to handle under their own conditions.

The surveyed capacity reports answer another question. ZeRO-Offload is described as supporting training up to 70B parameters with 16 V100s. ZeRO-Infinity is described as supporting up to 32T parameters on 32 nodes with a total of 512 V100s. These are capacity points for different approaches and configurations. In particular, offloading can make more state fit while adding data transfers to normal execution. The report on ROAM concerns a different scale and objective. Its largest stated single-GPU evaluation uses GPT-2 XL at 1.5B parameters and studies memory layout and operator order. Those examples tell the reader which constraints each technique was reported to address and at what scale.

### What the ablations show

The survey offers no original component-removal ablation and instead presents a communication trace, analytical comparisons of execution choices, and failure observations from production training. These forms of analysis support different kinds of conclusions. The trace shows which patterns of traffic coexist in a specific job. The state accounting shows how a memory term changes under sharding. The production reports document the consequences of operating under faults. None directly isolates the effect of replacing a single component in an otherwise fixed training stack.

The closest comparison to a stepwise intervention is the treatment of ZeRO. ZeRO-1 partitions optimizer state, ZeRO-2 also partitions gradients, and ZeRO-3 also partitions parameters. The formulas show the state savings gained at each stage. The survey reports communication volume of 1.5× over vanilla data parallelism for full sharding. This is a tradeoff in an analyzed execution scheme. The full-sharding comparison associates lower resident state with the need to gather parameters during execution. Smaller sharding groups retain more copies and can reduce how far those gatherings travel. The comparison explains why memory savings and speed need to be evaluated together.

The paper’s treatment of activation recomputation shows how the cost depends on the work that is repeated. In its discussion of sequence parallelism, the survey gives 30% overhead for full recomputation. For long sequences, repeating attention can be especially expensive. Saving a kernel output and selected statistics leaves a smaller set of costly operations to repeat. The examples distinguish full recomputation from policies with different save points. The survey gives mechanisms for those choices and an overhead figure for the full-recompute case. It supplies no common set of timings for all of the policies it covers.

Pipeline scheduling provides a comparison about dependencies. If a stage finishes all forward work before beginning backward work, the schedule has periods during which few stages can proceed. Interleaving forward and backward tasks changes that distribution. Splitting backward work into activation and parameter gradients creates more flexibility because those outputs have different consumers. The former can unblock another stage. The latter can sometimes wait for a gap in the schedule. The survey connects that change to lower idle time and increased peak memory in the Zero Bubble approach. The analysis shows why a change to the order of work can also change the number of activation buffers that stay live.

The production failure evidence helps distinguish symptom from source. In the C4 report discussed by the authors, about 82.5% of errors were confined to particular nodes or devices, although users often saw errors from the collective library. A collective spans workers, so a local failure can become visible in many places. This observation explains why transport statistics, traces of collective operations, and device counters can help with diagnosis. It does not quantify the benefit of adding any one monitoring tool to a fixed cluster. The gap between estimated and elapsed OPT training time concerns the cost of the observed failures and their handling as a whole.

The authors also use comparisons where two operations draw on the same resource. Lina’s analysis shows that the All-to-All used to dispatch expert work can take longer when it overlaps with an AllReduce. Both can occupy the same links, and expert computation waits for the dispatch. Giving priority to the dispatch changes when gradient traffic can use bandwidth. This comparison illustrates a distinction that recurs throughout the paper. Overlap is useful when it puts otherwise idle resources to work or shortens the critical path. Operations that run simultaneously can still delay each other if they compete for the same bandwidth, memory, or computing capacity.

### Limitations

#### Limits stated by the authors

The authors define the scope around training systems and infrastructure for transformer-based language models. Their descriptions of attention variants, expert networks, and preference-based training explain the workloads a system has to execute. The paper leaves the evolution of architectures, the choice of training algorithms, instruction-tuning methods, and alignment objectives to other work. It also leaves advanced optimization algorithms and general distributed deep-learning frameworks outside its main scope. Its account of fine-tuning concentrates on the memory, placement, and execution demands of the process.

The attention section concentrates on exact implementations. The authors exclude approximate approaches such as linear attention from that discussion. The communication section likewise leaves lossy compression outside its detailed treatment, although quantization appears elsewhere as part of mixed-precision training or state transfer. These choices matter when comparing methods. Changing how an exact operation is computed raises a different question about numerical fidelity from changing the inputs that an exchange transmits or the outputs that attention is designed to approximate.

The authors identify method-specific limits as well. DeepSpeed-Ulysses depends on the available attention heads for the degree of parallelism. ZeRO’s collective latency can increase as the group grows. ROAM’s cited evaluation is limited to a single GPU, leaving its behavior for much larger distributed computation graphs untested in the survey. In-memory checkpoints can be written more often but offer different durability from persistent storage. The paper presents hybrid checkpointing as a way to use quick in-memory recovery and keep durable state available for other failure scenarios.

The outlook considers optical networking and integrated photonics in response to physical and economic constraints on digital computing. The paper describes optical circuit switching in TPUv4, joint network and placement design in TopoOpt, and Taichi’s photonic architecture. It reports 160 tera-operations per second per watt (TOPS/W) for Taichi. That metric belongs to the photonic computing example, while the survey’s production training measurements concern different systems and workloads. The authors frame a broader optical transition as requiring further system design and implementation work.

#### Limits of the evidence

The paper’s organization is technical. It explains how the surveyed approaches work and where they fit, but it does not report a reproducible study-selection procedure or an assessment of how representative the cited deployments are. Large jobs with detailed public records make particular failures and bottlenecks visible. The reports provide examples of what happened under those workloads and operating conditions, with limited grounds for estimating how frequently the same outcomes occur elsewhere.

The traffic visualization measures one iteration under a particular placement and collective algorithm. It shows where data traveled under that configuration. It does not vary sequence length, network topology, or the choice of collective while holding everything else fixed. The sparse pattern of device pairs is evidence for designing around the traffic of the jobs studied. A different partition or workload can change both which pairs exchange data and how expensive those exchanges are. In particular, the survey’s own discussion of sequence and expert parallelism shows how a change inside a transformer can change the dominant communication pattern.

The run reports have different device counts, operating periods, and event definitions. A GPU failure, a slowdown, and an interruption to a job describe different observations. The estimated ideal duration for OPT provides a counterfactual derived from its utilization, instead of a second run under identical conditions without faults. The reported failure cost shows how much the elapsed time differed from that estimate. It cannot establish how much time a particular monitoring system, checkpoint policy, or migration method would have saved on the same job.

Finally, many results apply at the level of one resource or one operation. Peak connection bandwidth describes a link. The ZeRO equations describe retained training state and leave peak allocations to the execution schedule. An attention kernel improvement concerns execution of that operation on particular hardware. A capacity report shows what the system is described as supporting. To infer a change in the elapsed time of a full training run, a reader would also need to know where the technique falls on the critical path, how it combines with the rest of the stack, and whether the same training outcome is reached. The survey offers mechanisms and examples for making those distinctions. It does not supply a common end-to-end comparison at matched training quality.

### What came after

[A Comprehensive Survey on Long Context Language Modeling](https://md.research.elamur.ai/free/en/papers/liu-2025-comprehensive-survey-long-context-language/) (2025) cites Duan and colleagues and focuses on long-context language modeling. In the earlier survey, long context is one example of a workload that changes the systems problem. More token positions increase attention work and activation storage, and distributing the sequence brings new exchanges of keys and values. Duan and colleagues discuss these effects alongside the demands of other workloads and the infrastructure they share.

The later survey’s stated focus gives that problem a dedicated treatment. The citation connects the system-wide account to a survey centered on context length. It establishes a documented connection between the papers. Which specific methods the later survey adopts, reevaluates, or extends cannot be determined from the citation alone.

## Cite

Cite as Jiangfei Duan, Shuo Zhang, Zerui Wang, Lijuan Jiang, Wenwen Qu, Qinghao Hu, Guoteng Wang, Qizhen Weng, Hang Yan, Xingcheng Zhang, Xipeng Qiu, Dahua Lin, Yonggang Wen, Xin Jin, Tianwei Zhang and Peng Sun. 2024. Efficient Training of Large Language Models on Distributed Infrastructures: A Survey. arXiv:2407.20018.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.48550/arxiv.2407.20018](https://doi.org/10.48550/arxiv.2407.20018) · [arXiv 2407.20018](https://arxiv.org/abs/2407.20018)

```bibtex
@misc{duan2024efficient,
  title = {{Efficient Training of Large Language Models on Distributed Infrastructures: A Survey}},
  author = {Jiangfei Duan, Shuo Zhang, Zerui Wang, Lijuan Jiang, Wenwen Qu, Qinghao Hu, Guoteng Wang, Qizhen Weng, Hang Yan, Xingcheng Zhang, Xipeng Qiu, Dahua Lin, Yonggang Wen, Xin Jin, Tianwei Zhang and Peng Sun},
  year = {2024},
  doi = {10.48550/arxiv.2407.20018},
  eprint = {2407.20018},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.2407.20018}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
