Communication Compression

A 32-billion-number update needs 20.5 seconds to cross a 25 Gbps link. Squeeze it 100 times and it needs 0.2 seconds. Try four ways to squeeze, and see what each one breaks.

Learn how a training run sends fewer bits between distant clusters: rounding numbers, keeping only the big ones, sending thin matrices, remembering what was dropped, and compressing momentum.

Pick a way to squeeze, then drag Squeeze from gentle to hard. The left grid is the update a perfect run would send. The right grid is what arrives. Then we build, piece by piece, each method, the memory trick that makes them safe, and the way they stack with rare syncing.

You need a rough idea of a gradient (the list of numbers that says how to nudge each weight) and a little arithmetic. We build the rest from zero.

Prerequisite 07 of the series Training on Compute Islands, built for the Core Automation post The Hitchhiker’s Guide to Training on Compute Islands by Rohan Anil (2 November 2026). No course slides exist for this session. It is taught from the primary papers: QSGD, Deep Gradient Compression, PowerSGD, DeMo, DisTrO and SparseLoCo; the Field Guide lists every source.

Squeeze the update

3 bits

Toy update: a 12 by 12 gradient matrix (144 numbers) built from three smooth patterns plus a little noise, fixed on every visit. The full message is counted at 16 bits per number. The time is for a 32-billion-number update (64 GB at 16 bits) on a 25 Gbps link, the scale of the Core Automation run; 64 GB is 512 billion bits, and 512 / 25 = 20.5 s. A kept number in Top-k costs its value (16 bits) plus its address (counted as 16 bits here). The last mode repeats 30 toy training steps and is explained in Chapter 4.

Chapter 0

The Bill for Every Step

Price one training update in bytes and seconds, and see why the size of the message, not the speed of the chips, decides what a slow link can do

Picture two warehouses, one in the United States and one in Asia, about 9,000 miles apart. Each holds 160 graphics chips (GPUs). They train one model together. After every step of learning, each warehouse must tell the other what it learned, so both copies of the model stay the same.

The note they send is big. The link between them is thin. In the Core Automation post that this series follows, the link carried 25 Gbps in each direction. This chapter turns that sentence into a bill, one you can read in seconds.

Bits, bytes and the width of a pipe

A bit is one yes-or-no digit, a 0 or a 1. A byte is 8 bits. Network speeds count bits: Gbps means gigabits per second, so 25 Gbps is 25 billion bits every second. Divide by 8 and you get 3.125 billion bytes (3.125 GB) per second.

Bandwidth is the width of the pipe: how many bits can pass each second. Think of a water pipe. A wide pipe fills a tank fast, and a narrow one takes a long time, however strong the pump behind it. Faster chips are a stronger pump. They do not widen the pipe.

What is in the note

A model is a long list of numbers called parameters or weights. Learning nudges each one a little. The list of nudges is called a gradient (or, when you bundle several steps, an update). It has one number per parameter. So the note is exactly as long as the model.

Each number takes some bits. A common choice is bf16, a 16-bit format, which is 2 bytes. The post’s model is a mixture of experts (see our mixture-of-experts lesson) with about 32 billion parameters in total. Here is the bill:

32 × 109 numbers × 16 bits = 512 × 109 bits = 64 GB  →  512 ÷ 25 = 20.5 s

One copy of the update takes 20.5 seconds to cross a 25 Gbps link. That ignores delays, retries and the return trip. It is the best case. Normal synchronous training does this after every step, and many steps last only a few seconds. The chips would spend most of their life waiting. The ordinary tool for sharing an update among many workers, the all-reduce, is taught in the data-parallel lesson; inside one building it is fine, because the pipes there are very wide.

Play with the bill below. Change the model size and the link, and watch how the time falls when each number uses fewer bits.

Price one update

Each bar is the time to send one full update across the link. Drag the model size, then pick a link. Watch the 16-bit bar, then the shorter bars below it.

32 billion

The 32 billion parameters and the 25 Gbps link are the post’s; the other sizes and speeds are illustrative picks. Time = parameters × bits ÷ link speed, one direction, with no delay, no overhead and no overlap with compute, so real transfers are slower.

Two numbers set the bill: how many numbers you send, and how many bits each one takes. Halve either and you halve the time. That gives three levers.

Three levers, and the danger of each

The first lever is fewer bits per number. Store each nudge in 8, 4, 2 or even 1 bit. This is quantization (Chapters 1 and 2). The second is fewer numbers: send only the nudges that matter (Chapter 3), or send a thin summary of the whole table (Chapter 5). The third is send less often: take many local steps between messages. The sibling lessons teach that one, and Chapter 8 stacks it on top of the first two.

Every squeeze here is lossy compression: what arrives is not what was sent. A picture saved as a small JPEG loses fine detail, and a gradient loses fine detail too. The compression ratio is the original size divided by the squeezed size. A ratio of 100 means one hundredth of the bytes.

The question is never “how small can it get?” It is “how small can it get before training breaks?” Three dangers wait. A squeeze can add bias: it pushes the update the same wrong way each time, so errors pile up instead of cancelling. A squeeze can lose a signal: a small but steady nudge is dropped every time and never arrives. And a squeeze can be incompatible with the all-reduce: its messages cannot be added on the way, so the cheap shared tool stops working. Each chapter names which danger it fights.

One honest note first. A compressed message must still be useful. The hero at the top shows this directly: squeeze hard, and the grid on the right stops looking like the one on the left. How much error training can bear is not a fixed number. It depends on what the optimizer does with the update, and that is why this lesson spends a full chapter on remembering what you dropped.

The road

  1. Fewer bits per number: rounding to a grid, and what 1 bit means.
  2. Rounding without bias: random rounding, and the QSGD trade-off.
  3. Fewer numbers: keep only the top-k, and pay for addresses.
  4. Remember what you dropped: error feedback.
  5. Fewer dimensions: low-rank messages and PowerSGD.
  6. Messages that add up: why all-reduce cares.
  7. Compressing momentum: DeMo and DisTrO.
  8. Squeeze plus rare syncing: SparseLoCo and the island run.
  9. Field guide: numbers, terms, checklist, code, sources.

Two traps in the units

The first trap is a capital letter. A network speed is written in bits: Gbps or Gb/s. A file size is written in bytes: GB. One byte is 8 bits, so a 25 Gbps link moves 3.125 GB each second. Mix the two and your answer is wrong by a factor of 8. In this lesson a small b always means bit, and a capital B always means byte.

The second trap is that bandwidth is not the only cost of a long link. Latency is the time for the first bit to arrive. Light in a glass fibre covers about 200,000 km each second, and 9,000 miles is about 14,500 km. So even a link of unlimited width needs roughly 72 ms one way, and about 145 ms there and back. That is a back-of-envelope floor from physics. Real routes are longer and slower.

Bandwidth answers “how long does the whole message take?” Latency answers “how long until anything starts to arrive?” A 64 GB message is ruled by bandwidth: 20.5 s dwarfs 0.145 s. A tiny message is ruled by latency. This is why, once Chapter 8 has squeezed the bytes, the post turns to tail latency, the slowest few transfers.

Hiding the bill behind the work

Suppose a step of computing takes C seconds and sending takes S seconds. If the sending can overlap the next step’s computing, the pair costs max(C, S), not C + S. When S is smaller than C, the link is hidden and the chips never wait. When S is 20 s and C is 3 s, the chips idle for 17 s out of every 20, which is 85% of the time.

That is the whole motivation. Every squeeze in this lesson is a way to push S below C, so that a thin and distant link stops being the slowest part of the job. The step time C of 3 s used in the devices is a free guess, and the lesson says so wherever it appears.

A 10-billion-parameter update is sent at 16 bits per number over a 10 Gbps link. About how long does one copy take, and what is the fastest fix that keeps the same number of parameters?

Chapter 1

Fewer Bits per Number

Round every nudge to a coarse grid, send small whole-number codes, and see how many bits a gradient can lose before it stops being useful

You are writing down heights for a friend over a phone with a very slow line. Each digit you say costs time. You can say “1.8372 metres” or just “about 1.8”. The short version costs far less, and for most purposes your friend learns the same thing.

Training messages work the same way. A gradient number such as 0.8372914 does not need seven decimal places. The next step will be noisy anyway. Quantization means storing each number on a coarse grid of allowed values, and sending only which grid point it landed on.

How a grid becomes a code

Say you allow b bits per number. A b-bit code can name 2b different things, so you can have 2b grid points. Three steps build the message.

  1. Find the scale. Take the largest size among the numbers, s = max |g|. Send it once, as one ordinary 32-bit number.
  2. Snap each number to the grid. Divide by s so every value sits between −1 and 1. Multiply by the number of steps on each side, L, and round to the nearest whole number. That whole number is the code.
  3. Rebuild on arrival. The receiver divides the code by L and multiplies by s.
q(g)
The number the receiver rebuilds. It is always one of the grid points.
s
The scale: the biggest size in the vector. It makes the grid fit the data, so the largest number lands exactly on the last grid point.
g
One gradient number before squeezing.
L
Steps on each side of zero. With b bits we use L = 2b−1 − 1, so 3 bits gives L = 3 and a grid of −3, …, 3 (seven points).

Work five numbers by hand at 3 bits, so L = 3. Let g = [0.83, −0.41, 0.07, −0.95, 0.30]. The scale is s = 0.95. One grid step is 0.95 ÷ 3 = 0.317.

0.83 → 0.83 ÷ 0.95 × 3 = 2.62 → code 3 → rebuilt 0.95 (error 0.12)
−0.41 → −1.29 → code −1 → −0.317 (error 0.09)
0.07 → 0.22 → code 0 → 0 (error 0.07)
−0.95 → −3 → code −3 → −0.95 (error 0)
0.30 → 0.95 → code 1 → 0.317 (error 0.017)

The codes are the small whole numbers 3, −1, 0, −3, 1. Each fits in 3 bits. The message is five codes plus one scale: 5 × 3 + 32 = 47 bits instead of 5 × 16 = 80. For a big vector the single scale costs almost nothing, so the ratio approaches 16 ÷ b.

Snap to the grid

Blue bars are 24 gradient numbers. The warm dots are what arrives after rounding. Faint lines are the grid. Drag the bits down and watch the dots jump onto fewer lines.

3 bits

Toy data: 24 heavy-tailed numbers (a few big, many small), fixed on every visit. Rounding is to the nearest grid point; at 1 bit each number becomes its sign times the average size, the idea behind 1-bit SGD. Error is the root mean square gap between each blue bar and its dot, as a share of the biggest number.

What the smallest grid means

Push the slider to 2 bits. Now L = 1 and the grid has three points: −s, 0 and +s. Every small number turns into 0, and only the big ones survive. At 1 bit even zero is gone: each number becomes just its sign (plus or minus), scaled by one shared size. This is the extreme case studied in 1-bit SGD (Seide and colleagues, 2014), the first row of the post’s history table that pairs 1-bit gradients with error feedback, the idea of Chapter 4.

Why does 1 bit work at all? The sign tells you which way to move. For a first rough step that is most of the message. What it loses is how far. A gradient entry of 0.9 and one of 0.01 look alike once only the sign is left.

The failure: a quiet layer goes silent

The symptom: some layers stop learning, though the loss still moves for others. The measurement: count how many codes are exactly 0. Because one biggest number sets the scale for all, a single large outlier stretches the grid, and every ordinary number rounds to 0. The device above shows it: at 2 bits, drag and see the zero share jump. The fix used in practice is to give each small block of numbers its own scale, so a loud block cannot silence a quiet one. The cost is one extra 32-bit scale per block.

There is a deeper issue. Rounding to the nearest point is biased in a quiet way: a number that sits at 0.3 of a step always rounds down, every time, so its average over many steps is 0, not 0.3. The next chapter fixes this with a coin flip.

The error of a grid, derived

How wrong is a rounded number? Rounding to the nearest grid point moves a number by at most half a step. If numbers fall anywhere inside a step with equal chance, the typical error is the step divided by √12, about 0.29 steps. This is the root mean square (RMS) of a number spread evenly across an interval, a standard result.

With a scale s and L steps each side, one step is s ÷ L. In the worked example, s = 0.95 and L = 3, so a step is 0.317 and the typical error is 0.317 ÷ 3.46 = 0.092. Each extra bit doubles L, so it halves the step and halves the error. Going from 3 to 4 bits moves L from 3 to 7 and cuts the error to 0.039. This is why the device above looks nearly exact by 6 bits: its grid has 31 steps each side.

What actually travels

Follow the data. A worker holds a gradient tensor of shape [n] in 32-bit floats. It computes the scale s (one float), then an integer code per entry in the range −L to L. A 3-bit code does not fit a normal byte. The sender packs codes together, for example 8 codes into 3 bytes. The wire carries [ceil(3n/8) bytes] plus 4 bytes for s.

The receiver reads s, unpacks the codes into integers, and computes code ÷ L × s to get a float tensor of shape [n] again. After that, training proceeds as normal. Nothing in the optimizer knows that the gradient was squeezed. This is the attraction of quantization: it is a drop-in change at the boundary between compute and network.

Packing costs a little computing time on both ends. It pays only if the network is the slow part, which on a distant link it is. On a fast link inside a building, the packing time can exceed the transfer time you saved. Always measure both.

Choosing the scale

Using the largest size as the scale is safe but fragile, as the failure above shows. Using a smaller scale, and clamping the few numbers above it, gives a finer grid for the many ordinary numbers at the price of clipping the rare big ones. Clipping is a bias too: the big numbers always come out too small. Practical systems pick between these, per block, and keep the error buffer of Chapter 4 to pay back the clipped part later.

You quantize a 1,000,000-number gradient to 4 bits with one scale for the whole vector. Roughly how much smaller is the message, and what is the main risk if one number is huge?

Chapter 2

Rounding Without Bias

Flip a weighted coin instead of always rounding to the nearest point, and see how QSGD buys back an honest average at the price of noise

A shop sells a screw for 0.3 of a cent. The till only takes whole cents. A rule says “round to the nearest cent”. Every sale rounds 0.3 down to 0. A customer who buys 1,000 screws pays nothing at all, though the true bill is 300 cents.

The shop can fix this with a coin. For each screw, charge 1 cent with probability 0.3, and 0 cents otherwise. Any single sale is wrong. But over 1,000 sales the total comes close to 300. The rounding is now unbiased: on average it is right.

The rule, in one line

Measure a number in grid steps. Say x = 2.3 steps. It sits between the grid points 2 and 3. Write ℓ for the lower point (here 2) and p for how far x is past it (here 0.3). Stochastic rounding sends the upper point with probability p, and the lower point otherwise.

E[ round(x) ]
The average result over many coin flips. The letter E means “expected value”.
ℓ
The grid point just below x.
p
How far x sits above ℓ, between 0 and 1. It is also the chance of rounding up.
ℓ + p
That is x itself. The average is exactly the true value.

Try it on the screw. ℓ = 0, p = 0.3, so the average is 0 × 0.7 + 1 × 0.3 = 0.3. Right on target. Now watch it happen. Pick a value, send it many times, and compare the two rounding rules.

Send it 400 times

The dashed line is the true value. The warm line is the running average of weighted-coin rounding. The red line is nearest rounding, which sends the same wrong answer every time. Choose a value, then press Send.

0.30

Toy: one number between the grid points 0 and 1, sent 400 times with a seeded random source, so a replay gives the same draws. Nearest rounding is red because here it fails: it stays at the wrong value however long you wait.

The coin has a price. Each single send is now either 0 or 1, never 0.3. The spread of one send is large: its variance is p(1 − p), which for p = 0.3 is 0.21 grid-steps squared. The average of W independent senders has variance 0.21 ÷ W. So noise falls as more workers contribute. Unbiased noise averages away. A bias never does.

QSGD: the same idea for a whole vector

Alistarh, Grubic, Li, Tomioka and Vojnovic gave this a name and a guarantee in 2016: QSGD, quantized stochastic gradient descent. For a gradient v with n numbers, pick s grid levels between 0 and 1. Scale every |vi| by the vector length ‖v‖2 (the square root of the sum of squares), then round it to a level by the weighted coin. Keep the sign. The paper proves three facts for this quantizer Qs:

The message is then three things: the length ‖v‖2 as a 32-bit number, the signs, and the small whole-number levels. Most levels are 0 or 1, so the paper packs them with a variable-length code, short codes for common values. The result is a dial the user turns:

The paper also proves this trade-off cannot be beaten much: a lower bound says any scheme with a constant variance blow-up must send on the order of n bits. In practice, the authors report that on 16 GPUs, QSGD trains ResNet-152 to full accuracy on ImageNet 1.8 times faster than the full-precision run.

In the Core Automation run the same idea appears in one line: the values exchanged between the two sites “were compressed with stochastic rounding plus error feedback”. Stochastic rounding keeps the average honest. Error feedback, in Chapter 4, mops up the noise that is left.

The failure: noise instead of bias

The symptom: the training loss is jumpy, or settles higher than the full-precision run. The measurement: compare the loss curve to the 16-bit curve at equal steps; the gap that stays after warm-up is the noise floor. The fix: raise the number of levels s, average over more workers, or add memory (Chapter 4). QSGD never lets the update point the wrong way on average. It only makes it shake.

A whole vector by hand

Work QSGD on the smallest interesting vector, v = (3, 4). Its length is ‖v‖2 = √(9 + 16) = 5. Divide each size by 5: 0.6 and 0.8. Use s = 2 levels, so the grid points are 0, 0.5 and 1.

The size 0.6 sits between 0.5 and 1. It is 0.1 above the lower point, out of a gap of 0.5, so p = 0.2. QSGD sends 1 with probability 0.2 and 0.5 with probability 0.8. The average is 0.5 × 0.8 + 1 × 0.2 = 0.6. The size 0.8 has p = 0.6: it sends 1 with probability 0.6 and 0.5 with probability 0.4, and the average is 0.8.

The receiver multiplies by 5 and restores the signs. So the first entry arrives as 2.5 (80% of the time) or 5 (20% of the time), and its average is 3. The second arrives as 2.5 (40%) or 5 (60%), average 4. Each draw is crude. The averages are exactly (3, 4).

Where the noise comes from

Look at what the worked example sent: 2.5 or 5, never 3 or 4. The extra variance of each entry here is p(1 − p) times the squared gap, with a gap of 0.5 × 5 = 2.5. For the first entry: 0.2 × 0.8 × 6.25 = 1.0. For the second: 0.6 × 0.4 × 6.25 = 1.5. The total extra variance is 2.5, against a squared length of 25. That is 10% of ‖v‖2, inside the paper’s bound of min(n/s2, √n/s) = min(2/4, 1.41/2) = 0.5.

The bound has a clean message. More levels s shrink the noise. And a longer vector n gives more noise in total, because every entry adds its own. That is why QSGD splits big gradients into smaller buckets, each with its own length: the noise then grows with the bucket size, not with the whole model.

Why noise is cheaper than bias

Training takes thousands of steps. Each step, an unbiased error is a random nudge in a random direction. Over many steps these nudges add up like a random walk: after N steps the drift grows like √N, not like N. A biased error pushes the same way every step, so after N steps the drift grows like N. For N = 10,000 steps that is 100 against 10,000.

Averaging helps further. Eight workers each add their own noise to the shared sum. The noise does not line up, so the average of eight has one eighth of the variance of one worker. This is why stochastic rounding scales so well to many workers: more workers means less noise per update, while the cost per worker stays flat.

Why does QSGD round with a weighted coin instead of to the nearest level?

Chapter 3

Fewer Numbers: Keep the Top-k

Send only the largest nudges together with their addresses, and learn why the addresses make the saving smaller than it first looks

A school of a thousand students sends a daily report to the head. Most days, 999 of them changed nothing worth saying. A sensible report lists only the few students whose scores moved a lot, with their names. The head learns almost everything and reads one page.

A gradient looks like this school. Most of its numbers are tiny on any one step. A few are large. Sparsification means making a vector sparse: mostly zeros. Top-k is the simplest rule. Keep the k numbers with the largest size, and drop the rest.

The message needs addresses

Here is the catch. A dense vector needs no addresses: the 5th number goes in the 5th slot. A sparse message must say which numbers it kept. Each kept number travels with its index, its position in the vector. So a kept number costs two things: its value bits and its address bits.

Work an example. A layer has n = 1,000,000 numbers. Keep 0.1%, so k = 1,000. A position in a list of a million needs about 20 bits, since 220 is just over a million. A value needs 16.

dense: 1,000,000 × 16 = 16,000,000 bits
top-k: 1,000 × (16 + 20) = 36,000 bits  →  16,000,000 ÷ 36,000 = 444 times smaller

The ratio is 444, not the 1,000 you would get by counting values only. The addresses cost more than the values. That is why real systems pack addresses cleverly. Deep Gradient Compression stores the 32-bit non-zero values together with 16-bit counts of zeros between them. SparseLoCo splits each matrix into 64 × 64 blocks and keeps the top few in each block, so an address only has to name a spot inside a block of 4,096 (12 bits), not inside the whole layer.

Keep the top-k

The bars are 64 gradient numbers, sorted from largest to smallest size. Warm bars are kept, grey bars are dropped. The yellow line shows how much of the vector’s total energy the kept bars hold. Drag k.

6 of 64

Toy data: 64 heavy-tailed numbers, fixed on every visit. Energy is the sum of squares, the usual way to say how much of a vector you kept. Cost counts 16 bits for each value and 6 bits for each address (26 = 64), against 64 × 16 for the dense vector. Real gradients are far longer, so the real saving is larger.

Why most of a gradient can go

Drag k to 6. The six biggest of the 64 numbers hold most of the energy. The long tail of small numbers adds little. Real gradients behave the same way, only more so. Lin, Han, Mao, Wang and Dally (2018) wrote in the abstract of Deep Gradient Compression (DGC): “99.9% of the gradient exchange in distributed SGD are redundant.” They sent only the largest 0.1% of values (those above a threshold) and kept the rest to send later (Chapter 4).

The results, from their abstract: gradient compression ratios from 270 to 600 times without losing accuracy. The gradient of ResNet-50 shrank from 97 MB to 0.35 MB, and the gradient of DeepSpeech from 488 MB to 0.74 MB. The authors state that this makes large-scale training possible on cheap 1 Gbps Ethernet.

It did not work by simply truncating. The paper adds four repairs: momentum correction, local gradient clipping, momentum factor masking and warm-up training. Warm-up matters most for the idea of this chapter. Early in training the gradient is far from sparse, so the paper raises sparsity step by step, 75%, 93.75%, 98.4375%, 99.6%, then 99.9%, instead of starting at the maximum.

The failure: a steady whisper never arrives

Top-k picks by size on this step. Suppose one weight needs a small push every single step, say 0.01, while another weight has a noisy gradient that swings between −1 and +1. The noisy one always wins the top-k. The quiet, steady weight is dropped on every step, and never learns.

The symptom: some parameters stay frozen near their start values while the loss plateaus. The measurement: for each parameter, count how many steps it was sent in the last 1,000. The frozen ones read zero. The fix is to stop forgetting what you drop, which is the whole of Chapter 4.

Top-k is also a biased compressor. It always removes a part of the vector, the small part, so its average is not the original. Chapter 2’s coin cannot help here, because the point of top-k is to be deterministic about who goes.

Why you cannot just truncate

Imagine the plain recipe: each step, send the top 0.1% and throw away the other 99.9%. Deep Gradient Compression’s authors tried a version of it (their Algorithm 1, which keeps the unsent part in a local sum). On CIFAR-10 it still lost more than one point of accuracy at the highest sparsity. Two things go wrong.

First, momentum. Most training uses a running average of gradients (Chapter 7 defines it fully). If you delay a gradient entry for 600 steps, its share of that running average is missing for all that time. DGC’s momentum correction fixes this by accumulating the velocity (the running average itself) locally, instead of the raw gradient, and sending from that sum. The change adds no new setting to tune.

Second, staleness. At 99.9% sparsity the paper found that most parameters were updated only every 600 to 1,000 iterations. By then the number was computed for weights that have long since moved. Momentum factor masking clears the stale momentum for the entries that were just sent, and warm-up (the sparsity schedule above) avoids the worst of it early, when gradients are large and dense.

Local clipping

