Advancing Model Pruning via Bi-level Optimization
Anonymous Author(s)
AffiliationAddress email
Abstract
The deployment constraints in practical applications necessitate the pruning oflarge-scale deep learning models, i.e. , promoting their weight sparsity.
As illustrated by the Lottery Ticket Hypothesis (LTH), pruning also has the potential ofimproving their generalization ability.
At the core of LTH, iterative magnitudepruning (IMP) is the predominant pruning method to successfully find ‘winningtickets’.
Yet, the computation cost of IMP grows prohibitively as the targetedpruning ratio increases.
To reduce the computation overhead, various efficient‘one-shot’ pruning methods have been developed but these schemes are usuallyunable to find winning tickets as good as IMP.
This raises the question of how toclose the gap between pruning accuracy and pruning efficiency?
To tackle it, wepursue the algorithmic advancement of model pruning.
Specifically, we formulatethe pruning problem from a fresh and novel viewpoint, bi-level optimization (BLO).
We show that the BLO interpretation provides a technically-grounded optimizationbase for an efficient implementation of the pruning-retraining learning paradigmused in IMP.
We also show that the proposed bi-level optimization-oriented pruningmethod (termed B I P) is a special class of BLO problems with a bi-linear problemstructure.
By leveraging such bi-linearity, we theoretically show that B I P canbe solved as easily as first-order optimization, thus inheriting the computationefficiency.
Through extensive experiments on both structured and unstructuredpruning with 5 model architectures and 4 data sets, we demonstrate that B I P canfind better winning tickets than IMP in most cases, and is computationally asefficient as the one-shot pruning schemes, demonstrating 2-7 × speedup over IMPfor the same level of model accuracy and sparsity.
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 onlyincrease computational costs during inference, but also pose serious deployment challenges onresource-limited devices [4].
As a result, model pruning has seen a lot of research interest in recentyears, 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-distributiongeneralization [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 withoutsuffering 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 ofdense 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 pruningratio has been reached.
While IMP often finds the winning ticket, it incurs the cost of repeatedmodel retraining from scratch, making it prohibitively expensive for large datasets or large modelarchitectures [28, 29].
To improve the efficiency of model pruning, numerous heuristics-basedone-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] andmostly lies in the low pruning ratio regime [25].
As systematically studied in [22, 31], there existsa clear performance gap between one-shot pruning and IMP.
As an alternative to heuristics-basedschemes, optimization-based pruning methods [15, 16, 9, 26, 27] still follow the pruning-retrainingparadigm and adopt sparsity regularization [32, 33] or parameterized masking [16, 9, 27] to prunemodels efficiently.
However, these methods do not always match the accuracy of IMP and thus havenot been widely used to find winning tickets [17, 21, 23–25, 29].
The empirical results showing thatoptimization underperforms heuristics motivate us to revisit the algorithmic fundamentals of pruning.
[Figure]
To this end, we put forth a novel perspective of modelpruning as a bi-level optimization (BLO) problem.
Inthis new formulation, we show that BLO provides atechnically-grounded optimization basis for an efficientimplementation of the pruning-retraining paradigm, thekey algorithmic component used in IMP.
To the bestof our knowledge, we make the first rigorous connection between model pruning and BLO.
Technically, wepropose a novel bi -level optimization-enabled p runingmethod (termed B I P).
We further show how B I P takesadvantage of the bi-linearity of the pruning problem toavoid the computational challenges of common BLOmethods, and is as efficient as any first-order alternatingoptimization scheme.
Practically, we demonstrate thesuperiority of the proposed B I P in terms of accuracy,sparsity, and computation efficiency through extensiveexperiments.
B I P finds the best winning ticket nearly in all settings while taking time comparableto the one-shot OMP.
In Fig.
1, we present a snapshot of our empirical results for CIFAR-10 with
ResNet architectures at 74% pruning ratio.
In all cases, B I P ( ⋆ ) finds winning tickets, improvingaccuracy 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 retrainingvariables, 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 computationallyintensive standard BLO solvers, we theoretically show that B
I P is as efficient as any first-orderoptimization by taking advantage of the bi-linear nature of the pruning variables.• (Experiments)
We conduct extensive experiments across 4 datasets (CIFAR-10/100, Tiny-ImageNetand ImageNet), 5 model architectures, and 2 pruning settings (unstructured and structured pruning).We show that (i) B I P achieves higher test accuracy than IMP and finds the best winning tickets nearlyin all settings, and (ii) B I P is highly efficient (comparable to one-shot pruning schemes), achieving2-7 × speedup over IMP for the same level of model accuracy and sparsity.
Related Work and Open Question
Neural network pruning.
As neural networks become deeper and more sophisticated, modelpruning technology has gained increasing attention over the last decade since pruned models arenecessary for the deployment of deep networks in practical applications [4, 34].
With the goal offinding highly-sparse and highly-accurate subnetworks from original dense models, a variety ofpruning methods have been developed such as heuristics-based pruning [17, 21, 23–25, 29, 35]and optimization-based pruning [16, 9, 26, 27].
The former identifies redundant model weights byleveraging heuristics-based metrics such as weight magnitudes [6, 17, 19, 11, 22, 36, 31, 35, 37],gradient magnitudes [21, 23, 24, 38, 39], and Hessian statistics [40–45].The latter is typically built on:
1) sparsity-promoting optimization [15, 33, 46–49], where model weights are trained by penalizingtheir sparsity-inducing norms, such as ℓ 0 and ℓ 1 norms for irregular weight pruning, and ℓ 2 normfor structured pruning; 2) parameterized masking [16, 9, 50–54], where model weight scores areoptimized to filter the most important weights and achieve better performance.
Iterative vs. one-shot pruning, and motivation.
Existing schemes can be further categorized intoone-shot or iterative pruning based on the pruning schedule employed for achieving the targeted modelsparsity.
Among the iterative schemes, the IMP (Iterative Magnitude Pruning scheme) [17, 20, 55–64, 35] has played a significant role in identifying high-quality ‘winning tickets’, as postulatedby LTH (Lottery Ticket Hypothesis) [18, 19].
To enable consistent comparisons among differentmethods, 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 formodel re-initialization [18] and the no-rewinding ( i.e. , fine-tuning) variant [65].
Briefly, the matchingsubnetworks should match or surpass the performance of the original dense model [20].
[Figure]
For example, the current state-of-theart (SOTA) implementation of IMP in[22] can lead to a pruned ResNet-20on CIFAR-10 with 74% sparsity and92 .
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 increasemodel sparsity over pruning iterations,and (ii) the pruning-retraining learningmechanism 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 iterationprunes ( p %) 1 / T of the currently unpruned model weights, progressively pruning fewer weights ineach iteration.
For (ii), the unpruned weights in each pruning iteration are re-set to the weightsat initialization or at an early-training epoch [18], and re-trained till convergence.
In brief, IMPrepeatedly prunes, resets, and trains the network over multiple iterations.
However, winning tickets found by IMP incur significant computational costs.
The sparsest winningticket 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 computationalcost 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 sparsityand retrained once.
In particular, OMP (one-shot magnitude pruning) is an important baseline thatsimplifies IMP [17].
It follows the pruning-retraining paradigm, but prunes the model to the targetratio 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 iscustomized with a reduced number of training epochs per pruning round, the pruning accuracy alsodrops largely (see Fig. A2).
Hence, there is a need for advanced model pruning techniques to findwinning 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 [47, 50, 66, 13, 67–70].
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 tomaintain 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 bestoptimization 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 toprune model parameters, and then , given the mask, find the best model weights for the unprunedmodel 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 theupper-level problem depends on the solution to the lower-level problem.
Such a nested structuremakes the BLO in its most generic form very difficult to solve, since it is hard to characterize theinfluence of the lower-level optimization on the upper-level problem.
Various existing literaturefocuses on the design and analysis of algorithms for various special cases of BLO.
Applications rangefrom the classical approximate descent methods [71, 72], penalty-based methods [73, 74], to recent
BigSAM [75] and its extensions [76, 77].
It is also studied in the area of stochastic algorithms [78–80]and back-propagation based algorithms [81–83].
BLO has also advanced adversarial training [84],meta-learning [85], data poisoning attack generation [86], neural architecture search [87] as well asreinforcement learning [88].
Although BLO was referred in [49] for model pruning, it actually calledan 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 consideredfor model pruning in-depth and systematically.
We will show that model pruning yields a specialclass of BLO problems with bi-linear optimization variables.
We will also theoretically show that thisspecialized 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 [85] and neural architecture search [87, 89]).
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 developthe bi-level pruning (B I P) algorithm.
We can theoretically show that B
I P can be solved as easily asthe 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-retraininglearning paradigm covers two kinds of tasks: ❶ pruning that determines the sparse pattern of modelweights, and ❷ training remaining non-zero weights to recover the model accuracy.
In existingoptimization-based pruning methods [90–93], the tasks ❶ - ❷ are typically achieved by optimizingmodel weights, together with penalizing their sparsity-inducing norms, e.g. , the ℓ 1 and ℓ 2 norms [94].
Different from the above formulation, we propose to separate optimization variables involved in thepruning tasks ❶ and ❷ .
This leads to the (binary) pruning mask variable m ∈ { 0 , 1 } n and the modelweight variable θ ∈ R n .
Here n denotes the total number of model parameters.
Accordingly, thepruned model is given by ( m ⊙ θ ) , where ⊙ denotes the element-wise multiplication.
As will beevident later, this form of variable disentanglement enables us to explicitly depict how the pruningand 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 theretrained sparse model weights θ .
Given the pruning ratio p % , the sparsity constraint is given bym ∈ S , where S =
{ m | m ∈ { 0 , 1 } n , 1 T m ≤ k } and k
=
(1 − p %) n .
Our goal is to prunethe original model directly to the targeted pruning ratio p % ( i.e. , without calling for the IMP-likesparsity schedule as described in Sec. 2) and obtain the optimized sparse model ( m ⊙ θ ) .
To thisend, we interpret the pruning task ( i.e. , ❶ ) and the model retraining task ( i.e. , ❷ ) as two optimizationlevels , where the former is formulated as an upper-level optimization problem, and it relies on theoptimization of the lower-level retraining task.
We thus cast the model pruning problem as thefollowing BLO problem (with ❷ being nested inside ❶ ):
[Equation]
Sparsity-fixedmodelretraining
[Equation]
where ℓ denotes the training loss ( e.g. , cross-entropy), m and θ are the upper-level and lower-leveloptimization variables respectively, θ ∗ ( m ) signifies the lower-level solution obtained by minimizingthe objective function g given the pruning mask m , and γ > 0 is a regularization parameter introducedto convexify the lower-level optimization so as to stabilize the gradient flow from θ ∗ ( m ) to m andthus the convergence of BLO [80, 95].
In a sharp contrast to existing single-level optimization-basedmodel pruning methods [90–93], the BLO formulation (1) brings in two advantages.
First, BLO has the flexibility to use mismatched pruning and retraining objectives at the upper andlower 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 bemore specific, one can update the upper-level pruning mask m using a data batch (called B 2 ) distinctfrom the one (called B 1 ) used for obtaining the lower-level solution θ ∗ ( m ) .
The resulting BLOprocedure can then mimic the idea of meta learning to improve model generalization [96], where thelower-level problem fine-tunes θ using B 1 , and the upper-level problem validates the generalizationof the sparsity-aware finetuned model ( m ⊙ θ ∗ ( m )) using B 2 .
Second, BLO enables us to explicitly model and optimize the coupling between the retrained modelweights θ ∗ ( m ) and the pruning mask m through the implicit gradient (IG)-based optimizationroutine.
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 [74].
The use of IGmakes our proposed BLO-oriented pruning (1) significantly different from the greedy alternatingminimization [97] that learns the upper-level and lower-level variables independently ( i.e. , minimizesone 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 pruningscenarios 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 firstelaborate 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.
thevariable m and θ respectively, d θ ⊤ /d m ∈ R n × n denotes the vector-wise full derivative , and for easeof notation, we will omit the transpose ⊤ when the context is clear.
In (2), the IG challenge refers tothe 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 [74, 80, 85].
Basedon 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 denotesthe matrix inversion operation.
Yet, the exact IG formula (3) remains difficult to calculate due to the presence of matrix inversion andsecond-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 ReLUactivations are piece-wise linear in a tropical hyper-surface [98], and this assumption has been widelyused in BLO-involved applications such as meta learning [99] and adversarial learning [84].
Given∇ 2 θ ℓ = 0 , the matrix inversion in (3) can be then mitigated, leading to the IG formula
[Equation]
237 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 usingonly first-order derivatives; see the following theorem.
Proposition 1 Assuming ∇ 2 θ ℓ = 0 and defining ∇ z ℓ ( z ) := ∇ z ℓ ( z ) |
z = m ⊙ θ ∗ , 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]
where diag( · ) represents a diagonal matrix with · being the main diagonal vector.
Further, we canconvert (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 thatdℓ ( m ⊙
[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 ⊙ θ ∗ ) makesthe IG-involved gradient (2) easily solvable, and the computational complexity is almost the same asthat 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 andthe alternating gradient descent based BLO solver [80].
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) , weupdate θ ( t ) by randomly selecting a data batch with the learning rate α and applying SGD (stochasticgradient 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 updatem using SPGD (stochastic 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 theconstraint set S given by S
= { m | m ∈ { 0 , 1 } n , 1 T m ≤ k } in (1) and is achieved by the top- khard-thresholding operation as will be detailed later.
In B I P, the ( θ -step) and ( m -step) steps execute iteratively.
In practice, we find that B I P convergesvery
well; see Fig.
A8 for an ablation study.
It is also worth noting that both ( θ -step) and ( m -step) onlyrequire the first-order information ∇ z ℓ ( z ) , demonstrating that B I P can be conducted as efficiently asfirst-order optimization.
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’ mechanismused in [16, 9].
Specifically, we relax the binary masking variables to continuous masking scoresm ∈ [ 0 , 1 ] .
We then acquire loss gradients at the backward pass based on the relaxed m .
At theforward 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 advantagesof the BLO formulation, which enables the flexibility to customize the lower-level and upper-levelproblems.
The use of diverse data batches is beneficial to generalization as shown in [96].
✦ 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-levellearning rate α , as θ is initialized by a pre-trained dense model.
We show ablation study on αin Fig. 6(c).
BLO also brings in the low-level convexification parameter γ .
We set γ = 1 .
inexperiments and refer readers to Fig.
6(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. 6(a).
✦ Extension to structured pruning: We formulate and solve the B
I
P problem in the context ofunstructured (element-wise) weight pruning.
However, if define the pruning mask m w.r.t.
model’sstructural units ( e.g. , filters), then it is easy to apply B I P to structured weight pruning; see Fig.
4 and
Fig.
A6 for empirical results.
Experiments
In this section, we present extensive experimental results to show the effectiveness of B I P acrossmultiple 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 winningtickets 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 [100], CIFAR-100 [100], Tiny-ImageNet [101], ImageNet [102], and 5 architecture typesincluding ResNet-20/56/18/50 and VGG-16 [103, 104].
Tab. A1 summarizes these datasets andmodel configurations and setups.
Baselines, training, and evaluation.
As baselines, we mainly focus on 4 SOTA pruning methods, 302 ①
IMP [17], ② OMP [17], ③ G RASP [23] (a one-shot pruning method by analyzing gradientflow at initialization), and ④ H YDRA [9] (an optimization-based pruning method that optimizesmasking scores).
It is worth noting that there exist various implementations of IMP, e.g. , specifiedby different learning rates and model initialization or ‘rewinding’ strategies [18].
To make a faircomparison, we follow the recent IMP benchmark in [22], which can find the best winning tickets overcurrent heuristics-based pruning baselines.
We also remark that H YDRA is originally proposed forimproving the adversarial robustness of a pruned model, but it can be easily customized for standardpruning when setting the adversary’s strength as 0 [9].
We choose H YDRA as a baseline becauseit can be regarded as a single-level variant of B I P with post-optimization weight retraining.
Whenimplementing B I P, unless specified otherwise, we use the 1 -step SGD in ( θ -step), and set the learningrates ( α, β ) and the lower-level regularization parameter γ as described in the previous section.
Whenimplementing baselines, we follow their official repository setups.
We evaluate the performanceof all methods mainly from two perspectives: (1) the test accuracy of the sub-network, and (2) theruntime of pruning to reach the desired sparsity.
We refer readers to Tab. A3 and Appendix C.2 formore training and evaluation details, such as training epochs and learning rate schedules.
4.2 Experiment Results
B I P identifies high-accuracy winning tickets.
In what follows, we look at the quality of winningtickets identified by B I P. Two key observations can be drawn from our results:
(1) B I P finds winningtickets of higher accuracy and/or higher sparsity than the baselines in most cases (as shown in Fig.
3and Tab. 1); (2) The superiority of B I P holds for both unstructured pruning and structured pruning (asshown in Fig.
4 and Fig.
A6 ).
Fig.
3 shows the unstructured pruning trajectory (given by test accuracy vs. pruning ratio) of B I Pand baseline methods in 8 model-dataset setups.
For comparison, we also present the performance ofthe 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 thebaseline methods, IMP is the pruning method most competitive to ours.
However, the improvementbrought by B I P is significant with respect to the variance of IMP, except for the 60% - 80% sparsityregime in (CIFAR-10, ResNet-20).
In the case of (CIFAR-100, ResNet-20) where IMP can not findany winning tickets (as confirmed by [22]), B I P still manages to find winning tickets with around0 .
6% improvement over the dense model.
In Tab. 1, we summarize the sparsest winning tickets alongthe pruning trajectory identified by different pruning methods.
As we can see, B I P can identify thewinning tickets with higher sparsity levels than the other methods, except in the case of (CIFAR-10,
[Figure]
We observe that B
I P consistently outperforms the other baselines.
Note in the (ImageNet, ResNet- setting, we only compare B I with our strongest baseline due to computational resource constraints.
ResNet-20).
We also refer readers to Appendix C.3 for more experimental results to justify the highquality of winning tickets identified by B I P.
[Figure]
[Table]
Fig.
4 demonstrates the structured pruning trajectory on the CIFAR-10/100 datasets.
Here we focuson filter pruning, where the filter is regarded as a masking unit in (1).
We refer readers to Appendix C.3for channel-wise pruning results.
Compared to Fig.
3, Fig.
4 shows that it becomes more difficultto find winning tickets of high accuracy and sparsity in the structured pruning, and the gap amongdifferent methods decreases.
This is not surprising, since filter pruning imposes much stricter pruningstructure constraints than irregular pruning.
However, B I P still outperforms all the baselines.
Mostimportantly, 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 yieldssparsity-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)
[Figure] [Figure]
This yields 7 × less runtime than IMP, which consumes
[Figure]
mins to find a comparable winning ticket with 87% sparsity.
Compared to the optimization-based baseline H YDRA , B I P ismore efficient as it does not rely on the extra post-optimizationretraining; see Tab.
A2 for a detailed summary of runtimeand number of training epochs required by different pruningmethods.
Further, B I P takes about 1.25 × more computationtime than G RASP and OMP.
However, the latter methods leadto worse pruned model accuracy, as demonstrated by theirfailure to find winning tickets in Tab. 1, Fig. 3, and Fig.
Rewinding effect on B I P. Another advantage of B I P is thatit is not sensitive to model rewinding.
Recall that rewinding isa strategy used in LTH [19] to determine what model initialization should be used for re-training apruned sparse model.
As shown in [22], an IMP-identified winning ticket could be sensitive to thechoice of a rewinding point.
Fig.
6(a) shows the test accuracy of the B I P-pruned model when it isretrained at different rewinding epochs, where ‘N/A’ in the x-axis represents the case of no retraining(and thus no rewinding).
More ablation studies on the rewinding epochs can be found in Fig.
A11.
Aswe can see, a carefully-tuned rewinding scheme does not lead to a significant improvement over B I Pwithout retraining.
This suggests that the subnetworks found by B I
P are already of high quality.
[Figure]
Sanity check of B I P on specialized hyperparameters.
In Fig.6(b), we show the sensitivity of
B I P to its specialized hyperparameters at lower-level optimization, including the number of SGDiterations ( N ) in ( θ -step), and the regularization parameter γ in (1).
Fig.
6(b1) shows the test accuracyof B I P-pruned models versus the choice of N .
As we can see, more SGD iterations for the lower-leveloptimization do not improve the performance of B I
P. This is because in B I P, the θ -step is initializedby 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 computationallylightest.
Fig.
6(b2) 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 lackof 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 performancedrop.
Fig.
6(b3) 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.
See Fig.
A4 for more results on hyperparameter tuning.
Conclusion
We proposed the B I P method to find sparse networks through the lens of BLO.
Our work advancedthe algorithmic foundation of model pruning by characterizing its pruning-retraining hierarchyusing BLO.
We theoretically showed that B
I P can be solved as easily as first-order optimizationby exploiting the bi-linearity of pruning variables.
We also empirically showed that B
I P can findhigh-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.
Checklist
The checklist follows the references.
Please read the checklist guidelines carefully for information onhow 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 referencingthe 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 areproprietary.•
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 instructionsblock 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’scontributions and scope?
[Yes](b) Did you describe the limitations of your work?
[Yes] See Sec C.4(c)
Did you discuss any potential negative societal impacts of your work?
[Yes] SeeSec C.4(d) Have you read the ethics review guidelines and ensured that your paper conforms tothem?
[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 andAppendix 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 experi-
ments multiple times)?
[Yes] See Sec.
(d) Did you include the total amount of compute and the type of resources used (e.g., typeof GPUs, internal cluster, or cloud provider)?
[Yes] See Table A
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]
If you used crowdsourcing or conducted research with human subjects...
(a) Did you include the full text of instructions given to participants and screenshots, ifapplicable?
[N/A](b)
Did you describe any potential participant risks, with links to Institutional ReviewBoard (IRB) approvals, if applicable?
[N/A]
(c) Did you include the estimated hourly wage paid to participants and the total amountspent 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 objectivefunction in (2), we obtain
[Equation]
where for ease of notation, we omit the dependence of θ ∗ ( m ) w.r.t.
m .
We then take derivative ofthe 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]
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 updatem 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 theconstraint set S given by S
= { m | m ∈ { 0 , 1 } n , 1 T m ≤ k } in (1) and is achieved by the top- khard-thresholding operation as will be detailed below.
Implementation of discrete optimization.
In the actual implementation, we use (cid:101) m ( t ) ∈ [0 , 1] dand 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 thefollowing:
[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.
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 datasetsand 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 methodsacross 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 ontheir official code repositories.
For IMP and OMP, we adopt the settings from the current SOTAimplementations [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 epochfor retraining.
G RASP conducts one-shot pruning to the target sparsity, followed by the 200-epochretraining.
In each pruning iteration, IMP prunes 20% of the remaining parameters before 160-epochretraining.
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 ratedecay rate of 0.1 at 50% and 75% epochs.
The initial learning rate for all the methods are 0.1.
Hyper-parameters for B I P.
In both structured and unstructured pruning settings, cosine learningrate 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-leveloptimization in all settings.
Ablation studies on different SGD steps for lower-level optimization canbe found in Fig.
6(b) and Fig.
A13.
We use 100 training epochs for B I P, and ablation studies ondifferent training epochs for larger pruning ratios can be found in Fig.
A12.
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 theretraining epoch numbers at each pruning cycle.
In Fig.
A2, the performance and time consumption of
IMP using 20, 40, and 80 epochs at each retraining cycle are presented.
The results and conclusionsare in general aligned with Fig.
First, with fewer epoch numbers, the time consumption decreasesat the cost of evident performance degradation.
Second, IMP with fewer epoch numbers are unableto 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 ofheuristics-based pruning, and thus justifies the necessity in developing a more powerful optimizationbased pruning method.
[Table]
[Table] [Table]
Comparison with more prune-at-initialization baselines.
In Fig.
A3, 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 methodsare clear, and the benefit becomes more significant as the sparsity increases.
Hyper-parameter sanity check.
In Fig.
A4, we further demonstrate the influence of differentchoices of lower-level learning rate α as well as the batch size on the performance of B I P. Fig.
A4 (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. Bycontrast, a small α is preferred due to the fact that the model parameters are updated based on thepre-trained values.
Fig.
A4 (b) shows how the batch size influences the performance.
As we can see,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.
Additional structured pruning experiments.
In addition to filter pruning in Fig. 4, we providemore results in the structured pruning setting, including both filter-wise and channel-wise pruning (as
[Figure]
[Figure] [Figure]
[Figure]
illustrated in Fig.
A5).
In Fig.
A6, results on CIFAR-10 with VGG-16 and ResNet-56 are added asnew experiments compared to Fig.
Fig.
A7 shows the results of the channel-wise pruning.
As wecan see, consistent with Fig. 4, B I P is able to find the best winning tickets throughout the experimentswhile it is difficult for IMP to find winning tickets in most cases.
We also notice that H YDRA , as theoptimization-based baseline, serves as a strong baseline in filter-wise pruning.
It also indicates thesuperiority of the optimization-based methods over the heuristics-based ones in dealing with morechallenging pruning settings.
Training trajectory of B I
P. We show in Fig.
A8 that the B
I P algorithm converges quite wellwithin 100 training epochs using a cosine learning rate scheduler.
[Figure] [Figure]
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.
A9.
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 betterthan G RASP but is still not as good as IMP and our method B I P in different architecture-datasetcombinations.
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 performanceto 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 caneffectively achieve comparable or even better testing performance than OMP in most differentarchitecture-dataset combinations, which is also the main contribution of [28].
However, E ARLY B IRDis still not as strong as IMP in testing performance.
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.
A10.
on the structuredpruning setting.
As we can see, B I P consistently outperforms P ROS P R and still stands top among allthe baselines.
Ablation study on the sensitivity of B I P to rewinding epochs.
We test the effects of rewinding +retraining of our proposed method B I P on more datasets and model architectures.
Two conclusionscan be drawn from Fig.
A11.
Firstly, the rewinding epoch number does not lead to significantimprovements over the result without retraining (denoted as "N/A" in each sub-figure).
[Figure] [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.
A12.
Specifically
[Figure]
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 epochnumber from 50 to 500.
Note that the number of training epochs in our original experiment setup wasset to 100.
As we can see, the performance of B I P gets saturated when the epoch number is over
[Figure] [Figure]
Tiny
[Figure]
ImageNet
[Figure] [Figure]
Thus, even for a higher pruning ratio, the increase of training epoch number over 100 does not gainmuch improvement in accuracy.
The effect of different lower-level steps in B I P on the training dynamics.
We conduct additionalexperiments 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, 3, and 5.
We report the training trajectories of B I P in
Fig.
A13.
As we can see, the use of multi-step SGD accelerates model pruning convergence at itsearly phase.
Yet, if we run B I P for a sufficient number of epochs (we used 100 by default in otherexperiments), the final test accuracy of using different SGD settings shows little difference.
Althoughthe use of multiple SGD steps could improve the convergence speed, it introduces extra computationcomplexity per BLO step.
Thus, from the overall computation complexity perspective, using 1 SGDstep but running more epochs is advantageous in practice.
[Figure] [Figure]
The training trajectory of the mask IoU score.
To verify the argument that the mask alsoconverges at the end of the training, we show the training trajectory of the mask similarity betweentwo adjacent-epoch models in Fig.
A14 at different pruning ratios.
Here the mask similarity isrepresented through the intersection of the union (IoU) score of the two masks found by two adjacentepochs.
The IoU score ranges from 0.0 to 1.0, and a higher IoU implies a larger similarity betweenthe two masks.
As we can see, the IoU score converges to 1.0 in the end, which denotes that the maskalso converges at the end of the training phase.
Also, with a smaller pruning ratio, the mask turns toconverge more quickly.
The effect of different training batch schemes.
We conducted ablation studies on three differentschemes of B
I P’s training batches for the upper and lower level.
In addition to two different randombatches for the two levels, we also consider the same batch and the reverse batch scheme.
B I P (samebatch) 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.
A15 shows that both the random batchscheme (i.e., B I P) and the reverse batch scheme can bring a better testing accuracy performance thanthe same batch scheme throughout different pruning ratio settings.
Fig.
A16 shows that B I P the samebatch scheme converges slower compared to the other two.
Both of the results indicate B I P benefitsfrom the diverse batch selection.
[Figure]
[Figure] [Figure]
100 Epoch Number
[Figure] [Figure]
C.4 Broader Impact
We do not recognize any potential negative social impacts of our work.
Instead, we believe our workcan inspire many techniques for model compression.
The finding of structure-aware winning ticketalso benefits the design of embedded solutions to deploying large-scale models on resource-limitededge devices ( e.g. , FPGAs), providing broader impact on both scientific research and practicalapplications ( e.g. , autonomous vehicles).