Literature DB >> 35684708

MobilePrune: Neural Network Compression via 0 Sparse Group Lasso on the Mobile System.

Yubo Shao1, Kaikai Zhao2, Zhiwen Cao3, Zhehao Peng1, Xingang Peng4, Pan Li1, Yijie Wang2, Jianzhu Ma5.   

Abstract

It is hard to directly deploy deep learning models on today's smartphones due to the substantial computational costs introduced by millions of parameters. To compress the model, we develop an ℓ0-based sparse group lasso model called MobilePrune which can generate extremely compact neural network models for both desktop and mobile platforms. We adopt group lasso penalty to enforce sparsity at the group level to benefit General Matrix Multiply (GEMM) and develop the very first algorithm that can optimize the ℓ0 norm in an exact manner and achieve the global convergence guarantee in the deep learning context. MobilePrune also allows complicated group structures to be applied on the group penalty (i.e., trees and overlapping groups) to suit DNN models with more complex architectures. Empirically, we observe the substantial reduction of compression ratio and computational costs for various popular deep learning models on multiple benchmark datasets compared to the state-of-the-art methods. More importantly, the compression models are deployed on the android system to confirm that our approach is able to achieve less response delay and battery consumption on mobile phones.

Entities:  

Keywords:  convolutional neural network; deep learning; mobile computing; model compression; pruning network

Mesh:

Year:  2022        PMID: 35684708      PMCID: PMC9185446          DOI: 10.3390/s22114081

Source DB:  PubMed          Journal:  Sensors (Basel)        ISSN: 1424-8220            Impact factor:   3.847


1. Introduction

Deep neural networks (DNNs) have achieved tremendous success in many real-world applications. However, the computational cost of DNN models significantly restricts their deployment on platforms with limited computational resources, such as mobile devices. To address this challenge, numerous model compression algorithms have been proposed to reduce the sizes of DNN models. The most popular solution is to prune the weights with small magnitudes by adding or penalties [1,2,3,4]. The non-zero weights selected by these methods are randomly distributed and do not reduce the memory consumption due to the matrix operations widely adopted in nowadays deep learning architectures as shown in Figure 1(b.2). The implementation of such a non-structured sparse matrix in cuDNN [5], which is the Basic Linear Algebra Subroutines library used by deep learning models, has similar memory consumption as the original matrix without pruning, as shown in Figure 1(b.2),(c.2). To overcome the problem, structured pruning models [6,7,8,9] are proposed to enforce group sparsity by pruning a group of pre-defined variables together. By tying the weights connecting to the same neuron together, these approaches are able to prune a number of hidden neurons to reduce the sizes of weight matrices and benefit General Matrix Multiply (GEMM) used in cuDNN as shown in Figure 1(b.3),(c.3). However, one of the main problems of the structured methods is that they do not consider and take advantage of the hardware accelerator architectures.
Figure 1

Observations of different strategies’ pruned filter matrix for hardware acceleration with software implementation of convolution in cuDNN. (a) General Matrix Multiply (GEMM) is applied in cuDNN. (b) Different strategies such as no pruning, individual sparsity, column-wise group sparsity, and both individual sparsity and column-wise group sparsity on pruning the filter matrix. (c) The pruned filter matrix implemented in cuDNN and determined whether it can be used for hardware acceleration or not.

In this paper, we observe three key factors that could lead to an extremely compact deep network. First, we observe that most modern deep learning architectures rely on the General Matrix Multiply (GEMM) functions implemented in the cuDNN package. We, therefore, propose a new network compression algorithm to harmonize the group selections in the structured penalty and the implementation of GEMM in cuDNN as well as the hardware accelerator using sparse systolic tensor array [10,11]. Figure 1 demonstrates the basic rationale of our observation. In comparison to the pruned model in Figure 1(c.3),(c.4) needs additional sparsity within the remaining groups, which could be utilized by the sparse systolic tensor array for hardware acceleration. The second observation is that recent studies [12,13] have demonstrated that norm is the best sparsity-inducing penalty compared to lasso [14], elastic net [15], SCAD [16], and MCP [17] models. Remarkably, even current optimization techniques can not achieve the global optimal solution, these -based methods with sub-optimal solutions still significantly outperform other sparsity norms, which can be solved to global optima [13,18]. Hence, the community has shown great interest in using norm to compress the large-scale DNN models [8,19,20,21,22,23,24]. However, some -based DNN pruning approaches [8,25,26] rely on different relaxation strategies to conquer the non-convex and non-differentiable challenges, which does not fully exploit the strength of regularization. The other methods [19,20,21,22,23] rely on the alternating direction method of multipliers (ADMM) whose global convergence has not been proved so far when applied to norm optimization [27,28,29]. Third, most of these algorithms are designed originally for mobile platforms, as the computational resources are relatively rich for desktop applications. However, few of them have been deployed on real mobile systems to test the running time and energy consumption to verify their assumptions. Therefore, we develop the very first algorithm in this paper, named MobilePrune, which is able to solve the optimization of sparse group lasso regularization in an exact manner. The main technical contribution is that we solve the proximal operators for sparse group lasso, where groups in the group lasso term could have overlapping group structure and tree structure [30]. From the theoretical point of view, we prove our algorithm always converges to the critical point (local optimal point) under mild conditions. In addition, we conduct extensive experiments on multiple public datasets and find MobilePrune achieves superior performance at sparsifying networks with both fully connected and convolutional layers. More importantly, we deploy our system on the real android system on several mobile devices and test the performance of the algorithm on multiple Human Activity Recognition (HAR) tasks. The results show that MobilePrune achieves much lower energy consumption and higher pruning rate while still retaining high prediction accuracy. Besides a powerful network compression algorithm, this work also provides a valuable platform and mobile dataset for further work to evaluate their methods in a very real scenario. The rest of this paper is organized as follows. Section 2 provides the relevant background and related work. In Section 3, we give a brief overview of the proposed MobilePrune methods. In Section 4, we discuss the detailed information of the proposed methods and algorithms. In Section 5, we describe how the experiments are set up and evaluate the proposed methods from different perspectives. Section 6 discusses the future work and summarizes the paper.