Gradient clipping caps a gradient that has grown too large. Normally it happens after the sum over workers. In DGC each worker adds up gradients over many steps, so clipping must happen before adding the new gradient to the local sum. The paper scales the clipping threshold by 1 ÷ √N for N workers, the share each worker would hold if all had alike gradients. The authors report that, with momentum correction, this brought the word error rate on a speech task from 14.1% down to 12.9%.

Threshold or fixed k?

There are two ways to choose what to keep. A fixed k keeps exactly k numbers per message, so the message size is known in advance. A threshold keeps everything above a cut, so the message size varies. Fixed k is easier on a network that wants predictable timing; a threshold is cheaper to compute, since finding the exact k-th largest value takes a sort or a partial sort over every entry on every step. Real systems often estimate the cut from a sample, then keep what lands above it.

Either way, the cost of choosing is real: selection runs on the GPU on every step for every layer. It is worth it only when the link is slow. Chunking helps: SparseLoCo finds the top few inside each 64 × 64 block, a small sort that runs in parallel over all blocks.

A layer has 1,000,000 numbers at 16 bits. You keep the top 1,000 and send each with a 20-bit address. About what share of the dense bytes do you send?

Chapter 4

Remember What You Dropped

Keep a running jar of everything the compressor threw away, add it to the next message, and turn a lossy squeeze into a delayed delivery

A bank pays interest to a million customers and must round each payment down to whole cents. A lazy bank throws the fractions away. An honest bank drops the fractions into a jar. Whenever the jar holds a full cent, it pays that cent out to someone. Nothing is lost. A fraction is only paid later than it was earned.

That jar is error feedback (also called error compensation). Whatever the compressor drops this step, the worker stores in a buffer, and adds it to the next step’s gradient before compressing again. The compressor can be crude, and the buffer keeps its mistakes from piling up.

The loop, step by step

Each worker keeps a buffer e with the same shape as the gradient, starting at zero. At every step:

  1. Add. Compute a = e + g, the new gradient plus the jar.
  2. Compress. Make the message m = C(a). C is any compressor: top-k, rounding, low-rank.
  3. Refill the jar. Set e = a − m. This is exactly what C left out.
  4. Send m. The receiver applies it as if it were the gradient.
et+1
The jar after this step: everything not yet delivered.
et
The jar before this step.
gt
This step’s gradient.
C( et + gt )
The compressed message actually sent.

Worked example with top-1. Two numbers, and one step each. Step 1: g = (0.9, 0.2), e = (0, 0). So a = (0.9, 0.2). Top-1 sends (0.9, 0). The jar becomes (0, 0.2). Step 2: g = (0.1, 0.2). Now a = (0.1, 0.4). The 0.4 is larger, so top-1 sends (0, 0.4) and the jar becomes (0.1, 0). The second number was ignored for one step and arrived in full the next. Total sent for it: 0.4 = 0.2 + 0.2. Nothing was lost.

Train with and without the jar

Eight weights, seven of them need a steady push toward 1. Weight 0 is pure noise and always shouts loudest. Lower curves are better. Press Train, then change how many numbers are sent per step.

1 of 8

Toy simulation, run live in your browser with a seeded random source: loss = average of ½(w−1)² over weights 1 to 7, learning rate 0.15, weight 0 gets gradient noise of size 2.5 and the others 0.15. Not a real network. The jar sends only what the compressor kept: at 1 of 8 it sends one eighth of the numbers each step, with or without memory.

Why the delayed number still helps

Deep Gradient Compression gives a neat reading of the jar. Look at one weight. If it is sent every T steps, carrying the sum of its last T gradients, then it behaves as if that weight were trained with a batch T times bigger, and the learning rate scales to match. In the paper’s equation the T in the learning rate and the T in the batch size cancel. Delay is, for that weight, a bigger batch.

Where does the idea come from? The post’s history table lists it in the first compression row: 1-bit SGD (Seide and colleagues, 2014) used error feedback to make sign-only gradients work. Stich and colleagues analysed it in 2018 for convex problems. Karimireddy and colleagues (2019) showed that for biased compressors such as sign and top-k, error feedback is crucial for both convergence and generalisation. The PowerSGD paper reports the effect directly: on ResNet-18 trained on CIFAR-10, its rank-2 compressor reaches 94.4% test accuracy against 94.3% for plain SGD, while an unbiased rank-2 compressor without a buffer reaches only 75.9%. The authors conclude that a biased compressor with error feedback outperforms an unbiased one.

What the jar costs, and where it breaks

The jar is not free. It is one more full copy of the gradient on every worker, kept in memory. The DeMo authors call this a substantial GPU memory overhead, which is one reason they reuse the momentum buffer as the jar (Chapter 7). The jar also holds old news. A number that waits 40 steps arrives stale: it was computed for weights that have since moved.

The symptom of a bad jar: loss falls, then spikes upward, or drifts. The measurement: plot the size of the buffer over time; it should hover, not grow without bound. If it grows, the compressor is too harsh for the learning rate, so a huge backlog gets paid out at once. The fixes: raise the budget (more numbers per step), ramp the squeeze in slowly (DGC’s warm-up), clip the gradient, or let old leftovers fade. SparseLoCo does the last: its buffer decays slightly every round.

The paper SparseLoCo makes the lesson sharp. Its Figure 1 shows that bolting top-k onto DiLoCo gives poor results with and without error feedback. The buffer helps only when it is built into the optimizer in the right place (Chapter 8). A jar is a tool, not a spell.

Why it works: a telescoping sum

Add up everything that was sent. Each step, the jar obeys et+1 = et + gt − mt, where mt is the message. Rearrange: mt = et + gt − et+1. Now add steps 1 to T. The e terms cancel in pairs, like a telescope folding up:

m1 + … + mT  =  g1 + … + gT  −  eT+1   (starting from e1 = 0)

Read it in words. The total that was sent equals the total that was wanted, minus whatever is still in the jar now. The gap is never larger than one jar. If the jar stays small, the model has received nearly everything, just later. Check it on the example: wanted total for weight B is 0.2 + 0.2 = 0.4, sent total is 0.4, jar now 0. For weight A: wanted 0.9 + 0.1 = 1.0, sent 0.9, jar 0.1, and 0.9 = 1.0 − 0.1. Exactly.

Compare with top-k alone: there is no e term, and the sent total is the wanted total minus everything ever dropped. That gap grows with every step. This one line is the whole difference between a method that stalls and one that does not.

What the jar costs in precision and memory

The jar holds small differences between numbers that are both large. Store it in 16 bits and tiny leftovers can round away, which is a quiet loss. Keep it in 32-bit floats. For a 32-billion-parameter model that is 128 GB per worker in extra memory, spread across the chips that hold the model. This is real money, and it is why DeMo’s trick of reusing the momentum buffer (Chapter 7) is attractive: the memory is already paid for.

Interaction with the learning rate

A delayed number arrives with the sum of several steps inside it. If the model has since moved, applying that sum at full strength can overshoot, which is what a growing jar followed by a spike looks like. The fixes in order of use: a gentler squeeze at the start, clipping the message, a slow decay of old leftovers, and a lower learning rate. The papers differ on which they use, and all of them test against a dense run to check the gap.

With top-k alone, a weight whose gradient is small but steady is dropped every step. What does error feedback change?

Chapter 5

Fewer Dimensions: Low-Rank Messages

Replace a big table of numbers by two thin tables whose product is nearly the same, and learn how PowerSGD finds them with one cheap step

Remember the multiplication table from school. It has 12 rows and 12 columns, so 144 entries. You never memorised 144 facts. You knew two lists of 12 numbers, and each entry was one row number times one column number. 24 facts rebuilt 144 numbers.

Some gradients are like that table. Not exactly, but nearly. If a table is nearly the product of a thin pair, we can send the thin pair.

Matrices, rank and the thin pair

A matrix is a grid of numbers with n rows and m columns. Most weights in a transformer live in matrices, and so do their gradients. Take a column list p with n numbers and a row list q with m numbers. Their outer product is the n × m grid whose entry in row i, column j is pi × qj. A grid made this way has rank 1. Add r such grids and you have rank at most r.

