When a language model is trained on many GPUs at once, every GPU computes its own gradient and the GPUs must then sum those gradients over the network before anyone can take a step. Linear-attention models replace the usual attention, whose cost grows with the square of sequence length, with a running summary whose cost grows linearly. That makes their per-GPU compute cheap, so the network summation becomes a larger share of each step. The standard fix is to compress gradients before sending them. It often backfires, because compressing a gradient costs GPU time that competes with the backward pass. In over 200 measured configurations, compression gave an end-to-end speedup in only 6 (On the Utility of Gradient Compression in Distributed Training Systems).
We propose to avoid the encoding step entirely. A weight gradient in a linear layer is a product of stored activations and incoming error signals. A shared-seed sparse random projection (each input coordinate is hashed to one bucket with a random sign) can therefore be applied to those two thin factors instead of the full gradient. The compressed gradient comes out of the backward pass already small, already a fixed-size dense tensor that ordinary ring all-reduce can sum, and cheaper to compute than the uncompressed gradient would have been. The claim is that this turns compression from a cost into a saving. We will test it where the saving matters most: linear-attention models whose compute slack is thin.
Core Claim
For a linear layer with weight $W \in \mathbb{R}^{m \times n}$, the weight gradient over a batch of $N$ tokens is $G = X^\top \Delta$. Here $X \in \mathbb{R}^{N \times m}$ are the layer inputs and $\Delta \in \mathbb{R}^{N \times n}$ are the gradients arriving at its output. Let $P \in \mathbb{R}^{m \times r}$ and $Q \in \mathbb{R}^{n \times r}$ be CountSketch matrices, meaning one $\pm 1$ entry per row, generated from a seed shared by all workers. Then
$$P^\top G Q = (XP)^\top (\Delta Q),$$
so each worker produces its $r \times r$ message by hashing $X$ and $\Delta$, at cost $O(N(m+n))$, and multiplying two thin matrices, at cost $O(N r^2)$. The full $G$ is never formed, which would cost $O(Nmn)$. Because the map is linear and the seed is shared, the sum of workers' messages equals the sketch of the summed gradient. The message is therefore compatible with standard ring all-reduce, unlike the two-round heavy-hitter protocol of Sketched-SGD. After the all-reduce, each worker forms the estimate $\hat G = P (P^\top G Q) Q^\top$, which is unbiased because $\mathbb{E}[PP^\top]=I$ for CountSketch. It then takes an optimizer step.
What is new is not sketching gradients, which Sketched-SGD, SADL, and SEPARATE all do. What is new is sketching the gradient's factors inside the backward pass. This makes the encoding cost negative relative to the uncompressed baseline. Sparsity of the projection is what drops the cost from $O(Nmr)$ to $O(Nm)$.
Where This Sits in Prior Work
Three papers supply the method and motivate the gap.
- SEPARATE. SEPARATE compresses already-formed gradients with a shared-seed dense Gaussian projection plus an error-feedback buffer. It reports a 2x wall-clock speedup to target loss on GPT-2 Medium. It projects after the gradient exists, uses dense matrices, and was only evaluated on softmax Transformers.
- SADL. SADL proves that unbiased sketches of size logarithmic in the parameter count preserve Adam-style convergence when the loss curvature has low intrinsic dimension. We rely on it for the no-error-feedback regime our fused design forces. It does not report wall-clock time on fast interconnects.
- Sketched-SGD. Sketched-SGD shows that CountSketch linearity lets sketches be summed across workers. It needs a parameter server and a second round of communication.
The theory of sparse projections supplies the justification for sparsity:
- Low-distortion Subspace Embeddings in Input-sparsity Time and Chenakkod et al. show that sparse hashing matrices embed low-dimensional subspaces as well as dense Gaussians do.
- Høgsgaard et al. tie this to coordinate localization.
- That localization caveat is a constraint on us. If activations or error signals are spread evenly across coordinates, pure hashing loses accuracy, and we will measure this directly.
On the architecture side, two papers set the application regime:
- Lightning Attention / TransNormerLLM makes linear-attention compute fast on a single node through tiling. It does not touch inter-node gradient traffic. This is exactly why the compute available to overlap with communication shrinks.
- Irie's fast-weight view casts the attention state as a sum of outer products $S_t = S_{t-1} + \phi(k_t)v_t^\top$. That is the same "sum of outer products" structure our identity exploits, and it raises the open question of whether gradient spectra differ from those of softmax models.
PLASH is the closest paper joining sketching and linear attention. It sketches token features in the forward pass to approximate softmax, not gradients across workers, so it is complementary rather than competing.
Research Program
The work has three parts.
Measurement. For matched softmax (GPT-2 style) and linear-attention (TransNormerLLM style) models at roughly 350M and 1.3B parameters, we profile per-layer backward compute time against all-reduce time at several bandwidths. We also record the singular-value decay of weight gradients per layer type and the coordinate localization of $X$ and $\Delta$. This tests the file's conjecture that linear attention both narrows compute slack and has a different gradient spectrum. The conjecture is currently unverified; a null result here would weaken the motivation and we will report it as such.
Kernel. We build a Triton kernel that fuses the hashing of $X$ and $\Delta$ into the weight-gradient computation for every linear layer. It emits the $r\times r$ sketch into the gradient bucket that PyTorch's distributed data parallel wrapper already all-reduces during the backward pass. The kernel also has a hybrid mode:
- embeddings, normalization, and decay parameters stay exact;
- sketch size $r$ is set per layer from the measured spectra;
- every $K$ steps a full uncompressed synchronization is run, which stands in for the error feedback the fused path cannot provide.
A side effect worth reporting is that $XP$ can be stored instead of $X$ for weight gradients, which cuts activation memory.
Convergence. We check SADL's no-error-feedback assumptions empirically by tracking the gradient estimate's variance against the true gradient on sampled steps.
Baselines
Uncompressed all-reduce. The naive reference is PyTorch distributed data parallel with NCCL ring all-reduce and default bucketed overlap. It is the configuration that won 194 of 200+ settings in Agarwal et al., which makes it the hardest to beat on fast interconnects. It runs on the same models, data, and learning-rate schedule. Beating it means lower wall-clock time to a fixed validation loss, not lower bytes sent.
SEPARATE (strongest existing method). SEPARATE uses a dense Gaussian projection with its moving-average error buffer. On the softmax side it reports halving the wall-clock time to target loss for GPT-2 Medium on OpenWebText versus AdamW. It also reports an average score of 39.71 versus 38.15 for vanilla Adam when fine-tuning LLaMA2-7B. For linear-attention models, no reported result was found on Lacuna for gradient compression of any kind. We will run SEPARATE ourselves on both architectures:
- the same communicated bytes per step as our method;
- its error parameter $\beta$ tuned over the same grid size we give our $r$ and $K$.
Beating it means reaching target loss faster at equal final loss, on at least one realistic bandwidth, for the linear-attention model.
PowerSGD. This deterministic low-rank method is included because its roughly 45 ms encoding overhead on ResNet-50 (Agarwal et al.) is the canonical example of the overlap problem.
4-bit quantization. A 4-bit quantized all-reduce in the style of SDP4Bit represents the quantization family.
Ablations isolating the key ingredients.
- Fused dense Gaussian. Computes $(XP)^\top(\Delta Q)$ with dense $P,Q$. It separates the benefit of fusion from the benefit of sparsity.
- Unfused CountSketch. Forms $G$, then hashes it. It separates fusion from the choice of sketch.
- Fused CountSketch with and without periodic full synchronization. Isolates the stand-in for error feedback.
Why not just…?
Why not just use uncompressed all-reduce with good overlap? On fast interconnects this often wins, and our method must beat it in wall-clock time, not in bytes. The argument for trying is that fusion removes the encoding cost that sank compression in Agarwal et al., and linear attention's cheap backward pass leaves less compute to hide communication behind. If the profiling shows that linear attention's slack is not smaller than softmax's, or that we lose at 100 Gbps, we will report the bandwidth crossover rather than claim a general win.
Why not just use SEPARATE's dense Gaussian projection, fused the same way? This is the real threat. A dense projection with small $r$ also avoids forming $G$, and dense matrix multiplies run on tensor cores, while hashing needs memory-bound scatter operations. The fused-dense ablation settles it directly, and we can predict the outcome from the identity. Sparse wins only when $r$ is large enough that $O(Nmr)$ outweighs the constant-factor overhead of scatter. If fused-dense matches fused-sparse at every $r$ we can afford, the contribution reduces to fusion. We will state that plainly and ship the dense variant.
Why not just quantize gradients to 4 bits? Quantization gives a fixed 8x reduction and still has to read and write the full gradient. Our sketch sizes target far larger ratios; SADL reports using 0.1% to 0.02% of the original communication bits. SADL also reports that 1-bit Adam collapsed at extreme compression where sketching did not. The two approaches are composable, so we also test quantizing the $r\times r$ sketch.
Why not just synchronize less often, as in DiLoCo? Infrequent averaging trades communication for divergence between workers (DiLoCo, WASH). It is orthogonal to per-step compression. We include DiLoCo at matched bytes on the 350M model as a reference, but do not treat it as the target competitor for tightly coupled pretraining.
Proposed Experiments
Setup. Pretraining uses FineWeb (FineWeb) and OpenWebText at the two scales above. We run on 8, 32, and 64 GPUs, with inter-node bandwidth throttled to 10, 25, and 100 Gbps.
Metrics.
- Wall-clock time to target validation loss.
- Final Wikitext-103 perplexity.
- Zero-shot PIQA, HellaSwag, and BoolQ at 1.3B.
- A long-context check on selected SCROLLS (SCROLLS) tasks. Linear-attention recall could be the first thing to degrade under noisy gradients to the attention projections.
Decisive checks.
- Does linear attention's ratio of backward compute to communication fall measurably below that of the matched softmax model?
- Is the fused kernel's added time a small fraction of the uncompressed weight-gradient cost, so that total backward time does not rise?
- Does fused CountSketch beat both uncompressed all-reduce and our run of SEPARATE in time to target loss at 10 and 25 Gbps, with no more than a small loss in final perplexity?
- Does sparse beat fused-dense at the sketch sizes actually used?
A failure on check 1 means the linear-attention regime was not the right motivation. A failure on check 4 means sparsity was not the key ingredient. Both outcomes will be reported.
References
- On the Utility of Gradient Compression in Distributed Training Systems
- Communication-efficient Distributed SGD with Sketching
- Sketched Adaptive Distributed Deep Learning: A Sharp Convergence Analysis
- SEPARATE: A Simple Low-rank Projection for Gradient Compression in Modern Large-scale Model Training Process
- Low-distortion subspace embeddings in input-sparsity time and applications to robust linear regression
- Optimal Embedding Dimension for Sparse Subspace Embeddings
- Sparse Dimensionality Reduction Revisited
- Various Lengths, Constant Speed: Efficient Language Modeling with Lightning Attention
- Practical Computational Power of Linear Transformers and Their Recurrent and Self-Referential Extensions
- PLASH: Provably Linear-Time Attention with Selective Higher-Order Feature Sketching
- SDP4Bit: Toward 4-bit Communication Quantization in Sharded Data Parallelism for LLM Training
- Communication-Efficient Language Model Training Scales Reliably and Robustly: Scaling Laws for DiLoCo
- WASH: Train your Ensemble with Communication-Efficient Weight Shuffling, then Average
- SCROLLS: Standardized CompaRison Over Long Language Sequences