summaries: To enforce sparsity in neural networks, the paper proposes a scale-invariant regularizer (DeepHoyer) inspired by the Hoyer measure. It is simply the ratio between l1 and l2 norm, which is almost everywhere differentiable, and enforces element-wise sparsity. It further proposes the Hoyer measure to quantify sparsity and applies the DeepHoyer in DNN training to train pruned models. The extension of Hoyer-Square is also straightforward.  The paper focuses on sparse neural networks. Typically, l1 regularization is the go-to strategy, however, it is not scale invariant. That is, all weights are affected by the regularization, not only those that are being driven to 0. l0 regularization is theoretically optimal, however, it is not smooth and has no gradients almost everywhere, so it cannot be used for training. As a compromise the paper proposes Hoyer regularization, that is the l1/l2 ratio. The Hoyer regularization has the same minima structure and leads to sparse solutions while being scale invariant, that is it does not affect all weights in the process. Additionally, the paper proposes structured Hoyer regularization. Last, it employs the said regularizations in deep networks: LeNet, AlexNet and ResNet on several datasets: MNIST, CIFAR, ImageNet.
abstractText: In seeking for sparse and efficient neural network models, many previous works investigated on enforcing `1 or `0 regularizers to encourage weight sparsity during training. The `0 regularizer measures the parameter sparsity directly and is invariant to the scaling of parameter values. But it cannot provide useful gradients and therefore requires complex optimization techniques. The `1 regularizer is almost everywhere differentiable and can be easily optimized with gradient descent. Yet it is not scale-invariant and causes the same shrinking rate to all parameters, which is inefficient in increasing sparsity. Inspired by the Hoyer measure (the ratio between `1 and `2 norms) used in traditional compressed sensing problems, we present DeepHoyer, a set of sparsity-inducing regularizers that are both differentiable almost everywhere and scale-invariant. Our experiments show that enforcing DeepHoyer regularizers can produce even sparser neural network models than previous works, under the same accuracy level. We also show that DeepHoyer can be applied to both element-wise and structural pruning. The codes are available at https://github.com/yanghr/DeepHoyer.
authors.name: Huanrui Yang
authors.name: Wei Wen
authors.name: Hai Li
references.authors: Jose M Alvarez Mathieu Salzmann
references.title: Learning the number of neurons in deep networks
references.venue: In Advances in Neural Information Processing Systems,
references.authors: Peter Auer Mark Herbster Manfred K Warmuth
references.title: Exponentially many local minima for single neurons
references.venue: In Advances in neural information processing systems,
references.authors: Xiaoliang Dai Hongxu Yin Niraj K. Jha
references.title: Nest: A neural network synthesis tool based on a grow-and-prune paradigm
references.venue: CoRR, abs/1711.02017,
references.authors: Xiaohan Ding Guiguang Ding Yuchen Guo Jungong Han
references.title: Centripetal sgd for pruning very deep convolutional networks with complicated structure
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition,
references.authors: Ernie Esser Yifei Lou Jack Xin
references.title: A method for finding structured sparse solutions to nonnegative least squares problems with applications
references.venue: SIAM Journal on Imaging Sciences,
references.authors: Jianqing Fan Runze Li
references.title: Variable selection via nonconcave penalized likelihood and its oracle properties
references.venue: Journal of the American statistical Association,
references.authors: Ariel Gordon Elad Eban Ofir Nachum Bo Chen Hao Wu Tien-Ju Yang Edward Choi
references.title: Morphnet: Fast & simple resource-constrained structure learning of deep networks
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition,
references.authors: Yiwen Guo Anbang Yao Yurong Chen
references.title: Dynamic network surgery for efficient dnns
references.venue: In Advances In Neural Information Processing Systems,
references.authors: Song Han Huizi Mao William J Dally
references.title: Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding
references.venue: arXiv preprint arXiv:1510.00149,
references.authors: Song Han Jeff Pool John Tran William Dally
references.title: Learning both weights and connections for efficient neural network
references.venue: In Advances in neural information processing systems,
references.authors: Kaiming He Xiangyu Zhang Shaoqing Ren Jian Sun
references.title: Deep residual learning for image recognition
references.venue: In Proceedings of the IEEE conference on computer vision and pattern recognition,
references.authors: Yang He Guoliang Kang Xuanyi Dong Yanwei Fu Yi Yang
references.title: Soft filter pruning for accelerating deep convolutional neural networks
references.venue: arXiv preprint arXiv:1808.06866,
references.authors: Yihui He Xiangyu Zhang Jian Sun
references.title: Channel pruning for accelerating very deep neural networks
references.venue: In Proceedings of the IEEE International Conference on Computer Vision,
references.authors: Yihui He Ji Lin Zhijian Liu Hanrui Wang Li-Jia Li Song Han
references.title: Amc: Automl for model compression and acceleration on mobile devices
references.venue: In Proceedings of the European Conference on Computer Vision (ECCV),
references.authors: Patrik O Hoyer
references.title: Non-negative matrix factorization with sparseness constraints
references.venue: Journal of machine learning research,
references.authors: Zehao Huang Naiyan Wang
references.title: Data-driven sparse structure selection for deep neural networks
references.venue: In Proceedings of the European Conference on Computer Vision (ECCV),
references.authors: Niall Hurley Scott Rickard
references.title: Comparing measures of sparsity
references.venue: IEEE Transactions on Information Theory,
references.authors: Diederik P Kingma Jimmy Ba
references.title: Adam: A method for stochastic optimization
references.venue: arXiv preprint arXiv:1412.6980,
references.authors: Dilip Krishnan Terence Tay Rob Fergus
references.title: Blind deconvolution using a normalized sparsity measure
references.authors: Alex Krizhevsky Geoffrey Hinton
references.title: Learning multiple layers of features from tiny images
references.venue: Technical report, Citeseer,
references.authors: Alex Krizhevsky Ilya Sutskever Geoffrey E Hinton
references.title: Imagenet classification with deep convolutional neural networks. In Advances in neural information processing
references.authors: Yann LeCun Léon Bottou Yoshua Bengio Patrick Haffner
references.title: Gradient-based learning applied to document recognition
references.venue: Proceedings of the IEEE,
references.authors: Namhoon Lee Thalaiyasingam Ajanthan Philip Torr
references.title: SNIP: SINGLE-SHOT NETWORK PRUNING BASED ON CONNECTION SENSITIVITY
references.venue: In International Conference on Learning Representations,
references.authors: Hao Li Asim Kadav Igor Durdanovic Hanan Samet Hans Peter Graf
references.title: Pruning filters for efficient convnets
references.venue: arXiv preprint arXiv:1608.08710,
references.authors: Tuanhui Li Baoyuan Wu Yujiu Yang Yanbo Fan Yong Zhang Wei Liu
references.title: Compressing convolutional neural networks via factorized convolutional filters
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition,
references.authors: Shaohui Lin Rongrong Ji Yuchao Li Yongjian Wu Feiyue Huang Baochang Zhang
references.title: Accelerating convolutional networks via global & dynamic filter pruning
references.venue: In IJCAI,
references.authors: Shaohui Lin Rongrong Ji Yuchao Li Cheng Deng Xuelong Li
references.title: Toward compact convnets via structure-sparsity regularized filter pruning
references.venue: IEEE transactions on neural networks and learning systems,
references.authors: Baoyuan Liu Min Wang Hassan Foroosh Marshall Tappen Marianna Pensky
references.title: Sparse convolutional neural networks
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition,
references.authors: Zhuang Liu Jianguo Li Zhiqiang Shen Gao Huang Shoumeng Yan Changshui Zhang
references.title: Learning efficient convolutional networks through network slimming
references.venue: In Proceedings of the IEEE International Conference on Computer Vision,
references.authors: Christos Louizos Karen Ullrich Max Welling
references.title: Bayesian compression for deep learning
references.venue: In Advances in Neural Information Processing Systems,
references.authors: Christos Louizos Max Welling Diederik P Kingma
references.title: Learning sparse neural networks through l_0 regularization
references.venue: arXiv preprint arXiv:1712.01312,
references.authors: Jian-Hao Luo Jianxin Wu
references.title: Autopruner: An end-to-end trainable filter pruning method for efficient deep model inference
references.venue: arXiv preprint arXiv:1805.08941,
references.authors: Jian-Hao Luo Jianxin Wu Weiyao Lin
references.title: Thinet: A filter level pruning method for deep neural network compression
references.venue: In Proceedings of the IEEE international conference on computer vision,
references.authors: Rongrong Ma Jianyu Miao Lingfeng Niu Peng Zhang
references.title: Transformed `1 regularization for learning sparse deep neural networks
references.venue: Neural Networks,
references.authors: Konstantinos Makantasis Konstantinos Karantzalos Anastasios Doulamis Nikolaos Doulamis
references.title: Deep supervised learning for hyperspectral data classification through convolutional neural networks
references.venue: In 2015 IEEE International Geoscience and Remote Sensing Symposium (IGARSS),
references.authors: Volodymyr Mnih Koray Kavukcuoglu David Silver Alex Graves Ioannis Antonoglou Daan Wierstra Martin Riedmiller
references.title: Playing atari with deep reinforcement learning
references.venue: arXiv preprint arXiv:1312.5602,
references.authors: Dmitry Molchanov Arsenii Ashukha Dmitry Vetrov
references.title: Variational dropout sparsifies deep neural networks
references.venue: In Proceedings of the 34th International Conference on Machine Learning-Volume
references.authors: Kirill Neklyudov Dmitry Molchanov Arsenii Ashukha Dmitry P Vetrov
references.title: Structured bayesian pruning via log-normal multiplicative noise
references.venue: In Advances in Neural Information Processing Systems,
references.authors: Jongsoo Park Sheng Li Wei Wen Ping Tak Peter Tang Hai Li Yiran Chen Pradeep Dubey
references.title: Faster cnns with direct sparse convolutions and guided pruning
references.venue: arXiv preprint arXiv:1608.01409,
references.authors: Adam Paszke Sam Gross Soumith Chintala Gregory Chanan Edward Yang Zachary DeVito Zeming Lin Alban Desmaison Luca Antiga Adam Lerer
references.title: Automatic differentiation in pytorch
references.venue: NIPS-W,
references.authors: Audrey Repetti Mai Quyen Pham Laurent Duval Emilie Chouzenoux Jean-Christophe Pesquet
references.title: Euclid in a taxicab: Sparse blind deconvolution with smoothed `1/`2 regularization
references.venue: IEEE signal processing letters,
references.authors: Karen Simonyan Andrew Zisserman
references.title: Very deep convolutional networks for large-scale image recognition
references.venue: arXiv preprint arXiv:1409.1556,
references.authors: Pravendra Singh Vinay Kumar Verma Piyush Rai Vinay P Namboodiri
references.title: Leveraging filter correlations for deep model compression
references.venue: arXiv preprint arXiv:1811.10559,
references.authors: Ilya Sutskever James Martens George Dahl Geoffrey Hinton
references.title: On the importance of initialization and momentum in deep learning
references.venue: In International conference on machine learning,
references.authors: Robert Tibshirani
references.title: Regression shrinkage and selection via the lasso
references.venue: Journal of the Royal Statistical Society: Series B (Methodological),
references.authors: Armenak Petrosyan Tran Clayton Webster
references.title: Reconstruction of jointly sparse vectors via manifold optimization
references.venue: arXiv preprint arXiv:1811.08778,
references.authors: Fei Wen Lei Chu Peilin Liu Robert C Qiu
references.title: A survey on nonconvex regularization-based sparse and low-rank recovery in signal processing, statistics, and machine learning
references.venue: IEEE Access,
references.authors: Wei Wen Chunpeng Wu Yandan Wang Yiran Chen Hai Li
references.title: Learning structured sparsity in deep neural networks
references.venue: In Advances in neural information processing systems,
references.authors: Wei Wen Yuxiong He Samyam Rajbhandari Minjia Zhang Wenhan Wang Fang Liu Bin Hu Yiran Chen Hai Li
references.title: Learning intrinsic sparse structures within long short-term memory
references.venue: arXiv preprint arXiv:1709.05027,
references.authors: Penghang Yin Ernie Esser Jack Xin
references.title: Ratio and difference of l1 and l2 norms and sparse representation with coherent dictionaries
references.venue: Commun. Inform. Systems,
references.authors: Ruichi Yu Ang Li Chun-Fu Chen Jui-Hsin Lai Vlad I Morariu Xintong Han Mingfei Gao Ching-Yung Lin Larry S Davis
references.title: Nisp: Pruning networks using neuron importance score propagation
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition,
references.authors: Ming Yuan Yi Lin
references.title: Model selection and estimation in regression with grouped variables
references.venue: Journal of the Royal Statistical Society: Series B (Statistical Methodology),
references.authors: Jihun Yun Peng Zheng Eunho Yang Aurelie Lozano Aleksandr Aravkin
references.title: Trimming the `1 regularizer: Statistical analysis, optimization, and applications to deep learning
references.venue: In International Conference on Machine Learning,
references.authors: Cun-Hui Zhang
references.title: Nearly unbiased variable selection under minimax concave penalty
references.venue: The Annals of statistics,
references.authors: Tianyun Zhang Shaokai Ye Kaiqi Zhang Jian Tang Wujie Wen Makan Fardad Yanzhi Wang
references.title: A systematic dnn weight pruning framework using alternating direction method of multipliers
references.venue: In Proceedings of the European Conference on Computer Vision (ECCV),
references.authors: Zhuangwei Zhuang Mingkui Tan Bohan Zhuang Jing Liu Yong Guo Qingyao Wu Junzhou Huang Jinhui Zhu
references.title: Discrimination-aware channel pruning for deep neural networks
references.venue: In Advances in Neural Information Processing Systems,
references.authors: Zhang
references.title: One thing worth noticing is that the AlexNet model provided in the “torchvision” package is not the ordinary version used in previous works Han et al. (2015b); Wen et al
sections.heading: 1 INTRODUCTION
sections.text: The use of deep neural network (DNN) models has been expanded from handwritten digit recognition (LeCun et al., 1998) to real-world applications, such as large-scale image classification (Simonyan & Zisserman, 2014), self driving (Makantasis et al., 2015) and complex control problems (Mnih et al., 2013). However, a modern DNN model like AlexNet (Krizhevsky et al., 2012) or ResNet (He et al., 2016) often introduces a large number of parameters and computation load, which makes the deployment and real-time processing on embedded and edge devices extremely difficult (Han et al., 2015b;a; Wen et al., 2016). Thus, model compression techniques, especially pruning methods that increase the sparsity of weight matrices, have been extensively studied to reduce the memory consumption and computation cost of DNNs (Han et al., 2015b;a; Wen et al., 2016; Guo et al., 2016; Louizos et al., 2017b; Luo et al., 2017; Zhang et al., 2018; Liu et al., 2015).
  Most of the previous works utilize some form of sparsity-inducing regularizer in searching for sparse neural networks. The `1 regularizer, originally proposed by Tibshirani (1996), can be easily optimized through gradient descent for its convex and almost everywhere differentiable property. Therefore it is widely used in DNN pruning: Liu et al. (2015) directly apply `1 regularization to all the weights of a DNN to achieve element-wise sparsity; Wen et al. (2016; 2017) present structural sparsity via group lasso, which applies an `1 regularization over the `2 norms of different groups of parameters. However, it has been noted that the value of the `1 regularizer is proportional to the scaling of parameters (i.e. ||αW ||1= |α|·||W ||1), so it “scales down” all the elements in the weight matrices with the same speed. This is not efficient in finding sparsity and may sacrifice the flexibility of the trained model. On the other hand, the `0 regularizer directly reflects the real sparsity of weights and is scale invariant (i.e. ||αW ||0= ||W ||0,∀α 6= 0), yet the `0 norm cannot provide useful gradients. Han et al. (2015b) enforce an element-wise `0 constraint by iterative pruning a fixed percentage of smallest weight elements, which is a heuristic method and therefore can hardly achieve optimal compression rate. Some recent works mitigate the lack of gradient information by integrating `0 regularization with stochastic approximation (Louizos et al., 2017b) or more complex optimization methods (e.g.
  ADMM) (Zhang et al., 2018). These additional measures brought overheads to the optimization process, making the use of these methods on larger networks difficult. To achieve even sparser neural networks, we argue to move beyond `0 and `1 regularizers and seek for a sparsity-inducing regularizer that is both almost everywhere differentiable (like `1) and scale-invariant (like `0).
  Beyond the `1 regularizer, plenty of non-convex sparsity measurements have been used in the field of feature selection and compressed sensing (Hurley & Rickard, 2009; Wen et al., 2018). Some popular regularizers like SCAD (Fan & Li, 2001), MDP (Zhang et al., 2010) and Trimmed `1 (Yun et al., 2019) use a piece-wise formulation to mitigate the proportional scaling problem of `1. The piece-wise formulation protects larger elements by having zero penalty to elements greater than a predefined threshold. However, it is extremely costly to manually seek for the optimal trimming threshold, so it is hard to obtain optimal result in DNN pruning by using these regularizers. The transformed `1 regularizer formulated as ∑N i=1 (a+1)|wi| a+|wi| manages to smoothly interpolate between `1 and `0 by tuning the hyperparameter a (Ma et al., 2019). However, such an approximation is close to `0 only when a approaches infinity, so the practical formulation of the transformed `1 (i.e. a = 1) is still not scale-invariant.
  Particularly, we are interested in the Hoyer regularizer (Hoyer, 2004), which estimates the sparsity of a vector with the ratio between its `1 and `2 norms. Comparing to other sparsity-inducing regularizers, Hoyer regularizer achieves superior performance in the fields of non-negative matrix factorization (Hoyer, 2004), sparse reconstruction (Esser et al., 2013; Tran et al., 2018) and blend deconvolution (Krishnan et al., 2011; Repetti et al., 2015). We note that Hoyer regularizer is both almost everywhere differentiable and scale invariant, satisfying the desired property of a sparsityinducing regularizer. We therefore propose DeepHoyer, which is the first Hoyer-inspired regularizers for DNN sparsification. Specifically, the contributions of this work include:
  • Hoyer-Square (HS) regularizer for element-wise sparsity: We enhance the original Hoyer regularizer to the HS regularizer and achieve element-wise sparsity by applying it in the training of DNNs. The HS regularizer is both almost everywhere differentiable and scale invariant. It has the same range and minima structure as the `0 norm. Thus, the HS regularizer presents the ability of turning small weights to zero while protecting and maintaining those weights that are larger than an induced, gradually adaptive threshold; • Group-HS regularizer for structural sparsity, which is extended from the HS regularizer; • Generating sparser DNN models: Our experiments show that the proposed regularizers beat
  state-of-the-arts in both element-wise and structural weight pruning of modern DNNs.
sections.heading: 2 RELATED WORK ON DNN PRUNING
sections.text: It is well known that high redundancy pervasively exists in DNNs. Consequently, pruning methods have been extensively investigated to identify and remove unimportant weights. Some heuristic pruning methods (Han et al., 2015b; Guo et al., 2016) simply remove weights in small values to generate sparse models. These methods usually require long training time without ensuring the optimality, due to the lack of theoretical understanding and well-formulated optimization (Zhang et al., 2018). Some works formulate the problem as a sparsity-inducing optimization problem, such as `1 regularization (Liu et al., 2015; Park et al., 2016) that can be optimized using standard gradientbased algorithms, or `0 regularization (Louizos et al., 2017b; Zhang et al., 2018) which requires stochastic approximation or special optimization techniques. We propose DeepHoyer regularizers in this work, which belong to the line of sparsity-inducing optimization research. More specific, the proposed Hoyer-Square regularizer for element-wise pruning is scale-invariant and can serve as an differentiable approximation to the `0 norm. Furthermore, it can be optimized by gradient-based optimization methods in the same way as the `1 regularization. With these properties, the HoyerSquare regularizer achieves a further 38% and 63% sparsity improvement on LeNet-300-100 model and LeNet-5 model respectively comparing to previous state-of-the-arts, and achieves the highest sparsity on AlexNet without accuracy loss.
  Structurally sparse DNNs attempt to create regular sparse patterns that are friendly for hardware execution. To achieve the goal, Li et al. (2016) propose to remove filters with small norms; Wen et al. (2016) apply group Lasso regularization based methods to remove various structures (e.g., filters, channels, layers) in DNNs and the similar approaches are used to remove neurons (Alvarez &
  Salzmann, 2016); Liu et al. (2017) and Gordon et al. (2018) (MorphNet) enforce sparsity-inducing regularization on the scaling parameters within Batch Normalization layers to remove the corresponding channels in DNNs; ThiNet (Luo et al., 2017) removes unimportant filters by minimizing the reconstruction error of feature maps; and He et al. (2017) incorporate both Lasso regression and reconstruction error into the optimization problem. Bayesian optimization methods have also been applied for neuron pruning (Louizos et al., 2017a; Neklyudov et al., 2017), yet these methods are not applicable in large-scale problems like ImageNet. We further advance the DeepHoyer to learn structured sparsity (such as reducing filters and channels) with the newly proposed “Group-HS” regularization. The Group-HS regularizer further improves the computation reduction of the LeNet-5 model by 8.8% from the `1 based method (Wen et al., 2016), and by 110.6% from the `0 based method (Louizos et al., 2017b). Experiments on ResNet models reveal that the accuracy-speedup tradeoff induced by Group-HS constantly stays above the Pareto frontier of previous methods. More detailed results can be found in Section 5.
sections.heading: 3 MEASURING SPARSITY WITH THE HOYER MEASURE
sections.text: Sparsity measures provide tractable sparsity constraints for enforcement during problem solving and therefore have been extensively studied in the compressed sensing society. In early non-negative matrix factorization (NMF) research, a consensus was that a sparsity measure should map a ndimensional vector X to a real number S ∈ [0, 1], such that the possible sparsest vectors with only one nonzero element has S = 1, and a vector with all equal elements has S = 0 (Hoyer, 2004). Unders the assumption, the Hoyer measure was proposed as follows
  S(X) =
  √ n− ( ∑ i|xi|)/ √∑ i x
  2 i√
  n− 1 . (1)
  It can be seen that
  1 ≤ ∑
  i|xi|√∑ i x 2 i ≤ √ n, ∀X ∈ Rn. (2)
  Thus, the normalization in Equation (1) fits the measure S(X) into the [0, 1] interval. According to the survey by Hurley & Rickard (2009), among the six desired heuristic criteria of sparsity measures, the Hoyer measure satisfies five, more than all other commonly applied sparsity measures. Given its success as a sparsity measure in NMF, the Hoyer measure has been applied as a sparsity-inducing regularizer in optimization problems such as blind deconvolution (Repetti et al., 2015) and image deblurring (Krishnan et al., 2011). Without the range constraint, the Hoyer regularizer in these works adopts the form R(X) = ∑ i|xi|√∑
  i x 2 i
  directly, as the ratio of the `1 and `2 norms.
  Figure 1 compares the Hoyer regularizer and the `1 regularizer. Unlike the the `1 norm with a single minimum at the origin, the Hoyer regularizer has minima along axes, the structure of which is very similar to the `0 norm’s. Moreover, the Hoyer regularizer is scale-invariant, i.e. R(αX) = R(X), because both the `1 norm and the `2 norm are proportional to the scale of X . The gradients of the Hoyer regularizer are purely radial, leading to “rotations” towards the nearest axis. These features make the Hoyer regularizer outperform the `1 regularizer on various tasks (Esser et al., 2013; Tran
  et al., 2018; Krishnan et al., 2011; Repetti et al., 2015). The theoretical analysis by Yin et al. (2014) also proves that the Hoyer regularizer has a better guarantee than the `1 norm on recovering sparse solutions from coherent and redundant representations.
sections.heading: 4 MODEL COMPRESSION WITH DEEPHOYER REGULARIZERS
sections.text: Inspired by the Hoyer regularizer, we propose two types of DeepHoyer regularizers: the Hoyer-Square regularizer (HS) for element-wise pruning and the Group-HS regularizer for structural pruning.
sections.heading: 4.1 HOYER-SQUARE REGULARIZER FOR ELEMENT-WISE PRUNING
sections.text: Since the process of the element-wise pruning is equivalent to regularizing each layer’s weight with the `0 norm, it is intuitive to configure the sparsity-inducing regularizer to have a similar behavior as the `0 norm. As shown in Inequality (2), the value of the original Hoyer regularizer of a N - dimensional nonzero vector lies between 1 and √ N , while its `0 norm is within the range of [1, N ]. Thus we propose to apply the square of Hoyer regularizer, namely Hoyer-Square (HS), to the weights W of a layer, like
  HS(W ) = ( ∑
  i|wi|)2∑ i w 2 i . (3)
  The proposed HS regularizer behaves as a differentiable approximation to the `0 norm. First, both regularizers now have the same range of [1, N ]. Second,HS is scale invariant asHS(αW ) = HS(W ) holds for ∀α 6= 0, so as the `0 norm. Moreover, as the squaring operator monotonously increases in the range of [1, √ N ], the Hoyer-Square regularizer’s minima remain along the axes as the Hoyer regularizer’s do (see Figure 1). In other words, they have similar minima structure as the `0 norm. At last, the Hoyer-Square regularizer is also almost everywhere differentiable and Equation (4) formulates the gradient of HS w.r.t. an element wj in the weight matrix W :
  ∂wjHS(W ) = 2sign(wj)
  ∑ i|wi|
  ( ∑
  i w 2 i ) 2 ( ∑ i w2i − |wj | ∑ i |wi|). (4)
  Very importantly, this formulation induces a trimming effect: when HS(W ) is being minimized through gradient descent, wj moves towards 0 if |wj |< ∑ i w 2 i∑
  i|wi| , otherwise moves away from 0. In
  other words, unlike the `1 regularizer which tends to shrink all elements, our Hoyer-Square regularizer will turn weights in small value to zero meanwhile protecting large weights. Traditional trimmed regularizers (Fan & Li, 2001; Zhang et al., 2010; Yun et al., 2019) usually define a trimming threshold as a fixed value or percentage. Instead, the HS regularizer can gradually extend the scope of pruning as more weights coming close to zero. This behavior can be observed in the gradient descent path shown in Figure 2.
sections.heading: 4.2 GROUP-HS REGULARIZER FOR STRUCTURAL PRUNING
sections.text: Beyond element-wise pruning, structural pruning is often more preferred because it can construct the sparsity in a structured way and therefore achieve higher computation speed-up on general computation platforms (Wen et al., 2016). The structural pruning is previously empowered by the group lasso (Yuan & Lin, 2006; Wen et al., 2016), which is the sum (i.e. `1 norm) of the `2 norms of all the groups within a weight matrix like
  RG(W ) = G∑ g=1 ||w(g)||2, (5)
  where ||W ||2= √∑ i w 2 i represents the `2 norm, w
  (g) is a group of elements in the weight matrix W which consists of G such groups.
  Following the same approach in Section 4.1, we use the Hoyer-Square regularizer to replace the `1 regularizer in the group lasso formulation and define the Group-HS (GH ) regularizer in Equation (6):
  GH(W ) = ( ∑G
  g=1||w(g)||2)2∑G g=1||w(g)||22
  = ( ∑G g=1||w(g)||2)2
  ||W ||22 . (6)
  Note that the second equality holds when and only when the groups cover all the elements of W without overlapping with each other. Our experiments in this paper satisfy this requirement. However, the Group-HS regularizer can always be used in the form of the first equality when overlapping exists across groups. The gradient and the descent path of the Group-HS regularizer are very similar to those of the Hoyer-Square regularizer, and therefore we omit the detailed discussion here. The derivation of the Group-HS regularizer’s gradient shall be found in Appendix A.
sections.heading: 4.3 APPLY DEEPHOYER REGULARIZERS IN DNN TRAINING
sections.text: The deployment of the DeepHoyer regularizers in DNN training follows the common layer-based regularization approach (Wen et al., 2016; Liu et al., 2015). For element-wise pruning, we apply the Hoyer-Square regularizer to layer weight matrix W (l) for all L layers, and directly minimize it alongside the DNN’s original training objective L(W (1:L)). The `2 regularizer can also be added to the objective if needed. Equation (7) presents the training objective with HS defined in Equation (3). Here, α and β are pre-selected weight decay parameters for the regularizers.
  min W (1:L)
  L(W (1:L)) + L∑
  l=1
  (αHS(W (l)) + β||W (l)||2). (7)
  For structural pruning, we mainly focus on pruning the columns and rows of fully connected layers and the filters and channels of convolutional layers. More specific, we group a layer in filter-wise and channel-wise fashion as proposed by Wen et al. (2016) and then apply the Group-HS regularizer to the layer. The resulted optimization objective is formulated in Equation (8).
  min W (1:L)
  L(W (1:L)) + L∑
  l=1
  (αn ( ∑Nl nl=1 ||w(l)nl,:,:,:||2)2
  ||W (l)||22 + αc
  ( ∑Cl
  cl=1 ||w(l):,cl,:,:||2)2
  ||W (l)||22 + β||W (l)||2). (8)
  HereNl is the number of filters andCl is the number of channels in the lth layer if it is a convolutional layer. If the lth layer is fully connected, then Nl and Cl is the number of rows and columns respectively. αn, αc and β are pre-selected weight decay parameters for the regularizers.
  The recent advance in stochastic gradient descent (SGD) method provides satisfying results under large-scale non-convex settings (Sutskever et al., 2013; Kingma & Ba, 2014), including DNNs with non-convex objectives (Auer et al., 1996). So we can directly optimize the DeepHoyer regularizers with the same SGD optimizer used for the original DNN training objective, despite their nonconvex formulations. Our experiments show that the tiny-bit nonconvexity induced by DeepHoyer does not affect the performance of DNNs.
  The pruning is conducted by following the common three-stage operations: (1) train the DNN with the DeepHoyer regularizer, (2) prune all the weight elements smaller than a predefined small threshold, and (3) finetune the model by fixing all the zero elements and removing the DeepHoyer regularizer.
sections.heading: 5 EXPERIMENT RESULT
sections.text: The proposed DeepHoyer regularizers are first tested on the MNIST benchmark using the LeNet300-100 fully connected model and the LeNet-5 CNN model (LeCun et al., 1998). We also conduct tests on the CIFAR-10 dataset (Krizhevsky & Hinton, 2009) with ResNet models (He et al., 2016) in various depths, and on ImageNet ILSVRC-2012 benchmark (Russakovsky et al., 2015) with the AlexNet model (Krizhevsky et al., 2012) and the ResNet-50 model (He et al., 2016). All the models are implemented and trained in the PyTorch deep learning framework (Paszke et al., 2017), where we match the model structure and the benchmark performance with those of previous works for the fairness of comparison. The experiment results presented in the rest of this section show that the proposed DeepHoyer regularizers consistently outperform previous works in both element-wise and structural pruning. Detailed information on the experiment setups and the parameter choices of our reported results can be found in Appendix B.
sections.heading: 5.1 ELEMENT-WISE PRUNING
sections.text: Table 1 and Table 2 summarize the performance of the proposed Hoyer-square regularizer on the MNIST benchmark, with comparisons against state of the art (SOTA) element-wise pruning methods. Without losing the testing accuracy, training with the Hoyer-Square regularizer reduces the number of nonzero weights by 54.5× on the LeNet-300-100 model and by 122× on the LeNet-5 model. Among all the methods, ours achieves the highest sparsity: it is a 38% improvement on the LeNet-300-100 model and a 63% improvement on the LeNet-5 model comparing to the best available methods. Additional results in Appendix C.1 further illustrates the effect of the Hoyer-Square regularizer on each layer’s weight distribution during the training process.
  The element-wise pruning performance on the AlexNet model testing on the ImageNet benchmark is presented in Table 3. Without losing the testing accuracy, the Hoyer-Square regularizer improves
  1We implement the transformed `1 regularizer in (Ma et al., 2019) ourselves because the experiments in the original paper are under different settings. Implementation details can be found in Appendix B.
  the compression rate by 21.3×. This result is the highest among all methods, even better than the ADMM method (Zhang et al., 2018) which requires two additional Lagrange multipliers and involves the optimization of two objectives. Considering that the optimization of the Hoyer-Square regularizer can be directly realized on a single objective without additional variables, we conclude that the Hoyer-Square regularizer can achieve a sparse DNN model with a much lower cost. A more detailed layer-by-layer sparsity comparison of the compressed model can be found in Appendix C.2.
  We perform the ablation study for performance comparison between the Hoyer-Square regularizer and the original Hoyer regularizer. The results in Tables 1, 2 and 3 all show that the Hoyer-Square regularizer always achieves a higher compression rate than the original Hoyer regularizer. The layer-wise compression results show that the Hoyer-Square regularizer emphasizes more on the layers with more parameters (i.e. FC1 for the MNIST models). This corresponds to the fact that the value of the Hoyer-Square regularizer is proportional to the number of non-zero elements in the weight. These observations validate our choice to use the Hoyer-Square regularizer for DNN compression.
sections.heading: 5.2 STRUCTURAL PRUNING
sections.text: This section reports the effectiveness of the Group-HS regularizer in structural pruning tasks. Here we mainly focus on the number of remaining neurons (output channels for convolution layers and rows for fully connected layers) after removing the all-zero channels or rows in the weight matrices. The comparison is then made based on the required float-point operations (FLOPs) to inference with the remaining neurons, which indeed represents the potential inference speed of the pruned model. As shown in Table 4, training with the Group-HS regularizer can reduce the number of FLOPs by 16.2× for the LeNet-300-100 model with a slight accuracy drop. This is the highest speedup among all existing methods achieving the same testing accuracy. Table 5 shows that the Group-HS regularizer can reduce the number of FLOPs of the LeNet-5 model by 12.4×, which outperforms most of the existing work—an 8.8% increase from the `1 based method (Wen et al., 2016) and a 110.6% increase from the `0 based method (Louizos et al., 2017b). Only the Bayesian compression (BC) method with the group-horseshoe prior (BC-GHS) (Louizos et al., 2017a) achieves a slightly higher speedup on the LeNet-5 model. However, the complexity of high dimensional Bayesian inference limits BC’s capability. It is difficult to apply BC to ImageNet-level problems and large DNN models like ResNet.
  In contrast, the effectiveness of the Group-HS regularizer can be easily extended to deeper models and larger datasets, which is demonstrated by our experiments. We apply the Group-HS regularizer to ResNet models (He et al., 2016) on the CIFAR-10 and the ImageNet datasets. Pruning ResNet has long been considered difficult due to the compact structure of the ResNet model. Since previous works usually report the compression rate at different accuracy, we use the “accuracy-#FLOPs” plot to represent the tradeoff. The tradeoff between the accuracy and the FLOPs are explored in this work by changing the strength of the Group-HS regularizer used in training. Figure 3 shows the performance of DeepHoyer constantly stays above the Pareto frontier of previous methods.
sections.heading: 6 CONCLUSIONS
sections.text: In this work, we propose DeepHoyer, a set of sparsity-inducing regularizers that are both scaleinvariant and almost everywhere differentiable. We show that the proposed regularizers have similar range and minima structure as the `0 norm, so it can effectively measure and regularize the sparsity of the weight matrices of DNN models. Meanwhile, the differentiable property enables the proposed regularizers to be simply optimized with standard gradient-based methods, in the same way as the `1 regularizer is. In the element-wise pruning experiment, the proposed Hoyer-Square regularizer achieves a 38% sparsity increase on the LeNet-300-100 model and a 63% sparsity increase on the LeNet-5 model without accuracy loss comparing to the state-of-the-art. A 21.3× model compression rate is achieved on AlexNet, which also surpass all previous methods. In the structural pruning experiment, the proposed Group-HS regularizer further reduces the computation load by 24.4% from the state-of-the-art on LeNet-300-100 model. It also achieves a 8.8% increase from the `1 based method and a 110.6% increase from the `0 based method of the computation reduction rate on the LeNet-5 model. For CIFAR-10 and ImageNet dataset, the accuracy-FLOPs tradeoff achieved by training ResNet models with various strengths of the Group-HS regularizer constantly stays above the Pareto frontier of previous methods. These results prove that the DeepHoyer regularizers are effective in achieving both element-wise and structural sparsity in deep neural networks, and can produce even sparser DNN models than previous works.
sections.heading: ACKNOWLEDGMENTS
sections.text: The authors would like to thank Feng Yan for his help on computation resources throughout this project. Our work was supported in part by NSF SPX-1725456 and NSF CNS-1822085.
sections.heading: A DERIVATION OF DEEPHOYER REGULARIZERS’ GRADIENTS
sections.text: In this section we provide detailed derivation of the gradient of the Hoyer-Square regularizer and the Group-GS regularizer w.r.t. an element wj in the weight matrix W .
  The gradient of the Hoyer-Square regularizer is shown in Equation (9). The formulation shown in Equation (4) is achieved at the end of the derivation.
  ∂wjHS(W ) = [∂wj ((
  ∑ i|wi|)2)] ∑ i w 2 i − [∂wj ( ∑ i w 2 i )]( ∑ i|wi|)2
  ( ∑
  i w 2 i ) 2
  = 2[∂wj (|wj |)]
  ∑ i|wi| ∑ i w 2 i − 2wj( ∑ i|wi|)2
  ( ∑
  i w 2 i ) 2
  = 2
  ∑ i|wi|
  ( ∑
  i w 2 i )
  2 (sign(wj) ∑ i w2i − sign(wj)|wj | ∑ i |wi|)
  = 2sign(wj)
  ∑ i|wi|
  ( ∑
  i w 2 i ) 2 ( ∑ i w2i − |wj | ∑ i |wi|).
  (9)
  The gradient of the Group-HS regularizer is shown in Equation (10). For simplicity we use the form shown in the second equality of Equation (6), where there is no overlapping between the groups. Here we assume that wj belongs to group w(ĝ).
  ∂wjGH(W ) = ∂wj ( ∑G
  g=1||w(g)||2)2∑ i w 2 i
  = [∂wj ((
  ∑G g=1||w(g)||2)2)] ∑ i w 2 i − [∂wj ( ∑ i w 2 i )]( ∑G g=1||w(g)||2)2
  ( ∑
  i w 2 i ) 2
  = 2[∂wj (||w(ĝ)||2)]
  ∑G g=1||w(g)||2 ∑ i w 2 i − 2wj( ∑G g=1||w(g)||2)2
  ( ∑
  i w 2 i ) 2
  = 2 ∑G g=1||w(g)||2 ( ∑
  i w 2 i )
  2 ( wj ||w(ĝ)||2 ∑ i w2i − wj G∑ g=1 ||w(g)||2)
  = 2 wj
  ||w(ĝ)||2
  ∑ i|wi|
  ( ∑
  i w 2 i ) 2 ( ∑ i w2i − ||w(ĝ)||2 G∑ g=1 ||w(g)||2).
  (10)
sections.heading: B DETAILED EXPERIMENT SETUP
sections.text: B.1 MNIST EXPERIMENTS
  The MNIST dataset (LeCun et al., 1998) is a well known handwritten digit dataset consists of greyscale images with the size of 28× 28 pixels. We use the dataset API provided in the “torchvision” python package to access the dataset. In our experiments we use the whole 60,000 training set images for the training and the whole 10,000 testing set images for the evaluation. All the accuracy results reported in the paper are evaluated on the testing set. Both the training set and the testing set are normalized to have zero mean and variance one. Adam optimizer (Kingma & Ba, 2014) with learning rate 0.001 is used throughout the training process. All the MNIST experiments are done with a single TITAN XP GPU.
  Both the LeNet-300-100 model and the LeNet-5 model are firstly pretrained without the sparsityinducing regularizer, where they achieve the testing accuracy of 98.4% and 99.2% respectively. Then the models are further trained for 250 epochs with the DeepHoyer regularizers applied in the objective. The weight decay parameters (αs in Equation (7) and (8)) are picked by hand to reach the best result. In the last step, we prune the weight of each layer with threshold proportional to the standard derivation of each layer’s weight. The threshold/std ratio is chosen to achieve the highest sparsity without accuracy loss. All weight elements with a absolute value smaller than the threshold
  is set to zero and is fixed during the final finetuning. The pruned model is finetuned for another 100 steps without DeepHoyer regularizers and the best testing accuracy achieved is reported. Detailed parameter choices used in achieving the reported results are listed in Table 6.
  B.2 IMAGENET AND CIFAR-10 EXPERIMENTS
  The ImageNet dataset is a large-scale color-image dataset containing 1.2 million images of 1000 categories (Russakovsky et al., 2015), which has long been utilized as an important benchmark on image classification problems. In this paper, we use the “ILSVRC2012” version of the dataset, which can be found at http://www.image-net.org/challenges/LSVRC/ 2012/nonpub-downloads. We use all the data in the provided training set to train our model, and use the provided validation set to evaluate our model and report the testing accuracy. We follow the data reading and preprocessing pipeline suggested by the official PyTorch ImageNet example (https://github.com/pytorch/examples/tree/master/imagenet). For training images, we first randomly crop the training images to desired input size, then apply random horizontal flipping and finally normalize them before feeding them into the network. Validation images are first resized to 256× 256 pixels, then center cropped to desired input size and normalized in the end. We use input size 227 × 227 pixels for experiments on the AlexNet, and input size 224 × 224 for experiments on the ResNet-50. All the models are optimized with the SGD optimizer Sutskever et al. (2013), and the batch size is chosen as 256 for all the experiments. Two TITAN XP GPUs are used in parallel for the AlexNet training and four are used for the ResNet-50 training.
  One thing worth noticing is that the AlexNet model provided in the “torchvision” package is not the ordinary version used in previous works Han et al. (2015b); Wen et al. (2016); Zhang et al. (2018). Therefore we reimplement the AlexNet model in PyTorch for fair comparison. We pretrain the implemented model for 90 epochs and achieve 19.8 % top-5 error, which is the same as reported in previous works. In the AlexNet experiment, the reported result in Table 3 is achieved by applying the Hoyer-Square regularizer with decay parameter 1e-6. Before the pruning, the model is firstly train from the pretrained model with the Hoyer-Square regularizer for 90 epochs, where an initial learning rate 0.001 is used. An `2 regularization with 1e-4 decay is also applied. We then prune the convolution layers with threshold 1e-4 and the FC layers with threshold equal to 0.4× of their standard derivations. The model is then finetuned until the best accuracy is reached. The learning rate is decayed by 0.1 for every 30 epochs of training. The training process with the Hoyer regularizer and the T`1 regularizer (Ma et al., 2019) is the same as the HS regularizer. For the reported result, we use decay 1e-3 and FC threshold 0.8× std for the Hoyer regularizer, and use decay 2e-5 and FC threshold 1.0× std for the T`1 regularizer. For the ResNet-50 experiments on ImageNet, the model architecture and pretrained model provided in the “torchvision” package is directly utilized, which achieves 23.85% top-1 error and 7.13% top-5 error. All the reported results in Figure 3 and Table 8 are achieved with 90 epochs of training with the Group-HS regularizer from the pretrained model using initial learning rate 0.1. All the models are pruned with 1e-4 as threshold and finetuned to the best accuracy. We only tune the decay parameter of the Group-HS regularizer to explore the accuracy-FLOPs tradeoff. The exact decay parameter used for each result is specified in Table 8.
  We also use the CIFAR-10 dataset (Krizhevsky & Hinton, 2009) to evaluate the structural pruning performance on ResNet-56 and ResNet-110 models. The CIFAR-10 dataset can be directly accessed through the dataset API provided in the “torchvision” python package. Standard preprocessing,
  including random crop, horizontal flip and normalization is used on the training set to train the model. We implemented the ResNet models for CIFAR-10 following the description in (He et al., 2016), and pretrain the models for 164 epochs. Learning rate is set to 0.1 initially, and decayed by 0.1 at epoch 81 and epoch 122. The pretrained ResNet-56 model reaches the testing accuracy of 93.14 %, while the ResNet-110 model reaches 93.62 %. Similar to the ResNet-50 experiment, we start with the pretrained models and train with the Group-HS regularizer. Same learning rate scheduling is used for both pretraining and training with Group-HS. All the models are pruned with 1e-4 as threshold and finetuned to the best accuracy. The decay parameters of the Group-HS regularizer used to get the result in Figure 3 is specified in Table 9 and Table 10.
sections.heading: C ADDITIONAL EXPERIMENT RESULTS
sections.text: C.1 WEIGHT DISTRIBUTION AT DIFFERENT STAGES
  Here we demonstrate how will the weight distribution change in each layer at different stages of our element-wise pruning process. Since most of the weight elements will be zero in the end, we only plot the histogram of nonzero weight elements for better observation. The histogram of each layer of the LeNet-300-100 model and the LeNet-5 model are visualized in Figure 4 and Figure 5 respectively. It can be seen that majority of the weights will be concentrated near zero after applying the HS regularizer during training, while rest of the weight elements will spread out in a wide range. The weights close to zero are then set to be exactly zero, and the model is finetuned with zero weights fixed. The resulted histogram shows that most of the weights are pruned away, only a small amount of nonzero weights are remaining in the model.
  C.2 LAYER-BY-LAYER COMPARISON OF ELEMENT-WISE PRUNING RESULT OF ALEXNET
  Table 7 compares the element-wise pruning result of the Hoyer-Square regularizer on AlexNet with other methods in a layer-by-layer fashion. It can be seen that the Hoyer-Square regularizer achieves high pruning rates on the largest layers (i.e. FC1-3). This observation is consistent with the observation made on the element-wise pruning performance of models on the MNIST dataset.
  C.3 DETAILED RESULTS OF THE RESNET EXPERIMENTS
  In this section we list the data used to plot Figure 3. Table 8 shows the result of pruning ResNet-50 model on ImageNet, Table 9 shows the result of pruning ResNet-56 model on CIFAR-10 and Table 10 shows the result of pruning ResNet-110 model on CIFAR-10. For all the tables, the results of previous works are listed on the top, and are ordered based on publication year. Results achieved with the Group-HS regularizer are listed below, marked with the regularization strength used for the training.
title: DEEPHOYER: LEARNING SPARSER NEURAL NETWORK WITH DIFFERENTIABLE SCALE-INVARIANT SPARSITY MEASURES