PowerSGD

PowerSGD sends two thin matrices instead of every gradient number. On ResNet-18, rank 2 sends 136 times less data per epoch, runs 23% faster per batch, and still reaches 94.4% test accuracy.

Learn how a training run squeezes a gradient through a slow network link. The gradient is the list of numbers that says how to change a model. Learn why the squeezed version still trains as well.

Pick a task, then press the ranks one by one. Watch the data sent, the time per batch and the accuracy move together. Then we build every part of the trick, piece by piece: how workers add up numbers, why most squeezing methods break that, what a low-rank matrix is, and the one step of arithmetic that finds it.

You need a rough idea of what a neural network is and what a matrix is (a grid of numbers with rows and columns). We build the rest from zero.

Paper: Thijs Vogels, Sai Praneeth Karimireddy and Martin Jaggi (EPFL), PowerSGD: Practical Low-Rank Gradient Compression for Distributed Optimization, NeurIPS 2019; authors’ code. Every idea is re-taught here in our own words and devices. It is read for the Core Automation post The Hitchhiker’s Guide to Training on Compute Islands (Rohan Anil, 2 November 2026), and it builds on the lesson on communication compression.

Squeeze the gradient

Paper numbers: Table 3 (16 workers, 10 Gbit/s network, NCCL; ResNet-18 on CIFAR10 and an LSTM on WikiText-2). The top bar is exact arithmetic on the largest layer: r(n + m) numbers instead of n × m, for the 512 × 4608 convolution and the 28869 × 650 embedding of the paper’s Tables 10 and 11.

Chapter 0

The Gradient Is a Bandwidth Problem

See why sharing a gradient across machines is the slow part of training, and what the paper does about it

Picture sixteen graphics chips (GPUs) training one network together. Each chip holds a full copy of the model. Each chip reads its own slice of the data, called a mini-batch. After every slice, all sixteen copies must change in exactly the same way. If they do not, the copies drift apart and stop being one model.

The change comes from the gradient. It holds one number for every weight in the network. Each number says which way to nudge that weight, and by how much. So the gradient is as big as the model itself. In this paper’s ResNet-18 (a network that classifies images), the gradient is 43 MB. That is about 11 million numbers at four bytes each.

The recipe: synchronous data-parallel SGD

The paper starts from the most common way to train on many chips. Its name has three parts. SGD means stochastic gradient descent: look at a small random batch, compute the gradient, and step the weights a little against it. Data-parallel means every chip holds the same model but reads different data. Synchronous means everyone waits for everyone else at each step. We call each chip a worker.

One step has four parts. Each worker computes its own gradient. The workers average their gradients. Each worker applies the same update. Then all of them start the next batch.

ḡ
The average gradient: the one number per weight that every worker agrees to use.
ḡ
The same average, now used to move the weights.
1/W
One divided by the number of workers. It turns a sum into an average.
gw
The gradient that worker number w computed from its own mini-batch.
x
All the weights of the model, written as one long list of d numbers. Every worker holds the same x.
x
The weights before the update. The arrow means “is replaced by”.
γ
The learning rate: how big a step to take against the gradient.

The sum on the left is the expensive part. Worker 1 cannot form the average alone. It needs a piece of every other worker’s gradient. So the gradient must cross the network, and it must do so at every single step.

How wide is the pipe?

A link between machines has a bandwidth: how many bits it carries each second. Think of the width of a water pipe. A bit is one 0 or 1, and 8 bits make a byte. So 10 gigabits per second (written 10 Gbit/s, or 10 Gbps) is 1.25 gigabytes per second.

Now do the sum. Sending 43 MB once at 10 Gbit/s takes 43 million bytes × 8 bits ÷ 10 billion bits per second, which is 34 milliseconds. Averaging across 16 workers moves about 1.9 times that much per worker (Chapter 1 shows why). That is about 65 ms. The paper’s rank-2 run, which sends almost nothing, takes about 240 ms per batch. Treat that as the cost of the real computing. The network then adds roughly a quarter on top.

The LSTM in the paper (a network that reads text) has a 110 MB gradient. Its network time is about 165 ms, next to about 135 ms per batch for the rank-4 run, which sends little (the paper’s Table 3). Here the network takes more than half the step. Try other links and models below.

Move one gradient through the pipe

Each bar is the time one averaging step needs on the network, with 16 workers. Pick a model, then drag the link speed. The full gradient is the long bar. The short bars are what PowerSGD sends.

10 Gbit/s

Sizes are the paper’s Tables 10 and 11: 43 MB and 110 MB, with per-rank compression of 243/r and 310/r. Time = 2(W − 1)/W × bytes × 8 ÷ bandwidth with W = 16, the ring all-reduce cost of Chapter 1. This is an idealised model: it ignores latency and software overhead, so real timings are longer.

At 10 Gbit/s the model says the ResNet-18 gradient needs 64.5 ms, and the LSTM gradient needs 165 ms. The paper measured that rank-4 PowerSGD saved 166 ms per batch on the LSTM (300 ms down to 134 ms). The idealised sum and the measurement land close together, which is a good sign that the network really is the cost.

Slow the link and the pipe time grows in direct proportion, while the computing time stays the same. That is why this paper matters for the Core Automation post. Its authors trained one model across two clusters “over a bidirectional link of 25 Gbps”. Their survey table lists this paper in one line: “2019 PowerSGD (Vogels et al.): Low-rank compression compatible with all-reduce.” We read that line closely here.

What the paper claims

Many earlier papers shrink the gradient before sending it. The authors found that their speedups “vanish with a fast network and highly optimized communication backend”. They combine three observations to fix this.

  1. Linear compressors can use all-reduce. If compressing commutes with adding, workers can sum compressed messages in a tree (Chapters 1 and 2).
  2. Low-rank updates compress hard without losing quality. A gradient matrix is well described by a few columns and rows (Chapters 3 to 5).
  3. Error feedback makes biased compression safe. What a worker drops this step it adds back next step (Chapter 6).

The headline numbers: compressing gradients more than 120 times cuts communication time, including the cost of compressing, by 54% for ResNet-18 and by 90% for the LSTM. Time to reach full test quality falls by 24% and 55%. Chapter 7 shows where each number sits in the tables.

The road

  1. All-reduce, and the gather trap: how workers add up numbers in a tree.
  2. Why earlier compressors fall short: sign, Top-K, random picks, and the linearity test.
  3. A gradient as a low-rank matrix: two thin matrices that rebuild a fat one.
  4. One step of power iteration: the algorithm, with every shape and a worked example.
  5. Warm start: why one cheap step per batch is enough.
  6. Error feedback and momentum: nothing dropped is lost for good.
  7. What the tables show: ResNet-18, the LSTM, and the scaling plots.
  8. Limits, and the link to compute islands: when it helps, when it does not.
  9. Field guide: numbers, a checklist, the core code, and where to go next.
Computing a batch takes the same time on a slow link and a fast link. Why does sending less data help more on the slow link?

Chapter 1

All-Reduce, and the Gather Trap

Learn how workers add up their numbers in a tree, and why a compressor that breaks the tree is slow

Four friends each hold a sheet with the same list of numbers. They want every friend to end up with the list of sums. The simplest plan is to pick a boss. Everyone mails their sheet to the boss. The boss adds the four sheets and mails the answer back.

The plan works, and it is slow. The boss’s mailbox receives three sheets, one after another. With 16 friends it receives 15. With 1,000 friends the boss spends all day opening mail. The work grows in step with the number of friends, and one person carries it all.

Reduce, and all-reduce

Computer scientists name the pieces. To reduce is to combine many arrays into one with an operation such as sum. To all-reduce is to reduce and also leave the result on every worker. The paper’s Algorithm 1 calls it ALLREDUCE MEAN: the sum divided by the number of workers.

The trick that makes all-reduce fast is a property of addition. The grouping does not matter: (a + b) + (c + d) gives the same answer as a + (b + (c + d)). Mathematicians call this associativity. The paper states it for four matrices: the sum M1 + M2 + M3 + M4 can be written (M1 + M2) + (M3 + M4).

That grouping gives a plan with no boss. In round one, worker 1 and worker 2 swap sheets and both compute M1 + M2. At the same moment, workers 3 and 4 compute M3 + M4. In round two, the pair results meet. Now all four hold the full sum. Two rounds cover four workers. Every round, half as many distinct partial sums remain, so W workers need about log2 W rounds. Sixteen workers need four. The paper writes it as: with W workers, computation and communication time scale as O(log W) for all-reduce, against O(W) for a gather.

Add up the numbers in a tree

Dots are workers. Press Play to watch the partial sums merge, one round at a time. The bars compare what each worker has to receive. Change the number of workers.

Illustrative sizes: a 43 MB message, the ResNet-18 gradient of Chapter 0. Bytes use the ring all-reduce count derived in the text and the exact all-gather count (W − 1) × 43 MB. The tree shows the idea of rounds; real libraries pick a ring or a tree by message size.

How many bytes does one worker move?

Rounds tell only half the story. The other half is how many bytes each worker sends. Real libraries, such as NCCL and GLOO (the two the paper tests), use a clever layout called a ring. Let us count it for four workers, each holding an 8 MB array.

Cut each array into 4 chunks of 2 MB. Put the workers in a circle. In each round, every worker sends one chunk to its right neighbour, and adds the chunk it receives to its own copy. After 3 rounds, each worker holds the full sum of one chunk. That phase sent 3 × 2 MB = 6 MB per worker. Then the workers pass the finished chunks around the circle for 3 more rounds, another 6 MB, until everyone has all four chunks. The total is 12 MB per worker, which is 1.5 times the array.

For W workers and an array of size S, the same count gives:

B
Bytes each worker sends (and receives) during one all-reduce.
2 (W − 1) / W
Two phases, each moving (W − 1) chunks of size S/W. For 4 workers this is 1.5. For 16 it is 1.875. It never passes 2.
S
The size of the array each worker holds, in bytes.

This is the factor of 1.9 from Chapter 0. It barely grows with the number of workers. That is why ordinary training scales so well on fast networks: adding workers adds almost no traffic per worker.

The gather trap

Now take a compressor that breaks the tree. Say each worker compresses its gradient in its own private way, so the messages cannot be added. The workers must then use an all-gather: every worker receives every other worker’s message, whole. Each worker receives (W − 1) × S bytes. For 16 workers and 43 MB, that is 645 MB, against 80.6 MB for the all-reduce. At 32 workers it is 1,333 MB against 83.3 MB.

There is a second cost, which the paper calls “more subtle”. In an all-reduce, adding happens while the data travels. Each worker receives a message that is already summed. So the cost of decoding (turning the message back into a full gradient) does not depend on W. In an all-gather, a worker receives W separate messages and must decode and add each one. That cost grows in step with W. The paper’s Table 5 shows both effects: the sign-based method Signum, which uses all-gather, has about the same exchange time as PowerSGD at 4 workers, and a clearly higher one at 16.

The paper adds a third point. A parameter server (one machine that collects, adds and sends back) has to compress twice, once going in and once coming out. With all-reduce, “we avoid this by merging compression and aggregation into one step.” Its cluster used NCCL, and the paper notes that NCCL in PyTorch then had no ‘gather’ call at all.

So a compressor earns a place only if its messages can be summed. The rest of the paper turns on that one requirement. Chapter 2 gives it a name and a test.

Which property of addition lets 16 workers sum their arrays in 4 rounds instead of 15?

Chapter 2

Why Earlier Compressors Fall Short

Meet the usual ways to shrink a gradient, and learn the one test that decides whether they can use all-reduce

You have a big grid of numbers and a thin pipe. The oldest idea is to throw most of the grid away and send the rest. The papers before PowerSGD tried many ways to choose what to keep. The paper draws these five, plus its own low-rank method, in its Figure 1, all applied to one layer’s gradient.

Five ways to shrink a grid

Treat one layer’s gradient as a matrix M, a grid of numbers with n rows and m columns. (Chapter 3 shows why a layer is a matrix.) Each method keeps a different part of it.

The paper sets K so that every method sends the same number of values as rank-r PowerSGD, namely (n + m) × r. That makes the comparison fair.

It also puts every method into the same training loop (the error-feedback loop of Chapter 6), with the learning rate tuned for plain SGD. Then it asks two questions. How well does the network train? How long does one batch take? The first question measures how much of the gradient a method keeps. The second measures the real cost: compressing, decompressing, and moving the data.

One test: does compressing commute with adding?

Chapter 1 said that all-reduce adds messages while they travel. For that to give the right answer, adding the compressed messages must give the same thing as compressing the sum. Call a compressor C. The paper calls C linear when:

