Compressing neural nets

pruning, compacting and otherwise fitting a good estimate into fewer parameters



How to make neural nets smaller while still preserving their performance. This is a subtle problem, As we suspect that part of their special sauce is precisely that they are overparameterized which is to say, one reason they work is precisely that they are bigger than they “need” to be. The problem of finding the network that is smaller than the bigger one that it seems to need to be is tricky. My instinct is to use some sparse regularisation but this does not carry over to the deep network setting, at least naïvely.

Pruning

Train a big network, then deleting neurons and see if it still works. See Jacob Gildenblat, Pruning deep neural networks to make them fast and small, or Why reducing the costs of training neural networks remains a challenge – TechTalks This is not complicated (I think?) but involves lots of retraining and therefore lots of compute.

Lottery tickets

Kim Martineau’s summary of the state of the art in “Lottery ticket” (Frankle and Carbin 2019) pruning strategies is fun; See also You et al. (2019) for an elaboration. The idea here is that we can try to “prune early” and never both fitting the big network as in classic pruning.

Regularising away neurons

Salome prepares trim the neural net.

Seems like it should be easy to apply something like LASSO in the NN setting to deep neural nets to trim away irrelevant features. Aren’t they just stacked layers of regressions, after all? and it works so well in linear regressions. But in deep nets it is not generally obvious how to shrink away whole neurons.

I am curious if Lemhadri et al. (2021) does the job:

Much work has been done recently to make neural networks more interpretable, and one approach is to arrange for the network to use only a subset of the available features. In linear models, Lasso (or ℓ1-regularized) regression assigns zero weights to the most irrelevant or redundant features, and is widely used in data science. However the Lasso only applies to linear models. Here we introduce LassoNet, a neural network framework with global feature selection. Our approach achieves feature sparsity by adding a skip (residual) layer and allowing a feature to participate in any hidden layer only if its skip-layer representative is active. Unlike other approaches to feature selection for neural nets, our method uses a modified objective function with constraints, and so integrates feature selection with the parameter learning directly. As a result, it delivers an entire regularization path of solutions with a range of feature sparsity. We apply LassoNet to a number of real-data problems and find that it significantly outperforms state-of-the-art methods for feature selection and regression. LassoNet uses projected proximal gradient descent, and generalizes directly to deep networks. It can be implemented by adding just a few lines of code to a standard neural network.

Edge ML

A.k.a. Tiny ML, Mobile ML etc. A major consumer of compressing neural nets, since small devices cannot fit large nerual nets. See Edge ML

References

