Stochastic & Neuromorphic Computing  /  Explore  /  Model compression

Model compression
most of a network is redundant

A trained network carries far more parameters than it needs. On an FPGA that waste is expensive — every weight is a bit of ROM and a routed connection — so compression is not an afterthought but part of fitting a model on-chip at all. SC-NeuroCore compresses spiking models four ways: pruning away small weights and dead neurons, quantising the rest to few bits, distilling a big model into a small one, and training with quantisation in the loop. The first of them you can drive below.

Magnitude pruning — drop the small weights

The simplest and most effective compression is also the most intuitive: a weight whose magnitude is near zero contributes almost nothing, so set it to exactly zero and skip it. Sweep a threshold up through the weight distribution and the fraction zeroed — the sparsity — climbs; on hardware, those zeros become connections that are never built and multiplies that never run. The trade is real: prune too aggressively and accuracy falls, so the threshold is a dial, not a free win.

$$w_{ij} \leftarrow \begin{cases} 0 & \lvert w_{ij}\rvert \le \theta \\ w_{ij} & \text{otherwise}\end{cases} \qquad \text{sparsity} = \frac{\#\{\,\lvert w_{ij}\rvert \le \theta\,\}}{\#\{w_{ij}\}}$$
Live — magnitude pruning of a weight matrix
weights: pruned: sparsity: remaining:

The histogram is the distribution of weight magnitudes; the shaded region left of the cutoff is everything pruned to zero. Most weights cluster near zero, which is why even a modest threshold removes a large fraction with little effect — the tall bins nearest the origin are the cheapest to give up. The percentile mode does the same by targeting a chosen sparsity directly rather than an absolute magnitude. On an FPGA the surviving fraction is what sets the resource budget.

The full toolkit

Pruning removes parameters; the other three make the survivors cheaper or teach a smaller model to stand in. They compose — prune, then quantise, then fine-tune — and the toolkit implements each from its standard formulation.

Structural & stochastic pruning

Beyond zeroing individual weights, structural pruning removes whole neurons that fire below an activity threshold — cutting a layer's width, not just its density, which is what actually shrinks the hardware. A stochastic-computing-specific variant scores each weight by its bitstream contribution — how many popcount bits it adds per inference — and prunes the ones that move the result least, a measure only meaningful in the SC datapath.

Quantisationweights & delays

Cut each surviving weight from 32 bits to a handful. The toolkit quantises both weights and synaptic delays, and the microscaling block-float formats are the low-bit end of that spectrum — a shared exponent per block and a few bits per weight.

Knowledge distillation

Train a small “student” network to match the outputs of a large “teacher” rather than the raw labels. The soft targets carry more information than a hard label, so the student reaches an accuracy its size would not otherwise allow — compression by teaching, not trimming.

Quantisation-aware trainingLSQ · PACT

Rather than quantise after training and hope, put the quantiser in the training loop so the network learns weights that survive it. The toolkit carries LSQ (learned step size) and PACT (learned clipping) — the two standard methods — with the quantiser's step or clip range trained alongside the weights.

Where it fits

Compression is the last mile to hardware. A model trained by surrogate gradients, by local plasticity, or converted from an ANN is usually larger than the target device can hold; pruning and quantisation are what close the gap, and they do it while the network is still an ordinary spiking model on this site — the compiler then lowers the sparse, low-bit result to the FPGA.

Evidence boundary: the demo runs the library's exact magnitude-pruning rule ($\lvert w\rvert \le \theta \to 0$, sparsity $=$ pruned/total) on a sampled weight matrix in your browser. How much accuracy a given sparsity costs depends entirely on the model and data — no accuracy-retention figures are quoted here; the demo shows the sparsity, not its consequence.