research35 min studyLesson 94 in Engineering

Communication-avoiding training

Evaluate accumulation, compression, and local updates by their effects on synchronization, numerical work, and time to a quality target.

On this page

What you’ll understand

  • Separate communication volume, message latency, and exposed critical-path time.
  • Identify when accumulation preserves an intended gradient.
  • Compare compression savings with altered convergence and added computation.

A network profile shows workers waiting while gradients synchronize. Sending fewer bytes sounds like an obvious improvement, but training is a coupled numerical process. Delaying an update changes the optimization schedule; compressing a gradient changes the update itself unless reconstruction is exact. The research question is whether a proposed reduction in communication improves completion time at the same quality and resource budget, under a topology and workload that justify the claim.

Locate the communication that is actually exposed

A collective's cost includes message startup, byte transfer, local reductions, and contention. An ideal ring all-reduce sends and receives chunks over multiple rounds. Its per-rank bytes sent approach twice the gradient buffer size as worker count grows; the same byte count is received. With simultaneous full-duplex transfer, avoid adding both directions and then dividing by a one-direction bandwidth. This is not an exact runtime formula for every algorithm or topology. Small messages can be latency dominated, while a large buffer may be bandwidth dominated or overlap with useful computation.

Exposed communication is the portion that extends the dependency graph's critical path after overlap. Removing a transfer that was completely hidden may leave step time unchanged. Measure a timeline rather than adding all kernel and collective durations, since concurrent intervals cannot be summed as elapsed time. A compression method can also consume compute resources needed for backward execution, reducing overlap. Report both measured communication bytes and total training behavior.

Tring≈2(p−1)τ+2(p−1)pGBT_{\mathrm{ring}}\approx2(p-1)\tau+\frac{2(p-1)}p\frac GB
For an ideal p-rank ring, τ is per-round startup time, G bytes is one gradient buffer, and B bytes/s is effective one-direction bandwidth with simultaneous send and receive. The bandwidth numerator counts bytes sent per rank, excluding contention, reduction work, and overlap.↔ Scroll wide equations horizontally.

Know which synchronization reduction changes the algorithm

Gradient accumulation sums contributions from several microbatches before one optimizer update. With correct normalization and compatible loss computation, it can reproduce a larger batch gradient at fixed parameters. Batch-dependent layers, stochastic operations, clipping placement, and unequal valid-token counts require care. Accumulating four microbatches is not equivalent to taking four optimizer steps: parameters and optimizer state remain unchanged between those backward passes.

Local training steps go further: each worker changes its own parameters before synchronization, so local gradients are evaluated at different states. Averaging parameters afterward generally does not equal centralized gradient descent. Statistical heterogeneity and step size affect drift. A claim of communication reduction must therefore include convergence evidence. Hold examples or tokens, quality target, and tuning budget explicit rather than comparing only synchronization counts.

gbatch=∑i=1abigi∑i=1abig_{\mathrm{batch}}=\frac{\sum_{i=1}^{a}b_i g_i}{\sum_{i=1}^{a}b_i}
Each gi is a mean gradient evaluated at the same parameters on bi equally weighted examples or valid tokens. This identity assumes additive loss and compatible per-example computation; it is not an equivalence for multiple local optimizer steps.↔ Scroll wide equations horizontally.

Compression exchanges bandwidth for approximation and work

Low-rank gradient compression represents a matrix update through thinner factors. Rank determines transmitted size and approximation quality; the useful rank depends on the gradient structure. Error feedback retains a residual so omitted information can influence later updates, but it does not make every individual compressed step exact or guarantee arbitrary training behavior. Compression needs compatible collective operations and may require extra synchronizations for its factors.

A credible comparison reports added compression time, residual memory, synchronization count, model quality, and total examples processed. Test across model layers and network regimes instead of assuming a fixed compression ratio implies a fixed speedup. If communication is already small or overlapped, the extra kernels can make the job slower. Include numerical checks for residual growth and nonfinite values, and compare time to target quality with a tuned uncompressed baseline.

Check a proposed compression speedup

Eight workers all-reduce a 2 GB gradient over an ideal full-duplex link providing an effective 25 GB/s in each direction concurrently. Ignore startup. Only 40 ms of the transfer can overlap. A proposed method reduces the bandwidth transfer by four and adds 20 ms of exposed compression work.

  1. Ideal bytes sent per rank are 2 × 7/8 × 2 = 3.5 GB, with the same amount received concurrently.

  2. Bandwidth time is 3.5/25 = 0.14 s. Subtract the measured 0.04 s overlap to estimate 0.10 s exposed.

  3. The compressed bandwidth estimate is 0.14/4 = 0.035 s. Assuming the same available overlap window, none of that transfer is exposed.

  4. Adding 0.020 s exposed compression leaves an estimated 0.080 s saving per update. Extra collectives, changed overlap, and additional updates to quality can erase it.

The result

The simplified critical-path model predicts 80 ms per update saved; validating convergence and actual overlap remains necessary.

Explore the model

Interactive lab

Interactive lab · optimization

Distinguish fewer updates from better optimization

Adjust η and x₀ for exact scalar gradient descent on f(x)=x²/2, with xₙ=(1−η)ⁿx₀ and divergence shown when η>2 leaves the plot. This illustrates update sensitivity; it does not simulate compressed gradients, local SGD, collective traffic, or a training network.

Distinguish fewer updates from better optimizationGradient descent on f(x) = x²/2: xₙ = (1 − η)ⁿx₀. Playback advances two discrete iterations per second. Values outside |x| ≤ 4 are explicitly reported. Current readings: Position x0: 2; Objective x²/2: 2; Iteration behavior: Stable step. All parameters are adjustable with the labeled controls below.−4−202402.174.356.528.7Parameter xf(x) = x²/2n = 0
ObjectiveDiscrete iterate
Position x0
2
Objective x²/2
2
Iteration behavior
Stable step
n = 0 · t = 0 s

Gradient descent on f(x) = x²/2: xₙ = (1 − η)ⁿx₀. Playback advances two discrete iterations per second. Values outside |x| ≤ 4 are explicitly reported. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forChanging an update schedule needs numerical and quality evidence as well as a communication profile.

Check your understanding

Which statement about four accumulated microbatches is generally correct?

Try it yourself

An uncompressed job takes 1,000 updates at 0.50 s/update. Compression gives 0.45 s/update but needs 1,200 updates to the same quality. Compare completion times without setup costs.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Multiply update count by elapsed update time for each job.

Compare with the solution

Uncompressed time is 500 seconds; compressed time is 540 seconds. The method is 10% faster per update yet 8% slower to the target. The communication saving does not establish an end-to-end training improvement.

Take it with you

  • Optimize exposed dependency time rather than total logged communication duration.
  • Accumulation, local updates, and compression have different mathematical effects.
  • Judge a method by time and resources to matched quality.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.