Home

Awesome

<h1>Structured Bayesian Pruning <br/> via Log-Normal Multiplicative Noise </h1>

This repo contains the code for our NIPS17 paper, Structured Bayesian Pruning via Log-Normal Multiplicative Noise (poster). In the paper, we propose a new Bayesian model that takes into account the computational structure of neural networks and provides structured sparsity, e.g. removes neurons and/or convolutional channels in CNNs. To do this we inject noise to the neurons outputs while keeping the weights unregularized.

Spotlight video

Launch experiments

Example for launching LeNet5 experiment.

python ./scripts/lenet5-sbp.py

Example for launching VGG-like experiment. To obtain sparse VGG-like architecture we use pretrained network, so you can use your own weights, or train the network from scratch using the following command.

python ./scripts/vgglike.py --num_gpus <num GPUs>

Don't forget to adjust batch size to obtain the same number of iterations. For instance, for one GPU we use batch_size=100, for 2 GPUs we use batch_size=50.

Finally, use the following command to launch SBP model for VGG-like architecture.

python ./scripts/vgglike-sbp.py --num_gpus <num GPUs> --checkpoint <path to pretrained checkpoint>

MNIST Experiments

Results for LeNet architectures on MNIST

NetworkMethodErrorNeurons per LayerCPUGPUFLOPs
Lenet-fcOriginal1.54784 - 500 - 300 - 101.00 X1.00 X1.00 X
SparseVD1.57537 - 217 - 130 - 101.19 X1.03 X3.73 X
SSL1.49434 - 174 - 78 - 102.21 X1.04 X6.06 X
StructuredBP1.55245 - 160 - 55 - 102.33 X1.08 X11.23 X
LeNet5Original0.8020 - 50 - 800 - 5001.00 X1.00 X1.00 X
SparseVD0.7517 - 32 - 329 - 751.48 X1.41 X2.19 X
SSL1.003 - 12 - 800 - 5005.17 X1.80 X3.90 X
StructuredBP0.863 - 18 - 284 - 2835.41 X1.91 X10.49 X

CIFAR-10 Experiments

Results for VGG-like architecture on CIFAR-10 dataset. Here speed-up is reported for CPU. More detailed results are provided in the paper.

<p align="center"> <img height="318" src="https://senya-ashukha.github.io/projects/sbp_neurips17/vgg-compression.png"/> </p>

Citation

If you found this code useful please cite our paper

@incollection{
  neklyudov2018structured,
  title = {Structured Bayesian Pruning via Log-Normal Multiplicative Noise},
  author = {Neklyudov, Kirill and Molchanov, Dmitry and Ashukha, Arsenii and Vetrov, Dmitry P},
  booktitle = {Advances in Neural Information Processing Systems 30},
  editor = {I. Guyon and U. V. Luxburg and S. Bengio and H. Wallach and R. Fergus and S. Vishwanathan and R. Garnett},
  pages = {6778--6787},
  year = {2017},
  publisher = {Curran Associates, Inc.},
  url = {http://papers.nips.cc/paper/7254-structured-bayesian-pruning-via-log-normal-multiplicative-noise.pdf}
}