C(a)
The compressed message of worker 1, whose gradient is a.
C(b)
The compressed message of worker 2, whose gradient is b.
C(a + b)
What you would get by adding the raw gradients first and compressing after. This is the answer we want. A linear C makes the cheap route, which adds messages in the network, give exactly it.

Test the five methods on two tiny gradients of eight numbers each. Pick a compressor and look at the two routes.

Run the linearity test

Two workers hold the gradients a and b. The top row is the average of their compressed messages, which is what all-reduce delivers. The middle row is the compressed average, which is what we want. If the rows differ, the bottom row shows the error.

Toy numbers (illustrative): a = [9, −2, 1, 0, 4, −1, 7, 2] and b = [1, 8, −3, 6, −1, 2, 0, −5]. Random Block keeps 3 neighbouring entries from a shared seed. Low-rank views each vector as a 2 × 4 grid and projects every row onto one fixed shared direction; PowerSGD chooses that direction well (Chapter 4).

Top-K fails the test. Worker 1 keeps positions 0 and 6. Worker 2 keeps positions 1 and 3. Their messages live in different places, so adding them gives a vector with four filled slots, not two. The compressed average is a different vector again. Sign + Norm fails too: the sum of two sign patterns is not the sign pattern of the sum. These methods need a gather, so each worker receives all W messages and merges them itself (Chapter 1).

Random Block passes, and so does the low-rank projection. In both, the rule that picks what to keep does not depend on the data values, so both workers keep the same thing. Keeping the same thing is a matrix multiplication, which is linear. The same holds for Random-K with a shared seed.

Linear is necessary, not sufficient

Passing the test gets you a fast sum. It does not get you a good gradient. Random Block and Random-K choose their entries blindly, with no look at which numbers matter. The paper’s Table 4 compares all of them on ResNet-18 with 16 workers and a learning rate tuned for plain SGD.

MethodTest accuracySent per epochAll-reduceTime per batch
No compression (SGD)94.3%1023 MByes312 ms
Medium: Rank 794.6%24 MByes285 ms
Medium: Random Block93.3%24 MByes243 ms
Medium: Random K94.0%24 MByes540 ms
Medium: Sign + Norm93.9%32 MBno429 ms
Medium: Top K94.4%32 MBno444 ms
High: Rank 294.4%8 MByes239 ms
High: Random Block87.8%8 MByes240 ms
High: Random K92.6%8 MByes534 ms
High: Top K93.6%8 MBno411 ms

Read it in three steps. First, at medium compression (about 32 times) every method except Random Block lands near SGD’s 94.3%. Second, at high compression (about 128 times) only rank 2 keeps 94.4%. Random Block falls to 87.8%, and Top K to 93.6%. Third, only two methods run faster than SGD’s 312 ms: rank-r PowerSGD and Random Block. Random-K is linear, yet it takes 534 ms. The paper blames the random memory access, which costs a lot when it gathers and scatters entries on a GPU. Matrix multiplication, in contrast, is what a GPU does best.

So PowerSGD has to meet three demands at once: linear, so it can use all-reduce; smart, so it keeps the part of the gradient that matters; and cheap, so the GPU does it with fast matrix multiplication. The next chapter shows what “smart” means here.

Why can workers not use an all-reduce on Top-K messages?

Chapter 3

A Gradient as a Low-Rank Matrix

Learn how two thin matrices can stand in for one fat one, and why a gradient is a good candidate

Look at a multiplication table. It has 12 cells for a 3-by-4 grid, but you could rebuild all of them from two short lists: the row numbers (1, 2, 3) and the column numbers (1, 2, 3, 4). Cell by cell, the entry in row i and column j is just rowi × colj. Seven numbers carry the information of twelve.

A grid that works this way is called rank 1. Many real grids are not exactly rank 1, but they are close to a sum of a few such layers. That is the idea PowerSGD builds on.

Outer products and rank

Take a column p with n numbers and a column q with m numbers. Their outer product is the n-by-m grid whose cell (i, j) is pi × qj. We write it p qT. (The small T means “turn the column into a row”, called the transpose.) A grid built this way has rank 1. Add r such grids and you get a grid of rank at most r: the smallest number of simple layers it takes to build it.

Stack the r columns p side by side and you get a matrix P with n rows and r columns. Do the same for q to get Q, with m rows and r columns. The sum of the r layers is then one matrix product:

M
The gradient of one layer, a grid with n rows and m columns. Its n × m cells are what plain SGD sends.
P
A thin matrix with n rows and r columns. It holds the “row side” of the r layers.
QT
A thin matrix with r rows and m columns, the transpose of Q (m rows, r columns). It holds the “column side”.

The saving is easy to count. The full grid has n × m numbers. The two thin matrices have n × r + m × r = r (n + m) numbers. For the biggest convolution in the paper’s ResNet-18, n = 512 and m = 4608. The full gradient has 2,359,296 numbers. At rank 2, P and Q hold 2 × 5,120 = 10,240. That is 230 times fewer, and in the paper’s Table 10 this layer shows as “461/r×”. The ratio is n m / (r (n + m)) = 460.8 / r.

Why a gradient is a matrix

A fully-connected layer multiplies its input by a weight matrix, so its weights and its gradient already have the shape n by m. A convolutional layer slides a small filter over an image. Its gradient has four axes: output channels, input channels, filter height and filter width. The paper flattens the last three into one. A 512 × 512 × 3 × 3 gradient becomes a 512 × 4608 matrix. Bias vectors are tiny, so they are sent as they are: 38 KB of ResNet-18’s 43 MB.

Is a gradient close to low rank? Here is the intuition, which is standard backpropagation and not a claim from the paper. For a single example, the gradient of a layer is an outer product: the error signal arriving at the layer, times the input the layer saw. That is rank 1 by construction. A mini-batch of B examples adds B such layers, so the rank is at most B, and in practice a few layers carry most of the weight. The paper’s argument is the same in spirit: it cites evidence that the singular values of stochastic gradients fall off fast, and that low-rank updates act like a mild regulariser. Treat that as a hypothesis the experiments test, not as a proof.

The best low-rank matrix, and its price

For any matrix, there is a best rank-r grid: the one closest to M. It comes from the singular value decomposition (SVD), which writes M as a sum of layers, each with a strength σi (a singular value), sorted from strong to weak. Keep the r strongest layers. The squared error is then the sum of the squared strengths you dropped. The paper’s Remark 1 states this: the error equals 1 minus the kept share of squared strength, times the squared size of M.