2. Related Work

2.1. Sparsity for Deep Learning Models

Many pruning algorithms for deep learning models achieve slim neural networks by introducing sparse-inducing norms to the models. regularization [31,32,33] and regularization [8] were applied to induce sparsity on each individual weight. However, such individual sparsity has arbitrary structures, which cannot be utilized by software and hardware. Wei et al. [24] applied group sparsity to prune filters or channels, which can reduce the matrix size used in GEMM in cuDNN. Because the pruned models are compatible with cuDNN, they achieved large speedups. There are methods [34,35] aiming to find sparse models at both individual and group levels, which is similar to our goal. However, they all used norm to induce individual sparsity in addition to group sparsity. We have performed a comprehensive comparison and demonstrated that our MobilePrune method is the best in inducing sparsity at both individual and group levels for pruning deep learning models in Section 5.

2.2. Learning Algorithms for Norm

Recent studies [12,13] demonstrate that norm is the best sparsity-inducing penalty comparing to lasso [14], elastic net [15], SCAD [16], and MCP [17] models. Remarkably, even current optimization techniques cannot achieve the global optimal solution, these -based methods with sub-optimal solutions still significantly outperform and elastic net models, which can be solved to global optima [13,18]. Therefore, the machine learning community has shown great interest in using norm to compress the large-scale DNN models [8,19,20,21,22,23,24]. However, some -based DNN pruning approaches [8,25] rely on different relaxation strategies to conquer the non-convex and non-differentiable challenges, which does not fully exploit the strength of regularization. The other methods [19,20,21,22,23] rely on the alternating direction method of multipliers (ADMM) whose global convergence has not proved so far when applied to norm optimization [27,28,29].

2.3. Software & Hardware Compatibility

In this paper, we aim to design an algorithm to make the pruned DNN models compatible with cuDNN library [5] and hardware accelerator architecture that uses the sparse systolic tensor array [11,36]. cuDNN is the GPU-accelerated library used in deep learning models [5]. As shown in Figure 1a, convolution used in the convolutional neural network is lowered to matrix multiplication. Therefore, the size of the filter matrix can be reduced when inducing group sparsity column-wise as shown in Figure 1(b.3),(b.4), which can reduce the memory of the DNN models to achieve practical performance improvement. The systolic tensor array is an efficient hardware accelerator for structured sparse matrix as shown in Figure 1(c.4). Specifically, each column in Figure 1(c.4) is sparse. To achieve a pruned DNN model that is compatible with cuDNN and the systolic tensor array, sparsity needs to be induced on both the group level and within-group level. We will show how we achieve this in the following sections.

3. Overview

The central idea of MobilePrune is to compress the deep learning model in a way that is compatible with the architecture of data organization in the memory by combining regularization and group lasso regularization. The group lasso regularization helps to keep important groups of weights that benefit cuDNN, while regularization helps to achieve additional sparsity within those important groups that are needed for hardware acceleration. Figure 2 provides an overview of the proposed MobilePrune method. As illustrated in Figure 2a–c, the group lasso penalty will remove all the weights together with the ith neuron if it is less important for the prediction and if a group is selected, the penalty further removes the weights with small magnitudes within the group. Note that zeroing out the weights connected to the ith neuron results in removing the ith neuron and all the associated weights entirely. We will discuss more detail information in next section.
Figure 2

Overview of the proposed MobilePrune method. (a) Group sparsity for weights of a neuron for fully connected layers. (b) Sparsity on individual weights for fully connected layers. (c) Pruning strategy for fully connected layers and their effect where sparsity is induced on both neuron-wise groups and individual weights. (d) Group and individual sparsity for convolutional layers.

4. Methods

Our main objective is to obtain a sparse deep neural network with a significantly less number of parameters at both individual and group levels by using the proposed novel combined regularizer: sparse group lasso.

4.1. Sparse Group Lasso

We aim to prune a generic (deep) neural network, which includes fully connected feed-forward networks (FCN) and convolutional neural networks (CNN). Assuming the generic neural network has N neurons in FCN and M channels in CNN. Let denote the outgoing weights of the ith neuron in FCN and represent the 3D tensor of all filters in the jth channel, which can come from different layers. The training objective for the neural network is given as follows: where , , is a training dataset with P instances, is an arbitrary loss function parameteized by W and T, and represent the sparse group lasso penalties for neurons and channels, respectively. Specifically, is defined as where and are regularization parameters. Let represent the set of outgoing edge weights of neuron i. Then, ( is the jth outgoing edge weight of neuron i; when and otherwise) computes the number of the non-zero edges in and aggregates the weights associated with the ith neuron as a group. The core spirit of Equation (2) is illustrated in Figure 2a–c, the group lasso penalty tends to remove all the weights together with the ith neuron if it is less important. If a group is selected, the penalty further removes the weights with small magnitudes within the group. Group sparsity can help remove neurons in the neural network, which reduces the size of the neural network and further improve efficiency. Individual sparsity helps to achieve additional sparsity within the remaining neurons. Such structured sparsity can be used by the systolic tensor array [10,11]. The other regularization term is defined as following, where , and are non-negative regularization parameters. Equation (3) defines a hierarchical-structured sparse penalty in which structure is guided by the memory organization of GEMM using cuDNN [5]. As demonstrated in Figure 2d, the pruning strategy encoded in Equation (3) explicitly takes advantage of the GEMM used in cuDNN. enforces the group sparsity of all the filters applied to the jth channel and enforces the group sparsity across the filters on the same channel and prunes the small weights within the remaining channels and filters. Equation (3) can help to achieve an extremely compact model as Figure 1(c.4). Therefore, the computation can be accelerated at both software and hardware levels.

