Advancing Model Pruning via Bi-level Optimization
Abstract
The deployment constraints in practical applications necessitate the pruning of large-scale deep learning models, i.e. , promoting their weight sparsity.
As illustrated by the Lottery Ticket Hypothesis (LTH), pruning also has the potential of improving their generalization ability.
At the core of LTH, iterative magnitude pruning (IMP) is the predominant pruning method to successfully find ‘winning tickets’.
Yet, the computation cost of IMP grows prohibitively as the targeted pruning ratio increases.
To reduce the computation overhead, various efficient ‘one-shot’ pruning methods have been developed but these schemes are usually unable to find winning tickets as good as IMP.
This raises the question of how to close the gap between pruning accuracy and pruning efficiency?
To tackle it, we pursue the algorithmic advancement of model pruning.
Specifically, we formulate the pruning problem from a fresh and novel viewpoint, bi-level optimization (BLO).
We show that the BLO interpretation provides a technically-grounded optimization base for an efficient implementation of the pruning-retraining learning paradigm used in IMP.
We also show that the proposed bi-level optimization-oriented pruning method (termed B I P) is a special class of BLO problems with a bi-linear problem structure.
By leveraging such bi-linearity, we theoretically show that B I P can be solved as easily as first-order optimization, thus inheriting the computation efficiency.
Through extensive experiments on both structured and unstructured pruning with 5 model architectures and 4 data sets, we demonstrate that B
I P can find better winning tickets than IMP in most cases, and is computationally as efficient as the one-shot pruning schemes, demonstrating 2-7 × speedup over
IMP for the same level of model accuracy and sparsity.
Codes are available at https://github.com/OPTML-Group/BiP
Introduction
While over-parameterized structures are key to the improved generalization of deep neural networks (DNNs) [1–3], they create new problems – the millions or even billions of parameters not only increase computational costs during inference, but also pose serious deployment challenges on resource-limited devices [4].
As a result, model pruning has seen a lot of research interest in recent years, focusing on reducing model sizes by removing (or pruning) redundant parameters [4–8].
Model sparsity (achieved by pruning) also benefits adversarial robustness [9], out-of-distribution generalization [10], and transfer learning [11].
Some pruning methods (towards structured sparsity) facilitate model deployment on hardware [12, 13].
Among various proposed model pruning algorithms [5, 9, 11, 14–27], the heuristics-based Iterative
Magnitude Pruning (IMP) is the current dominant approach to achieving model sparsity without suffering performance loss, as suggested and empirically justified by the Lottery Ticket Hypothesis (LTH)
The LTH hypothesizes the existence of a subnetwork (the so-called ‘winning ticket’) when trained in isolation ( e.g. , from either a random initialization [17] or an early-rewinding point of dense model training [19]), can match the performance of the original dense model [5, 11, 17–20].
The core idea of IMP is to iteratively prune and retrain the model while progressively pruning a small ratio of the remaining weights in each iteration, and continuing till the desired pruning ratio has been reached.
While IMP often finds the winning ticket, it incurs the cost of repeated model retraining from scratch, making it prohibitively expensive for large datasets or large model architectures [28, 29].
To improve the efficiency of model pruning, numerous heuristics-based one-shot pruning methods [17, 21–25], e.g. , one-shot magnitude pruning (OMP), have been proposed.
These schemes directly prune the model to the target sparsity and are significantly more efficient than
IMP.
Yet, the promise of current one-shot pruning methods is dataset/model-specific [22, 30] and mostly lies in the low pruning ratio regime [25].
As systematically studied in [22, 31], there exists a clear performance gap between one-shot pruning and IMP.
As an alternative to heuristics-based schemes, optimization-based pruning methods [9, 15, 16, 26, 27] still follow the pruning-retraining paradigm and adopt sparsity regularization [32, 33] or parameterized masking [9, 16, 27] to prune models efficiently.
However, these methods do not always match the accuracy of IMP and thus have not been widely used to find winning tickets [17, 21, 23–25, 29].
The empirical results showing that optimization underperforms heuristics motivate us to revisit the algorithmic fundamentals of pruning.
[Figure]
To this end, we put forth a novel perspective of model pruning as a bi-level optimization (BLO) problem.
In this new formulation, we show that BLO provides a technically-grounded optimization basis for an efficient implementation of the pruning-retraining paradigm, the key algorithmic component used in IMP.
To the best of our knowledge, we make the first rigorous connection between model pruning and BLO.
Technically, we propose a novel bi -level optimization-enabled p runing method (termed B I P).
We further show how B I P takes advantage of the bi-linearity of the pruning problem to avoid the computational challenges of common BLO methods, and is as efficient as any first-order alternating optimization scheme.
Practically, we demonstrate the superiority of the proposed B I P in terms of accuracy, sparsity, and computation efficiency through extensive experiments.
B I P finds the best winning ticket nearly in all settings while taking time comparable to the one-shot OMP.
In Fig.
1, we present a snapshot of our empirical results for CIFAR-10 with 3 ResNet architectures at 74% pruning ratio.
In all cases, B I P ( ⋆ ) finds winning tickets, improving accuracy over the dense model ( • ) and matching IMP ( ▲ ), while being upto 5 × faster than IMP.
Our contributions can be summarized as follows:
• (Formulation)
We rethink the algorithmic foundation of model pruning through the lens of BLO (bi-level optimization).
The new BLO-oriented formulation disentangles pruning and retraining variables, providing the flexibility to design the interface between pruning and retraining.
• (Algorithm)
We propose the new bi-level pruning (B I P) algorithm, which is built upon the aforementioned BLO formulation and the implicit gradient-based optimization theory.
Unlike computationally intensive standard BLO solvers, we theoretically show that B
I P is as efficient as any first-order optimization by taking advantage of the bi-linear nature of the pruning variables.
• (Experiments)
We conduct extensive experiments across 4 datasets (CIFAR-10, CIFAR-100, TinyImageNet and ImageNet), 5 model architectures, and 3 pruning settings (unstructured pruning, filter-wise structured pruning, and channel-wise structured pruning).
We show that (i) B I P achieves higher test accuracy than IMP and finds the best winning tickets nearly in all settings, (ii) B I P is highly efficient (comparable to one-shot pruning schemes), that is able to achieve 2-7 × speedup over IMP for the same level of model accuracy and sparsity, and (iii) B I P is able to find subnetworks that achieve better performance than the dense model regardless of initialization rewinding.
Related Work and Open Question
Neural network pruning.
As neural networks become deeper and more sophisticated, model pruning technology has gained increasing attention over the last decade since pruned models are necessary for the deployment of deep networks in practical applications [4, 34, 35].
With the goal of finding highly-sparse and highly-accurate subnetworks from original dense models, a variety of pruning methods have been developed such as heuristics-based pruning [17, 21, 23–25, 29, 36] and optimization-based pruning [9, 16, 26, 27].
The former identifies redundant model weights by leveraging heuristics-based metrics such as weight magnitudes [6, 17, 19, 11, 22, 37, 31, 36, 38], gradient magnitudes [21, 23, 24, 39, 40], and Hessian statistics [41–46].The latter is typically built on: 1) sparsity-promoting optimization [15, 33, 47–50], where model weights are trained by penalizing their sparsity-inducing norms, such as ℓ 0 and ℓ 1 norms for irregular weight pruning, and ℓ 2 norm for structured pruning; 2) parameterized masking [16, 9, 51–55], where model weight scores are optimized to filter the most important weights and achieve better performance.
Iterative vs. one-shot pruning, and motivation.
Existing schemes can be further categorized into one-shot or iterative pruning based on the pruning schedule employed for achieving the targeted model sparsity.
Among the iterative schemes, the IMP (Iterative Magnitude Pruning scheme) [17, 20, 56– 65, 36] has played a significant role in identifying high-quality ‘winning tickets’, as postulated by LTH (Lottery Ticket Hypothesis) [18, 19].
To enable consistent comparisons among different methods, we extend the original definition of winning tickets in [17] to ‘matching subnetworks’ [20] so as to cover different implementations of winning tickets, e.g. , the use of early-epoch rewinding for model re-initialization [18] and the no-rewinding ( i.e. , fine-tuning) variant [66].
Briefly, the matching subnetworks should match or surpass the performance of the original dense model [20].
In this work, if a matching subnetwork is found better than the winning ticket obtained by the same method that follows the original LTH setup [18, 19], we will also call such a matching subnetwork a winning ticket throughout the paper.
[Figure]
For example, the current state-of-theart (SOTA) implementation of IMP in [22] can lead to a pruned ResNeton CIFAR-10 with 74% sparsity and 92 .
12% test accuracy, matching the performance of the original dense model (see red ⋆ in Fig.
2- Left ).
The IMP algorithm typically contains two key ingredients: (i) a temporally-evolving pruning schedule to progressively increase model sparsity over pruning iterations, and (ii) the pruning-retraining learning mechanism applied at each pruning iteration.
With a target pruning ratio of p % with T pruning iterations, an example pruning schedule in (i) could be as follows – each iteration prunes ( p %) 1 / T of the currently unpruned model weights, progressively pruning fewer weights in each iteration.
For (ii), the unpruned weights in each pruning iteration are re-set to the weights at initialization or at an early-training epoch [18], and re-trained till convergence.
In brief, IMP repeatedly prunes, resets, and trains the network over multiple iterations.
However, winning tickets found by IMP incur significant computational costs.
The sparsest winning ticket found by IMP in Fig.
2- Left (red ⋆ ) utilizes T = 6 pruning iterations.
As shown in Fig.
2- Right , this takes 3 × more time than the original training of the dense model.
To avoid the computational cost of IMP, different kinds of ‘accelerated’ pruning methods were developed [17, 21, 23–25, 29], and many fall into the one-shot pruning category: The network is directly pruned to the target sparsity and retrained once.
In particular, OMP (one-shot magnitude pruning) is an important baseline that simplifies IMP [17].
It follows the pruning-retraining paradigm, but prunes the model to the target ratio with a single pruning iteration.
Although one-shot pruning schemes are computationally cheap (Fig.
2- Right ), they incur a significant accuracy drop compared to IMP (Fig.
2- Left ).
Even if IMP is customized with a reduced number of training epochs per pruning round, the pruning accuracy also drops largely (see Fig. A2).
Hence, there is a need for advanced model pruning techniques to find winning tickets like IMP, while being efficient like one-shot pruning.
Different from unstructured weight pruning described above, structured pruning takes into consideration the sparse patterns of the model, such as filter and channel-wise pruning [13, 48, 51, 67– 71].
Structured pruning is desirable for deep model deployment in the presence of hardware constraints [4, 34].
However, compared to unstructured pruning, it is usually more challenging to maintain the performance and find structure-aware winning tickets [28, 29].
Open question.
As discussed above, one-shot pruning methods are unable to match the predictive performance of IMP, and structure-aware winning tickets are hard to find.
Clearly, the best optimization foundation of model pruning is underdeveloped.
Thus, we ask:
Is there an optimization basis for a successful pruning algorithm that can attain high pruned model accuracy (like IMP) and high computational efficiency (like one-shot pruning)?
The model pruning problem has a natural hierarchical structure – we need to find the best mask to prune model parameters, and then , given the mask, find the best model weights for the unpruned model parameters.
Given this hierarchical structure, we believe that the bi-level optimization (BLO) framework is one promising optimization basis for a successful pruning algorithm.
Bi-level optimization (BLO).
BLO is a general hierarchical optimization framework, where the upper-level problem depends on the solution to the lower-level problem.
Such a nested structure makes the BLO in its most generic form very difficult to solve, since it is hard to characterize the influence of the lower-level optimization on the upper-level problem.
Various existing literature focuses on the design and analysis of algorithms for various special cases of BLO.
Applications range from the classical approximate descent methods [72–74], penalty-based methods [75, 76], to recent
BigSAM [77] and its extensions [78, 79].
It is also studied in the area of stochastic algorithms [80–82] and back-propagation based algorithms [83–85].
BLO has also advanced adversarial training [86], meta-learning [87], data poisoning attack generation [88], neural architecture search [89] as well as reinforcement learning [90].
Although BLO was referred in [50] for model pruning, it actually called an ordinary alternating optimization procedure, without taking the hierarchical learning structure of
BLO into consideration.
To the best of our knowledge, the BLO framework has not been considered for model pruning in-depth and systematically.
We will show that model pruning yields a special class of BLO problems with bi-linear optimization variables.
We will also theoretically show that this specialized BLO problem for model pruning can be solved as efficiently as first-order optimization.
This is in a sharp contrast to existing BLO applications that rely on heuristics-based BLO solvers ( e.g. , gradient unrolling in meta learning [87] and neural architecture search [89, 91]).
B I P: Model Pruning via Bi-level Optimization
In this section, we re-investigate the problem of model pruning through the lens of BLO and develop the bi-level pruning (B I P) algorithm.
We can theoretically show that B
I P can be solved as easily as the first-order alternating optimization by taking advantage of the bi-linearity of pruning variables.
A BLO viewpoint on model pruning As described in the previous section, the pruning-retraining learning paradigm covers two kinds of tasks: ❶ pruning that determines the sparse pattern of model weights, and ❷ training remaining non-zero weights to recover the model accuracy.
In existing optimization-based pruning methods [92–95], the tasks ❶ - ❷ are typically achieved by optimizing model weights, together with penalizing their sparsity-inducing norms, e.g. , the ℓ 1 and ℓ 2 norms [96].
Different from the above formulation, we propose to separate optimization variables involved in the pruning tasks ❶ and ❷ .
This leads to the (binary) pruning mask variable m ∈ { 0 , 1 } n and the model weight variable θ ∈ R n .
Here n denotes the total number of model parameters.
Accordingly, the pruned model is given by ( m ⊙ θ ) , where ⊙ denotes the element-wise multiplication.
As will be evident later, this form of variable disentanglement enables us to explicitly depict how the pruning and retraining process co-evolve, and helps customize the pruning task with high flexibility.
We next elaborate on how BLO can be established to co-optimize the pruning mask m and the retrained sparse model weights θ .
Given the pruning ratio p % , the sparsity constraint is given by m ∈ S , where S =
{ m | m ∈ { 0 , 1 } n , 1 T m ≤ k } and k
=
(1 − p %) n .
Our goal is to prune the original model directly to the targeted pruning ratio p % ( i.e. , without calling for the IMP-like sparsity schedule as described in Sec. 2) and obtain the optimized sparse model ( m ⊙ θ ) .
To this end, we interpret the pruning task ( i.e. , ❶ ) and the model retraining task ( i.e. , ❷ ) as two optimization levels , where the former is formulated as an upper-level optimization problem, and it relies on the optimization of the lower-level retraining task.
We thus cast the model pruning problem as the following BLO problem (with ❷ being nested inside ❶ ):
[Equation]
where ℓ denotes the training loss ( e.g. , cross-entropy), m and θ are the upper-level and lower-level optimization variables respectively, θ ∗ ( m ) signifies the lower-level solution obtained by minimizing the objective function g given the pruning mask m , and γ > 0 is a regularization parameter introduced to convexify the lower-level optimization so as to stabilize the gradient flow from θ ∗ ( m ) to m and thus the convergence of BLO [82, 97].
In a sharp contrast to existing single-level optimization-based model pruning methods [92–95], the BLO formulation (1) brings in two advantages.
First, BLO has the flexibility to use mismatched pruning and retraining objectives at the upper and lower optimization levels, respectively.
This flexibility allows us to regularize the lower-level training objective function in (1) and customize the implemented optimization methods at both levels.
To be more specific, one can update the upper-level pruning mask m using a data batch (called B 2 ) distinct from the one (called B 1 ) used for obtaining the lower-level solution θ ∗ ( m ) .
The resulting BLO procedure can then mimic the idea of meta learning to improve model generalization [98], where the lower-level problem fine-tunes θ using B 1 , and the upper-level problem validates the generalization of the sparsity-aware finetuned model ( m ⊙ θ ∗ ( m )) using B 2 .
Second, BLO enables us to explicitly model and optimize the coupling between the retrained model weights θ ∗ ( m ) and the pruning mask m through the implicit gradient (IG)-based optimization routine.
Here IG refers to the gradient of the lower-level solution θ ∗ ( m ) with respect to (w.r.t.)
the upper-level variable m , and its derivation calls the implicit function theory [76].
The use of IG makes our proposed BLO-oriented pruning (1) significantly different from the greedy alternating minimization [99] that learns the upper-level and lower-level variables independently ( i.e. , minimizes one variable by fixing the other).
We refer readers to the following section for the detailed IG theory.
We will also show in Sec. 4 that the pruning strategy from (1) can outperform IMP in many pruning scenarios but is much more efficient as it does not call for the scheduler of iterative pruning ratios.
Optimization foundation of B I
P.
The key optimization challenge of solving the B
I
P problem (1) lies in the computation of IG (implicit gradient).
Prior to developing an effective solution, we first elaborate on the IG challenge , the unique characteristic of BLO.
In the context of gradient descent, the gradient of the objective function in (1) yields
[Equation]
where ∇ m and ∇ θ denote the partial derivatives of the bi-variate function ℓ ( m ⊙ θ )
w.r.t.
the variable m and θ respectively, d θ ⊤ /d m ∈ R n × n denotes the vector-wise full derivative , and for ease of notation, we will omit the transpose ⊤ when the context is clear.
In (2), the IG challenge refers to the demand for computing the full gradient of the implicit function θ ∗ ( m ) =
arg min θ g ( m , θ ) w.r.t.
m , where recall from (1) that g ( m , θ ) :
=
ℓ ( m ⊙ θ ) + γ 2 ∥ θ ∥ 22 .
Next, we derive the IG formula following the rigorous implicit function theory [76, 82, 87].
Based on the fact that θ ∗ ( m ) satisfies the stationarity condition for the lower-level objective function in (2), it is not difficult to obtain that (see derivation in Appendix A)
[Equation]
where ∇ 2 m θ ℓ and ∇ 2 θ ℓ denote the second-order partial derivatives of ℓ respectively, and ( · ) − 1 denotes the matrix inversion operation.
Yet, the exact IG formula (3) remains difficult to calculate due to the presence of matrix inversion and second-order partial derivatives.
To simplify it, we impose the Hessian-free assumption, ∇ 2 θ ℓ = 0 , which is mild in general; For example, the decision boundaries of neural networks with ReLU activations are piece-wise linear in a tropical hyper-surface [100], and this assumption has been widely used in BLO-involved applications such as meta learning [101] and adversarial learning [86].
Given ∇ 2 θ ℓ = 0 , the matrix inversion in (3) can be then mitigated, leading to the IG formula
[Equation]
At the first glance, the computation of the simplified IG (4) still requires the mixed (second-order) partial derivative ∇ 2 m θ ℓ .
However, B I P is a special class of BLO problems with bi-linear variables ( m ⊙ θ ) .
Based on this bi-linearity, we can prove that IG in (4) can be analytically expressed using only first-order derivatives; see the following theorem.
Proposition 1 Assuming ∇ 2 θ ℓ = 0 and defining ∇ z ℓ [Equation] z [Equation]
:= ∇ z [Equation] ∗ , the implicit gradient (4) is then given by
[Equation]
Further, the gradient of the objective function given by (2) becomes
[Equation]
where ⊙ denotes the element-wise multiplication.
Proof : Using chain-rule, we can obtain that
[Equation]
similarly,
[Equation]
where diag( · ) represents a diagonal matrix with · being the main diagonal vector.
Further, we can convert (4) to
[Equation]
where the last equality holds due to the Hessian-free assumption.
With (9) and (4) we can prove (5).
Next, substituting the IG (5) to the upper-level gradient (2), we obtain that
[Equation]
which leads to (6).
The proof is now complete.
□
The key insight drawn from Prop. 1 is that the bi-linearity of pruning variables ( i.e. , m ⊙ θ ∗ ) makes the IG-involved gradient (2) easily solvable, and the computational complexity is almost the same as that of computing the first-order gradient ∇ z ℓ ( z ) just once, as supported by (6)
B I P algorithm and implementation.
We next formalize the B
I P algorithm based on Prop. 1 and the alternating gradient descent based BLO solver [82].
At iteration t , there are two main steps.
★ Lower-level SGD for model retraining :
Given m ( t − 1) , θ ( t − 1) , and z ( t − 1) :
= m ( t − 1) ⊙ θ ( t − 1) , we update θ ( t ) by randomly selecting a data batch with the learning rate α and applying SGD (stochastic gradient descent) to the lower-level problem of (1),
[Equation]
★ Upper-level SPGD for pruning :
Given m ( t − 1) , θ ( t ) , and z ( t +1 / 2) :
= m ( t − 1) ⊙ θ ( t ) , we update m using SPGD (stochastic projected gradient descent) along the IG-enhanced descent direction (2), m [Equation] =
[Equation]
Our proposal: Bi-level Pruning (BiP) directly to pruning ratio p% Original
Pruned
[Figure]
Original
Prior art: Iterative Magnitude Pruning (IMP) over T Rounds
Pruned
[Figure]
where β > 0 is the upper-level learning rate, and P S ( · ) denotes the Euclidean projection onto the constraint set S given by S
= { m | m ∈ { 0 , 1 } n , 1 T m ≤ k } in (1) and is achieved by the top- k hard-thresholding operation as will be detailed later.
In B I P, the ( θ -step) and ( m -step) steps execute iteratively.
For clarity, Fig.
3 shows the difference between the pruning pipelines of B I P and IMP.
In contrast to IMP that progressively prunes and retrains a model with a growing pruning ratio, B I P directly prunes the model to the targeted sparsity level without involving costly re-training process.
In practice, we find that both the upper- and lowerlevel optimization routines of B I P converge very well (see Fig.
A12 and Fig.
A13).
It is also worth noting that both ( θ -step) and ( m -step) only require the first-order information ∇ z ℓ ( z ) , demonstrating that B I P can be conducted as efficiently as first-order optimization.
In Fig.
A1, we highlight the algorithmic details on the B I P pipeline.
We present more implementation details of B I P below and refer readers to Appendix B for a detailed algorithm description.
✦ Discrete optimization over m : We follow the ‘convex relaxation + hard thresholding’ mechanism used in [9, 16].
Specifically, we relax the binary masking variables to continuous masking scores m ∈ [ 0 , 1 ] .
We then acquire loss gradients at the backward pass based on the relaxed m .
At the forward pass, we project it onto the discrete constraint set S using the hard thresholding operator, where the top k elements are set to 1 s and the others to 0 s. See Appendix B for more discussion.
✦ Data batch selection for lower-level and upper-level optimization
: We adopt different data batches (with the same batch size) when implementing ( θ -step) and ( m -step).
This is one of the advantages of the BLO formulation, which enables the flexibility to customize the lower-level and upper-level problems.
The use of diverse data batches is beneficial to generalization as shown in [98].
✦ Hyperparameter tuning: As described in ( θ -step)-( m -step), B I P needs to set two learning rates α and β for lower-level and upper-level optimization, respectively.
We choose α = 0 .
01 and β = 0 .
1 in all experiments, where we adopt the mask learning rate β from Hydra [9] and set a smaller lower-level learning rate α , as θ is initialized by a pre-trained dense model.
We show ablation study on α in Fig.
A8(c).
BLO also brings in the low-level convexification parameter γ .
We set γ = 1 . 0 in experiments and refer readers to Fig.
A8(b) for a sanity check.
✦ One-step vs. multi-step SGD: In ( θ -step), the one-step SGD is used and helps reduce the computation overhead.
In practice, we also find that the one-step SGD is sufficient: The use of multi-step
SGD in B I P does not yield much significant improvement over the one-step version; see Fig.
A8(a).
✦ Extension to structured pruning: We formulate and solve the B
I P problem in the context of unstructured (element-wise) weight pruning.
However, if define the pruning mask m w.r.t.
model’s structural units ( e.g. , filters), B I P is easily applied to structured pruning (see Fig. 6 and Fig.
A10).
[Figure]
We observe that B
I P consistently outperforms the other baselines.
Note in the (ImageNet, ResNet-50) setting, we only compare B I P with our strongest baseline IMP due to computational resource constraints.
Experiments
In this section, we present extensive experimental results to show the effectiveness of B I P across multiple model architectures, various datasets, and different pruning setups.
Compared to IMP, one-shot pruning, and optimization-based pruning baselines, we find that B
I P can find better winning tickets in most cases and is computationally efficient.
4.1 Experiment Setup
Datasets and models.
Following the pruning benchmark in [22], we consider 4 datasets including
CIFAR-10 [102], CIFAR-100 [102], Tiny-ImageNet [103], ImageNet [104], and 5 architecture types including ResNet-20/56/18/50 and VGG-16 [105, 106].
Tab. A1 summarizes these datasets and model configurations and setups.
Baselines, training, and evaluation.
As baselines, we mainly focus on 4 SOTA pruning methods, ①
IMP [17], ② OMP [17], ③ G RASP [23] (a one-shot pruning method by analyzing gradient flow at initialization), and ④ H YDRA [9] (an optimization-based pruning method that optimizes masking scores).
It is worth noting that there exist various implementations of IMP, e.g. , specified by different learning rates and model initialization or ‘rewinding’ strategies [18].
To make a fair comparison, we follow the recent IMP benchmark in [22], which can find the best winning tickets over current heuristics-based pruning baselines.
We also remark that H YDRA is originally proposed for improving the adversarial robustness of a pruned model, but it can be easily customized for standard pruning when setting the adversary’s strength as 0 [9].
We choose H YDRA as a baseline because it can be regarded as a single-level variant of B I P with post-optimization weight retraining.
When implementing B I P, unless specified otherwise, we use the 1 -step SGD in ( θ -step), and set the learning rates ( α, β ) and the lower-level regularization parameter γ as described in the previous section.
When implementing baselines, we follow their official repository setups.
We evaluate the performance of all methods mainly from two perspectives: (1) the test accuracy of the sub-network, and (2) the runtime of pruning to reach the desired sparsity.
We refer readers to Tab. A3 and Appendix C.2 for more training and evaluation details, such as training epochs and learning rate schedules.
4.2 Experiment Results
B I P identifies high-accuracy subnetworks.
In what follows, we look at the quality of winning tickets identified by B I P. Two key observations can be drawn from our results:
(1) B I P finds winning tickets of higher accuracy and/or higher sparsity than the baselines in most cases (as shown in Fig.
[Table]
[Figure]
and Tab. 1); (2) The superiority of B I P holds for both unstructured pruning and structured pruning (as shown in Fig.
6 and Fig.
A10).
We refer to more experiment results in Appendix C.3.
Fig.
4 shows the unstructured pruning trajectory (given by test accuracy vs. pruning ratio) of B I P and baseline methods in 8 model-dataset setups.
For comparison, we also present the performance of the original dense model.
As we can see, the proposed B I P approach finds the best winning tickets (in terms of the highest accuracy) compared to the baselines across all the pruning setups.
Among the baseline methods, IMP is the most competitive method to ours.
However, the improvement brought by B I P is significant with respect to the variance of IMP, except for the 60% - 80% sparsity regime in (CIFAR-10, ResNet-20).
In the case of (CIFAR-100, ResNet-20), where IMP can not find any winning tickets (as confirmed by [22]), B I P still manages to find winning tickets with around 0 .
6% improvement over the dense model.
In Tab. 1, we summarize the sparsest winning tickets along the pruning trajectory identified by different pruning methods.
B I P can identify the winning tickets with higher sparsity levels than the other methods, except in the case of (CIFAR-10, ResNet-20).
[Figure]
Fig.
6 demonstrates the structured pruning trajectory on the CIFAR-10/100 datasets.
Here we focus on filter pruning, where the filter is regarded as a masking unit in (1).
We refer readers to Fig.
A10 for channel-wise pruning results.
Due to the page limit, we only report the results of the filter-wise pruning in the main paper and please refer to Appendix C.3 for channel-wise pruning.
Compared to Fig. 4, Fig.
6 shows that it becomes more difficult to find winning tickets of high accuracy and sparsity in the structured pruning, and the gap among different methods decreases.
This is not surprising, since filter pruning imposes much stricter pruning structure constraints than irregular pruning.
However, B I P still outperforms all the baselines.
Most importantly, it identifies clear winning tickets in the low sparse regime even when IMP fails.
B I P is computationally efficient.
In our experiments, another key observation is that B I P yields sparsity-agnostic runtime complexity while IMP leads to runtime exponential to the target sparsity.
Fig.
5 shows the computation cost of different methods versus pruning ratios on (CIFAR-10, ResNet18).
For example, B I P takes 86 mins to find the sparsest winning ticket (with 89% sparsity in Tab. 1).
This yields 7 × less runtime than IMP, which consumes 620 mins to find a comparable winning ticket with 87% sparsity.
Compared to the optimization-based baseline H YDRA , B I P is more efficient as it
[Figure]
does not rely on the extra post-optimization retraining; see Tab.
A2 for a detailed summary of runtime and number of training epochs required by different pruning methods.
Further, B I P takes about 1.
× more computation time than G RASP and OMP.
However, the latter methods lead to worse pruned model accuracy, as demonstrated by their failure to find winning tickets in Tab. 1, Fig. 4, and Fig.
B I P requires no rewinding.
Another advantage of B I P is that it insensitive to model rewinding to find matching subnetworks.
Recall that rewinding is a strategy used in LTH [19] to determine what model initialization should be used for retraining a pruned model.
As shown in [22], an IMP-identified winning ticket could be sensitive to the choice of a rewinding point.
Fig.
7 shows the test accuracy of the B I P-pruned model when it is retrained at different rewinding epochs under various datasets and model architectures, where ‘N/A’ in the x-axis represents the case of no retraining (and thus no rewinding).
As we can see, a carefully-tuned rewinding scheme does not lead to a significant improvement over B I P without retraining.
This suggests that the subnetworks found by B I
P are already of high quality and does not require any rewinding operation.
Additional results.
We include more experiment results in Appendix C.3.
In particular, we show more results in both unstructured and structured pruning settings in Fig.
A4, Fig.
A5, Fig.
A6 and
Fig.
A7, where we compare B I P with more baselines and cover more model architectures.
We also study the sensitivity of B I P to the lower-level step number, lower-level regularization coefficient, the significance of the implicit gradient term (2), learning rate, and batch size, as shown in Fig.
A and Fig. A9.
To demonstrate the convergence of the upper-level and lower-level optimization in B I P, we show the training trajectory of B I P for accuracy (Fig.
A12) and mask score (Fig.
A13), and show how the lower-level step number affects the convergence speed (Fig. A14)).
Further, we show the performance of B I P vs. the growth of training epochs (Fig. A15), and its performance vs. different data batch schedulers (see Fig.
A16).
Conclusion
We proposed the B I P method to find sparse networks through the lens of BLO.
Our work advanced the algorithmic foundation of model pruning by characterizing its pruning-retraining hierarchy using BLO.
We theoretically showed that B
I P can be solved as easily as first-order optimization by exploiting the bi-linearity of pruning variables.
We also empirically showed that B
I P can find high
-quality winning tickets very efficiently compared to the predominant iterative pruning method
In the future, we will seek the optimal curriculum of training data at different optimization levels of
B I P, and will investigate the performance of our proposal for actual hardware acceleration.
Acknowledgement
The work of Y. Zhang, Y. Yao, and S. Liu was supported by National Science Foundation (NSF) Grant
IIS-2207052.
The work of M. Hong was supported by NSF grants CIF-1910385 and CMMI-1727757.
The work of Y. Wang was supported NSF grant CCF-1919117.
The computing resources used in this work were also supported by the MIT-IBM Watson AI Lab, IBM Research and the Institute for
Cyber-Enabled Research (ICER) at Michigan State University.
Checklist
The checklist follows the references.
Please read the checklist guidelines carefully for information on how to answer these questions.
For each question, change the default [TODO] to [Yes] , [No] or [N/A] .
You are strongly encouraged to include a justification to your answer , either by referencing the appropriate section of your paper or providing a brief inline description.
For example:
• Did you include the license to the code and datasets?
[Yes] See Section .
• Did you include the license to the code and datasets?
[No] The code and the data are proprietary.
• Did you include the license to the code and datasets?
[N/A]
Please do not modify the questions and only use the provided macros for your answers.
Note that the
Checklist section does not count towards the page limit.
In your paper, please delete this instructions block and only keep the Checklist section heading above along with the questions/answers below.
For all authors... (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope?
[Yes] (b) Did you describe the limitations of your work?
[Yes] See Sec C. (c) Did you discuss any potential negative societal impacts of your work?
[Yes] See Sec C. (d) Have you read the ethics review guidelines and ensured that your paper conforms to them?
[Yes] 2.
If you are including theoretical results... (a) Did you state the full set of assumptions of all theoretical results?
[Yes] See Section 3.
(b) Did you include complete proofs of all theoretical results?
[Yes] See Section 3 and Appendix A. 3.
If you ran experiments... (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)?
[Yes] See supplemental material.
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)?
[Yes] See Sec.(c)
Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)?
[Yes] See Sec.(d)
Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)?
[Yes] See Table A 4.
If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
(a) If your work uses existing assets, did you cite the creators?
[Yes] (b) Did you mention the license of the assets?
[No] The licences of used datasets are provided in the cited references (c) Did you include any new assets either in the supplemental material or as a URL?
[Yes] Our code is included in the supplementary material (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating?
[N/A] (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content?
[N/A] 5.
If you used crowdsourcing or conducted research with human subjects... (a) Did you include the full text of instructions given to participants and screenshots, if applicable?
[N/A] (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable?
[N/A] (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation?
[N/A]
Appendix A Derivation of (3)
Based on the fact that the θ ∗ ( m ) is satisfied with the stationary condition of the lower-level objective function in (2), we obtain
[Equation]
where for ease of notation, we omit the dependence of θ ∗ ( m ) w.r.t.
m .
We then take derivative of the second equality of (A1) w.r.t.
m by using the implicit function theory.
This leads to
[Equation]
A
[Equation]
B B I P Algorithm Details
[Figure]
At iteration t of B I P, there are two main steps: ★ Lower-level SGD for model retraining :
Given m ( t − 1) , θ ( t − 1) , and z ( t − 1) :
= m ( t − 1) ⊙ θ ( t − 1) , we update θ ( t ) by applying SGD (stochastic gradient descent) to the lower-level problem of (1),
[Equation]
t
[Equation]
where α > 0 is the lower-level learning rate.
★ Upper-level SPGD for pruning :
Given m ( t − 1) , θ ( t ) , and z ( t +1 / 2) :
= m ( t − 1) ⊙ θ ( t ) , we update m using PGD (projected gradient descent) along the IG-enhanced descent direction (2),
[Equation]
where β > 0 is the upper-level learning rate, and P S ( · ) denotes the Euclidean projection onto the constraint set S given by S
= { m | m ∈ { 0 , 1 } n , 1 T m ≤ k } in (1) and is achieved by the top- k hard-thresholding operation as will be detailed below.
Implementation of discrete optimization.
In the actual implementation, we use (cid:101) m ( t ) ∈ [0 , 1] d and obtain m ( t ) ∈ { 0 , 1 } d where m ( t ) ← P S (cid:2) (cid:101) m ( t ) (cid:3) .
The ( m -step) is then implemented as the following:
[Table]
and then m ( t ) ← P S (cid:2) (cid:101) m ( t ) (cid:3) , with z ( t +1 / 2) :
= m ( t − 1) ⊙ θ ( t ) as defined above.
Algorithm A1 B
I P
[Equation]
[Table]
[Equation]
[Table] [Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
θ ℓ tr ( m ⊙ θ ) (cid:19)(cid:12)(cid:12)(cid:12) m = m t , θ = θ t + (A4) 6:
Update the binary mask z ∗ : Hard-threshold the mask score m with the give sparse ratio p : z ∗ =
T { 0 , 1 } d ( m t +1 , s ) .
(A5) 7: end for
C Additional Experimental Details and Results C.1 Datasets and Models
Our dataset and model choices follow the pruning benchmark in [22].
We summarize the datasets and model configurations in Tab. A1.
In particular, we would like to stress that we adopt the
ResNet-18 with convolutional kernels of 3 × 3 in the first layer for Tiny-ImageNet, aligned with
CIFAR-10 and CIFAR-100, compared to ImageNet ( 7 × 7 ).
See https://github.com/kuangliu/ pytorch-cifar/blob/master/models/resnet.py for more details.
C.2 Detailed Training Settings
Baselines.
For both unstructured and structured pruning settings, we consider four baseline methods across various pruning categories, including IMP [17], OMP [17], H YDRA [9] and G RASP [23].
For H YDRA and G RASP , we adopt the original setting as well as hyper-parameter choices on their official code repositories.
For IMP and OMP, we adopt the settings from the current SOTA implementations [22].
Details on the pruning schedules can be found in Tab. A2.
In particular,
H YDRA prunes the dense model to the desired sparsity with 100 epoch for pruning and 100 epoch for retraining.
G RASP conducts one-shot pruning to the target sparsity, followed by the 200-epoch retraining.
In each pruning iteration, IMP prunes 20% of the remaining parameters before 160-epoch retraining.
H YDRA adopts the cosine learning rate scheduler for both pruning and retraining stage.
The learning rate scheduler for IMP, OMP, and G RASP is the step learning rate with a learning rate decay rate of 0.1 at 50% and 75% epochs.
The initial learning rate for all the methods are 0.1.
[Table] [Table]
[Table]
Hyper-parameters for B I P.
In both structured and unstructured pruning settings, cosine learning rate schedulers are adopted, and B I P takes an initial learning rate of 0.1 for the upper-level problem (pruning) and 0.01 for the lower-level problem (retraining).
The lower-level regularization coefficient λ is set to 1 . 0 throughout the experiments.
By default, we only take one SGD step for lower-level optimization in all settings.
Ablation studies on different SGD steps for lower-level optimization can be found in Fig.
A8(b) and Fig.
A14.
We use 100 training epochs for B I P, and ablation studies on different training epochs for larger pruning ratios can be found in Fig.
A15.
[Figure]
Structured pruning.
To differentiate of the filter-wise and channel-wise structured pruning setting, we illustrate the details of these settings in Fig.
A3.
Note, the filter-wise pruning setting prunes the output dimension (output channel) of the parameters in one layer, while the channel-wise prunes the input dimension (input channel).
C.3 Additional Experiment Results
Comparison with IMP using reduced retraining epochs.
As IMP is significantly more timeconsuming than one-shot pruning methods, a natural way to improve the efficiency is to decrease the retraining epoch numbers at each pruning cycle.
In Fig.
A2, the performance and time consumption of
[Figure]
IMP using 20, 40, and 80 epochs at each retraining cycle are presented.
The results and conclusions are in general aligned with Fig.
First, with fewer epoch numbers, the time consumption decreases at the cost of evident performance degradation.
Second, IMP with fewer epoch numbers are unable to obtain winning tickets.
Thus, the direct simplification of IMP would hamper the pruning accuracy.
This experiment shows the difficulty of achieving efficient and effective pruning under the scope of heuristics-based pruning, and thus justifies the necessity in developing a more powerful optimizationbased pruning method.
[Figure]
Comparison with more prune-at-initialization baselines.
In Fig.
A4, we include more heuristicsbased one-shot pruning baselines (S YN F LOW [24], S NIP [21]) for comparison.
Together with G RASP , these methods belong to the category of pruning at initialization, which determines the sparse subnetworks prior to training.
As we can see, the advantage of our method over the newly added methods are clear, and the benefit becomes more significant as the sparsity increases.
This further demonstrates the superiority of the optimization-basis of B I P over the heuristics-based one-shot methods.
Experiments on unstructured pruning with more baselines.
We compare our proposed method
B I P to more baselines on different datasets and architectures in Fig.
A5.
We add two more baselines, including E ARLY B IRD [28] and P ROS P R [25].
The results show that P ROS P R is indeed better than G RASP but is still not as good as IMP and our method B I P in different architecture-dataset combinations.
Meanwhile, except for the unstructured pruning settings of ResNet18 pruning over
CIFAR10 and CIFAR100, P ROS P R , as a pruning before training, can achieve comparable performance to the state-of-the-art implementation of OMP.
However, the gap between this SOTA pruning-atinitialization method and our method still exists.
Besides, the result shows that E ARLY B IRD can effectively achieve comparable or even better testing performance than OMP in most different
[Figure]
ARLY B IRD [28]
[Figure]
architecture-dataset combinations, which is also the main contribution of [28].
However, E ARLY B IRD is still not as strong as IMP in testing performance.
[Figure]
Experiments on structured pruning with more baselines.
We compare our proposed method
B I P to the new baseline P ROS P R on different datasets and architectures in Fig.
A6.
on the structured pruning setting.
As we can see, B I P consistently outperforms P ROS P R and still stands top among all the baselines.
More results on ImageNet.
In Fig.
A7, we provide additional results on the dataset ImageNet with
ResNet-18 in the unstructured pruning setting, in addition to the results of (ImageNet, ResNet-50) shown in Fig.
As we can see, the performance of B
I P still outperforms the strongest baseline IMP and the same conclusion can be drawn as Fig.
Sanity check of B I P on specialized hyperparameters.
In Fig.
A8, we show the sensitivity of B I P to its specialized hyperparameters at lower-level optimization, including the number of SGD iterations ( N ) in ( θ -step), and the regularization parameter γ in (1).
Fig.
A8(a) shows the test accuracy of
B I P-pruned models versus the choice of N .
As we can see, more SGD iterations for the lower-level optimization do not improve the performance of B I
P. This is because in B I P, the θ -step is initialized by a pre-trained model which does not ask for aggressive weight updating.
The best performance of
B I P is achieved at N ≤ 3 .
We choose N = 1 throughout the experiments as it is computationally lightest.
Fig.
A8(b) shows the performance of B I P by varying γ .
As we can see, the choice of γ ∈ { 0 . 5 , 1 } yields the best pruning accuracy across all pruning ratios.
If γ is too small, the lack
[Figure]
[Figure] [Figure]
of strong convexity of lower-level optimization
would hamper the convergence.
If γ is too large, the lower-level optimization would depart from the true model objective and causes a performance drop.
Fig.
A8(c) demonstrates the necessity of the IG enhancement in B I
P. We compare B I P with its
IG-free version by dropping the IG term in (2).
We observe that B I P without IG (marked in blue) leads to a significant performance drop ( > 1% ) at various sparsities.
This highlights that the IG in the ( m -step) plays a critical role in the performance improvements obtained by B I P, justifying our novel BLO formulation for the pruning problem.
In Fig.
A9, we further demonstrate the influence of different choices of lower-level learning rate α as well as the batch size on the performance of B I P.
Fig.
A9 (a) shows that the test accuracy of B I P-pruned models is not quite sensitive to the choice of α ∈ { 0 . 01 , 0 . 008 } .
A large α value ( e.g. , α > 0 . 05 ) will slightly decrease the performance of B I P.
By contrast, a small α is preferred due to the fact that the model parameters are updated based on the pre-trained values.
Fig.
A9 (b) shows how the batch size influences the performance.
As we can see,
[Figure]
a large batch size might hurt the stochasticity of the algorithm and thus degrades the performance.
We list our detailed batch size choices for different datasets in Tab.
A1.
[Figure]
Additional structured pruning experiments.
In addition to filter pruning in Fig.
[Figure]
we provide more results in the structured pruning setting, including both filter-wise and channel-wise pruning (as illustrated in Fig.
A3).
In Fig.
A
[Figure]
results on CIFAR-10 with VGG-16 and ResNet-56 are added as new experiments compared to Fig.
Fig.
A11 shows the results of the channel-wise pruning.
As we can see, consistent with Fig.
[Figure]
B I P is able to find the best winning tickets throughout the experiments while it is difficult for IMP to find winning tickets in most cases.
We also notice that H YDRA , as the optimization-based baseline, serves as a strong baseline in filter-wise pruning.
It also indicates the superiority of the optimization-based methods over the heuristics-based ones in dealing with more challenging pruning settings
[Figure]
Training trajectory of B I
P. We show in Fig.
A12 that the B I P algorithm converges quite well within 100 training epochs using a cosine learning rate scheduler
[Figure]
The training trajectory of the mask IoU score.
To verify the argument that the mask also converges at the end of the training, we show the training trajectory of the mask similarity between two adjacent-epoch models in Fig.
A13 at different pruning ratios.
Here the mask similarity is represented through the intersection of the union (IoU) score of the two masks found by two adjacent epochs.
The IoU score ranges from 0.0 to 1.0, and a higher IoU implies a larger similarity between
[Figure] [Figure]
the two masks.
As we can see, the IoU score converges to 1.0 in the end, which denotes that the mask also converges at the end of the training phase.
Also, with a smaller pruning ratio, the mask turns to converge more quickly.
[Figure]
The effect of different lower-level steps in B I P on the training dynamics.
We conduct additional experiments to demonstrate the effectiveness of using one-step SGD in B I P.
In our new experiments, we consider the number of SGD steps, 1,
[Figure]
and 5.
We report the training trajectories of B I P in
Fig.
A14.
As we can see, the use of multi-step SGD accelerates model pruning convergence at its early phase.
Yet, if we run B I P for a sufficient number of epochs (we used 100 by default in other experiments), the final test accuracy of using different SGD settings shows little difference.
Although the use of multiple SGD steps could improve the convergence speed, it introduces extra computation complexity per BLO step.
Thus, from the overall computation complexity perspective, using 1 SGD step but running more epochs is advantageous in practice.
[Figure]
The effect of larger training epoch numbers with extreme sparsities.
We allow more time (training epochs) for B I P when a higher pruning rate is considered and the results are shown in
Fig.
A15.
Specifically, we test three datasets and consider three pruning ratios (p=86.58%, 94.50%, 97.75%).
For each pruning ratio, we examine the test accuracy of B I P versus the training epoch number from 50 to 500.
Note that the number of training epochs in our original experiment setup was set to 100.
As we can see, the performance of B I P gets saturated when the epoch number is over 100.
Thus, even for a higher pruning ratio, the increase of training epoch number over 100 does not gain much improvement in accuracy.
The effect of different training batch schemes.
We conducted ablation studies on three different schemes of B I P’s training batches for the upper and lower level.
In addition to two different random batches for the two levels, we also consider the same batch and the reverse batch scheme.
B I P (same batch) always uses the same data batches for the two levels in each iteration while B I P (reverse batch) uses the data batches in a reversed order for the two level.
Fig.
A16 shows that both the random batch scheme (i
[Figure]
e., B I P) and the reverse batch scheme can bring a better testing accuracy performance than the same batch scheme throughout different pruning ratio settings.
Fig.
A17 shows that B I P the same batch scheme converges slower compared to the other two.
Both of the results indicate B I P benefits from the diverse batch selection
[Figure]
[Figure] [Figure]
[Table]
C.4 Broader Impact
We do not recognize any potential negative social impacts of our work.
Instead, we believe our work can inspire many techniques for model compression.
The finding of structure-aware winning ticket also benefits the design of embedded solutions to deploying large-scale models on resource-limited edge devices ( e.g. , FPGAs), providing broader impact on both scientific research and practical applications ( e.g. , autonomous vehicles).