---
title: "A Hitchhiker's Guide On Distributed Training of Deep Neural"
description: "A guide to distributed neural network training that explains how synchronization, gradient exchange, batch size, and numerical precision affect…"
canonical: "https://research.elamur.ai/free/en/papers/chahal-2018-hitchhiker-s-guide-distributed-training/"
---
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/chahal-2018-hitchhiker-s-guide-distributed-training/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2018](https://md.research.elamur.ai/free/en/papers/2018/) / A Hitchhiker's Guide On Distributed Training of Deep Neural Networks

# A Hitchhiker's Guide On Distributed Training of Deep Neural Networks

Paper · 2018 · Karanbir Chahal, Manraj Singh Grover and Kuntal Dey

**Authors:** Karanbir Chahal, Manraj Singh Grover and [Kuntal Dey](https://md.research.elamur.ai/free/en/authors/kuntal-dey/) · **Year:** 2018 · **Venue:** arXiv:1810.11787 · **Licence:** [arXiv — non-exclusive license to distribute](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

[Cited by **3** papers in our library of more than 163,000 papers whose bibliographies we read](https://md.research.elamur.ai/free/en/papers/chahal-2018-hitchhiker-s-guide-distributed-training/cited-by/) · [licence](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

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

## Summary

Giving more machines a share of neural network training can shorten a run considerably. It also creates a new task. The machines must combine what they learn from different examples, and the time they spend exchanging updates can eat into the time saved by dividing the computation. Chahal, Grover, and Dey survey how researchers tackle this problem. They focus on data parallelism, in which workers hold copies of the same network and calculate gradients on different portions of the training data. A gradient tells the optimizer how changing the current weights would affect the training loss. The system’s job is to turn those separate calculations into a sequence of useful weight updates.

The paper distinguishes synchronous training, in which workers complete a shared update before moving on, from asynchronous training, in which workers can submit updates independently. Synchronization keeps the gradients for a step tied to the same set of weights, at the cost of waiting for slow machines. Asynchronous workers can keep computing during a delay, but a gradient can arrive after the weights used to calculate it have changed. The authors favor synchronous stochastic gradient descent and discuss several ways of organizing its gradient exchanges. They also propose a fault-tolerant version of the binary-blocks exchange scheme. Drawing on Raft, it would replicate the state of participating nodes so a replacement leader could take over if a node failed. The paper describes the design without reporting recovery benchmarks.

The survey’s fastest example comes from earlier work that trained ResNet on ImageNet in 4 minutes with 2048 GPUs. That run combined a large batch with layer-specific learning rates, grouped gradient messages, a choice of communication schedules, and mixed-precision arithmetic. Elsewhere, the paper reviews experiments showing how accuracy can fall when the batch grows without corresponding changes to training, and how compressing gradients can save bandwidth with effects that vary by workload. The authors recommend combining techniques that address different costs. Their evidence comes from studies conducted under different conditions, so the survey explains how the pieces fit together and where each has helped, while leaving the performance of the full recommended combination open.

## Deep dive: A Hitchhiker's Guide On Distributed Training of Deep Neural Networks

A guide to distributed neural network training that explains how synchronization, gradient exchange, batch size, and numerical precision affect speed. · about 38 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

#### Dividing the work changes the work

The motivation is a practical problem in [machine learning](https://md.research.elamur.ai/free/en/concepts/machine-learning/). A network may make good predictions once trained, yet the time required to train it can make it difficult to use on a larger collection of data. The authors recall early ImageNet training that took about a week on a single GPU and describe datasets that could be larger still. They treat the training run itself as something to design. A cluster needs to make progress faster than a single machine while preserving the quality of the trained network. The authors also want the run to withstand machine failures and make progress under unfavorable network conditions. Those goals put communication alongside computation as a concern of [GPU and parallel computing](https://md.research.elamur.ai/free/en/topics/gpu-parallel-computing/).

There are distinct ways to distribute the work. Model parallelism splits the network across devices. The survey uses AlexNet as an early example. Its architecture was divided between 2 GPUs so it would fit in memory. The authors also describe object detection as a setting where parts of a network can have separate jobs, such as predicting a bounding box and assigning a class. That kind of structure gives a designer a place to split the computation. The opportunities for doing so depend on the architecture and on whether memory capacity is the problem the designer needs to solve. [ImageNet Classification with Deep Convolutional Neural Networks](https://md.research.elamur.ai/free/en/papers/krizhevsky-2012-imagenet-classification-deep-convolutional/) and [YOLO9000](https://md.research.elamur.ai/free/en/papers/redmon-2017-yolo9000-better-faster-stronger/)

Data parallelism splits the examples instead. Each worker can hold and run the complete network, so workers can carry out the same calculations on separate portions of the data. The difficulty comes when those calculations have to affect the shared training process. If each worker trains indefinitely on its own portion, its weights follow the updates produced by those examples. The system needs a procedure for coordinating those updates. For this paper, most of the interesting design choices start at that boundary, where computing a gradient becomes a problem of passing information between machines.

Dividing the data also raises a question about how much work belongs in a single update. The batch a worker handles can stay small while participation by more workers makes the combined batch large. The resulting calculation may look much like a single-machine update over the combined set of examples. Over a full pass through the training data, however, changing the combined batch changes how frequently the optimizer updates the weights. This is why the paper treats batch size as a choice about optimization as well as a choice about distributing computation.

#### The two ways of coordinating updates

The paper uses stochastic gradient descent, or SGD, to explain the main choices. In its mini-batch form, SGD produces an update from a subset of training examples. The optimizer can take a step without computing the gradient across the entire dataset. That division into batches creates a natural unit of work for the cluster. Workers can agree to calculate different parts of the same batch, or they can complete and submit their own batches on independent schedules. The authors say that the coordination principles they discuss for SGD also apply to optimizers such as [Adam](https://md.research.elamur.ai/free/en/papers/kingma-2014-adam-method-stochastic-optimization/).

In synchronous SGD, the workers agree on when an update can happen. The usual illustration in the paper has them send gradients to a central server. The server combines the gradients and makes the result available for the update. Each worker then proceeds from the same weights. This design retains the relationship between the examples, the gradients, and the weight update that a reader would expect from ordinary mini-batch training. It also means that a worker with finished gradients can have nothing further to do until the remaining contributions arrive.

Asynchronous SGD gives workers more independence. A worker obtains weights from a parameter server, computes on its local examples, and submits a gradient. Other workers can be at different points in that sequence. Earlier proposals cited by the authors explore how to let work proceed in this way while controlling the effect of delayed updates. A delayed message can be more than a systems nuisance. If the weights have moved since a worker received them, its gradient describes how to improve an earlier state of the network. The paper calls such a gradient stale.

#### Why the network becomes part of the optimizer’s design

The authors trace the communication side of the problem to earlier distributed systems and to collective operations in high-performance computing. A collective is an operation that involves a group of workers. All Reduce combines values contributed by that group and returns the combined result to every participant. For synchronous SGD, that is the collective operation the workers need when they all start from the same weights and must finish the step with the same aggregate gradient. The survey describes how this approach entered deep learning and points to its use in systems such as [TensorFlow](https://md.research.elamur.ai/free/en/papers/abadi-2016-tensorflow-system-large-scale-machine/).

A message has a cost to start and a cost to transmit its contents. A system that sends frequent small messages can spend much of its time initiating exchanges. A system that sends large gradients over a slow connection can spend much of its time moving bytes. The time at which workers finish their calculations matters as well. If a worker joins a collective late, faster transfers alone may leave much of the waiting intact. The survey approaches these costs through several separate decisions, including who exchanges data with whom, how much data gets sent, and whether an exchange can begin while some gradient calculations are still underway.

The literature the paper reviews also changes the arithmetic or the information sent. Mixed precision assigns narrow and wide number formats to different parts of training. Gradient compression can represent individual values with fewer bits or transmit only selected components of an update. These choices matter especially in the paper’s discussion of federated learning, where training may take place on consumer devices with limited computation and slow or unreliable connections. The same goal of reducing wall-clock time therefore leads to different questions on a fast GPU cluster and on devices with limited resources. The paper uses that variety to motivate a survey of components instead of a single design for every setting.

### The method, step by step

#### From examples to a shared gradient

A training step begins with weights and a batch of examples. The forward pass uses those weights to compute predictions and a loss, which measures how the predictions fare on the training objective. Back-propagation uses the loss to work out how it changes with the weights. SGD takes a step in the direction that lowers that loss locally. The paper writes the mini-batch update as follows.

```
wₜ₊₁ = wₜ − η (1/n) ∑ₓ∈B ∇ℓ(x, wₜ)
```

Here `t` is the current update index, `wₜ` holds the weights at that index, and `wₜ₊₁` holds the weights after the update. `B` is the mini-batch and `n` is its number of examples. `x` denotes an example in `B`. `ℓ(x, wₜ)` is the loss for that example at the current weights, and `∇` takes its gradient with respect to the weights. `∑ₓ∈B` adds the example gradients, while `1/n` turns their sum into a mean. `η` is the learning rate, which sets the scale of the step. The subtraction makes the update go against the gradient.

In the paper’s basic synchronous procedure, each worker starts with the same weights and computes gradients for a local batch. The system then averages the local gradients. With equally sized local batches, averaging the local means gives equal influence to each example in the full batch. Once the global gradient is available, all replicas can apply the same update. A central server can perform the averaging, or the workers can obtain the same aggregate by participating in All Reduce. The flow below follows the paper’s peer-to-peer route with a two-phase reduction.

A synchronous training step with All Reduce The steps in order.

The shared update defines a synchronization barrier. A worker can finish its part of the batch and still have to wait. The authors discuss backup workers as a way to narrow that wait. In the arrangement they describe, extra replicas do work in parallel, and aggregation can begin when the required number of responses has arrived. Timely responses can then cover for slow ones. The decision to add replicas trades extra computation for less exposure to the slow end of the response-time distribution. The question is how much that trade saves across a run, since both the available parallel work and the time spent waiting matter.

#### Letting workers proceed independently

Under basic asynchronous SGD, a worker fetches the global weights, uses them to process its mini-batch, and sends back the gradient. The parameter server can update the global weights when a contribution arrives. The worker does not need the other workers to complete their current calculations first. If some workers or messages are late, others can continue. The relative timing of submissions now affects which weights receive each update. A gradient calculated from an old copy can be useful, but it no longer has the same interpretation as a gradient calculated from the state to which it is applied.

The paper reviews ways to manage that difference. The n-softsync protocol lets the server proceed after responses from a specified subset of learners. It uses a parameter to control the response threshold and adjusts the learning rate with the degree of staleness. The threshold is written as follows.

```
c = ⌊λ/n⌋
```

Here `c` is the number of learners whose gradients must be collected for an update, `λ` is the total number of learners, and `n` controls the degree of synchronization. The floor signs `⌊ ⌋` mean to take the greatest integer at or below the quotient. In this expression `n` concerns synchronization. The `n` in the mini-batch SGD formula counts examples.

Delay-compensated asynchronous SGD takes another approach. It uses a Taylor expansion of the gradient to estimate how it would change as the weights move. The survey describes the use of an approximate Hessian, a matrix that describes how the gradient varies with the weights. The approximation gives the server a way of adjusting for the distance between the weights a worker used and the weights the server is updating. The paper also discusses work combining delayed proximal gradients with stochastic variance reduction. It presents those studies as responses to the convergence problem that arises when the system accepts gradients calculated at different points in training.

#### Keeping separate weights with elastic averaging

Elastic Averaging SGD gives each worker its own weights and couples those weights to a center variable. A worker follows gradients from its data while also feeling a pull toward the center. The center in turn moves in response to the workers. The authors present this as a way to let workers explore while keeping their training trajectories related. The objective combines a local training loss and a squared distance from the center.

```
F(x₁, …, xₚ, x̃) = ∑ᵢ₌₁ᵖ [f(xᵢ, Xᵢ) + (ρ/2) ‖xᵢᵗ − x̃ᵗ‖²]
```

`F` is the combined objective and `f` is the local loss. `i` indexes workers and `p` is their total number. `xᵢ` contains worker `i`’s weights, and `Xᵢ` is the data used in that worker’s loss. `x̃` is the center variable. The superscript `t` indicates the current iteration, so `xᵢᵗ` and `x̃ᵗ` are that worker’s weights and the center at that iteration. `‖ ‖²` gives the squared norm of their difference. `ρ` controls the coupling strength, and `ρ/2` is the coefficient of the penalty. The sum adds the loss and penalty contributions across workers.

The local update includes both the training gradient and the pull from the center.

```
xᵢᵗ⁺¹ = xᵢᵗ − η [gᵢᵗ(xᵢᵗ) + ρ(xᵢᵗ − x̃ᵗ)]
```

`xᵢᵗ⁺¹` is the next weight vector for worker `i`. `gᵢᵗ(xᵢᵗ)` is its gradient at the current weights, and `η` is the learning rate. The difference `xᵢᵗ − x̃ᵗ` points from the center towards the worker’s weights. Subtracting the contribution proportional to that difference moves the worker towards the center, alongside the step suggested by its data.

The center update uses the differences in the opposite direction.

```
x̃ᵗ⁺¹ = x̃ᵗ + η ∑ᵢ₌₁ᵖ ρ(xᵢᵗ − x̃ᵗ)
```

`x̃ᵗ⁺¹` is the updated center. `∑ᵢ₌₁ᵖ` adds the pulls from the `p` workers, whose current weights are `xᵢᵗ`. `ρ` determines the strength of each pull, and `η` scales the center’s step. The plus sign moves the center toward the workers’ displacements. The paper uses `τ` for the communication period at which the server performs updates. A larger period allows more local training between exchanges.

Gossiping SGD takes the same broad concern with coordinating local weights and gives it a decentralized form. In the survey’s description, workers use an average of local weights in place of a distinguished center at a server. This changes where the coordinating information comes from. It also illustrates that the label *asynchronous* covers different ways of sharing information. Basic asynchronous SGD sends gradients to be applied to global weights, while elastic averaging and gossiping allow workers to keep local weights whose relationship is managed through communication.

#### All Reduce on a ring

All Reduce has a straightforward input and output. Every worker starts with a vector, and every worker ends with the result of combining the vectors at corresponding positions. To see the operation in the training setting, imagine the same weight position on every worker. Each worker has a gradient for that position from its own examples. The corresponding position in the output must reflect contributions from all workers. The collective repeats that logic across the entire vector.

A ring orders the workers so each has a neighbor from which it receives and a neighbor to which it sends. Workers split their gradient vectors into chunks. The first phase, scatter-reduce, sends chunks around the ring and adds contributions along the way. A worker combines an incoming partial result with its own data for the corresponding chunk. By the end of this phase, the full reduction is distributed across the workers. Each worker holds a completed part of the answer.

The second phase, all-gather, circulates those completed parts. Workers store incoming chunks in their positions and pass them along. The operation at receipt changes from arithmetic to copying because the chunks already contain the complete set of contributions. At the end, every participant can reconstruct the whole reduced vector. The paper counts `p − 1` steps in each phase, where `p` counts machines. It gives the ring’s latency in terms of these communication steps.

```
2 × (p − 1)
```

`p` is the number of machines, `p − 1` is the step count for one phase, and the factor `2` counts scatter-reduce and all-gather. This is a count tied to the exchange schedule. Turning it into elapsed time requires information about how long an exchange takes. The survey’s attraction to the ring is that workers can be active together and continually send chunks to their neighbors. The schedule also accommodates odd and even worker counts. Its cost is a sequence of communication rounds that grows linearly with the number of participants.

#### Reducing the number of exchange rounds

The recursive algorithm also does scatter-reduce followed by all-gather. For a power-of-two group, it changes the partner and the size of the data at every round. A worker splits the vector it is responsible for into halves. It sends one half to its partner and receives contributions for the half it will retain. The partner takes the complementary half. Each worker reduces the data for its retained half, then repeats the process on a smaller portion with a different partner.

The paper’s scatter-reduce description starts with partners separated by half the group and halves that distance in successive rounds. A worker’s responsibility narrows as the reduction progresses. Eventually, its retained chunk contains all contributions for its part of the vector. All-gather traces the partner schedule in reverse. Each exchange joins the chunks already available at the partners. The amount of data a worker has assembled grows until it holds the full result.

```
log₂(P)
```

`P` is the number of processors in the power-of-two group. `log₂` is the logarithm with base `2`, written to make explicit the halving and doubling in the schedule. The expression counts the exchange rounds in either phase. The paper uses a communication-time expression that makes message startup and byte transfer separate costs.

```
2 × A × log₂(P) + 2 × n × B
```

`A` is the startup time for a message, `P` is the processor count, and `log₂(P)` is the number of rounds per phase. `n` stands for the byte count in the paper’s cost expression, and `B` is transfer time per byte. The two terms account for starting messages and moving data across the phases. The letter `B` here refers to a transfer cost. In the mini-batch update it names the batch. The paper omits the local cost of performing the reduction in this communication calculation.

When the machine count falls between powers of two, the recursive scheme needs a way to include the extra contributions. The paper describes pairing some machines in advance, folding each pair’s contributions into an active participant, and then running the recursive exchange on a power-of-two group. The partners left out of the main exchange still need the completed vector. The paper describes a final handoff back to those machines and gives the following cost expression.

```
2 × A × log₂(P) + A + 3 × n × B
```

`A` and `B` are the message startup time and per-byte transfer time, and `n` is the byte count. The logarithmic term represents the recursive exchange. The paper uses `P` for processor count in both expressions, although the recursive phase in the irregular case runs on the active power-of-two group. The added startup and transfer costs represent the extra communication associated with including machines outside that group. The underlying problem is that some machines contribute at the start and receive at the end but sit out the intervening exchanges.

#### Working with blocks of different sizes

Binary blocks is the survey’s alternative for avoiding a large idle group. It partitions the workers into groups whose sizes are powers of two. Each group can perform the recursive scatter-reduce procedure internally. At that point, workers in a block have reduced chunks for that block’s contributions. The smallest block sends its chunks towards the next larger one. Corresponding data are reduced there, and the process moves up the size ordering until the largest block has received the contributions from below.

Distribution goes in the opposite direction. Starting at the largest block, workers pass completed data downward. Blocks use their own all-gather operations to assemble the result, while passing the necessary pieces along to smaller blocks. This design gets work from multiple groups during the internal reduction. The amount of data that has to cross group boundaries still depends on the sizes of those groups. The authors express the cost in a compact form.

```
2 log₂(P) + 2 n B
```

`P` denotes the number of machines and `log₂` is the logarithm corresponding to the recursive schedule. `n` is the byte count in the transfer term and `B` is time per byte. The paper presents the logarithmic round term in this form without the explicit startup coefficient `A` used in the previous expression. Its discussion also treats the traffic between unequal blocks as a separate source of imbalance. The compact expression gives the scaling argument, while the block arrangement determines how much work falls on particular workers.

#### Keeping a collective alive after a failure

A peer-to-peer collective can remove a permanent central server from the exchange and still depend on every participant being available. In a ring, for instance, a worker expects its neighbor to forward a particular chunk. Losing that neighbor can interrupt the sequence. The authors describe ordinary All Reduce as requiring a restart after a machine failure. Their proposed extension starts with binary blocks and makes an exchange participant replaceable by replicating its state.

The proposal uses elements of Raft. A participating node has a group of replicas, with 3 or 5 given as typical replica counts. A leader accepts state changes and the replicas follow those changes. The state changes relevant to the collective include combining partial gradients during scatter-reduce and joining pieces during all-gather. If the leader fails, the replicas can choose another one. The paper describes randomized election timeouts and election by a majority of votes. Randomization gives candidates a way to start at different times, and a majority determines which candidate can lead.

The connection between the election and the gradient exchange is the state that the new leader can recover. A replacement needs the progress of the exchange to stand in for the failed leader. The proposal therefore puts replication under the operations that produce or assemble a partial result. Its intended benefit is to preserve enough of that work for the collective to continue while viable replicas are available. The design occupies a different place from backup workers in synchronous SGD. Backup workers can supply a timely contribution to a batch, whereas these replicas are meant to carry forward the state of a participant already involved in the collective.

#### Increasing the batch without losing useful updates

More workers can process more examples together. The authors emphasize that this can shorten a run by reducing how frequently the cluster has to coordinate a weight update over a pass through the dataset. Large batches can also change the training trajectory. Early in training, the weights may be changing rapidly, and applying a large learning rate to a large-batch gradient can cause divergence. At the end of training, the resulting weights can generalize less well than those produced with smaller batches. The paper describes this as a generalization gap when the larger-batch run produces lower accuracy on held-out data.

The survey discusses two related uses of batch size. A training schedule can increase the batch as training progresses while keeping the learning rate constant. The paper compares this with a schedule that holds the batch fixed and reduces the learning rate over time. In its account of the increasing-batch approach, the authors advise keeping the maximum batch well below the training-set size. They also discuss an alternative that changes both the learning rate and the batch schedule, with a possible cost in test accuracy.

The linear scaling rule addresses a different decision. When a practitioner increases the mini-batch for a distributed run, the rule increases the learning rate by the same factor.

```
η′ = k × η
```

`η` is the reference learning rate and `η′` is the learning rate for the larger batch. `k` is the factor by which the mini-batch size grows. The warm-up procedure in the survey starts training with a smaller learning rate and raises it over 5 epochs. The purpose is to delay the full scaled rate until after the period in which early gradients make large steps especially risky. The paper discusses this method through [Accurate, Large Minibatch SGD](https://md.research.elamur.ai/free/en/papers/goyal-2017-accurate-large-minibatch-sgd-training/).

Layer-wise adaptive rate scaling, or LARS, adds another adjustment. The survey describes a wide variation across layers in the relative sizes of the weights and gradients. A global learning rate applies the same multiplier everywhere. LARS supplies a local multiplier so the size of each layer’s step can be related to the size of that layer’s weights. The survey begins with this expression for the step.

```
Δwₗᵗ = γ × λₗ × ∇L(wₗᵗ)
```

`Δwₗᵗ` is the gradient step for layer `l` at iteration `t`, expressed as the quantity used in the weight update. `wₗᵗ` is that layer’s current weight vector. `L` is the training loss and `∇L(wₗᵗ)` is its gradient with respect to that layer’s weights. `γ` is the global learning rate, and `λₗ` is the layer’s local multiplier.

```
λₗ = η × ‖wₗ‖ / ‖∇L(wₗ)‖
```

`λₗ` is the multiplier for layer `l`, `wₗ` denotes its weights, and `∇L(wₗ)` denotes their gradient. The norm signs `‖ ‖` give the magnitude of the vectors. `η` is the trust coefficient, specified as less than `1`, and sets how large an update the method allows relative to the weight norm. Here `η` is a coefficient specific to LARS. The gradient norm in the denominator adjusts the local multiplier as the gradient magnitude changes.

```
λₗ = η × ‖wₗ‖ / (‖∇L(wₗ)‖ + β × ‖wₗ‖)
```

`β` is the weight-decay coefficient. Weight decay is an additional contribution to the update associated with the size of the weights. The other symbols retain their meaning from the preceding formula. Adding the weight-decay term to the denominator accounts for its scale when setting the local multiplier. The resulting procedure adapts as the layers’ weights and gradients change through training. [Large Batch Training of Convolutional Networks](https://md.research.elamur.ai/free/en/papers/you-2017-large-batch-training-convolutional-networks/)

#### Grouping messages and choosing an exchange schedule

The gradients of a network arrive as tensors, or arrays of numerical values associated with its layers. The paper draws attention to small gradient tensors in ResNet, particularly those from convolutional layers relative to those from fully connected layers. Sending each tensor separately can incur repeated startup costs while making little use of the bandwidth available after each message begins. Tensor fusion combines several of these tensors into a larger message. The receiving side can then recover the constituent gradients from the combined data.

The survey also describes a hierarchical exchange. Machines form groups, and a representative aggregates for each group. The representatives perform a ring All Reduce among themselves and distribute the result to their groups. That arrangement puts fewer participants in the intergroup ring. It introduces work inside each group, so the relevant quantity is the elapsed time for the complete exchange. In the fast ImageNet system discussed by the paper, the communication strategy switches between the ordinary ring and a hierarchical version depending on tensor size. Tensor fusion is also described in connection with [Horovod](https://md.research.elamur.ai/free/en/papers/sergeev-2018-horovod-fast-easy-distributed-deep/).

There is a scheduling choice even before selecting a collective. Back-propagation can make the gradient of one layer available while work on other layers continues. Sending gradients as they become available lets the exchange overlap with computation. Fusion, meanwhile, may require waiting for a group of tensors to be ready before starting a message. The techniques address different costs. Overlap can shorten the portion of the exchange that lies outside computation, and fusion cuts the number of messages that need to start. Their interaction depends on when tensors become available and how expensive a message is in the cluster.

#### Preserving important calculations at higher precision

Mixed precision uses narrower values for much of the computation and retains single precision where the training procedure needs it. In the survey’s account, a master copy of the weights is stored in 32 bit floating point. A 16 bit copy is used for forward and backward passes. The gradients are then converted for the weight update, which is performed on the master copy. The fresh master weights supply the lower-precision copy for the next iteration.

The master copy addresses a problem with low-precision updates. Computing the weight change in the narrow format can lose information used by subsequent iterations. Retaining full precision for the persistent weights allows the system to benefit from narrower operands in the forward and backward work while using higher precision to accumulate changes. The survey also discusses 32 bit accumulation for operations involving lower-precision operands, and it calls out reductions in batch normalization and softmax as places where summing in higher precision can matter. Inputs and outputs can still use the narrower representation even when the arithmetic in between uses the wider one.

A second issue arises when a gradient is too small to represent. The paper gives the normalized exponent range as `[-14, 15]` for the low-precision format it discusses. Small gradients can fall below the available range and become zero. Loss scaling multiplies the forward-pass loss so back-propagation produces gradients with correspondingly larger magnitudes. Before the optimizer uses those gradients, they are divided by the same scale. The paper recommends unscaling first, then applying operations like gradient clipping and weight decay.

The scale has to accommodate large values as well as small ones. A larger scale can preserve gradients that would otherwise disappear, but it can push other values beyond the top of the representable range. The survey describes skipping a batch if a gradient overflow is detected. It also gives an example in which scaling by a factor of 8 let the cited network match its single-precision counterpart’s accuracy. That example shows what loss scaling can recover in a particular training setup. The paper discusses choosing the scale as a separate decision because the relevant gradient ranges can vary.

#### Sending fewer bits or fewer values

Gradient quantization reduces the number of bits used to communicate values. A sign-based scheme can transmit the sign and carry the representation error into later work. [QSGD](https://md.research.elamur.ai/free/en/papers/alistarh-2016-qsgd-communication-efficient-sgd-gradient/) uses stochastic rounding to represent gradient components with a discrete set of values. The randomness is part of the approximation, chosen to preserve statistical properties of the gradient. TernGrad also uses stochastic rounding, but restricts its transmitted levels to `−1`, `0`, and `1`. The paper describes using clipping and a layer-wise procedure to control the range over which that representation is applied.

Sparsification reduces the number of components sent. A worker can use a fixed threshold for magnitudes or set a threshold through the proportion of components it wants to drop. The paper discusses methods that retain unsent information locally, allowing an omitted component to contribute to a later exchange. It also describes AdaComp, which divides a layer’s residual into bins and uses local magnitude information to decide which entries warrant communication. The threshold in such a method can respond to differences in activity within a layer.

Deep Gradient Compression combines thresholding with changes to the way the optimizer handles delayed contributions. Each worker computes a local mini-batch gradient and can clip it to control large values. It accumulates momentum and uses the resulting velocity to build a residual. Above-threshold components are selected for communication. The selected components are cleared from the local residual and from the corresponding momentum entries, while the rest are retained. Across workers, the transmitted pieces are combined, and the optimizer updates the weights from the combined result.

The survey’s pseudocode begins by scaling the contribution of each example to the local gradient.

```
Gₖᵗ ← Gₖᵗ + ∇f(x, wᵗ) / (N b)
```

`Gₖᵗ` is the gradient being accumulated by worker `k` at iteration `t`, and the arrow means assignment. `x` is an example sampled from the training dataset `X`. `wᵗ` is the current weight vector, `f` is the example loss, and `∇f(x, wᵗ)` is its gradient with respect to `wᵗ`. `N` is the number of workers and `b` is the local mini-batch size. The denominator `N b` gives the normalization used before the local results are added across workers.

```
Uₖᵗ ← m × Uₖᵗ⁻¹ + Gₖᵗ
```

`Uₖᵗ` is the new velocity on worker `k`, `Uₖᵗ⁻¹` is its previous velocity, `m` is the momentum coefficient, and `Gₖᵗ` is the local gradient after any clipping. The new velocity combines the current gradient with a retained portion of the old one.

```
Vₖᵗ ← Vₖᵗ⁻¹ + Uₖᵗ
```

`Vₖᵗ` is the current residual and `Vₖᵗ⁻¹` is what remained after the previous selection and clearing on that worker. `Uₖᵗ` is the velocity just computed. Adding velocity to the residual lets locally retained contributions accumulate until they meet the selection criterion.

```
Mask[j] ← |Vₖᵗ[j]| > thr
```

`j` indexes a weight component. `Vₖᵗ[j]` is the residual at that component, and `| |` takes its absolute value. `thr` is the threshold chosen from the residual magnitudes according to the sparsity setting, and `>` tests whether the component exceeds it. `Mask[j]` records the result. The worker transmits the selected entries and uses the mask to clear those entries locally. This clearing limits the effect of carried momentum on components whose accumulated values have already been sent.

```
Gᵗ ← ∑ₖ₌₁ᴺ encode(G̃ₖᵗ)
```

`G̃ₖᵗ` denotes worker `k`’s selected update, and `encode` denotes the representation used to communicate it. `∑ₖ₌₁ᴺ` represents the all-worker reduction in the pseudocode, giving `Gᵗ`, the aggregate at iteration `t`. The expression describes the exchange at the level of the algorithm. Its purpose is to combine the selected gradient components from all workers so the optimizer can use the global update.

```
wᵗ⁺¹ ← SGD(wᵗ, Gᵗ)
```

`wᵗ⁺¹` is the weight vector for the next iteration, and `SGD` is the optimizer operation using current weights `wᵗ` and aggregate gradient `Gᵗ`. The paper describes easing training into high sparsity by increasing it during the early part of the run. It also describes learning-rate warm-up. These steps address the fact that restricting the transmitted updates can affect the optimizer even if the communication scheme eventually sends contributions that were deferred.

### Experiments and results

#### What the ImageNet runs measured

The paper is a survey. Its empirical evidence comes from the experiments it discusses, with ImageNet classification supplying the clearest examples of time to train at scale. The comparisons use different baselines for different questions. Some ask whether scaling across workers preserves the accuracy of single-machine training. Others measure the speed of a particular collective or compare accuracy at different batch sizes. The survey does not present one benchmark in which every technique is applied to the same architecture and evaluated under the same conditions.

In the linear-scaling study, a ResNet run uses an ImageNet mini-batch of 8,192 in the paper’s detailed discussion. The run takes an hour on 256 GPUs and trains for 90 epochs. The authors report no loss of validation accuracy against the single-machine comparison. The cluster uses recursive halving and doubling for All Reduce, with a reported 3× communication speed improvement over the ring algorithm in that setting. The survey also reports 90% scaling efficiency for the distributed setup, in which gradient exchange is pipelined as layers finish computing. These numbers describe distinct outcomes. The hour is training time, 3× refers to the collective comparison, and 90% describes scaling efficiency.

The survey cites a subsequent ImageNet run that reaches 4 minutes on 2048 GPUs. It uses ResNet, LARS, mixed-precision training, tensor fusion, and a hybrid All Reduce on a low-latency RDMA connection. The paper uses `64k` in its overview of the batch size for that run and `64,000` when discussing what LARS enabled. Its discussion attributes a training speedup of 8× to gains in throughput and bandwidth efficiency from mixed precision, but it does not lay out the baseline and conditions for that figure in enough detail to read it as an isolated comparison of number formats. [Highly Scalable Deep Learning Training System with Mixed-Precision](https://md.research.elamur.ai/free/en/papers/jia-2018-highly-scalable-deep-learning-training/)

The fastest run is evidence of what the combined system could achieve in that configuration. The paper treats its optimizer and its communication stack as parts of the result. LARS permits large steps to be adjusted by layer, while fusion and the hybrid collective handle the way gradients leave those layers. The low-latency connection is also part of the reported setup. A comparison between the hour and the 4 minutes would include changes in hardware scale, optimization, arithmetic, and communication at once.

#### What changes when the batch grows

The AlexNet comparison gives a closer view of what can happen when batch size is raised. The cited baseline uses a batch of 256 and reports an accuracy value of 57.6 on the percentage scale. For a batch of 4,000 the survey gives 53.1%, and for 8,000 it gives 44.8%. It explicitly calls the last value test accuracy. The surrounding discussion also uses the term validation accuracy for the generalization problem, so the chart retains the paper’s comparison without assigning a more specific split to every point.

Reported AlexNet accuracy on ImageNet at different batch sizes The reference batch has the highest reported accuracy, and the largest batch has the lowest.

**The numbers**

| System or setting | accuracy % |
| --- | --- |
| Batch size 256, reference setting (this paper) | 57.6 |
| Batch size 4,000 | 53.1 |
| Batch size 8,000 | 44.8 |

Batch normalization substantially improves the large-batch result in the study the authors discuss. At a batch size of 8,000, the paper reports that the accuracy gap falls from 14% to 2.2% when batch normalization is applied to AlexNet. These are reported gaps, not accuracy values for the training runs. The authors also cite variation across layers as evidence for adapting the learning rate locally. In AlexNet, the reported ratio of weight norm to gradient norm is 5.76 in the first convolutional layer and 1345 in the last fully connected layer. The measurement is about update scale inside the network. It helps explain the choice of a layer-specific rule without itself measuring the accuracy gained by using that rule.

#### Waiting for the last worker

To show why the synchronization barrier matters, the survey draws on a study of gradient arrival times. It reports the share of second-to-last gradients and final gradients that arrived in under 2 seconds. For a synchronous step that requires all responses, the earlier arrival positions show how soon most of the work is ready. The last arrival controls when the full set can be combined.

Gradient arrivals under 2 seconds in the synchronous SGD timing study The last gradient reaches the timing cutoff in a smaller share of observations.

**The numbers**

| System or setting | arrivals under cutoff % |
| --- | --- |
| Second-to-last gradient (this paper) | 80 |
| Final gradient | 30 |

The observations describe different positions in the same kind of exchange. The better arrival rate belongs to the second-to-last contribution. It does not imply that a trainer can simply discard the last gradient and expect an unchanged optimization procedure. The backup-replica study addresses that practical question through redundancy. For a 100 machine cluster, the survey reports that the best observed arrangement was 96 workers and 4 backups. The outcome being optimized is time to convergence under the study’s configuration. The survey supplies the worker and backup counts without giving a numerical convergence time for the chosen configuration.

The paper also reviews comparisons among asynchronous SGD, Elastic Averaging SGD, Gossiping SGD, and synchronous All Reduce SGD. It reports that elastic averaging improves the rate of convergence compared with Downpour across the tested communication periods. At long communication periods, it has lower validation error on CIFAR, and the study observes that validation error declines as the number of workers grows. These are qualitative comparisons of the curves and errors as described by the survey. Specific validation-error values for those conditions are absent.

#### Communication savings across workloads

The results on quantization and sparsification span image classification, speech recognition, and language tasks. The distinction between speedup and compression is essential to reading them. A compression ratio describes a change in the amount of data represented or transmitted. A training speedup describes elapsed work in a particular system. An improvement in one metric can translate into a smaller improvement in the other when network transfer is only part of the training time.

For QSGD, the paper describes a 4-bit setting used with a 62M-parameter AlexNet on 8 GPUs. The speedup is 2.05×, with a small increase in Top-1 accuracy, which is the fraction of cases in which the first-ranked prediction is correct. The survey says a 13M-parameter LSTM on AN4 showed similar gains, without supplying a separate speedup figure for that run. It reports speedups up to 3.04× for TernGrad on AlexNet while maintaining accuracy. On GoogleNet it describes a smaller speed gain and a 2% accuracy decrease. The reported difference is consistent with the authors’ explanation that AlexNet spends more time on communication relative to computation in those experiments.

The sparsification results likewise depend on the workload. According to the survey, Gradient Dropping yielded speedups of 49% on MNIST and 22% on a neural machine translation task. The cited experiments exchange 50× less data and are reported to preserve accuracy. For Adaptive Quantization, the survey gives a 1.76× speed advantage over the next implementation in the comparison, which used uncompressed communication. Those experiments use fully connected networks on MNIST. For AdaComp, the authors report compression close to 40× on convolutional layers and 200× on fully connected and recurrent layers, with convergence and accuracy maintained in the reported experiments.

Deep Gradient Compression provides the most extensive set of compression figures discussed in the survey. The paper gives 597× for AlexNet and 277× for ResNet-50, with a slight accuracy improvement and no observed loss in convergence in the comparisons it cites. It gives 462× for language modeling and 608× for speech recognition. The quality measures in those tasks are perplexity and word error rate, respectively, and the paper describes slight reductions in both. The survey does not supply their absolute values. Those results establish the size of the reported communication savings and the direction of the accompanying quality changes, with less detail about the size of those changes.

### What the ablations show

The survey reports no original ablation study of its proposed fault-tolerant All Reduce or its recommended training stack. It does discuss comparisons from earlier experiments that vary batch size, learning behavior, communication schedules, and gradient representations. The most useful distinctions are which settings were changed together and what the authors could observe as a result.

#### Batch size and early training

The AlexNet comparison traces what happens across settings with different batch sizes. Accuracy falls as the batch grows in the reported comparison, and using batch normalization at the largest setting substantially narrows the reported gap. These observations show that the effect of batch size depends on the training configuration. They also separate a quality outcome from a systems motivation. A larger batch gives the cluster more examples to process in parallel, but the optimization must still arrive at weights that perform well on the accuracy measure. The paper uses these results to explain the interest in layer-wise learning rates.

The norm measurements provide a mechanism for understanding why a single scaling rule could have uneven effects. The early convolutional layer and the final fully connected layer have very different ratios of weight magnitude to gradient magnitude. A multiplier that yields a tolerable relative change in one layer can yield a large or small one elsewhere. LARS uses those relative scales directly. The reported ratios motivate that design. Demonstrating how much each of its adjustments contributes would require comparisons at the same batch size with the same surrounding training procedure.

The discussion of warm-up likewise distinguishes conditions within a run. At the start, gradients can be large, so immediately using a scaled-up learning rate can cause divergence. The cited linear-scaling run builds up to the target rate. The survey identifies that schedule as important to the successful configuration. It does not give a series of accuracy and time measurements for different warm-up lengths. Readers can therefore see why the schedule is used and what result the complete recipe achieved, while the exact cost of removing or shortening warm-up remains unspecified.

#### The optimization phase and the cluster size

The comparisons discussed under Gossiping SGD distinguish the beginning of training from its later stages. With a large step size, the authors report faster convergence for asynchronous SGD than for synchronous All Reduce SGD. At a smaller step size, Gossiping SGD is reported to converge faster than Elastic Averaging SGD. Across the methods, synchronous All Reduce SGD is described as the most consistent. Faster progress in one part of a run and higher eventual accuracy are different observations, so the survey’s preference for the synchronous approach can coexist with the early advantage observed for asynchronous training.

The paper also divides the findings by scale. On clusters of up to 32 nodes, it reports faster convergence for elastic averaging and gossiping in the cited comparison. At 100 or more nodes, synchronous All Reduce SGD is reported to converge more consistently to a higher-accuracy solution. This makes worker count part of the interpretation of the comparison. A result from a small group of workers characterizes the delays, communication, and optimization behavior of that setup. Changing the group size can change all three. The survey supplies the cluster-size conditions but gives no complete accuracy curves or time measurements for reconstructing the comparisons.

The elastic averaging results add communication frequency as another condition. A worker that communicates less frequently can take more local steps before being drawn back toward the center. The higher-period CIFAR comparison suggests that elastic averaging can preserve or improve validation performance relative to Downpour under that condition. The reported decline in validation error as workers are added is a separate finding. It describes the behavior of the tested setup as participation grows, alongside the comparison that changes communication periods.

#### The shape and cost of communication

The ring and recursive exchange comparison gives a concrete test of the importance of communication rounds. The recursive method has fewer sequential rounds as the worker count increases. The reported advantage over a ring comes from a particular ImageNet training system in which exchanges can also overlap with back-propagation. The paper’s analytical cost expressions explain why the algorithms can differ. The measured result shows how that difference played out on one system with its message sizes and scheduling choices.

The irregular-worker case offers a different analysis. Folding workers into pairs before a recursive exchange leaves the inactive partners waiting while the active group carries out the collective. Binary blocks give those workers useful work inside their own power-of-two groups, then require data to move between groups of unequal sizes. The paper reports favorable behavior for `8 + 4` and `16 + 8` block configurations. These are cluster configurations, not timings. The comparison explains what source of imbalance binary blocks address and why traffic between blocks can still limit them.

Tensor fusion and the hybrid collective show why message size matters to interpreting a benchmark. Combining small messages reduces the number of starts. A hierarchical exchange can also reduce the number of workers in the main ring. The fast ImageNet system chooses between exchange schedules according to tensor size, illustrating that the same system can face different communication costs as the run proceeds. Its final training time includes those choices along with the optimizer and arithmetic changes.

#### When reducing the payload pays off

The TernGrad results illustrate how the benefit of communicating fewer bits changes with the workload. The larger gain occurs where the baseline spends comparatively more time on communication. In the comparison with a smaller communication burden, the reported gain is less and accuracy also falls. This comparison varies the architecture, so it combines differences in communication load with differences in optimization and layer structure. The transfer-to-computation balance gives a plausible explanation for the speed pattern. The experiments as recounted do not isolate that balance as the only cause.

Deep Gradient Compression raises a related question about quality. The survey explains why simply omitting many entries can damage convergence and describes the mechanisms used to mitigate that problem. Momentum correction governs what is accumulated. The mask governs what is cleared after transmission. Clipping and warm-up address large or rapidly changing updates. The reported task results concern these mechanisms operating together. The paper gives enough detail to see which problem each mechanism is intended to address, while its headline compression ratios describe the complete method.

Mixed precision separates the choice of storage format from the precision of selected operations. The survey describes cases where all-low-precision updates harm accuracy, where small gradients can disappear, and where low-precision accumulation harms convergence. Single-precision master weights, loss scaling, and higher-precision reductions respond to those different failure modes. The loss-scaling example is a direct indication that numerical range can affect accuracy. It also shows why a throughput result for mixed precision is meaningful only in combination with the procedures that keep training numerically effective.

### Limitations

#### Limits identified by the authors

The authors identify a continuing tension between synchronization and staleness. Synchronous training workers can wait at every update, and backup replicas or a faster collective can reduce the wait without abolishing the need for a coordinated step. Asynchronous training relaxes that requirement but can apply old gradients to later weights. The survey reviews successful ways to manage this problem in specific settings and identifies better convergence and final accuracy for asynchronous training as open directions.

Large batches face a separate limit. The authors say that increasing the batch can bring early divergence or a decline in held-out accuracy. Warm-up, linear learning-rate scaling, and LARS extend the range of batch sizes used successfully in the cited work. The paper acknowledges a small accuracy gap in the discussion of the largest batches and says that training for more epochs can help. That remedy changes the total work needed to train, which matters when reading a result expressed in wall-clock time. The paper treats increasing usable batch sizes as continuing work.

The communication methods come with their own constraints. The ring is efficient in its use of links but has a sequential round count that grows with participation, and a participant failure can halt the collective. Recursive halving and doubling can reduce the round count while leaving some workers out of the main exchange when the group size is irregular. Binary blocks reduce the idle-work problem but can incur substantial traffic between blocks of different sizes. For low-bandwidth or unreliable devices, the authors expect further improvements in training and communication to be necessary.

The paper also points out that mixed precision has numerical limits. Loss scaling has to preserve small values while avoiding overflow, and some operations need higher-precision accumulation. Gradient compression can similarly affect accuracy, and the threshold or representation may need to suit the workload. The survey limits some of its cited comparisons explicitly. For instance, the Adaptive Quantization result it reports comes from fully connected networks on MNIST. Its discussion of federated learning identifies slow connections and limited compute as constraints that remain even when local training has advantages.

#### Limits visible in the evidence

The strongest empirical claims belong to the cited studies and their configurations. The survey combines evidence across different architectures, worker counts, datasets, and hardware. A result about time to train on ImageNet, a percentage of timely gradient arrivals, and a compression ratio on speech recognition address different questions. There is no common experiment measuring time, network traffic, final accuracy, and recovery under failure across the complete set of recommended choices. In particular, the paper recommends combining Deep Gradient Compression and mixed precision without presenting an end-to-end comparison of that combination against the same system with each technique used separately.

The fault-tolerant All Reduce design is especially limited by the absence of an evaluation. The paper explains how a replica could assume leadership and presents replication as a way to continue an interrupted exchange. It does not measure the healthy-case cost of keeping replicas current, the time lost during an election, or the total time saved by avoiding a restart. It also leaves details of resuming a partial collective open, such as how a replacement handles a contribution that was in transit at the moment of failure. Those details bear on whether every contribution is included once and whether workers can finish an update from the same aggregate. The paper mentions several kinds of cluster failure in its discussion of stragglers, while the proposed recovery mechanism is described specifically through leader replacement.

Several numerical passages call for care. The overview gives 8,096 for the batch in the hour-long ImageNet example, while the detailed linear-scaling discussion gives 8,192. The latter is the figure used in the results discussion because it appears alongside the specifics of the run. The theoretical communication costs also use a simplified transfer accounting and set aside local reduction work. They explain how the number of exchanges changes with cluster size, but do not by themselves predict elapsed time for a particular network. Finally, the paper uses broad convergence language for synchronous SGD. The construction described in the method supports equivalence to a shared mini-batch update under its assumptions. The paper’s own discussion of divergence with large batches makes clear that the training, even when synchronized, still depends on the optimizer settings.

### What came after

The later citing work is *Flower: A Friendly Federated Learning Research Framework* (2020). Its connection is to a setting the survey identifies as an open direction. In the survey’s discussion of federated learning, training can take place on consumer devices, where limited computation and slow links put pressure on the size and frequency of exchanges. Flower addresses the framework side of federated-learning research. The citation connects that framework work to the earlier discussion of distributed training, without establishing that Flower adopted the proposed Raft-based collective or reproduced the GPU-cluster experiments. [Flower](https://md.research.elamur.ai/free/en/papers/beutel-2020-flower-friendly-federated-learning-research/)

## Cite

Cite as Karanbir Chahal, Manraj Singh Grover and Kuntal Dey. 2018. A Hitchhiker's Guide On Distributed Training of Deep Neural Networks. arXiv:1810.11787.

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

```bibtex
@misc{chahal2018hitchhiker,
  title = {{A Hitchhiker's Guide On Distributed Training of Deep Neural Networks}},
  author = {Karanbir Chahal, Manraj Singh Grover and Kuntal Dey},
  year = {2018},
  doi = {10.48550/arxiv.1810.11787},
  eprint = {1810.11787},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.1810.11787}
}
```

> 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)