That share is what we call energy below. When the strengths are top-heavy (a few big, then a long thin tail), a small rank keeps nearly all the energy. When all strengths are about equal, no small rank works. Try both.

Keep r layers of a matrix

Left: a 24 × 32 matrix. Right: the best matrix that is built from r layers. Warm cells are positive, blue cells negative. Drag r, and switch between a structured matrix and pure noise.

2

Toy data (illustrative, seeded so it is the same on every visit). The approximation is computed live with the same power-iteration step the paper uses, repeated until it settles (Chapter 4). Energy means the share of the squared size of M that the approximation keeps.

With the structured matrix, rank 2 already keeps 96% of the energy, and rank 3 adds only 1.6 points: the extra layers chase noise. With pure noise, every layer buys a small gain, and rank 2 keeps only 23% of the matrix. The paper’s bet is that real gradients look like the first picture. Its error feedback (Chapter 6) takes care of what the low-rank part misses.

One problem remains. The exact best rank-r matrix needs a full SVD, and that is slow. The paper times it: the SVD of one stochastic gradient takes 673 ms, the cost of computing 6 mini-batch gradients. Spectral Atomo, a method that does an SVD every step, runs at 948 ms per batch against 312 ms for SGD (Table 6). So we need a way to find a good low-rank matrix without the SVD. The next chapter gives it.

A layer’s gradient is a 512 × 4608 matrix. How many numbers do P and Q hold together at rank 2?

Chapter 4

One Step of Power Iteration

Follow the paper’s Algorithm 1 line by line, with the shape of every matrix and a full worked example

Suppose you want the main direction in which a grid of numbers M stretches things. Start with a guess q. Multiply M by q and see what comes out: a column p that says how strongly each row responds to your guess. Now multiply MT by p. You get a new column q. This new q lines up better with the strongest layer of M than your guess did.

Repeat, and q keeps turning toward that strongest layer. This is power iteration. It is cheap, because each round is just two multiplications. For r layers at once, the paper uses the generalisation called subspace iteration, which carries r columns together. It adds one safeguard: after each multiplication the columns are tidied so they do not collapse onto one direction.

Algorithm 1, line by line

Each layer’s gradient is a matrix M with n rows and m columns. Every worker holds its own Mw. All workers also hold the same matrix Q with m rows and r columns, filled at the start with random numbers from a standard normal distribution. One compression runs these steps:

  1. P = M Q. Each worker multiplies its own gradient by Q. The result P has shape n × r.
  2. P = ALLREDUCE_MEAN(P). The workers average their P. Because multiplication distributes over sums, the average equals (M1 + … + MW) / W times Q: the answer for the mean gradient.
  3. P̂ = ORTHOGONALIZE(P). Make the r columns of P have length 1 and meet at right angles (Gram-Schmidt, explained below). Every worker holds the same P, so every worker computes the same P̂.
  4. Q = MT P̂. Each worker multiplies its own M by the shared P̂. The result Q has shape m × r.
  5. Q = ALLREDUCE_MEAN(Q). The workers average Q. Now Q equals the mean gradient transposed, times P̂.
  6. Return (P̂, Q). To rebuild, compute P̂ QT, a full n × m matrix that approximates the mean gradient.

Only P and Q cross the network, in two all-reduces. Their sizes are n × r and m × r, so r (n + m) numbers in total (Chapter 3). The big matrix M never leaves its worker. Rebuilding P̂ QT happens on each worker, for free in network terms.

P̂
n × r with orthonormal columns: each has length 1, and any two meet at a right angle. It fixes r directions in the row space.
M
The (mean) gradient of the layer, n × m.
Q
m × r, the current guess for the column-side directions. At the first step it is random.
Q′
m × r, the new Q. It is the best possible Q for the P̂ we have: it makes P̂ Q′T as close to M as any matrix can be.
MT
M turned on its side: m rows, n columns.
P̂
The same orthonormal matrix, now used to read off Q′.
M ≈ P̂ Q′T
The rebuilt rank-r gradient. Its squared error is the squared size of M minus the squared size of Q′.

Why Q′ = MT P̂ is the right Q

Fix P̂ with orthonormal columns. We want the Q that makes M − P̂ QT smallest. Expand the squared size: ||M||2 − 2 ⟨MTP̂, Q⟩ + ||Q||2. The orthonormal columns remove P̂ from the last term. The expression is smallest when Q = MTP̂, and the leftover error is then ||M||2 − ||Q||2. So step 4 is the best Q for the P̂ from step 3. Step 3 is the part that is only approximately right, because P̂ comes from a single multiplication.

Gram-Schmidt is the tidying step. Take the first column of P and divide it by its length. Take the second column, subtract the part of it that points along the first, then divide by its new length. Continue for each column. With 1 to 4 columns this is cheap, but the paper notes that it is still “the most expensive part of the compression procedure” because it is not a plain matrix multiplication.

A worked example with every number

Two workers hold 3 × 2 gradients (toy numbers, illustrative):

M1 = [[2, 0], [0, 2], [2, 2]]    M2 = [[2, 2], [4, 0], [0, 2]]    mean = [[2, 1], [2, 1], [1, 2]]

Rank r = 1, and Q = [1, 0]T. In step 1, P1 = M1Q = [2, 0, 2] and P2 = M2Q = [2, 4, 0]. In step 2 the mean is P = [2, 2, 1]. In step 3, its length is the square root of 4 + 4 + 1, which is 3, so P̂ = [2/3, 2/3, 1/3]. In step 4, Q1 = M1TP̂ = [2, 2] and Q2 = [4, 2]. In step 5 the mean is Q′ = [3, 2]. The rebuilt matrix is P̂ Q′T = [[2, 1.33], [2, 1.33], [1, 0.67]]. Its squared error against the mean is 2, out of a squared size of 15: 13.3%. Check with the formula: 15 − (32 + 22) = 2.

The exact best rank-1 matrix (from an SVD) has squared error 1.315, or 8.8%. One step with a bad guess left 13.3%. Now run the step again, this time starting from Q = [3, 2], the answer we just found. The new error is 1.322 (8.8%). One extra round almost closes the gap. That is exactly the idea of the next chapter. Step through it:

Step through Algorithm 1