4.2. Exact Optimization by PALM

In this subsection, we first briefly review the general PALM (Proximal Alternating Linearized Minimization) framework used in our MobilePrune algorithm. Then, we introduce how we modify PALM to efficiently optimize the sparse group lasso for neural network compression. PALM is designed to optimize a general optimization problem formulated as: where is a smooth function and and do not need to be convex or smooth, but are required to be lower semi-continuous. The PALM algorithm applies proximal forward–backward algorithm [37] to optimize Equation (4) with respect to W and T in an alternative manner. Specifically, at iteration , the temporal values of and for the proximal forward–backward mapping are derived by solving the following sub-problems, where and . Additionally, and are positive constants. This optimization process has been proven to converge to a critical point when functions F, , and are bounded [37]. We further extend the convergence proof in [37] and prove that the global convergence of PALM holds for training deep learning models under mild conditions. The detailed proof can be found in Appendix A. To optimize Equation (1), we define two proximal operators for the two penalty terms as the following, Here, functions and take vectors as inputs, which are equivalent to Equations (2) and (3) once we vectorize and . The overall optimization process of MobilePrune is described in Algorithm 1. Once we can efficiently compute the optimal solution of and , the computational burden mainly concentrates on the partial derivative calculation of functions and , which is the same as training a normal DNN model. Initialize , and . fordo for  do . by solving Equation (7). end for for  do . by solving Equation (8). end for end for

4.3. Efficient Computation of Proximal Operators

To the best of our knowledge, and defined in Equations (7) and (8) are novel proximal operators that have not been attempted before. Solving and is the key to apply MobilePrune in Algorithm 1. Therefore, this subsection elaborates the algorithmic contributions we made to efficiently calculate and .

4.3.1. Proximal Operator

The difficulty of solving in Equation (9) is that both and are not differentiable when the vector . Furthermore, calculates the number of non-zeros in the vector and there are ( computes the number of non-zero patterns in x where k elements in x are not zeros) possible combinations, which indicates the brute-force method needs computations to find the global optimal solution. However, here we prove that the in Equation (9) can be efficiently solved by a algorithm in a closed from. We illustrate the algorithm in Algorithm 2 and prove its correctness in Theorem 1. To the best of our knowledge, it is the first efficient algorithm that can calculate this novel proximal operator. The proximal operator The optimal solution of this proximal operator can be computed by Algorithm 2. Input: A sorted vector y, such that Output: for do if  then else end if end for Compute if then else end if Without loss of generality, we assume is an ordered vector, where . Then, we define , where the top k elements with largest absolute values are kept and all the rest elements are set to zeroes. We define another set to represent all n-dimensional vectors with exact k non-zero elements. For any , we further define a mask function to reveal the non-zero locations of x. Since we do not know how many non-zero elements remain in the optimal solution of Equation (9), we need to enumerate all possible k and solve sub-problems for all with . For each k, the sub-problem is defined as Based on Lemma A4 in Appendix A.2, we observe that if , then and . If , then and the value of the objective function can be computed as Equation (11) tells us is a function of . The task of calculating the minimum value of function is transformed into solving another optimization with respect to , which is equivalent to ask which of the k components of y can achieve the minimum value of f. Since we assume , the optimal solution is clearly to select the top k components with the largest value from y. Therefore we have and the corresponding . Furthermore, the objective function value is . Hence, problem (10) has a closed-form solution.    □ As shown in Algorithm 2, the heaviest computation is to sort the input vector y, therefore, the time complexity for solving Equation (9) is .

4.3.2. Proximal Operator

Similar as , is the solution of the following optimization problem: where we assume . is the index of a group and d represents the number of groups. Note that the grouping structures specified in Equation (12) is a special case of the grouped tree structures [30], where is the group lasso for the root of the tree and all the are the group lasso terms of its children. Notice that groups from the same depth on the tree do not overlap and furthermore . To simplify the notation, assuming we define that is a convex and differentiable and rewrite the problem as where . We can use the proximal method [38] to find a solution of Equation (13). In the proximal method, we need to estimate the Lipschitz constant and the partial derivative . In addition, we need to use Algorithm 2 to solve for each group . After obtaining , we can find the solution of Equation (12) by comparing with . If , then the local optimal solution of Equation (12) is , otherwise, . We elaborate the algorithm for the proximal operator in the Algorithm 3. The major computation cost is the proximal method, therefore, the convergence rate of Algorithm 3 is [38]. Input: and Output: fordo Let and , then compute by applying Algorithm 2. end for ifthen else end if

5. Experimental Setup and Results

5.1. Performance on Image Benchmarks

In this subsection, we compared our proposed MobilePrune approach with other state-of-the-art pruning methods in terms of prune rate, computational costs, and test accuracy. We mainly compared our methods with structured pruning methods because DNN models pruned by non-structure pruning methods could not obtain practical speedup as shown in Figure 1. Notably, we only compared the results that can be reproduced by the source codes provided by the competing methods. First, we briefly summarized their methodology. PF [32] and NN slimming [33] were simple magnitude-based pruning methods based on norm. BC [9], SBP [7], and VIBNet [39] cast the DNN pruning into probabilistic Bayesian models. C-OBD [40], C-OBS [2], Kron-OBD [40,41], Kron-OBS [2,41], and EigenDamage [42] are Hessian matrix-based methods. norm penalized method [8] and group lasso penalized method [24] are also well-known methods. In our experiments, we use NVIDIA Corporation as the GPU and the number of cores of the CPU is 12. All the baseline models were trained from scratch via stochastic gradient decent(SGD) with a momentum of 0.9. We trained the networks for 150 epochs on MNIST and 400 epochs on CIFAR-10 and Tiny-ImageNet with an initial learning rate of 0.1 and weight decay of 5 × 10−4. The learning rate is decayed by a factor of 10 at 50, 100 on MNIST and at 100, 200 on CIFAR-10 and Tiny-ImageNet, respectively. The details of hyper-parameters for all experiments are summarized in Appendix B. We also provide the computational efficiency of our methods in Appendix C.