Stack the r column lists side by side and call the result P (shape n × r). Do the same for the row lists and call it Q (shape m × r). Then the grid is P QT, where the small T flips Q on its side. Instead of the n × m grid, send P and Q.

message size: r × (n + m) numbers, against n × m for the full grid
n = m = 4,096, r = 4: 4 × 8,192 = 32,768 numbers vs 16,777,216  →  512 times smaller

The saving grows with the size of the matrix. Bigger layers compress better. The error is the part of the grid that no rank-r pair can reach, and for gradients that part is often small, because their singular values (the strengths of the rank-1 pieces) fall off fast. The PowerSGD authors note exactly this decay as the reason a rank-based scheme can work.

Send two thin matrices

Left: the full 12 by 12 gradient. Right: what PowerSGD rebuilds from P and Q. Pick a method, set the rank, then press Next step to let the gradient drift and see whether a warm start keeps up.

2

Toy: a 12 by 12 matrix with a fast-falling spectrum plus small noise; Next step blends in 8% of a fresh draw. “Best fit” finds the true top-r pieces by many power iterations and costs a lot in real use. The one-step methods do what PowerSGD does: P = MQ, orthogonalise P, Q = MTP. Errors are relative to the size of the matrix. Cost counts r × 24 numbers against 144.

PowerSGD: one cheap step instead of a full decomposition

How do we find a good P and Q? The textbook answer is the singular value decomposition (SVD), which gives the best possible pair. It is far too slow to run on every layer on every step. Vogels, Karimireddy and Jaggi (2019) use power iteration instead, and only one round of it:

  1. Multiply. P = M Q, with Q an m × r table. P has shape n × r.
  2. Tidy. Orthogonalise P: make its r columns unit length and at right angles to each other. The paper uses the Gram-Schmidt procedure, since r is only 1 to 4. Call the result P̂.
  3. Multiply back. Q = MT P̂. Q has shape m × r.
  4. Rebuild. The receiver forms P̂ QT.

Where does Q come from at step 1? From a random normal draw. And at every later step? From the previous step. This is the warm start. The gradient changes only a little between steps, so last step’s Q is a good guess for this step’s. The paper reports that with a warm start, a single iteration matches the best rank-r approximation. In Table 2 (ResNet-18, CIFAR-10, rank 2): best approximation 94.4%, warm start 94.4%, no warm start 94.0%. Try it above: Reset, then press Next step a few times in the warm mode and watch the error approach the best fit.

The numbers from the paper

On ResNet-18 trained on CIFAR-10 (Table 3), plain SGD reached 94.3% test accuracy and sent 1,023 MB per epoch, at 312 ms per batch. Rank-1 PowerSGD reached 93.6% with 4 MB per epoch and 229 ms per batch (26% faster). Rank-2 reached 94.4% with 8 MB and 239 ms per batch (23% faster). That is 1,023 MB down to 8 MB, about 128 times less, with equal accuracy. The authors add that theirs was the only method they tested that gave consistent wall-clock speedups against plain SGD run with well-tuned off-the-shelf communication tools.

Not every tensor is a matrix. Biases are plain vectors, and PowerSGD sends those uncompressed because they are a tiny share of the parameters. Convolution kernels are flattened into matrices first.

The failure: rank too low

The symptom: accuracy lands a point or two below the baseline, as rank-1 does above (93.6% against 94.3%). The measurement: the relative error of P̂QT against M, per layer. The fix: raise the rank for the layers with the slowest singular-value decay, and always keep error feedback (Chapter 4). The PowerSGD algorithm includes error feedback, and Table 1 shows what happens without a good scheme: the unbiased rank-2 alternative falls to 75.9%.

One step by hand

Take a small matrix that is exactly rank 1. Let the column list be u = (1, 2, 2) and the row list v = (2, 1, 2). The matrix M has entry ui × vj in row i, column j, so its rows are (2, 1, 2), (4, 2, 4) and (4, 2, 4). Start with Q = (1, 1, 1)T, a column of ones.

Multiply. P = M Q. The product M Q = u (v · Q) = u × 5 = (5, 10, 10). Tidy. Its length is √(25 + 100 + 100) = 15, so P̂ = (1/3, 2/3, 2/3). Multiply back. Q = MT P̂ = v (u · P̂) = v × 3 = (6, 3, 6). Rebuild. The entry in row 1, column 1 is (1/3) × 6 = 2. That is exactly u1 v1 = 2. Every other entry matches too.

One step recovered a rank-1 matrix exactly, from a poor guess for Q. The only way it fails is if Q is at right angles to v, so that v · Q = 0. A random Q is almost never that unlucky. For a matrix that is only nearly rank 1, the step gives a close copy, and a second step would improve it. The multiplication M Q stretches Q most along the directions where M is strongest, so the strongest direction wins.

Why the warm start works

Between two training steps the gradient matrix changes only a little, so its strongest directions barely move. Last step’s Q is therefore already close to the answer. Each new step refines it, the same way a second power step would. After a few steps the refinement is as good as many iterations from a cold start. You pay for one multiplication pair per step, and you get the quality of several.

The cost of the compression itself matters too. The two multiplications are each about n × m × r operations, and the Gram-Schmidt step is on an n × r matrix, which is tiny for r between 1 and 4. The paper says the orthogonalisation is the most expensive part of compression, and still cheap.

Why every worker must share Q

The linearity trick needs the same Q on every worker. That is automatic here: Q starts from a shared random seed, then each step it is the all-reduced result of the previous step, which every worker holds. Nobody has to send Q on its own. The only things on the wire are the two small all-reduces per matrix. A model has many matrices, so these small messages are batched together to avoid paying the link’s latency hundreds of times.

A gradient matrix is 4,096 × 4,096. You send P (4,096 × 4) and Q (4,096 × 4). How many numbers is that against the full matrix?

Chapter 6

Messages That Add Up

See why a squeezed message must be addable without unpacking it, and why sparse messages from many workers quietly grow back

Eight friends each hold a list of numbers. They want the total list, the sum of all eight. The slow way: everyone sends their list to everyone else, and each friend adds eight lists alone. The quick way: friends pair up and add. Then the four results pair up and add. Then two. Three rounds, and the total is done. Each round the lists stay the same length.

The quick way is the idea behind the all-reduce that the data-parallel lesson explains. Its cost grows like the logarithm of the number of workers W: doubling the friends adds one round. The slow way is a gather (everyone collects everyone’s message), and its cost grows with W. The PowerSGD paper states it plainly: all-reduce time scales as O(log W), while all-gather scales as O(W).

The test: can you add before you unpack?

The quick way has a condition. It only works if the partial sums stay as small as the originals. A linear compressor meets it: compress(A) + compress(B) equals compress(A + B). You can add the squeezed messages directly, and the result is the squeezed sum. Nobody needs to unpack anything in the middle.

Low-rank is linear. Take the PowerSGD step P = M Q. If every worker uses the same Q, then (M1 + M2)Q = M1Q + M2Q. So workers can all-reduce P, orthogonalise the averaged result, then all-reduce Q. That is why Algorithm 1 in the paper has two ALLREDUCE lines and no gather. Message size stays n × r and m × r, whatever W is.

Rounding to a grid is not, in general. Two workers with different scales s1 and s2 use different grids, so their small whole-number codes cannot be added: 3 on one grid is not 3 on the other. The messages must be unpacked first, or gathered. Top-k is not linear either, for a plain reason: different workers keep different positions.

Add the workers

Each worker has a 64 by 64 gradient (4,096 numbers). Bars show how many numbers the summed message holds. Drag the worker count up, then change how alike the workers’ gradients are.

8
30%

Toy simulation with a seeded random source. Each worker keeps its top 128 of 4,096 numbers (3.1%) from a gradient made of a shared pattern times the alikeness plus its own noise. A sparse number travels with its address, so it counts as two numbers on the wire. Low-rank is rank 4: P and Q hold 4 × 64 each, 512 numbers. Worker counts run 2, 4, 8, 16, 32, 64.

Look at the middle bar. One worker’s sparse message holds 128 numbers and their addresses, 256 values on the wire. When two workers add their messages, the result holds the union of their positions, which is bigger. By 64 workers who disagree about what matters, the sum has spread over almost every position, and the sparse message has grown larger than the dense one it was meant to beat. Alike gradients overlap, so the union stays small. Real workers on different data shards are often only partly alike.