Press Next to run one line of the algorithm. Each box shows a real matrix with its shape. Step 7 reruns the compression from the Q you just found.

Toy numbers (illustrative) with two workers and rank 1; every value is computed live with the same multiply, orthogonalize and transpose steps as Algorithm 1. The best rank-1 error 1.315 is from the singular values of the mean matrix.

Look at the message sizes. In step 2 each worker sends 3 numbers; in step 5 it sends 2. Plain SGD would send all 6 numbers of M. In a real layer the saving is far larger (230 times for the 512 × 4608 convolution at rank 2). Notice also the order: P̂ is computed after the first all-reduce, so every worker agrees on it before the second round starts. That agreement is what keeps the whole thing linear.

After step 2, every worker holds the same averaged P. Why does that matter for step 4?

Chapter 5

Warm Start: One Cheap Step Per Batch Is Enough

See how reusing last step’s answer turns a rough one-step estimate into the best low-rank matrix

You hike along a ridge and check your compass each morning. The ridge bends only a little from one day to the next. On day two, you do not start with a random heading. You start with yesterday’s heading and correct it a bit. After a week of small corrections you are as accurate as if you had spent a whole day on one careful reading.

PowerSGD does the same. Chapter 4 ended with a problem: one step of power iteration from a random Q left 13.3% of the matrix unexplained, and the best rank-1 answer leaves 8.8%. A second step from the first answer almost closed the gap. In training there are thousands of steps. So the paper reuses Q from the previous batch as the starting guess for the next one. It calls this the warm start. A start from random numbers is a cold start.

Why reusing Q is allowed

The gradient matrix changes at every batch, so yesterday’s Q is not exactly right for today. The paper argues that it is close enough. Two facts support it.

First, the weights move only a little per step. So the expected gradient (the average over many random batches) barely changes between steps. Each single batch is the expected gradient plus noise. The paper writes that, as the function is smooth, E[Mt] ≈ E[Mt−1].

Second, power iteration on a fixed matrix converges. The paper’s Theorem I says that repeated subspace iteration reaches the best rank-r approximation of M, provided there is a gap between the r-th and the (r+1)-th singular value (the r-th layer is clearly stronger than the next one). If M stays nearly the same, then running one iteration per batch, thousands of times, is the same as running thousands of iterations on one matrix. The paper compares it to Oja’s algorithm for stochastic power iteration, an old method from 1982 that tracks the main direction of a stream of noisy samples.

There is a standard fact behind the gap condition, which the paper cites but does not spell out. Each power-iteration step shrinks the wrong part of the guess by about the ratio of the next layer’s strength to the r-th layer’s strength. With strengths 6 and 3, as in the device below, the wrong part halves every step. A big gap means fast progress. If the two strengths are nearly equal, progress is slow, and the warm start has to do more of the work.

A side benefit. The appendix argues that reuse also averages out noise. The sequence of steps drifts toward the directions of the average gradient over many batches. That average has less variance than any single batch, so the warm start can do better than a cold start run on that one batch.

What it costs

Almost nothing. The only state kept between steps is Q, an m × r matrix per layer. It is the output of an all-reduce, so every worker already holds the same copy. No extra messages are needed. The warm start is also why one step is enough to be cheap: the paper times a full rank-2 PowerSGD step, including the communication among 16 workers, at 105 ms. A full SVD of the same gradient takes 673 ms.

What it buys

The paper tests this directly on ResNet-18 (its Table 2). The reference, labelled “best approximation”, runs four steps of subspace iteration (eight matrix multiplications) with no reuse. That is enough to match the exact best rank-2 matrix.

Rank-2 variantTest accuracy
Best approximation (4 steps, no reuse)94.4%
Warm start (the default, 1 step)94.4%
Without warm start (1 step from random)94.0%

One reused step matches four fresh ones. Dropping the reuse costs 0.4 points. The gap looks small, but it is the whole difference between matching SGD and falling short of it. Now watch the effect on a stream of changing matrices.

Track a drifting matrix

Each step a new 20 × 30 gradient arrives: a few strong layers that drift, plus fresh noise. The lines show how much of each gradient a rank-2 approximation captures. Raise the noise or the drift and see who falls behind.

0.60
0.04

Toy data (illustrative, seeded): three layers of strength 10, 6 and 3 whose directions take a small random step each batch; each entry also gets Gaussian noise. Rank 2. “Best” runs 14 iterations on each matrix; the other two run exactly one, as in Algorithm 1.

With the starting settings (noise 0.60, drift 0.04), the warm line hugs the best line within a few steps and keeps about 97% of what it captures. The cold line keeps about 54%: one random guess is just not enough. Raise the noise to 2 and the warm line sags to 66%, because each batch pulls Q toward its own noise. Raise the drift to 0.30 and it sags to 75%, because yesterday’s Q no longer fits today’s matrix. Even then the warm start stays ahead of the cold one in this toy. The paper argues that training sits in the low-drift regime, because each update is a small step on a smooth function. It does not prove this for deep networks. It shows that the accuracy gap closes in practice.

The gradient matrix is different at every batch. Why is last step’s Q still a good starting guess?

Chapter 6

Error Feedback and Momentum

Learn how each worker keeps a ledger of what it failed to send, so that nothing a compressor drops is lost for good

A shop rounds every bill down to whole dollars and drops the cents. Each bill is off by less than a dollar. But if the owner never writes the cents down, they vanish. A busy year of rounding adds up to a large sum. Now give the shop a small notebook. It records the dropped cents, and the next bill carries them forward. Nothing is lost for good: at any moment, the notebook holds the only difference between what was owed and what was billed.

That notebook is error feedback. It is the second of the paper’s three ideas, and it is what lets a crude compressor train a network to full accuracy.

The problem: PowerSGD is biased

A compressor is unbiased if, averaged over many tries, it returns the original. Random sampling schemes can be built this way. The paper shows one for low rank. Pick a random m × r matrix U such that E[U UT] = I (the identity, which leaves things unchanged). Send the pair (M U, U). The rebuilt matrix M U UT equals M on average, since E[(M U) UT] = M E[U UT] = M.

PowerSGD is the natural biased counterpart. It does not return M on average. It always keeps the strongest layers and always drops the weak ones, so the same part of the gradient is dropped at every step. A weak but steady direction would never be sent. Without a fix, training drifts.

The paper compares the two directly on ResNet-18 (its Table 1). The unbiased version is as small on the wire, and far worse in accuracy.

