Pruning neural networks with precision and discipline
Project Bonsai embodies the philosophy that neural network pruning should be deliberate and thoughtful — akin to tending a bonsai tree. Rather than crude magnitude-based approaches, Bonsai emphasizes careful, iterative reduction of network parameters based on statistical sensitivity analysis.
Bonsai Art: Like cultivating a bonsai, pruning should be a disciplined practice that enhances rather than diminishes the essential structure. Each cut should be informed, purposeful, and reversible if proven wrong.
Bonsai introduces several novel concepts for principled neural network pruning:
The foundation of Bonsai is the NIM, defined as the partial derivative of the loss function with respect to the post-activation value of a neuron. This is essentially the saliency of each neuron, easily captured using PyTorch's gradient hooks.
FANIM extends NIM by incorporating temporal dynamics:
FANIM = NIM × (a[i+1] - a[i]) / L
Where:
While FANIM looks forward in time, BANIM (Backward Advanced Neuron Impact Metric) examines past behavior:
BANIM = NIM × (a[i] - a[i-1]) / L
BANIM is mathematically less clean (not a pure Taylor expansion) but computationally simpler since it doesn't require "phantom" forward steps.
Unexpected Result: Bonsai consistently pruned more conservatively than random pruning
Performance Gap: Random pruning to 70%+ sparsity often outperformed Bonsai
Strategic Pivot: AFL research revealed that the problem space is different than assumed
Project Bonsai is on hold pending resolution of AFL research findings: