What is Pruning?
In Turkish: Budama (pruning) · Topic: Models and training
A technique that shrinks a trained neural network and lowers its running cost by removing weights, neurons or layers that contribute little to its output.
How does it work?
First, the importance of each weight or neuron is measured; the simplest criterion is how small a weight's absolute value is. Those judged unimportant are set to zero or removed entirely. The remaining parts then go through a short round of extra training to make up for lost accuracy. In unstructured pruning, where individual weights are dropped, speed gains can be limited without special software and hardware support. When whole neurons, attention heads or layers are removed, the model really does become smaller and faster. It resembles a gardener trimming a tree.
Why does it matter?
Large models are expensive to run. Pruning reduces memory needs and latency, making it easier to fit models onto limited devices such as phones. Research suggests that a considerable share of the weights in many networks is unnecessary. Still, aggressive pruning hurts accuracy, so the balance is tuned for each task.
Example
A company could prune some attention heads of its own language model and recover quality with fine-tuning, ending up with a version that does the same job with less hardware and in less time.
FAQ
What is the difference between pruning and quantization?
Pruning reduces the number of parameters, while quantization lowers the number of bits used to store them. The two can also be used together.
Does pruning reduce a model's accuracy?
When done moderately, the loss is usually small and can be recovered with extra training. With heavy pruning, quality can degrade noticeably.