Aghasi, Alireza, Nam Nguyen, and Justin Romberg. 2016. “Net-Trim: A Layer-Wise Convex Pruning of Deep Neural Networks.” arXiv:1611.05162 [cs, Stat], November. http://arxiv.org/abs/1611.05162.
Blalock, Davis, Jose Javier Gonzalez Ortiz, Jonathan Frankle, and John Guttag. 2020. “What Is the State of Neural Network Pruning?” arXiv:2003.03033 [cs, Stat], March. http://arxiv.org/abs/2003.03033.
Borgerding, Mark, and Philip Schniter. 2016. “Onsager-Corrected Deep Networks for Sparse Linear Inverse Problems.” arXiv:1612.01183 [cs, Math], December. http://arxiv.org/abs/1612.01183.
Cai, Han, Chuang Gan, Tianzhe Wang, Zhekai Zhang, and Song Han. 2020. “Once-for-All: Train One Network and Specialize It for Efficient Deployment.” In. http://arxiv.org/abs/1908.09791.
Chen, Tianqi, Ian Goodfellow, and Jonathon Shlens. 2015. “Net2Net: Accelerating Learning via Knowledge Transfer.” arXiv:1511.05641 [cs], November. http://arxiv.org/abs/1511.05641.
Chen, Wenlin, James T. Wilson, Stephen Tyree, Kilian Q. Weinberger, and Yixin Chen. 2015. “Compressing Convolutional Neural Networks.” arXiv:1506.04449 [cs], June. http://arxiv.org/abs/1506.04449.
Cheng, Yu, Duo Wang, Pan Zhou, and Tao Zhang. 2017. “A Survey of Model Compression and Acceleration for Deep Neural Networks.” arXiv:1710.09282 [cs], October. http://arxiv.org/abs/1710.09282.
Cutajar, Kurt, Edwin V. Bonilla, Pietro Michiardi, and Maurizio Filippone. 2017. “Random Feature Expansions for Deep Gaussian Processes.” In PMLR. http://proceedings.mlr.press/v70/cutajar17a.html.
Daniely, Amit. 2017. “Depth Separation for Neural Networks.” arXiv:1702.08489 [cs, Stat], February. http://arxiv.org/abs/1702.08489.
Frankle, Jonathan, and Michael Carbin. 2019. “The Lottery Ticket Hypothesis: Finding Sparse, Trainable Neural Networks.” arXiv:1803.03635 [cs], March. http://arxiv.org/abs/1803.03635.
Garg, Sahil, Irina Rish, Guillermo Cecchi, and Aurelie Lozano. 2017. “Neurogenesis-Inspired Dictionary Learning: Online Model Adaption in a Changing World.” In arXiv:1701.06106 [cs, Stat]. http://arxiv.org/abs/1701.06106.
Gelder, Maxwell Van, Mitchell Wortsman, and Kiana Ehsani. n.d. “Deconstructing the Structure of Sparse Neural Networks.” In, 6.
Ghosh, Tapabrata. 2017. “QuickNet: Maximizing Efficiency and Efficacy in Deep Architectures.” arXiv:1701.02291 [cs, Stat], January. http://arxiv.org/abs/1701.02291.
Globerson, Amir, and Roi Livni. 2016. “Learning Infinite-Layer Networks: Beyond the Kernel Trick.” arXiv:1606.05316 [cs], June. http://arxiv.org/abs/1606.05316.
Gray, Scott, Alec Radford, and Diederik P Kingma. n.d. “GPU Kernels for Block-Sparse Weights,” 12.
Ha, David, Andrew Dai, and Quoc V. Le. 2016. “HyperNetworks.” arXiv:1609.09106 [cs], September. http://arxiv.org/abs/1609.09106.
Hardt, Moritz, Benjamin Recht, and Yoram Singer. 2015. “Train Faster, Generalize Better: Stability of Stochastic Gradient Descent.” arXiv:1509.01240 [cs, Math, Stat], September. http://arxiv.org/abs/1509.01240.
Hayou, Soufiane, Jean-Francois Ton, Arnaud Doucet, and Yee Whye Teh. 2020. “Pruning Untrained Neural Networks: Principles and Analysis.” arXiv:2002.08797 [cs, Stat], June. http://arxiv.org/abs/2002.08797.
Hazimeh, Hussein, Natalia Ponomareva, Petros Mol, Zhenyu Tan, and Rahul Mazumder. 2020. “The Tree Ensemble Layer: Differentiability Meets Conditional Computation,” February. https://arxiv.org/abs/2002.07772v2.
He, Yihui, Ji Lin, Zhijian Liu, Hanrui Wang, Li-Jia Li, and Song Han. 2019. “AMC: AutoML for Model Compression and Acceleration on Mobile Devices.” arXiv:1802.03494 [cs], January. http://arxiv.org/abs/1802.03494.
Howard, Andrew G., Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. 2017. “MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications.” arXiv:1704.04861 [cs], April. http://arxiv.org/abs/1704.04861.
Iandola, Forrest N., Song Han, Matthew W. Moskewicz, Khalid Ashraf, William J. Dally, and Kurt Keutzer. 2016. “SqueezeNet: AlexNet-Level Accuracy with 50x Fewer Parameters and <0.5MB Model Size.” arXiv:1602.07360 [cs], February. http://arxiv.org/abs/1602.07360.
LeCun, Yann, John S. Denker, and Sara A. Solla. 1990. “Optimal Brain Damage.” In Advances in Neural Information Processing Systems, 598–605. http://yann.lecun.com/exdb/publis/pdf/lecun-90b.pdf.
Lee, Holden, Rong Ge, Tengyu Ma, Andrej Risteski, and Sanjeev Arora. 2017. “On the Ability of Neural Nets to Express Distributions.” In arXiv:1702.07028 [cs]. http://arxiv.org/abs/1702.07028.
Lemhadri, Ismael, Feng Ruan, Louis Abraham, and Robert Tibshirani. 2021. “LassoNet: A Neural Network with Feature Sparsity.” Journal of Machine Learning Research 22 (127): 1–29. http://jmlr.org/papers/v22/20-848.html.
Liebenwein, Lucas, Cenk Baykal, Brandon Carter, David Gifford, and Daniela Rus. 2021. “Lost in Pruning: The Effects of Pruning Neural Networks Beyond Test Accuracy.” arXiv:2103.03014 [cs], March. http://arxiv.org/abs/2103.03014.
Lobacheva, Ekaterina, Nadezhda Chirkova, and Dmitry Vetrov. 2017. “Bayesian Sparsification of Recurrent Neural Networks.” In Workshop on Learning to Generate Natural Language. http://arxiv.org/abs/1708.00077.
Louizos, Christos, Max Welling, and Diederik P. Kingma. 2017. “Learning Sparse Neural Networks Through \(L_0\) Regularization.” arXiv:1712.01312 [cs, Stat], December. http://arxiv.org/abs/1712.01312.
Molchanov, Dmitry, Arsenii Ashukha, and Dmitry Vetrov. 2017. “Variational Dropout Sparsifies Deep Neural Networks.” In Proceedings of ICML. http://arxiv.org/abs/1701.05369.
Narang, Sharan, Eric Undersander, and Gregory Diamos. 2017. “Block-Sparse Recurrent Neural Networks.” arXiv:1711.02782 [cs, Stat], November. http://arxiv.org/abs/1711.02782.
Pan, Wei, Hao Dong, and Yike Guo. 2016. “DropNeuron: Simplifying the Structure of Deep Neural Networks.” arXiv:1606.07326 [cs, Stat], June. http://arxiv.org/abs/1606.07326.
“Pruning by Explaining: A Novel Criterion for Deep Neural Network Pruning.” 2021. Pattern Recognition 115 (July): 107899. https://doi.org/10.1016/j.patcog.2021.107899.
Renda, Alex, Jonathan Frankle, and Michael Carbin. 2020. “Comparing Rewinding and Fine-Tuning in Neural Network Pruning.” arXiv:2003.02389 [cs, Stat], March. http://arxiv.org/abs/2003.02389.
Scardapane, Simone, Danilo Comminiello, Amir Hussain, and Aurelio Uncini. 2016. “Group Sparse Regularization for Deep Neural Networks.” arXiv:1607.00485 [cs, Stat], July. http://arxiv.org/abs/1607.00485.
Shi, Lei, Shikun Feng, and ZhifanZhu. 2016. “Functional Hashing for Compressing Neural Networks.” arXiv:1605.06560 [cs], May. http://arxiv.org/abs/1605.06560.
Srinivas, Suraj, and R. Venkatesh Babu. 2016. “Generalized Dropout.” arXiv:1611.06791 [cs], November. http://arxiv.org/abs/1611.06791.
Steeg, Greg Ver, and Aram Galstyan. 2015. “The Information Sieve.” arXiv:1507.02284 [cs, Math, Stat], July. http://arxiv.org/abs/1507.02284.
Ullrich, Karen, Edward Meeds, and Max Welling. 2017. “Soft Weight-Sharing for Neural Network Compression.” arXiv Preprint arXiv:1702.04008. https://arxiv.org/abs/1702.04008.
Urban, Gregor, Krzysztof J. Geras, Samira Ebrahimi Kahou, Ozlem Aslan, Shengjie Wang, Rich Caruana, Abdelrahman Mohamed, Matthai Philipose, and Matt Richardson. 2016. “Do Deep Convolutional Nets Really Need to Be Deep (Or Even Convolutional)?” arXiv:1603.05691 [cs, Stat], March. http://arxiv.org/abs/1603.05691.
Wang, Yunhe, Chang Xu, Chao Xu, and Dacheng Tao. 2019. “Packing Convolutional Neural Networks in the Frequency Domain.” IEEE transactions on pattern analysis and machine intelligence 41 (10): 2495–2510. https://doi.org/10.1109/TPAMI.2018.2857824.
Wang, Yunhe, Chang Xu, Shan You, Dacheng Tao, and Chao Xu. 2016. “CNNpack: Packing Convolutional Neural Networks in the Frequency Domain.” In Advances in Neural Information Processing Systems 29, edited by D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett, 253–61. Curran Associates, Inc. http://papers.nips.cc/paper/6390-cnnpack-packing-convolutional-neural-networks-in-the-frequency-domain.pdf.
Wang, Zhangyang, Shiyu Chang, Qing Ling, Shuai Huang, Xia Hu, Honghui Shi, and Thomas S. Huang. 2016. “Stacked Approximated Regression Machine: A Simple Deep Learning Approach.” In. https://arxiv.org/abs/1608.04062.
Warden, Pete, and Daniel Situnayake. 2020. TinyML: Machine Learning with TensorFlow Lite on Arduino and Ultra-Low-Power Microcontrollers. O’Reilly Media, Incorporated.
You, Haoran, Chaojian Li, Pengfei Xu, Yonggan Fu, Yue Wang, Xiaohan Chen, Richard G. Baraniuk, Zhangyang Wang, and Yingyan Lin. 2019. “Drawing Early-Bird Tickets: Toward More Efficient Training of Deep Networks.” In. https://openreview.net/forum?id=BJxsrgStvr.
Zhao, Liang. 2017. “Fast Algorithms on Random Matrices and Structured Matrices.” http://academicworks.cuny.edu/gc_etds/2073/.

No comments yet. Why not leave one?

GitHub-flavored Markdown & a sane subset of HTML is supported.