Where this bites, and where it does not

The symptom: step time rises as you add workers, though each worker sends the same number of bytes. The measurement: bytes arriving at one node per step, plotted against W. For a gather, that line is straight: each node receives W − 1 messages. DeMo’s authors note that download bandwidth scales with the number of workers. DisTrO’s preliminary report does the same sum: with 32 nodes, a node sends 2.8 MB per step and receives 31 times that, 86.8 MB.

The fixes: use a linear compressor (low-rank with a shared Q); make workers agree on the positions to send; or use a parameter server that gathers once. The server route has its own cost, named in the PowerSGD paper: both directions, clients to server and back, would have to be compressed, which compresses twice. Merging compression and aggregation in one all-reduce avoids that.

And here is a point for this series. With only two sites, as in the Core Automation run, a gather is easy: each site sends its message to the one other site, and a union of two sets is not much bigger than either. The linearity problem is a problem of many workers. Large groups, like the pairs of the butterfly mixing in the post, avoid it another way: they never ask for a global sum.

How fast the union grows: a worked sum

Suppose each of W workers keeps a random 3.125% of 4,096 positions (128 of them), chosen independently. The chance that one given position is missed by one worker is 1 − 0.03125 = 0.96875. The chance it is missed by all W workers is 0.96875W. So the share of positions covered by the union is 1 − 0.96875W.

For W = 8: 0.968758 = 0.777, so the union covers 22.3% of positions, about 913 of 4,096. For W = 64: 0.9687564 = 0.131, so the union covers 86.9%, about 3,560 positions. These match the device’s numbers when you set the workers to be completely unalike. In the sparse format, each position needs a value and an address, so 3,560 positions are 7,120 numbers on the wire, against 4,096 for the dense vector.

When does sparse become worse than dense? When twice the union exceeds the full length, so the union passes half of all positions. Solve 1 − 0.96875W = 0.5: W = ln 0.5 ÷ ln 0.96875 = 21.8. With independent choices, 22 workers is the break-even. Past that, the “compressed” sum is the larger message. Real gradients are partly alike, which pushes the break-even higher, but it never disappears.

Making sparse messages add up

There are three ways out. The first is to agree on positions in advance. If every worker uses the same random mask of positions for a step (generated from a shared seed), the union is just the mask, and the sum stays at k entries. The cost is that the positions are random, not the largest, so quality drops unless the jar catches the rest.

The second is to go through a server or a tree that re-compresses at each hop. This keeps messages small but compresses the same information more than once, and each round adds error. The PowerSGD paper names this double compression as the reason to prefer all-reduce.

The third is to accept the gather and keep the group small. DeMo and DisTrO do this. It is fine for a handful of sites. It is not fine for thousands of workers, and that is one reason the island setting, with few big sites, suits them.

Why can PowerSGD use all-reduce while per-worker top-k usually cannot?

Chapter 7

Compressing Momentum: DeMo and DisTrO

Send a few waves of the optimizer’s own memory instead of raw gradients, and let that memory double as the error jar

You push a heavy swing. It does not follow your hand exactly. It keeps swinging between pushes, smoothing out your jerks. That smoothing is momentum. In training, the optimizer keeps a buffer M, the same shape as the gradient, and updates it each step as M = βM + G. The factor β (say 0.9) says how much of the old swing remains. Many optimizers carry such a buffer.

Standard data-parallel training all-reduces the raw gradients every step, then lets each worker update its own momentum from the averaged result. DeMo, Decoupled Momentum Optimization (Peng, Chen, Su, Quesnelle, Kingma and Liu), turns that around. It has three moves, stated in its abstract.

Three moves

  1. Decouple. Skip the global all-reduce of gradients. Each worker builds its own momentum from its own gradients, and the buffers drift apart on purpose.
  2. Transform, then top-k. Cut the momentum into chunks (the paper uses 64 × 64 blocks). Move each chunk into the frequency domain with the discrete cosine transform, and keep only the k largest coefficients. Send those.
  3. Subtract what was sent. Remove the sent part from the local momentum. What stays in the buffer is the jar of Chapter 4. The momentum doubles as the error memory, so no second buffer is needed.

What the cosine transform does

A row of 64 numbers can be written as a sum of 64 smooth cosine waves: one that does not change at all, one with a single slow hump, one with two, and so on up to a fast zigzag. The discrete cosine transform (DCT) finds how much of each wave the row contains. Those amounts are the coefficients. It loses nothing: 64 numbers in, 64 coefficients out, and the inverse transform rebuilds the row exactly.

The gain is where the energy lands. A smooth row has almost all of its energy in the first few slow waves. Keeping only those few coefficients gives a good copy. This is the same trick that makes JPEG pictures small. The paper does not claim the DCT is magic. It reports that the DCT clearly beats no transform, and that a random orthonormal projection does marginally better but costs more to compute.

Pick in which space?

Top: the chunk (blue), what arrives (warm) and the part left in the buffer (purple). Bottom: its cosine coefficients, with the kept ones in warm. Switch where top-k picks, then drag k. Try both signals.

4 of 64

Toy: one row of 64 numbers (the paper cuts a tensor into 64 by 64 chunks and uses a 2-D transform). The smooth chunk is three slow waves plus noise; the spiky one is five sharp spikes. The transform is the orthonormal DCT-II, so the reconstruction error equals the energy of the dropped coefficients. Each kept number would also carry an address.

Switch to the spiky signal. Now the plain top-k wins: sharp spikes are not slow waves, so the DCT spreads each spike over many coefficients. The transform only helps when the data is smooth in the way the transform expects. DeMo bets that momentum, summed over many steps, is.

The loop

Algorithm 1 of the paper, in plain steps. On every worker: compute the gradient on your own batch. Update your own momentum. For every chunk, take the top-k DCT coefficients Q, and subtract their inverse transform from the momentum. Send Q. After the exchange, rebuild and sum the chunks from all workers, and apply the sign of that sum as the update: X = X − η sgn(M) + weight decay. The output is a direction, not a size, so the scale of the compressed message matters less.

Because each chunk is 4,096 numbers and each worker sends k of them, the upload shrinks by about 4,096 ÷ k. The paper reports per-GPU traffic after 100 billion tokens of pretraining (its Table 1):

ModelOptimizerMB sent per stepAgainst AdamW
OLMo 300MAdamW with DDP636.91 times
OLMo 300MDeMo, k = 87.4985 times less
OLMo 300MDeMo, k = 10.93about 685 times less
OLMo 1BAdamW with DDP2,416.61 times
OLMo 1BDeMo, k = 1655.1644 times less

The authors report matching or better scores on HellaSwag, ARC-Easy and PIQA than AdamW at these settings, and that even k = 2 trained better than AdamW in their loss curves. At 1B parameters k = 16 gave HellaSwag 0.47 against 0.43 for AdamW. Treat that as one paper’s result on two small models. The same SparseLoCo paper that you meet in Chapter 8 compares DeMo on its own setup and finds it behind (Table 1 there: DeMo loss 2.83 at 0.78% density, against 2.69 for AdamW DDP).

DisTrO: the report that came first

The Nous Research group published A Preliminary Report on DisTrO before DeMo. It claims a family of optimizers that cut inter-GPU communication by four to five orders of magnitude. Its one real experiment: a 1.2B model pretrained on about 105 billion tokens on 32 H100 GPUs. The report’s bandwidth table:

All-reduce + AdamW: 74.4 GB received per step, 17.1 h, final loss 2.449
DisTrO + AdamW: 86.8 MB received per step, 19.8 h, final loss 2.373  →  857 times less

Read it with care. It is labelled preliminary, it is one run, and the report does not describe the method: the authors say a full paper is in progress and that they “do not fully understand the theory” behind the result. The run also took longer, 19.8 hours against 17.1. The post lists DisTrO and DeMo as one line of work that compresses momentum in a transformed representation. DeMo is the open, written-out member of that line. What both teach is the central claim of this chapter: a lot of what a normal run sends each step is redundant.

The failure here is the failure of every sparse scheme: the 85 times saving counts only upload. Download scales with the number of workers (Chapter 6). The DeMo authors say so themselves, and DisTrO’s own sum is 2.8 MB sent against 86.8 MB received.

