Mahir Shahriar Tamim

AI Researcher · Explainable & Responsible AI · Vision, Language & Agentic Systems

Part 6 of Pruning and the Lottery Ticket

Sparse training: networks that are sparse from the start

Module 6 · 7 min read

Sparse training: networks that are sparse from the start

TL;DR

  • Sparse-to-sparse training keeps a fixed connection budget from the start, with no dense network to prune.
  • Dynamic methods drop weak connections and regrow others. RigL grows where the gradient is largest and nears dense-then-prune accuracy on ImageNet.
  • On GPUs the compute savings are mostly theoretical, so N:M-pattern training is the practical version today.

The awkward part so far

Every method so far trains a dense network and then cuts it. The lottery ticket even trains it many times just to find the small one (part 3). So the expensive part, training, never gets cheaper, even when the final network needs only 10% of its connections. Parts 1–5 were all dense-to-sparse. This part is about sparse-to-sparse, which starts sparse, stays sparse and never holds all the connections at once.

It’s like road planning. Dense-to-sparse builds a road between every pair of houses, watches traffic for a year, then digs up the quiet ones. Sparse-to-sparse builds a few, and every few months closes the emptiest and opens new ones where people seem to want them.

Attempt 1: pick a sparse shape and keep it

Static sparse training fixes a random mask at the start (say, 10% of each layer’s connections) and trains only those. That’s usually a losing ticket (part 3), since the connections that matter most may be missing and a fixed mask can’t add them. The split across layers matters a lot, because small layers like the first convolution can’t lose as much as huge ones. With a good split, wide enough networks get surprisingly close to dense (Liu et al., 2022, “The Unreasonable Effectiveness of Random Pruning”), but at high sparsity a fixed random shape leaves accuracy on the table.

Attempt 2: let the shape change during training

Dynamic sparse training keeps how many connections fixed, while which ones can change. Every so often it drops some of the weakest active connections (smallest magnitude, as in part 1) and grows as many elsewhere, so memory and compute stay in the sparse budget. Methods differ in where they grow.

  • SET (Sparse Evolutionary Training, Mocanu et al., 2018) grows at random. It’s simple and surprisingly effective, since bad guesses get dropped next round.
  • DSR (Dynamic Sparse Reparameterization, Mostafa & Wang, 2019) also moves connections between layers using a shared threshold, so layers needing capacity take it from layers needing less.
  • SNFS (Sparse Networks From Scratch, Dettmers & Zettlemoyer, 2019) grows where gradient momentum is largest, i.e. where training keeps pushing even though no weight exists yet.
  • RigL (“Rigging the Lottery”, Evci et al., 2020) grows where the gradient is largest right now.

RigL: ask the gradient where to grow

A missing connection is zero and does nothing, but its gradient says how much the loss would want it to change if it existed. A big one means “the network would really like a road here”. Every hundred or so steps, RigL:

  1. Drops the active connections with the smallest magnitude.
  2. Computes the gradient for all connections, missing ones included, for that one step.
  3. Grows the missing ones with the largest gradient magnitude, starting them at zero so the output doesn’t suddenly change.

The swapped fraction shrinks on a cosine curve so the shape settles as weights mature. ERK (Erdős–Rényi-Kernel) spreads sparsity across layers, so bigger layers get sparser and smaller ones keep more connections.

Below, a toy network always keeps 24 of its 78 connections and has to find a hidden “useful” set. Try both growth rules.

Grow new connections
active, useful active, not useful just grown just dropped

A toy, not a real training run. Both rules start from the same random shape and swap fewer connections each update (cosine decay). Random growth finds useful connections by luck, gradient growth goes straight to them.

How this connects to the lottery ticket

The lottery ticket finds a good sparse network after dense training, then retrains it. Dynamic sparse training never trains the dense network. It searches while training, like holding a few tickets and swapping bad ones for better ones. That’s what RigL’s title is getting at. You can steer a sparse network toward a good ticket as you go. On ImageNet, RigL beat static sparse training and SET at the same sparsity, and with longer training came close to (sometimes beyond) pruning a dense network, at a fraction of the training compute on paper.

But the GPU still doesn’t care

As part 2 showed, a matrix with 90% scattered zeros doesn’t run 10× faster on a GPU. Training is worse, because the mask keeps changing, so you can’t build a sparse format once and reuse it. Most papers report theoretical FLOPs (as if every zero were skipped), but real wall-clock time on a normal GPU, with dense kernels and a mask, is often no better than dense training. Two things can close the gap.

  • Hardware-friendly patterns. Zhou et al. (2021) trained N:M-sparse networks (like part 2’s 2:4) from scratch to run on sparse tensor cores. The per-group pattern is fixed, but which 2 of 4 still adapts during training.
  • Hardware or software built for sparsity. Some CPUs, custom accelerators and research kernels skip zeros efficiently, and there the savings become real.

The toy chart shows the weights each method keeps active during training. The area under each line is its “on paper” compute.

100%0% startend training progress →
Highlight

Toy numbers. Compute is counted as if every zero could be skipped, which normal GPUs can’t do for scattered sparsity. Gradual pruning follows a smooth cubic schedule from 10% to 70% of training.

Where it stands today. RigL-style methods are the standard baseline in a lively research area, but industry rarely uses dynamic sparse training. Same reason as part 5. Without hardware that rewards scattered sparsity the savings stay theoretical, while quantization or distillation give real gains with less effort. For now the practical form is training with N:M patterns GPUs already support.

MethodShape changes?Where new connections go
Static sparseNoNowhere: the random mask is fixed
SET (2018)YesRandom
DSR (2019)YesRandom, with connections moved between layers
SNFS (2019)YesLargest gradient momentum
RigL (2020)YesLargest current gradient (checked occasionally)

Quick check

A missing connection has a weight of zero. How can RigL know that growing it would help?

Q&A

Doesn’t computing the full gradient make RigL dense again?

Only for one step in every hundred or so. In between it trains only the sparse weights and never stores dense weights or dense optimizer state, so memory stays sparse and the occasional dense gradient costs a little extra.

Can large language models be trained sparse from scratch?

People are trying, but it isn’t common yet. Most sparse LLMs today are dense models pruned afterwards (part 4). Mixture-of-experts, where each token uses only part of the network, is widely used, but that sparsity is in the activations, with no pruned weight mask.

Papers