AlgorithmTest accuracyData per epoch
SGD94.3%1023 MB
Rank-1 PowerSGD93.6%4 MB
Rank-2 PowerSGD94.4%8 MB
Unbiased rank 171.2%3 MB
Unbiased rank 275.9%4 MB

Algorithm 2, line by line

Each worker w keeps a memory ew, the same shape as the gradient, and it starts at zero. Each step runs this loop:

  1. Compute a stochastic gradient gw on the local mini-batch.
  2. Add the ledger. Δw = gw + ew. This is the gradient plus what was dropped before.
  3. Compress Δw with PowerSGD (Chapter 4).
  4. Update the ledger. ew = Δw − DECOMPRESS(C(Δw)). That is what this worker wanted to send and did not.
  5. Aggregate the compressed messages and decompress them into one update Δ′.
  6. Momentum, then step. m = λ m + Δ′, then x = x − γ (Δ′ + m).
Δ
What worker w tries to send this step: today’s gradient plus the carried-over error.
g
Today’s fresh gradient from the local mini-batch.
e
The ledger from the last step. It starts at zero.
enext
The new ledger, kept on the worker. It is never sent anywhere.
Δ
The same quantity as above.
D(C(Δ))
Compress and then decompress Δ: what the receiver gets, rebuilt at full size. The difference from Δ is the part that was dropped.

Why does this repair the bias? Follow one worker. Call the update applied at step t simply at = D(C(Δt)). The ledger rule says et+1 = gt + et − at. Add this up from step 0 to T − 1, and the ledger terms cancel in pairs:

a0 + a1 + … + aT−1 = (g0 + g1 + … + gT−1) − eT

The total update applied equals the total gradient, minus one ledger. As long as the compressor keeps the ledger from growing without bound, the weak directions get through eventually. The ledger piles up the weak direction until it becomes the strongest layer of Δ, and then the compressor sends it. The paper’s appendix gives the formal condition: the best rank-r matrix must capture a fixed share of the squared size of Δ, which holds when the singular values are top-heavy.

Watch the ledger work

Each gradient has a strong layer and a weaker layer that never changes direction, plus noise. A rank-1 compressor sees mostly the strong one. The lines show how far the total applied update has fallen behind the total true gradient. Slide the weak layer’s strength.

4

Toy data (illustrative, seeded): 12 × 12 gradients, a strong layer of strength 10, a weak layer you set (1 to 8) with a fixed direction, and Gaussian noise of 0.3 per entry. One worker. The compressor is the best rank-r matrix, so the only thing that changes between the lines is the ledger. The gap is the Frobenius size of (total gradient − total applied).

Without the ledger, the weak layer is dropped at every step and the gap grows straight upward. With the ledger, the gap rises for a short time, then flattens: the ledger fills until the weak layer is big enough to win a place in the message. At rank 2 the compressor has room for both layers, so the plain gap is far smaller (24 against 146 at weak strength 4, in this toy), and the ledger cuts it again, to 6. The paper makes the same point on real training: in its Figure 7, rank-4 PowerSGD without error feedback “does not converge to a good accuracy at all”, while the same method with it matches SGD.

Why momentum goes after compression

Line 6 is the paper’s own small change to the old error-feedback recipe. Many tuned networks train with momentum, which smooths steps by mixing in a running average of past updates (m, with weight λ). The paper applies momentum to the decompressed update, after the network has done its work. The authors say this “allows us to reuse the same learning rate and hyper-parameters as those tuned for SGD with momentum.” So PowerSGD is a plug-in replacement: take a recipe tuned for plain SGD, switch on compression, and do not retune. All the paper’s tables use the learning rate tuned for full-precision SGD.

What does a worker store in its error-feedback memory ew?

Chapter 7

What the Tables Show

Read each result in the paper, learn what was measured, and see where the method wins and where it needs more rank

A result means little until you know what was measured. So first the setup, which the paper gives in a small table. The main task is ResNet-18 on CIFAR10, a set of small colour pictures in ten classes. There are 16 workers: 8 machines with 2 GPUs each, linked by a 10 Gbit/s network. The software library that moves the data is NCCL, the fastest one in PyTorch at the time. The batch size is 128 per worker. Training runs 300 epochs (an epoch is one pass over the data) with momentum 0.9. The learning rate is the one tuned for plain SGD, scaled up with the number of workers, with a 5-epoch warm-up and cuts by 10 at epochs 150 and 250. Each result is repeated 3 times with different seeds.

A second task checks that the idea is not tied to images: a three-layer LSTM for language modelling on WikiText-2. Its quality is perplexity, where lower is better. Time per batch includes the forward pass, the backward pass, compressing, decompressing and the network.

Table 3: how much rank do you need?

The paper first varies the rank. On ResNet-18, rank 1 sends 4 MB per epoch against 1023 MB for SGD, and is 243 times smaller, but loses 0.7 points of accuracy (93.6%). Rank 2 reaches 94.4%, slightly above SGD’s 94.3%. Rank 4 reaches 94.5% but its batch takes 260 ms against 239 ms for rank 2: more rank costs more compute and more bytes. On the LSTM, rank 1 is too small (perplexity 102 against 91), rank 2 nearly matches (93), and rank 4 matches (91). The text reads: “the test quality achieved by PowerSGD grows with increasing rank” until it is as good as, or slightly better than, regular SGD.

Tables 4, 6 and 7: against the other methods

Table 4 (Chapter 2) showed that only the linear methods can be fast, and only PowerSGD is also accurate at 128 times compression. Table 6 adds two named rivals on the same ResNet-18 task. Spectral Atomo does an SVD every step and samples layers at random: 92.6% accuracy and 948 ms per batch, 204% slower than SGD. Signum sends only signs: 93.6% and 301 ms, a 3% gain. Rank-2 PowerSGD gets 94.4% and 239 ms, 23% faster. Table 7 does the same for the LSTM. Signum reaches a perplexity of 142 (SGD gets 91) and runs 41% slower than SGD, at 424 ms. Rank-4 PowerSGD matches SGD and takes 134 ms, 55% less.

Why is the LSTM gain so much larger? Its gradient is 110 MB against 43 MB, while its computing per batch is about half as long. Communication was a larger share of the step, so there was more to save. The paper says it directly: the advantage of PowerSGD “truly shows when using really large models, i.e. where the communication actually becomes a bottleneck.”

Table 5 and Figure 3: more workers

Table 5 breaks one batch into forward, backward, gradient exchange and encode/decode time, for 2, 4, 8 and 16 workers. Forward and backward time stay constant. Because PowerSGD and SGD both use all-reduce, their exchange time grows gently with W. Signum uses all-gather, so its exchange time climbs faster, and the cost of decoding grows with W (Chapter 1). Figure 3 plots the speed-up of one epoch against one worker on two backends. On the fast NCCL, all three methods scale reasonably, and Signum bends below a straight line. On the slower GLOO, “PowerSGD is notably the only method that retains excellent scaling due to its high compression rate.” The paper adds that the fast NCCL backend “benefits the baselines more than our method”, so the gap would be wider on slower setups. That reads as good news for slow links.

Appendix D: a transformer, and a higher rank

A last case study uses a Transformer language model on WikiText-103, with 32 workers on Google Cloud and one K80 GPU each. The hyper-parameters come from the fairseq example and are not re-tuned. The paper reports that it needs a much higher rank here: 32 instead of 4.

CompressionTraining time, 17,875 updatesCompression ratioValidation loss
Uncompressed20 h1×4.92
Rank 411 h105×5.58
Rank 811 h55×5.19
Rank 1612 h28×5.03
Rank 3213 h14×4.97

At rank 32 the loss is 4.97 against 4.92, with 14 times less data and 13 hours against 20. (The paper’s text says 12 h for rank 32; the table says 13 h. We use the table.) The time to reach a loss of 5 is about 1.5 times faster. The authors guess that the architecture and the cosine learning-rate schedule explain the need for more rank, and that retuning could improve the numbers. Treat it as honest evidence that the right rank depends on the model.

Explore all five experiments. Pick one, then tap a row.

Read the paper’s tables

Each bar is time, from the paper’s tables. The dot says whether quality matches the first row: green if it does, yellow if it falls short. Choose an experiment, then tap a row for the full sentence.

All numbers are the paper’s: Tables 3, 6, 7 and 9 (16 workers and a 10 Gbit/s network for the first four; 32 K80 workers on Google Cloud for the transformer). The transformer bar is total training time for 17,875 updates; the others are time per batch. “Matches” means within 0.2 points of accuracy, 2 of perplexity, or 0.1 of validation loss of the first row.

At similar compression, PowerSGD cuts batch time by 55% on the LSTM but by 23% on ResNet-18. What explains the difference?

Chapter 8

Limits, and the Link to Compute Islands

Find out what PowerSGD does not fix, and where it fits among the tools for training across slow links

A method is easier to trust when you know where it stops. PowerSGD is a careful, practical paper, and it says plainly what is still open. Some of what follows comes from the paper’s text. Some is our own reading, and we mark which is which.

What the paper itself says

What it cannot fix: how often you sync

Here is our own reading. The time to move data over a link has two parts: a fixed delay for each trip, and the bytes divided by the bandwidth. PowerSGD attacks the second part. It makes each exchange carry far fewer bytes. It does not reduce the number of exchanges. A synchronous step still needs two all-reduces, every batch, and every worker waits for both.

Here is an illustrative sum. Say each trip over the link takes 50 ms, and each all-reduce needs 4 rounds for 16 workers. Two all-reduces then cost at least 8 × 50 = 400 ms per step, before one byte is counted. That is more than the whole 239 ms batch. Smaller messages cannot lower that floor.

That matters on a link with a long delay, such as one between clusters on different continents. The paper never tested this. Its network was a 10 Gbit/s link inside one data centre, and its model of cost contains no delay term. The paper does reduce the number of messages in one way, by packing all gradient tensors into one flat buffer (Appendix H). It does not skip a single synchronisation.

Where it sits in the compute-islands story

Core Automation’s post trained one model across two clusters “over a bidirectional link of 25 Gbps”. It sorts the earlier work into families: local updates, compression, gossip, and fault-tolerant averaging. About compression it says: “Quantization, sparsification and low-rank methods shrink the bytes sent and received in each exchange.” PowerSGD is the low-rank entry. The family that cuts the number of exchanges is local SGD, where each worker takes many steps between syncs. Local SGD and model averaging teaches it, and DiLoCo is its modern form. The two families attack different terms, so they are complements, not rivals. The paper does not combine them; the closing lesson of this series shows how the post puts the pieces together.

The scorecard below uses the paper’s own Table 3 and an assumption we state: the network part of a batch grows in proportion to 1 / bandwidth. It reproduces the paper’s numbers exactly at 10 Gbit/s and extends them to other links. It is a back-of-envelope guide to how the gain moves, and nothing more.

Slow the link, and see the gain grow

Both axes are logarithmic. The yellow line is plain SGD. The warm line is PowerSGD. The vertical marks are the paper’s 10 Gbit/s and the post’s 25 Gbit/s. Drag the link speed and read the gap.

25 Gbit/s

An extrapolation, not a measurement. Plain SGD: time = non-network time + network time, where the non-network time is the paper’s PowerSGD row (239 ms for ResNet-18 rank 2, 134 ms for the LSTM at rank 4) and the network time is the gap to plain SGD at 10 Gbit/s (73 ms and 166 ms), scaled by 10 ÷ bandwidth. PowerSGD keeps its own network time, divided by its compression (121.5 and 77.5). Latency, overlap and the number of syncs are ignored.

On the ResNet-18, the model says rank 2 buys about 1.1 times at 25 Gbit/s, and about 4 times at 1 Gbit/s. On the LSTM it buys about 1.5 times at 25 Gbit/s. The lesson is the ratio: bytes per step divided by compute per step. A model with more bytes for each second of compute, or a link with less bandwidth, gets more from compression. When the network is not the bottleneck, there is nothing to win.

Which statement about PowerSGD on a very slow, long-delay link between two clusters is the best summary?

Chapter 9

Field Guide

Keep the numbers, the terms, a checklist and the core code, then carry them to the next lesson in the series

You can now rebuild PowerSGD from memory. This chapter is the page to keep open while you do.

The one-paragraph summary

In synchronous data-parallel training, every step averages the workers’ gradients, and that average crosses the network. PowerSGD shrinks each layer’s gradient M (n × m) to two thin matrices, P̂ (n × r) and Q (m × r), using one step of power iteration. Both products are matrix multiplications followed by a mean, so the compressor is linear and the workers can use a cheap tree or ring all-reduce. A warm start reuses the last Q so that one step per batch is enough. Error feedback keeps what was dropped and adds it back next step, and momentum is applied after decompression, so the settings tuned for SGD carry over. On ResNet-18, rank 2 sent 136 times less data, ran 23% faster and kept 94.4% accuracy.