5.1.1. MNIST Dataset

We first applied MobilePrune to prune the LeNet-300-100 and LeNet-5 [7,8,9] models on the MNIST dataset [43]. LeNet-300-100 is a fully-connected neural network model with three layers and 267 K parameters. LeNet-5 is comprised of two [20, 50] convolutional layers and two [800, 500] fully-connected layers with 431K parameters. Here, we compared with the state-of-the-art structured network compression algorithms [7,8,9] in terms of pruned accuracy, remaining parameters, pruned architecture, and FLOPs of the pruned models. As shown in the top half of the MNIST dataset of Table 1, our model achieves the least number of neurons after pruning the LeNet-300-100 model and the lowest drop of the prediction accuracy 0.01% compared to other methods. More importantly, our pruned model achieves the lowest FLOPs. Note that the architecture of our pruned model is as compact as L0-sep [8], but is extremely sparse with only 5252 weights left. This additional sparsity would be critical when applying hardware acceleration [10,11] to our pruned model.
Table 1

Comparison of pruned models with state-of-the-art methods on different datasets – MNIST, CIFAR-10, and Tiny-ImageNet, respectively. (We highlight our MobilePrune results and mark the best performance as blue among different methods for each model in each dataset).

DatasetModelMethodsBase/Pruned Accuracy (%)Original/Remaining Parameters (Mil)FLPOs (Mil)
MNIST BC-GNJ [9]98.40/98.20267.00/28.7328.64
BC-GHS [9]98.40/98.20267.00/28.1728.09
LeNet-300-100L0 [8]-/98.60-69.27
L0-sep [8]-/98.20-26.64
MobilePrune 98.24/98.23 267.00/5.25 25.79
SBP [7]-/99.14-212.80
BC-GNJ [9]99.10/99.00431.00/3.88282.87
BC-GHS [9]99.10/99.00431.00/2.59153.38
LeNet-5L0 [8]-/99.10-1113.40
L0-sep [8]-/99.00-390.68
MobilePrune 99.12/99.11 431.00/2.31 113.50
CIFAR-10 Original [44]-/92.4515.00/-313.5
PF [32]-/93.4015.00/5.4206.3
VGG-likeSBP [7]92.80/92.5015.00/-136.0
SBPa [7]92.80/91.0015.00/-99.20
VIBNet [39]-/93.5015.00/0.8786.82
MobilePrune 92.96/92.94 15.00/0.60 77.83
C-OBD [40]95.30/95.277.42/2.92488.85
C-OBS [2]95.30/95.307.42/3.04378.22
ResNet32Kron-OBD [40,41]95.30/95.307.42/3.26526.17
Kron-OBS [2,41]95.30/95.467.42/3.23524.52
EigenDamage [42]95.30/95.287.42/2.99457.46
MobilePrune 95.29/95.47 7.42/2.93 371.30
NN slimming [33]61.56/40.0520.12/5.83158.62
C-OBD [40]61.56/47.3620.12/4.21481.90
C-OBS [2]61.56/39.8020.12/6.55210.05
Tiny-ImageNetVGG-19Kron-OBD [40,41]61.56/44.4120.12/4.72298.28
Kron-OBS [2,41]61.56/44.5420.12/5.26 266.43
EigenDamage [42]61.56/56.9220.12/5.21408.17
MobilePrune 61.56/56.27 20.12/4.05 407.37
In addition, we compared with SSL on pruning the first two convolutional layers as done in [24] in Table A2. SSL has the same group lasso penalty term as ours but without norm regularization. As shown, our method decreases the sizes of the filters from 25 and 500 to 16 and 65, respectively, which dramatically lowers the FLOPs. In addition, the non-zero parameters in those remaining filters is very sparse in our model.
Table A2

Results about learning filter shapes in LeNet-5. (We highlight our MobilePrune results).

MethodBase/Pruned Accuracy (%)Filter SizeRemaining FiltersRemaining ParametersFLOPs (K)
Baseline-25–50020–50500–25,0002464
SSL [24]99.10/99.007–141–50-63.82
MobilePrune 99.12/99.03 14–9 4–16 46–26 51.21
The bottom half of the MNIST dataset in Table 1 shows the performance comparison on pruning the LeNet-5 model. The LeNet-5 model pruned by our method achieves the lowest FLOPs (113.50 K) with the smallest predicting accuracy drop . Moreover, our pruned model also has the smallest number of weights (around 2310). In addition, we compared with SSL on pruning the first two convolutional layers as done in [24]. SSL has the same group lasso penalty term as ours, but without norm regularization. More details about SSL can be found in Appendix C.2. As shown, our method decreases the sizes of the filters from 25 and 500 to 16 and 65, respectively, which dramatically lowers the FLOPs. In addition, the non-zero parameters in those remaining filters are very sparse in our model.

5.1.2. CIFAR-10 Dataset

We further evaluated our method on pruning more sophisticated DNN architectures, VGG-like [44] and ResNet-32 [42,45] and widen the network by a factor of 4, on CIFAR-10 [46]. Similarly, we compared with the state-of-the-art structured pruning methods [2,7,32,39,40,41,42] in terms of various metrics. As shown in the middle of Table 1, the pruned VGG-like model obtained by our method achieves the lowest FLOPs with the smallest test accuracy drop. Similar to previous results, our pruned model is able to keep the smallest number of weights in comparison to other methods, the key for hardware acceleration [10,11]. As presented in Table 1, the pruned ResNet-32 model achieved by our method outperforms other pruned models in terms of pruned test accuracy and FLOPs. In addition, in terms of the remaining weights, our pruned model is at the same sparsity level as C-OBD [40] while our pruned accuracy outperforms C-OBD by a large margin.