A cosine transform by hand

Take four numbers on a straight ramp: x = (1, 2, 3, 4). Their energy, the sum of squares, is 1 + 4 + 9 + 16 = 30. The orthonormal DCT of four numbers gives the coefficients (5.00, −2.23, 0.00, −0.16). Square and add them: 25 + 4.97 + 0 + 0.03 = 30. The transform keeps the energy; it only moves it around.

Now see where it landed. The first coefficient (the average level) holds 25 of the 30. The second (one slow wave) holds 4.97. Together they hold 99.9% of the energy. Keep only those two numbers, and the rebuilt ramp is within a rounding error of the original. In the raw domain, the four numbers are all about the same size, and dropping any two would hurt. In the cosine domain, two of the four are nearly zero. That is the entire reason to transform first.

Why decoupled momentum is allowed

Normal training sums the gradients over workers, then updates momentum once. DeMo updates momentum on each worker from its own gradient. Do these agree? The update is linear: M = βM + G. If worker 1 keeps M1 from its gradients and worker 2 keeps M2, then M1 + M2 equals the momentum you would have built from the summed gradients G1 + G2, provided both start from zero and use the same β. The paper notes that aggregating gradients or aggregating momenta is theoretically equivalent for this reason.

So the sum of local momenta is the right quantity. The saving comes from how it is sent: not all at once as a dense tensor, but a few cosine waves per step, with the rest kept back by subtraction and sent in later steps. The buffers on different workers hold different leftovers, so they drift apart on purpose, and the sent parts keep the total consistent.

Why the sign

The last step applies the sign of the aggregated momentum, not its size. A sign update uses only the direction of each entry. This pairs well with a lossy message: whatever scale error crept in, the sign is robust to it, and the learning rate sets the step size. It also means the update is a clean −1 or +1 per weight, which the optimizer scales with η and weight decay λ. The paper builds DeMo as a replacement for momentum-based optimizers of this kind, and it names Signum and Muon, with SGD with momentum, as the targets.

In DeMo, what plays the role of the error-feedback jar?

Chapter 8

Squeeze Plus Rare Syncing: SparseLoCo and the Island Run

Stack the three levers (fewer bits, fewer numbers, fewer messages), read the paper’s traffic table, and see what is left to worry about when the bytes stop mattering

A small business posts a parcel once a week instead of a letter every day. It also uses a thin envelope and writes only the changes. Each lever helps. Together they multiply. This chapter multiplies them.

The missing piece: send less often

Chapters 1 to 7 cut the size of each message. The other lever cuts how many messages there are. In local SGD and its descendant DiLoCo, each site takes H ordinary steps on its own, without talking. Then it sends one message, and the sites combine. The change in the parameters over those H local steps is called a pseudo-gradient: it plays the role of a gradient, but it summarises H steps. A separate outer optimizer applies the average pseudo-gradient to the shared model. The sibling lessons in this series teach both ideas. What matters here is a fact the post states: a standard DiLoCo message is still a dense, model-sized pseudo-gradient. Sending it every H steps cuts the count but not the size.

SparseLoCo: compress the pseudo-gradient

Sarfi, Thérien, Lidin and Belilovsky (SparseLoCo, 2025) compress that parcel. Their recipe, from Section 3.3 of the paper:

  1. Locally, train H steps. Form the pseudo-gradient Δ = (parameters before) − (parameters after).
  2. Add the jar. a = βe + Δ, where e is the error buffer of Chapter 4 and β lets old leftovers fade a little.
  3. Top-k inside chunks. Cut each matrix into 64 × 64 blocks and each vector into runs of 4,096. Keep the top few numbers in each chunk. Then quantize the kept values to 2 bits.
  4. Refill the jar, e = a − (what was sent), and send.
  5. Average and apply. The sites average the messages and move the model by that.

One design choice is the point of the paper. The error buffer replaces the outer momentum of DiLoCo. The jar and the memory are the same object. The paper’s Figure 1 shows why that matters: a naive DiLoCo plus top-k does badly with or without a buffer, while SparseLoCo reaches 97 to 99% sparsity and still beats dense DiLoCo on final loss. With the jar built into the optimizer, the 2-bit rounding of Chapter 2 also stops hurting, because the buffer absorbs it.

The paper’s own Table 1 compares methods on a 512M-parameter model, 10 billion training tokens, R = 8 replicas and H = 15 local steps. The last column is our arithmetic: message size times the number of syncs.

MethodDensityFinal lossSize per syncSyncsTotal sent
AdamW DDP100%2.691.02 GB2,4452,494 GB
DiLoCo, H = 15100%2.76512.40 MB16383.5 GB
DeMo0.78%2.8310.01 MB2,44524.5 GB
SparseLoCo, H = 150.78%2.795.45 MB1630.89 GB
SparseLoCo, H = 153.12%2.7017.21 MB1632.81 GB

Read down the last column. SparseLoCo at 3.12% density finishes at a loss of 2.70, about the same as dense DDP at 2.69, and sends 2.81 GB over the whole run against 2,494 GB: roughly 890 times less. At 0.78% it sends about 2,800 times less and ends at 2.79, a small loss gap. Two levers produced those numbers. Each message is smaller: 17.21 MB against DiLoCo’s dense 512.40 MB is about 30 times less per sync. And there are 15 times fewer syncs than in DDP, which syncs every step.

Stack the savings

A 32-billion-number model on a 25 Gbps link. The bar is the average bandwidth the run asks of the link. The line is the link. Drag the sync interval, then pick density and bits per kept number.

50
3 s

Illustrative arithmetic, not a measurement. The model size (32 billion) and the link (25 Gbps) are the post’s; the seconds per step are a free guess. A kept number costs its value bits plus about 8 bits of address; at 100% density no address is needed. The 8 bits is a rough stand-in: it lands within about 16% of the SparseLoCo table’s 5.45 MB and 17.21 MB messages. Bandwidth demand = bits per sync divided by (local steps times seconds per step), averaged over the window. It ignores overlap and delay.

What the island run actually did

The post reports its own recipe in four lines, and each one is a chapter of this lesson. Sites “exchanged updates on a 50-step schedule”. They synced the model “fragment by fragment, staggered across each 50-step window”. “Exchanged values were compressed with stochastic rounding plus error feedback” (Chapters 2 and 4). And a late update “can still be committed”, so the delayed delivery of the jar is built in. The post does not publish a compression ratio, so we do not guess one. It reports a loss of about 0.2525 bits per byte for the two-site run against 0.2549 for standard training at the same compute.

Now play the device with the post’s numbers: H = 50, 1% density, 2 bits. The demand falls to a few tens of megabits per second on a 25 Gbps link. At that point the byte count is no longer the problem. The post says as much, in a different place: it “rewrote the networking layer to focus on completion time of each update” and optimized “directly for tail latency”. A message that is small but arrives late still stalls a site. After the squeeze, waiting is the new bill.

The failure of stacking is a quiet gap. The symptom: the final loss ends a little above the dense baseline, and the gap grows with H and with sparsity. The measurement: always run a dense baseline at the same compute (the post does: “at the same compute”). The fix: raise density or lower H until the gap is acceptable. The device cannot show quality, which only a training run can; it shows what each choice does to the bytes.

The outer step in symbols

Δ
The pseudo-gradient: how far the parameters moved over the H local steps. It is model-sized.
a
The pseudo-gradient plus the faded jar. β is a decay a little under 1.
m
The message: top-k inside each chunk, then the kept values rounded to 2 bits (the function Q).

Every site does this in parallel. Then the sites average their messages into one update and move the model by it, with a step size α. This is the whole algorithm. It is Chapter 4’s jar, Chapter 3’s top-k and Chapter 2’s rounding, applied once every H steps to the change in the weights.

What an address costs at scale

The table has a hidden fact. At 0.78% density, a 512M model keeps about 4.0 million numbers, and the message is 5.45 MB, which is 43.6 million bits. That is 10.9 bits per kept number: a 2-bit value and about 9 bits of address. At 3.12% density, about 16.0 million numbers sit in 17.21 MB, which is 8.6 bits each. The address gets cheaper per number as the kept share grows, because a denser pattern needs less to say where the numbers are. Chunking keeps the address small too: inside a block of 4,096 positions, a position fits in 12 bits.