The numbers that matter

WhatNumberWhere, and why it matters
Gradient sizeResNet-18 43 MB (243/r); LSTM 110 MB (310/r)Tables 10 and 11. The ratio holds for the whole network.
Largest ResNet-18 layer512 × 4608; 2,359,296 numbers; 461/rTable 10. Messages carry r (n + m) numbers.
Messages per stepP (n × r) then Q (m × r): two all-reducesAlgorithm 1. Latency still counts twice.
ResNet-18, rank 294.4% vs 94.3%; 8 vs 1023 MB; 239 vs 312 msTable 3. 136 times less data, 23% faster.
LSTM, rank 4perplexity 91 = SGD; 64 vs 7730 MB; 134 vs 300 msTable 3. 120 times less data, 55% faster.
Headlineover 120×; communication −54% and −90%; end to end −24% and −55%Introduction. ResNet-18 and the LSTM.
At 128× compressionRank 2 94.4%; Top K 93.6%; Random K 92.6%; Random Block 87.8%Table 4. Only PowerSGD hits the target.
Warm start94.4% with; 94.0% without; 94.4% for 4 fresh stepsTable 2. One reused step matches four fresh ones.
Unbiased low rank71.2% (rank 1); 75.9% (rank 2)Table 1. Bias plus error feedback beats unbiased.
Cost of an SVD673 ms vs 105 ms for a full rank-2 stepSection 4.2. Why power iteration, not an SVD.
RivalsAtomo 92.6%, 948 ms; Signum on the LSTM perplexity 142, 424 msTables 6 and 7.
Transformer, rank 32loss 4.97 vs 4.92; 14× less data; 13 h vs 20 hTable 9. Some models need a high rank.
The test cluster16 GPUs on 8 machines, 10 Gbit/sSection 5 and Appendix B.

The terms, in plain words

TermPlain meaning
GradientOne number per weight, saying which way to nudge it.
BandwidthBits a link carries per second, like the width of a pipe.
All-reduceEvery worker ends with the sum or mean of all workers’ arrays, built in a tree or ring.
All-gatherEvery worker receives every other worker’s whole message. Cost grows with the number of workers.
Linear compressorC(a) + C(b) = C(a + b). The messages can be added in the network.
RankHow many simple layers (outer products) a matrix is built from.
Power iterationMultiply by M, then by MT, to turn a guess toward M’s strongest layer.
OrthogonalizeMake columns length 1 and perpendicular (Gram-Schmidt).
Warm startStart this step’s iteration from last step’s Q.
Error feedbackKeep what the compressor dropped, and add it to the next gradient.
Biased compressorOne whose average output is not the original. It needs error feedback.

The core as code

This sketch simulates W workers in one process. Each list entry stands for one worker, and every np.mean over the list stands for an all-reduce. It is our code, not the authors’. Their implementation is at github.com/epfml/powersgd, and PyTorch ships a PowerSGD communication hook for its distributed data-parallel wrapper (that fact comes from outside the paper).

pythonimport numpy as np

def orthogonalize(P):
    """Gram-Schmidt: columns get length 1 and meet at right angles."""
    P = P.copy()
    for i in range(P.shape[1]):
        P[:, i] /= np.linalg.norm(P[:, i]) + 1e-8
        for j in range(i + 1, P.shape[1]):
            P[:, j] -= P[:, i] * (P[:, i] @ P[:, j])
    return P

def powersgd(Ms, Q):
    """Ms: one n x m matrix per worker. Q: m x r, the same on every worker."""
    P = np.mean([M @ Q for M in Ms], axis=0)      # local P, then all-reduce mean   (n x r)
    P = orthogonalize(P)                           # same result on every worker
    Q = np.mean([M.T @ P for M in Ms], axis=0)    # local Q, then all-reduce mean   (m x r)
    return P, Q                                    # rebuild with P @ Q.T

def step(x, grads, errs, Q, mom, lr=0.02, lam=0.9):
    D = [g + e for g, e in zip(grads, errs)]       # add each worker's ledger
    P, Q = powersgd(D, Q)                          # Q is reused next step: warm start
    delta = P @ Q.T                                # the mean update, back at full size
    errs = [d - delta for d in D]                  # what each worker still owes
    mom = lam * mom + delta                        # momentum after compression
    return x - lr * (delta + mom), errs, Q, mom

Two notes on the code. The paper writes the ledger with each worker’s own compressed message. Here each worker subtracts the shared rebuilt update instead. Because the compressor is linear, the average ledger is the same either way (Appendix A.3). And the demo learning rate is small on purpose: in a quick test of ours, a rate of 0.05 with momentum made this toy diverge, while 0.02 settled to 1.6% error.

A checklist for using it

Where it sits

This paper is one reading of the lesson on communication compression, which teaches the wider family: quantization, sparsification, and why error feedback matters. The data-parallel background is in data parallelism and all-reduce, and the arithmetic of links is in bandwidth arithmetic. The Core Automation post that sets this series is The Hitchhiker’s Guide to Training on Compute Islands by Rohan Anil.

Keep going

Credit

PowerSGD is the work of Thijs Vogels, Sai Praneeth Karimireddy and Martin Jaggi at EPFL, published at NeurIPS 2019 (arXiv 1905.13727). The ideas, the tables and the quotes in this lesson are theirs. The devices, the toy numbers (marked as illustrative) and the explanations are ours.

The takeaway. A gradient is a big grid, but a few layers carry most of it. Send two thin matrices that rebuild those layers, make sure the messages can be added in the network, and keep a ledger of what you dropped. Then a slow link costs a fraction of what it did.
Which pair of choices makes PowerSGD both fast on the network and accurate at high compression?

Now press Present or Teach and explain PowerSGD out loud, from memory: why the gradient is a bandwidth problem, why linear messages can use all-reduce, how one power-iteration step makes P and Q, why the warm start works, and what the ledger saves. Then go back to the instrument at the top and predict each number before you press it.

PowerSGD: Practical Low-Rank Gradient Compression for Distributed Optimization
Read the paper · Authors’ code · The Core Automation post · Communication compression · Back to Gleams