What is unstructured pruning?
Unstructured pruning is a model compression method zeroing individual weights of a neural network by an importance criterion regardless of position, leaving an irregular sparsity pattern; the simplest criterion is absolute weight magnitude.
Unlike structured pruning, which removes whole channels or heads and genuinely shrinks matrices, unstructured pruning can reach higher sparsity at equal accuracy, but matrix sizes stay the same, so speed depends on special sparse compute support.
- Topic
- Machine learning, models and training
- Also known as
- Weight pruning
How unstructured pruning works
- Weights are scored by an importance criterion such as magnitude or a second-order error estimate.
- A set share of the least important weights is zeroed and kept at zero with a mask.
- The classic method trains, prunes, then retrains the remaining weights.
- For large language models some methods prune in one shot without retraining, also adapting to semi-structured patterns.
In more detail
2:4 semi-structured sparsity and hardware support
Tensor Cores in NVIDIA Ampere and later GPUs accelerate 2:4 semi-structured sparsity in hardware: at least two of every four consecutive weights are zero. The constraint roughly halves weight storage (with a small index overhead) and can speed up compute-bound operations; inference engines such as TensorRT-LLM and vLLM support the format. It usually costs somewhat more accuracy than free unstructured pruning at the same sparsity.
Commonly confused terms
| Term | How it differs |
|---|---|
| Quantisation | Quantisation reduces the numerical bit-width of weights or activations (e.g., FP16 to INT4 or FP8) across all parameters, whereas unstructured pruning sets a fraction of weights to exact zero while keeping remaining weights at their original precision; the two are often combined. |
Why unstructured pruning matters for on-premises AI
An early study pruned image classifiers' parameters by an order of magnitude without accuracy loss using a three-step method: learn important connections, prune the rest, retrain. A one-shot method for large language models pruned 175 billion parameter scale models to at least 50% sparsity without retraining, keeping the perplexity increase negligible even at 60%. It is also compatible with quantisation.
A bank's AI infrastructure team prunes an in-house language model to a 50% semi-structured pattern; it measures latency on GPUs where the inference engine accelerates the pattern and the accuracy gap on its own question set.
Common questions
Does unstructured pruning speed up a model?
Irregular sparsity usually does not speed up standard hardware, though it can save memory if weights are stored in a sparse format. Semi-structured patterns can speed up supporting GPUs.
Can large language models be pruned without retraining?
Yes. One-shot methods can prune large models by half with low loss and no retraining.
Related terms
Sources
- Han et al., Learning both Weights and Connections for Efficient Neural Networks, 2015
- Frantar and Alistarh, SparseGPT: Massive Language Models Can Be Accurately Pruned in One-Shot, 2023
In the glossary: Glossary, R to Z