This is why the device’s fixed 8-bit address is only a rough stand-in. It lands within 16% of the two table rows, which is good enough to show the order of magnitude and not good enough to size a real network.

What a late update means

The post lets a late update “still be committed”. In terms of this lesson: the message for window t may arrive after the site has already started window t + 1. The jar already guarantees that nothing is lost, only delayed, so a late message is safe to apply when it comes. It is stale in the sense of Chapter 4, and the fewer steps it is late by, the less it hurts. In the post’s separate eight-cell butterfly experiment, a cell blended its partner’s result into its training weights at equal weight, two steps after sending. That is a different run from the two-site one, and a design choice we cannot judge from the post alone.

A site syncs every 50 steps, sends 1% of its numbers, and uses 10 bits per kept number instead of 16 bits per number. About how many times fewer bits does it send per step than a dense 16-bit message every step?

Chapter 9

Field Guide: Send Fewer Bits

Keep the numbers, the terms, a checklist, the core code, and the sources on one page

A training run can shrink its messages in three ways. It can round each number to fewer bits. It can send fewer numbers: the biggest ones, or a thin pair of matrices. And it can compress momentum itself. Two ideas make these safe: rounding by a weighted coin keeps the average honest, and a buffer of leftovers turns a dropped number into a late one. Together with rare syncing, they cut a run’s traffic by three orders of magnitude on the papers’ tests. What remains is waiting.

The numbers, with their sources

FactValueSource
One 32B-number update at 16 bits64 GB; 20.5 s on 25 Gbpsour arithmetic from the post
QSGD, gentle endat most 2.8n + 32 bits vs 32n; variance x2; about 5.7 times less dataQSGD, Sec 1
QSGD on ResNet-152, 16 GPUs1.8 times faster to full accuracyQSGD abstract
Deep Gradient Compression270 to 600 times; ResNet-50 97 MB to 0.35 MB; DeepSpeech 488 MB to 0.74 MBDGC abstract
DGC warm-up sparsity75%, 93.75%, 98.4375%, 99.6%, 99.9%DGC, warm-up training
PowerSGD, ResNet-18 CIFAR-10SGD 94.3%, 1,023 MB per epoch; rank 2 94.4%, 8 MB; rank 1 93.6%, 4 MBPowerSGD, Table 3
PowerSGD without error feedbackunbiased rank 2 reaches 75.9%PowerSGD, Table 1
DeMo uploadabout 4,096 ÷ k per 64 × 64 chunk; 300M model 636.9 to 7.49 MB (k = 8)DeMo, Table 1
DisTrO preliminary run74.4 GB to 86.8 MB per step (857 times); 17.1 h vs 19.8 hDisTrO report
SparseLoCo, 512M model0.78% density: 5.45 MB, loss 2.79; 3.12%: 17.21 MB, loss 2.70; DDP 1.02 GB, 2.69SparseLoCo, Table 1
The island runsync every 50 steps; 0.2525 vs 0.2549 bits per bytethe Core Automation post

The terms

TermPlain meaningChapter
Bandwidth, GbpsHow many billion bits a link moves each second.0
QuantizationStore each number on a coarse grid, send small whole-number codes.1
Stochastic roundingRound up with probability equal to the fraction. Right on average.2
Unbiased / biasedUnbiased: correct on average. Biased: pushed the same wrong way each time.2
Top-k, sparsificationKeep the k largest numbers, drop the rest; send addresses too.3
Error feedbackKeep what was dropped in a buffer and add it to the next message.4
StaleComputed for weights that have since moved.4
Rank, low-rankHow many outer products make up a matrix; low rank means few.5
Power iteration, warm startA cheap way to find the main directions; start from last step’s answer.5
Linear compressorcompress(A) + compress(B) = compress(A + B); allows all-reduce.6
GatherEveryone collects everyone’s message; cost grows with workers.6
MomentumThe optimizer’s running average of gradients.7
DCTRewrites numbers as a sum of cosine waves; smooth data needs few.7
Pseudo-gradientThe parameter change over H local steps, used like a gradient.8
Outer optimizerThe rule that applies the averaged pseudo-gradient to the shared model.8

A checklist before you compress

  1. Price it. Bytes per sync, divided by the link. If it already fits, do not compress.
  2. Pick the compressor for the topology. Many workers and all-reduce: a linear one (low-rank with a shared Q). Two sites: any compressor works with a gather.
  3. Keep a jar. Any biased compressor (top-k, sign, low-rank) needs error feedback. Budget one extra copy of the gradient.
  4. Ramp the squeeze. Start gentle and tighten, as DGC does with its warm-up.
  5. Watch the buffer. Its size should hover. If it grows, the squeeze is too hard.
  6. Compare to a dense run at equal compute. The gap is the true price.
  7. Then measure tail latency, not only bytes.

The core as code

This is a sketch for one tensor on one worker, using NumPy. Shapes are in the comments. The two all_reduce_mean calls mark where PowerSGD talks to other workers.

python
import numpy as np

def stochastic_round(x, scale, levels):            # x: (n,) float; unbiased, QSGD-style
    y   = np.abs(x) / scale * levels                  # in [0, levels]
    low = np.floor(y)
    up  = np.random.rand(*x.shape) < (y - low)        # round up with prob = fraction
    return np.sign(x) * (low + up) / levels * scale     # what the receiver rebuilds

def topk(a, k):                                      # a: (n,) -> same shape, k entries kept
    idx = np.argpartition(np.abs(a), -k)[-k:]
    out = np.zeros_like(a); out[idx] = a[idx]
    return out

class ErrorFeedback:
    def __init__(self, shape): self.e = np.zeros(shape)   # the jar, same shape as the gradient
    def step(self, g, compress):
        a = self.e + g                                # add the jar
        m = compress(a)                               # the message that is sent
        self.e = a - m                                # refill the jar with what was dropped
        return m

def powersgd_step(M, Q):                             # M: (n, m) gradient; Q: (m, r), reused each step
    P = M @ Q                                         # (n, r)
    P = all_reduce_mean(P)                            # sum of thin matrices = thin matrix of the sum
    P, _ = np.linalg.qr(P)                            # orthonormal columns (the paper uses Gram-Schmidt)
    Q = M.T @ P                                       # (m, r)
    Q = all_reduce_mean(Q)
    return P @ Q.T, Q                                  # (n, m) rebuild, and the warm start for next step

Read it line by line. stochastic_round is Chapter 2, topk is Chapter 3, ErrorFeedback is Chapter 4 and wraps either of them, and powersgd_step is Chapter 5, with the linearity of Chapter 6 in the two reduce calls. In PowerSGD the buffer wraps the whole step: the input M is the gradient plus the jar, and the jar becomes M minus the rebuild.

Where this sits

Compression is one of four old lines of work behind low-communication training, in the post’s own list: local updates, compression, gossip, and fault-tolerant averaging. This lesson covered the second. The first and the third meet it in the final lesson of the series, Training on Compute Islands, where the island run is rebuilt from the parts. For the machinery underneath, see data parallelism and all-reduce and the parallelism zoo.

Keep going

Sources

No course slides exist for this session. Everything here is re-taught in our own words and devices, with toy numbers labelled as toy. The credit for the ideas belongs to the papers’ authors and to the Core Automation post that gathered them.

The takeaway. A slow link prices every message in seconds, so shrink the message three ways: fewer bits, fewer numbers, fewer dimensions. Make the rounding unbiased, keep a jar for everything dropped, and choose compressors that add up. Then stack them with rare syncing. After that the bytes stop being the bottleneck, and waiting is.
You must pick a compressor for 64 workers using all-reduce, with one extra buffer allowed. Which choice follows this lesson?

Open Teach and explain, from memory, how one number travels from a gradient to the other site and back: how it is rounded, whether it is kept, where the leftover goes. Then go back to the grids at the top, pick Top-k with memory, and say why the right-hand grid looks better with the jar than without.

Compute Islands, prerequisite 07: Communication Compression
The Core Automation post · QSGD · Deep Gradient Compression · PowerSGD · DeMo · SparseLoCo · Back to the series