5.1.3. Tiny-ImageNet Dataset

Besides the experiments on MNIST and CIFAR-10 datasets, we further evaluated the performance of our method on a more complex dataset, Tiny-ImageNet [47], using VGG-19 [48]. Tiny-ImageNet is a subset of the full ImageNet, which consists of 100,000 images for validation. There are 200 classes in Tiny-ImageNet. We compared our method with some state-of-the-art methods [2,33,40,42] in Table 1. As shown in Table 1, the test accuracy of the pruned model derived from our method outperforms all the other methods by a significant margin, about 10%, except EigenDamage. Our proposed method obtains the same-level test accuracy as EigenDamage. However, our method achieves a much sparser DNN model with 1.16 million fewer weights than EigenDamage. Meanwhile, our pruned model achieves lower FLOPs.

5.2. Performance on Human Activity Recognition Benchmarks

To demonstrate the efficacy and effectiveness of our proposed MobilePrune method, we perform a series of compassion studies with other state-of-the-art pruning methods such as norm, norm, norm, group lasso, and sparse group lasso for all three datasets—WISDM [49,50], UCI-HAR [51,52], and PAMAP2 [53,54,55]. We evaluate the pruning accuracy and pruning rate of weights (parameters) and nodes for our proposed MobilePrune approach and all other state-of-the-art pruning methods using the same learning rate (0.0001) and the same number of epochs (150) for all three datasets. The pruning thresholds are 0.015, 0.005, 0.01 for the pruning methods in the WISDM, HCI-HAR, and PAMAP2 datasets, respectively. In addition, we evaluate the computational cost and battery consumption for our proposed method with all other state-of-the-art pruning methods as well. The details of the dataset descriptions and the hyper-parameters for all experiments are summarized in Appendix D.

5.2.1. Performance on the Desktop

We use Google Colab [56] to build a PyTorch backend on the above datasets. The GPU for Google Colab is NVIDIA Tesla K80 and the number of cores of the CPU for Google Colab is 2. As shown in Table 2, if we only use norm penalty or norm penalty, there is no effect on neurons or channels pruning as expected for all three datasets. Similarly, if we only employ group lasso penalty, the pruned model still has more weights or nodes left. For the UCI-HAR dataset, norm penalty and sparse group lasso penalty cannot sparse down the model while for the other two datasets, these two penalties could achieve better sparsity, but cannot be better than MobilePrune approach. There exists a trade-off between the pruned accuracy and the pruning rate. As can be seen in Table 2, our MobilePrune method still has high pruned accuracy even if there are not too many parameters and nodes left. In addition, we compare our MobilePrune method with sparse group lasso penalty. The sparse group lasso model still significantly outperforms the sparse group lasso model in weights and nodes pruning, which demonstrates its superiority in pruning CNN models.
Table 2

Comparison of pruning method on the desktop with state-of-the-art methods for pruning accuracy, pruning rate and response delay on HAR datasets—WISDM, HCI-HAR, and PAMAP2, respectively. (We highlight our MobilePrune results and mark the best performance as blue among different penalties for each dataset).

DatasetPenaltyBase/Pruned Accuracy (%)Parameter Nonzero (%)Parameter Remaining (%)Node Remaining (%)Base/Pruned Response Delay (s)Time Saving Percentage (%)
WISDMl0 norm94.72/94.7963.36100.00100.000.38/0.390.00
l1 norm94.30/93.8413.5846.2668.160.38/0.2436.84
l2 norm94.61/94.5456.2890.4695.120.38/0.357.89
Group lasso94.68/94.3248.2389.7394.730.38/0.357.89
l1 sparse Group lasso94.81/94.7917.9153.4173.830.41/0.2636.59
MobilePrune 94.97/94.65 9.52 28.03 52.52 0.50/0.17 66.00
UCI-HARl0 norm91.52/91.4888.49100.00100.000.84/0.804.76
l1 norm90.46/90.3381.5898.4799.220.81/0.820.00
l2 norm91.01/90.9488.35100.00100.000.79/0.800.00
Group lasso90.80/90.8482.91100.00100.000.83/0.786.02
l1 sparse Group lasso91.11/91.0481.2197.7098.830.84/0.804.76
MobilePrune 90.06/89.96 23.00 46.83 68.75 1.01/0.43 57.43
PAMAP2l0 norm93.15/93.0769.27100.00100.000.41/0.410.00
l1 norm95.22/95.291.467.2819.730.40/0.0880.00
l2 norm92.08/92.0965.3294.9397.270.41/0.394.88
Group lasso93.30/93.2861.78100.00100.000.41/0.410.00
l1 sparse Group lasso96.87/97.202.679.7226.170.40/0.1075.00
MobilePrune 96.89/96.95 1.26 3.72 10.74 0.51/0.05 90.20
We also calculate the response delay and time saving percentage for all the above methods on the desktop platform. Response delay is the time needed for the desktop to run the pre-trained model after the raw input signal is ready. Here in Table 2, the response delay results are obtained after running 200 input samples. As can be seen in Table 2, MobilePrune could save up to 66.00%, 57.43%, 90.20% on response delay on WISDM, HCI-HAR, and PAMAP2 datasets, respectively. Overall, if we apply MobilePrune method, the pruned CNN models can still achieve the best sparsity in terms of both neurons (or channel) and weights without loss of performance. Additionally, the results in Table 2 show that our MobilePrune method could achieve 28.03%, 46.83%, 3.72% on weight (parameter) sparsity, and 52.52%, 68.75%, and 10.74% on node sparsity for the WISDM, UCI-HAR, and PAMAP2 datasets, respectively.

5.2.2. Performance of Mobile Phones

We evaluate the computational cost and battery consumption for our proposed MobilePrune approach with all other state-of-the-art pruning methods. In order to obtain the final results about how these models perform on today’s smartphone, we implement an Android Application using Android Studio on Huawei P20 and OnePlus 8 Pro. PyTorch Android API [57] is used here for running trained models on Android devices. Currently, the Android devices only support running machine learning models by using CPU only. For the Huawei P20, the CPU is Cortex-A73. For the OnePlus 8 Pro, it is using Octa-Core as its CPU. We also use the Batterystats tool and the Battery Historian script [58] to test the battery consumption. Table 3 shows the response delay results and battery usage for our proposed method and all other state-to-the-arts pruning methods. Response delay is the time needed for the smartphone’s system to run the pre-trained model after the raw input signal is ready. Here, in Table 3, the response delay results are obtained after running 200 input samples and the battery consumption results are obtained after running 2000 input samples for each penalty in all three datasets. For the HCI-HAR dataset, our MobilePrune approach could save up to 40.14%, 22.22% on response delay and 34.52%, 19.44% on battery usage for Huawei P20 and OnePlus Pro 8, respectively, while the other pruning methods stay almost the same compared to the uncompressed version. For the WISDM and PAMAP2 datasets, norm penalty, norm penalty, and group lasso penalty cannot sparse down the model, and therefore they cannot provide any savings in both response delay and battery consumption. norm and sparse group lasso methods could provide better time saving and battery consumption saving compared to those three penalties, but they still cannot perform better than the MobilePrune method, which saves 61.94% and 88.15% in response time, and 37.50% and 36.71% in battery consumption for WISDM and PAMAP2 dataset, respectively, on Huawei P20. Additionally, it also saves 52.08% and 77.66% in response time, and 32.35% and 37.93% in battery consumption for WISDM and PAMAP2 dataset, respectively, on OnePlus 8 Pro. Overall, results in Table 3 demonstrate MobilePrune’s superiority in pruning HAR CNN models for battery usage and computational cost on today’s smartphone.
Table 3

Comparison of pruning method on the mobile devices with other state-of-the-art pruning methods for computational cost and battery usage on HAR dataset—WISDM, HCI-HAR, and PAMAP2, respectively. (We highlight our MobilePrune results and mark the best performance as blue among different penalties for each device in each dataset).

DatasetDevicePenaltyBase/Pruned Response Delay (s)Time Saving Percentage (%)Based/Pruned Device Estimated Battery Use (%/h)Battery Saving Percentage (%)
WISDM Huawei P20l0 norm1.40/1.279.290.71/0.701.41
l1 norm1.33/0.7146.620.74/0.6512.16
l2 norm1.28/1.215.470.74/0.770.00
Group lasso1.27/1.270.000.74/0.770.00
l1 sparse Group lasso1.25/0.8135.200.74/0.688.11
MobilePrune 1.34/0.51 61.94 0.72/0.45 37.50
OnePlus 8 Prol0 norm0.57/0.4914.040.34/0.325.88
l1 norm0.48/0.3429.170.35/0.3014.29
l2 norm0.48/0.4016.670.34/0.340.00
Group lasso0.49/0.458.160.34/0.350.00
l1 sparse Group lasso0.48/0.3331.250.35/0.3014.29
MobilePrune 0.48/0.23 52.08 0.34/0.23 32.35
HCI-HAR Huawei P20l0 norm1.43/1.430.000.84/0.840.00
l1 norm1.42/1.420.000.85/0.841.18
l2 norm1.43/1.430.000.84/0.840.00
Group lasso1.43/1.430.000.84/0.822.38
l1 sparse Group lasso1.42/1.410.700.85/0.823.53
MobilePrune 1.42/0.85 40.14 0.84/0.55 34.52
OnePlus 8 Prol0 norm0.53/0.530.000.35/0.350.00
l1 norm0.54/0.515.560.37/0.362.70
l2 norm0.54/0.531.850.37/0.370.00
Group lasso0.53/0.521.890.36/0.360.00
l1 sparse Group lasso0.53/0.521.890.36/0.360.00
MobilePrune 0.54/0.42 22.22 0.36/0.29 19.44
PAMAP2 Huawei P20l0 norm2.64/2.720.000.76/0.790.00
l1 norm2.74/0.4583.580.79/0.5332.91
l2 norm2.67/2.564.120.78/0.780.00
Group lasso2.67/2.680.000.78/0.780.00
l1 sparse Group lasso2.69/0.5579.550.79/0.5727.85
MobilePrune 2.70/0.32 88.15 0.79/0.50 36.71
OnePlus 8 Prol0 norm0.94/0.931.060.88/0.880.00
l1 norm0.93/0.2573.120.87/0.5536.78
l2 norm0.93/0.912.150.88/0.871.14
Group lasso0.94/0.950.000.89/0.890.00
l1 sparse Group lasso0.95/0.2969.470.88/0.5932.95
MobilePrune 0.94/0.21 77.66 0.87/0.54 37.93

5.3. Ablation Studies

To demonstrate the efficacy and effectiveness of the sparse group lasso penalty, we performed a series of ablation studies on various DNN models. As shown in Table 4, if we only use norm penalty, there is no effect on a neuron or channel pruning as expected. Similarly, if we only employ the group lasso penalty, the pruned model still has more weights left. However, if we apply sparse group lasso, we can achieve pruned DNN models that are sparse in terms of both neurons (or channel) and weights. In addition, we compare our sparse group lasso model with sparse group lasso [59] on pruning DNN models. Table 4 shows their comparison on pruning various DNN models. More details can be found in Appendix A.3 and Appendix C. As shown in Table 4 and the results in supplementary, the sparse group lasso model significantly outperforms the sparse group lasso model in all aspects, which demonstrates its superiority in pruning DNN models.
Table 4

Alation studies on various network models. (We mark the best performance as blue among different penalties for each model).

Network ModelPenaltyBase/Pruned Accuracy (%)Original/Remaining Parameters (Mil)FLOPsSparsity (%)
LetNet-3000 norm98.24/98.46267 K/57.45 K143.2021.55
Group lasso98.24/98.17267 K/32.06 K39.7012.01
1 sparse group lasso98.24/98.00267 K/15.80 K25.885.93
0 sparse group lasso98.24/98.23267 K/5.25 K 25.79 1.97
LetNet-50 norm99.12/99.20431 K/321.0 K2293.074.48
Group lasso99.12/99.11431 K/8.81 K187.002.04
1 sparse group lasso99.12/99.03431 K/9.98 K183.832.32
0 sparse group lasso99.12/99.11431 K/2.31 K 113.50 0.54
VGG-like0 norm92.96/93.4015 M/3.39 M210.9422.6
Group lasso92.96/92.4715 M/0.84 M78.075.60
1 sparse group lasso92.96/92.9015 M/0.61 M134.354.06
0 sparse group lasso92.96/92.9415 M/0.60 M 77.83 4.00
ResNet-320 norm95.29/95.687.42 M/6.74 M993.1190.84
Group lasso95.29/95.307.42 M/3.03 M373.0940.84
1 sparse group lasso95.29/95.047.42 M/5.66 M735.1276.28
0 sparse group lasso95.29/95.477.42 M/2.93 M 371.30 39.49
VGG-190 norm61.56/61.99138 M/19.29 M1519.2313.98
Group lasso61.56/53.25138 M/5.93 M683.994.30
1 sparse group lasso61.56/53.97138 M/0.21 M1282.82 0.15
0 sparse group lasso61.56/56.27138 M/4.05 M 407.37 2.93

6. Conclusions

In this work, we proposed a new DNN pruning method MobilePrune, which is able to generate compact DNN models that are compatible with both cuDNN and hardware acceleration. MobilePrune compress DNN models at both group and individual levels by using the novel sparse group lasso regularization. We further developed a global convergent optimization algorithm MobilePrune based on PALM to directly train the proposed compression models without any relaxation or approximation. Furthermore, we developed several efficient algorithms to solve the proximal operators associated with sparse group lasso with different grouping strategies, which is the key computation of our MobilePrune. We have performed empirical evaluations on several public benchmarks. Experimental results show that the proposed compression model outperforms existing state-of-the-art algorithms in terms of computational costs and prediction accuracy. MobilePrune has a great potential to design slim DNN models that can be deployed on dedicated hardware that uses a sparse systolic tensor array. More importantly, we deploy our system on the real android system on both Huawei P20 and OnePlus 8 Pro, and the performance of the algorithm on multiple Human Activity Recognition (HAR) tasks. The results show that MobilePrune achieves much lower energy consumption and higher pruning rate while still retaining high prediction accuracy. There are other options to further compress the neural network models such as Neural Logic Circuits and Binary Neural Networks, which all use binary variables to represent inputs and hidden neurons. These two models are orthogonal to our methods, which means our pruning model could be adopted on Neural Logic Circuits, Binary Neural Networks and other neural network architectures designed for mobile systems. We will explore which mobile neural network could be better integrated with our network compression model in the future.
Table A1

List of hyper-parameters and their values(“-” denotes “not applicable”).

Hyper-ParameterLeNet300LeNet5VGG-LikeResNet-32VGG-19Description
learning rate1 × 10−31 × 10−31 × 10−31 × 10−31 × 10−3The learning rate used in retraining process
gradient momentum0.90.90.90.90.9The gradient momentum used in retraining process
weight decay1 × 10−41 × 10−55 × 10−41 × 10−41 × 10−4The weight decay factor used in retraining process
minibatch size1 × 1026 × 1021 × 1033 × 1024 × 102The number of training samples over which each SGD update is computed during the retraining process
0 norm factor4 × 10−42 × 10−41 × 10−61 × 10−81 × 10−10The shrinkage coefficient for 0 norm regularization
channel factor-1 × 10−31 × 10−3–1 × 10−2 15 × 10−25 × 10−2The shrinkage coefficient of channels for group Lasso
neuron factor2 × 10−42 × 10−41 × 10−401 × 10−2The shrinkage coefficient of neurons for group Lasso
filter size factor-1 × 10−31 × 10−41 × 10−41 × 10−4The shrinkage coefficient of filter shapes for group Lasso
pruning frequency (epochs/minibatches)1010121No. of epochs(LeNet)/minibatches(VGGNet/ResNet) for pruning before retraining
retraining epochs3030203015The number of retraining epochs after pruning
iterations7410263266The number of iterations for obtaining the final results

1 On VGG-like, the channel factor is adaptive and it is increased by 0.001 if its cross-entropy loss is not greater than the loss before performing pruning for the current mini-batch. Its range is [0.001,0.01].

Table A3

Alation studies on LetNet-5 (Architecture: 20-50-800-500).

PenaltyBase/Pruned Accuracy (%)Original/Remaining Parameters (K)Pruned ArchitectureFilter SizeFLOPs (K)Sparsity (%)
0 norm99.12/99.20431/321.0020-50-800-50025–5002293.074.48
Group Lasso99.12/99.11431/8.814-19-301-2925–99187.002.04
1 Group Lasso99.12/99.03431/9.984-17-271-8223–99183.832.32
0 sparse group lasso99.12/99.11431/2.315-14-151-5716–65113.501.97
Table A4

Alation studies on VGG-like.

PenaltyBase/Pruned Accuracy (%)Original/Remaining Parameters (Mil)Pruned ArchitectureFLOPs (Mil)
0 norm92.96/93.4015/3.3918-43-92-99-229-240-246-507-504-486-241-114-428-168210.94
Group Lasso92.96/92.4715/0.8417-43-89-99-213-162-93-42-32-28-8-5-429-16878.07
1 Group Lasso92.96/92.9015/0.6117-43-92-99-229-240-246-323-148-111-41-39-159-161134.35
0 sparse group lasso92.96/92.9415/0.6017-43-87-99-201-185-80-37-27-25-9-4-368-16777.83
Table A5

Alation studies on ResNet-32.

PenaltyBase/Pruned Accuracy (%)Original/Remaining Parameters (Mil)FLOPs (Mil)Sparsity (%)
0 norm95.29/95.687.42/6.74993.1190.84
Group Lasso95.29/95.307.42/3.43393.0945.95
1 Group Lasso95.29/95.047.42/5.66735.1276.28
0 sparse group lasso95.29/95.477.42/2.93371.3039.49
Table A6

Alation studies on VGG19.

PenaltyTest Accuracy (%)Remaining Parameters (Mil)Pruned ArchitectureFLOPs (Mil)
Baseline61.5620.1264-64-128-128-256-256-256-256-512-512-512-512-512-512-512-5121592.53
0 norm61.9919.2945-64-114-128-256-256-256-256-512-511-512-509-512-512-512-5121519.23
Group Lasso53.255.9323-61-80-128-122-114-164-253-255-322-412-462-23-93-129-512683.99
1 Group Lasso53.970.2129-64-109-128-254-246-254-256-510-509-509-509-512-512-484-5121282.82
0 sparse group lasso56.274.0519-48-57-102-79-83-100-179-219-273-317-341-256-158-116-512407.37
Table A7

The effect of the coefficient of norm penalty on VGG-like.

0 Penalty CoefficientBase/Pruned Accuracy (%)Original/Remaining Parameters (Mil)Pruned ArchitectureFLOPs (Mil)
1 × 10−492.96/89.7715/0.0617-43-83-99-161-105-57-28-24-15-11-4-104-15756.43
1 × 10−592.96/92.1915/0.3016-43-85-99-171-155-75-33-23-18-10-3-264-16766.82
1 × 10−692.96/92.9415/0.6017-43-87-99-201-185-80-37-27-25-9-4-368-16777.83
1 × 10−792.96/92.5415/0.7417-43-87-99-213-188-91-40-26-27-9-4-400-16881.64
Table A8

The effect of the coefficient of norm penalty on ResNet-32.

0 Penalty CoefficientBase/Pruned Accuracy (%)Original/Remaining Parameters (Mil)FLOPs (Mil)Sparsity
1 × 10−695.29/95.117.42/2.06330.9027.76
1 × 10−795.29/95.337.42/2.72369.3636.66
1 × 10−895.29/95.477.42/2.9377.8339.49
1 × 10−995.29/95.447.42/3.02372.9840.70
Table A9

Impact of different cross-validation fold numbers and learning rates on the proposed sparse group lasso approach on each HAR dataset—WISDM, UCI-HAR, and PAMAP2, respectively. (We highlight our selection in both fold number and learning rate for each dataset).

DatasetTypeValueBase/Pruned Accuracy (%)Parameter Nonzero (%)Parameter Remaining (%)Node Remaining (%)
WISDMFold Number193.52/92.6811.6432.4957.42
294.88/93.7010.0330.3555.08
394.45/93.489.4527.9752.13
4 94.97/94.65 9.52 28.03 53.52
593.52/92.6811.6432.4957.42
Learning Rate1.0 ×10589.55/86.7227.0993.5096.68
5.0 ×10592.93/84.369.4140.4464.06
1.0 ×104 94.97/94.65 27.09 28.03 53.52
1.5 ×10494.96/94.8810.3827.2652.54
1.0 ×10494.65/94.5710.5432.3856.84
UCI-HARFold Number178.42/78.0815.5331.9956.64
289.89/89.2832.4964.2980.27
379.13/79.3716.0232.2556.84
478.22/78.2218.6940.0263.48
5 90.06/89.96 23.00 46.83 68.75
Learning Rate1.0 ×10585.27/85.5177.9894.6697.27
5.0 ×10589.38/89.2416.6985.7792.58
1.0 ×104 90.06/89.96 23.00 46.83 68.75
1.5 ×10490.94/90.9116.6931.0456.45
2.0 ×10490.40/90.4313.2429.1054.10
PAMAP2Fold Number 1 96.89/96.95 1.26 3.72 10.74
292.29/92.281.273.1510.35
396.49/96.281.814.7414.84
495.08/94.991.203.4210.55
594.81/94.811.463.7111.52
Learning Rate1.0 ×10593.63/85.807.9328.6149.22
5.0 ×10594.25/93.893.9011.8128.32
1.0 ×104 96.89/96.95 1.26 3.72 10.74
1.5 ×10496.57/96.621.122.367.62
2.0 ×10494.89/94.990.682.027.62
  1 in total

1.  An iterative pruning algorithm for feedforward neural networks.

Authors:  G Castellano; A M Fanelli; M Pelillo
Journal:  IEEE Trans Neural Netw       Date:  1997
  1 in total
  2 in total

1.  ARDformer: Agroforestry Road Detection for Autonomous Driving Using Hierarchical Transformer.

Authors:  Eksan Firkat; Jinlai Zhang; Danfeng Wu; Minyuan Yang; Jihong Zhu; Askar Hamdulla
Journal:  Sensors (Basel)       Date:  2022-06-22       Impact factor: 3.847

2.  A Novel Deep-Learning Model Compression Based on Filter-Stripe Group Pruning and Its IoT Application.

Authors:  Ming Zhao; Xindi Tong; Weixian Wu; Zhen Wang; Bingxue Zhou; Xiaodan Huang
Journal:  Sensors (Basel)       Date:  2022-07-27       Impact factor: 3.847

  2 in total

北京卡尤迪生物科技股份有限公司 © 2022-2023.