Majid Al-RaimiSecond-order, activation and regression criteria

COE 592Lecture 4.1Part 06

Second-order, activation and regression criteria

Optimal Brain Damage's Taylor-expansion importance 1/2 h_ii w_i^2, neuron pruning as coarse-grained weight pruning, APoZ activation-sparsity scoring, and regression-based channel pruning that minimizes layer output reconstruction error.

Concepts
6
Slides
34-43
Reading
36 min
Understood
0/6 concepts

Why this part matters

Part 05 ranked weights by their absolute value and nothing else. That rule cannot tell a small weight sitting in a steep valley of the loss from a small weight resting on a flat plain, and only one of those two is safe to delete. This part gives you three criteria that look past the weight value to what actually happens when the weight is gone.

The first reads the curvature of the loss: Optimal Brain Damage from 1989, the root of the SparseGPT-style methods that prune large language models today. The second reads the activations: APoZ, the cheapest data-driven structured criterion you can run before deploying on an embedded board. The third reads the layer output itself: regression-based channel pruning, the basis of the pipelines used to shrink networks for edge accelerators. All three are standard exam derivations, and the reasoning behind them is what you will reuse when your research project has to justify a pruning choice.

By the end you can

  1. Derive the OBD importance 1/2 h_ii w_i^2 from the Taylor expansion and name the assumption that removes each term.
  2. Explain why magnitude pruning is OBD with a constant Hessian diagonal, and show a case where the two rankings disagree.
  3. Compute APoZ for a channel from its activation maps and decide which channel to prune.
  4. State the regression-based channel pruning objective, its L0 constraint and the two alternating LASSO and least-squares steps.
  5. Place each criterion in the reference list and say what data it needs.

Start with a trained network and its loss L(x; W). Setting one weight to zero moves the parameter vector from W to W_P = W + δW, where δW is zero everywhere except at the pruned position, where δw_i = -w_i. The question every criterion in this part is trying to answer is simple: how much does the loss move? You could answer it exactly by re-evaluating the loss after each candidate deletion, but LeCun, Denker and Solla call that approach prohibitively laborious, and for a network with thousands of weights it is. Second-order pruning builds a local model of the loss instead.

One weight before the general case. A weight sits at w = 0.5 in a valley of the loss surface given by L(w) = 1 + 2(w - 0.5)². Setting it to zero walks back to w = 0 and raises the loss from 1 to 1.5, and that rise is exactly ½ h w² with curvature h = 4: the gradient at the bottom of the valley is zero, so the first-order term contributes nothing and the curvature term contributes everything. Now scale the picture up to a whole parameter vector. The local model is a Taylor expansion of the loss around the trained point. Perturbing the weights by δW changes the loss by a first-order slope term, a second-order curvature term, and a remainder that shrinks as the cube of the perturbation.

δL=L(x;W+δW)L(x;W)=igiδwi+12ihiiδwi2+12ijhijδwiδwj+O ⁣(δW3)\delta L = L(x; W + \delta W) - L(x; W) = \sum_i g_i\,\delta w_i + \frac{1}{2}\sum_i h_{ii}\,\delta w_i^2 + \frac{1}{2}\sum_{i \neq j} h_{ij}\,\delta w_i\,\delta w_j + O\!\left(\lVert \delta W \rVert^3\right)
Second-order Taylor expansion of the loss change under a weight perturbation, new loss minus old
gi=Lwi,hij=2Lwiwjg_i = \frac{\partial L}{\partial w_i}, \qquad h_{ij} = \frac{\partial^2 L}{\partial w_i\,\partial w_j}
The gradient entries and the Hessian entries

Read the four pieces one at a time. The first sum is the slope: how fast the loss rises if you nudge each weight on its own. The second sum is the self-curvature: how quickly that slope itself changes along each weight's own axis, weighted by the square of the nudge. The third sum is the cross-curvature: whether moving weight i also tilts the loss along weight j. The last piece is everything the quadratic picture misses. The Hessian is the matrix that holds the second and third pieces together: its diagonal h_ii feeds the self-curvature sum and its off-diagonal h_ij feeds the cross terms.

Goodfellow, Bengio and Courville define the Hessian exactly this way, as the matrix with entries ∂²f/(∂x_i ∂x_j), and note that it is symmetric wherever the second partials are continuous. The cross sum runs over ordered pairs i ≠ j, so each unordered pair appears twice, once as (i, j) and once as (j, i); the one half in front is the second-order Taylor coefficient from ½ δWᵀ H δW, not a symmetry correction. Because H is symmetric the same term can be written without the one half as Σ_{i < j} h_ij δw_i δw_j. They also use this same second-order expansion to derive Newton's method, so the expression on the slide is not a pruning trick: it is the standard local model of any smooth function.

How big the Hessian is for the OBD zip-code network (LeCun et al., 1989, p. 600)

Parameters
about 2600 (2578 free parameters)
Full Hessian entries
about 6.5 × 10⁶, the figure the paper quotes
Diagonal entries
about 2600, one per parameter

The table is the reason the rest of this part exists. Even a 1989 network with about 2600parameters has millions of Hessian entries, and a modern network with 10⁸ weights would have 10¹⁶. Nobody computes that matrix. The whole art of second-order pruning is deciding which of its entries you can afford to ignore.

Recall

Write the second-order Taylor expansion of the loss change and name what each of its four pieces measures.

δL = L(W + δW) - L(W) = Σ g_i δw_i + ½ Σ h_ii δw_i² + ½ Σ_{i ≠ j} h_ij δw_i δw_j + O(||δW||³). The first sum is the slope along each weight, the second is the curvature along each weight's own axis, the third is the cross-curvature between pairs of weights, and the remainder collects every term of third order and higher.

Four terms is three too many. Optimal Brain Damage keeps the expansion usable by making three assumptions, and each one erases exactly one piece of the sum. The paper gives them names, the slide gives them plain-language bullets, and you should be able to match the two lists and say which term each one kills.

Three assumptions cross out three terms: the converged gradient, the cross-curvature and the cubic remainder. Only the diagonal curvature term survives.
OBD nameSlide wordingTerm removedWhy it is allowed
QuadraticL is nearly quadraticO(||δW||³)Near the minimum the loss surface is well described by its curvature alone, so the cubic remainder is negligible.
ExtremalTraining has convergedΣ gᵢ δwᵢAt a local minimum every partial derivative is zero, so the whole first-order sum vanishes and every hᵢᵢ is non-negative.
DiagonalDeletion errors are independent½ Σᵢ≠ⱼ hᵢⱼ δwᵢ δwⱼThe cost of deleting several weights is taken as the sum of their individual costs, which is exactly what dropping the off-diagonal terms means.
The three OBD approximations and what each removes

The extremal assumption does double duty. Because training stopped at a local minimum, the gradient is zero and the first sum disappears, but LeCun, Denker and Solla also point out that at a local minimum all the h_ii are non-negative, so any perturbation of the parameters will cause the loss to increase or stay the same. That single sentence is the source of the footnote on slide 36 that h_ii is non-negative, and it is what lets the surviving term serve as a cost rather than a signed change.

What survives is the diagonal curvature term alone. Deleting weight i means setting it to zero and, in the paper's words, freezing it there, so the step along that axis has the size of the weight itself, |δw_i| = |w_i|. The squared terms of the expansion do not care about the sign of δw_i, so substitute and you have the OBD estimate of the loss increase.

δLi=L(x;W)L(x;WPwi=0)12hiiwi2\delta L_i = L(x; W) - L(x; W_P \mid w_i = 0) \approx \frac{1}{2} h_{ii} w_i^2
Loss change from deleting a single weight under the three OBD assumptions
importancewi=δLi=12hiiwi2\text{importance}_{w_i} = \lvert \delta L_i \rvert = \frac{1}{2} h_{ii} w_i^2
OBD saliency. Remove the weights with the smallest values first.

The paper calls this quantity the saliency of a parameter, s_k = h_kk w_k² / 2 (the paper writes its parameter as u_k, the same variable as the w_k used on the slide and here), and the recipe is to delete the parameters with the lowest saliency. Notice what the formula says about a weight's importance: it is the product of two things, how large the weight is and how sharply the loss curves along that weight's axis. Magnitude pruning from part 05 kept only the first factor.

Magnitude pruning is OBD with the curvature assumed constant

Suppose every h_ii were the same number h. Then importance would be (h/2) w_i², and ranking weights by that value is exactly ranking them by |w_i|, since squaring and scaling by a positive constant preserve the order. So Magnitude-based pruning is OBD under a fourth, hidden assumption: that the loss curves equally steeply along every weight. The 1989 paper states its goal as moving beyond the approximation that magnitude equals saliency, and the point of a second-order criterion is to drop that assumption. The table below is a small case where doing so changes the answer.

Weightwᵢhᵢᵢ|wᵢ|½ hᵢᵢ wᵢ²MagnitudeOBD
A1.50.21.50.225keepprune
B1.01.01.00.5keepkeep
C-0.64.00.60.72keepkeep
D0.58.00.51.0prunekeep
E0.22.00.20.04pruneprune
Magnitude and OBD disagree on which two of five weights to prune
Two weights rest on two loss valleys. Sliding each to zero raises the loss by half the curvature times the weight squared. The smaller weight in the steep valley costs twice as much as the larger weight on the flat one.

Worked example

Five weights, two rankings, prune two

  1. Square each weight

    1.5² = 2.25, 1.0² = 1.0, (-0.6)² = 0.36, 0.5² = 0.25, 0.2² = 0.04. The sign of C disappears, as it does in |w|.
  2. Multiply by the curvature and halve

    A: ½ × 0.2 × 2.25 = 0.225, B: ½ × 1.0 × 1.0 = 0.5, C: ½ × 4.0 × 0.36 = 0.72, D: ½ × 8.0 × 0.25 = 1.0, E: ½ × 2.0 × 0.04 = 0.04.
  3. Rank by each criterion, lowest first

    Magnitude: E, D, C, B, A. Saliency: E, A, B, C, D.
  4. Pruning two weights

    Both criteria delete E. Magnitude then deletes D, the weight OBD rates as the most important of all five. OBD deletes A instead, the largest weight in the set, because it sits on almost flat ground.
InteractiveMagnitude versus OBD: same weights, two rankings
Weightw_ih_ii|w_i|½ h_ii w_i²mag rankmagnitudeobd rankobd
A1.50.2255keep2prune
B10.54keep3keep
C0.60.723keep4keep
D0.512prune5keep
E0.20.041prune1prune
Disagreements2weightsrows with a stripe are pruned by one criterion and kept by the other
Rank 1 meanslowestpruned firstset every h_ii equal and the two rankings coincide: magnitude is OBD with constant curvature

Set every h_ii in the table to the same value and watch the two decision columns fall into line. Then give a small weight a large curvature and watch them split again. That is the entire relationship between the two criteria in one gesture.

Why the slide says the Hessian is difficult

The full Hessian has entries, and the previous concept showed that this is out of reach even for a small network. OBD never computes it. The diagonal approximation means only the n entries h_ii are needed, and the paper derives a second back-propagation pass that computes them with, in its words, the same order of complexity as computing the gradient. Along the way it drops the terms involving the second derivative of the activation function, a Levenberg-Marquardt style approximation that gives guaranteed positive estimates of the second derivative. So the difficulty the slide flags is real for the full matrix and for networks with 10⁸ parameters, where even a diagonal pass over the whole training set is expensive, but it is not a reason OBD itself was impractical. Optimal Brain Surgeon (Hassibi and Stork, 1993) kept the cross terms by using the inverse of the full Hessian. SparseGPT (2023) makes second-order pruning practical at scale by solving layer-wise reconstruction problems with block-wise Hessian updates, which the final concept points to.

The recipe and what it achieved

The abstract on the slide states the motivation the formula serves. Deleting unimportant weights is a trade-off between network complexity and training-set error, and the paper expects better generalization, fewer training examples required and faster learning and classification from it. That is why the recipe below is framed as model selection, not only compression.

  1. Choose a reasonable network architecture.
  2. Train the network until reasonable convergence.
  3. Compute the second derivatives h_kk for each parameter.
  4. Compute the saliencies s_k = h_kk w_k² / 2.
  5. Sort the parameters by saliency and delete some low-saliency parameters.
  6. Return to step 2.

The loop back to training is the Iterative pruning and Fine-tuning pattern from part 02, thirty years earlier. The 1989 experiment applied it to a handwritten zip-code recognizer.

Optimal Brain Damage results (LeCun, Denker and Solla, 1989)

Setup
about 10⁵ connections controlled by 2578 free parameters, trained on roughly 9300 digits and tested on 3350
Prediction quality
The quadratic, extremal, diagonal estimate tracks the measured loss up to about 800 deleted parameters, roughly 30%; beyond that the cross terms and higher-order terms the approximation dropped start to matter
After retraining
Up to 1500 parameters, about 60%, deleted with almost unchanged training and test error
Versus magnitude
Deleting in order of saliency causes a significantly smaller increase of the objective than deleting by magnitude (figure 1a)
Versus random
Random deletion was so much worse it could not be plotted on the same scale
Venue
Advances in Neural Information Processing Systems 2 (NIPS 1989), AT&T Bell Laboratories, Holmdel NJ

Quick check

Under OBD, which assumption removes the first-order gradient term from the Taylor expansion?

Quick check

Weight A has w = 1.0 and h = 1; weight B has w = 0.5 and h = 8. Which does OBD keep first?

Recall

Why is magnitude pruning a special case of OBD?

If every h_ii equals the same constant h, importance becomes (h/2) w_i², and ranking by that value is the same as ranking by |w_i|. OBD differs only by letting the curvature vary from weight to weight.

Everything so far scored individual synapses. Take a linear layer with 5 inputs and 4 outputs, so its weight matrix has shape [4, 5]. Deleting the second output neuron does not zero one entry; it removes the entire row W[1, :], all 5 incoming weights at once, along with the edges drawn into that neuron on the slide, which is why the lower layer shows three circles with a gap where the fourth stood. The matrix becomes [3, 5], a smaller dense matrix, which is the reason Coarse-grained (structured) pruning gives real speedup without any sparse format.

That is the whole content of the sentence on the slide: Neuron pruning is coarse-grained weight pruning. In a convolution layer with weights of shape [c_o, c_i, k_h, k_w] (recall Convolution weight dimensions), deleting output channel o deletes W[o, :, :, :], one full row of c_i kernels in the slide's grid, where rows 3 and 5 of six filters are blanked out. It also deletes the corresponding map from the layer's output, and therefore the input channel o of every filter in the next layer, a point He et al. make explicitly in their figure. Channel pruning cuts twice.

Unit removedSlice deletedWeights deletedShape after
Output neuron of a linear layerW[o, :]One row: all incoming weights of that neuron[c_o - 1, c_i]
Output channel (filter) of a conv layerW[o, :, :, :]c_i kernels of k_h × k_w each[c_o - 1, c_i, k_h, k_w]
Input channel of the next conv layerW[:, o, :, :]c_o kernels, one per filter, that read the removed map[c_o, c_i - 1, k_h, k_w]
What one removed unit takes with it

The rule on the slide is then almost a tautology: the less useful the removed neurons are, the better the pruned network performs. The work is in defining useful. The Pruning criterion question has simply moved up one level of granularity, and part 05 already gave one answer, the L1 or L2 norm of the row or filter. The next two concepts give two answers that need no Hessian and no norm: look at the activations the neuron produces, or look at how well the layer output can be rebuilt without it.

Recall

A linear layer has weight shape [8, 16]. You prune three output neurons. How many weights disappear and what is the new shape?

Each output neuron owns one row of 16 weights, so 3 × 16 = 48 weights disappear and the matrix becomes [5, 16]. The next layer also loses three input columns.

ReLU outputs zero for every negative pre-activation. A channel whose output map is mostly zero, image after image, contributes almost nothing to the layer that follows, whatever its weights look like. Hu, Peng, Tai and Tang turned that observation into a criterion. On VGG-16 they found 631 neurons whose activations were zero more than 90% of the time on ImageNet validation images, and they found that the mean fraction of zeros is far higher in the deeper convolutional layers and the fully connected layers than in the early layers, so most of the redundancy sits at the top of the network.

LayerMean APoZ
CONV1-147.07%
CONV3-369.93%
CONV4-387.30%
CONV5-393.19%
FC675.26%
FC774.14%
Mean APoZ per layer of VGG-16 on ImageNet validation (Hu et al., 2016, Table 1)

The score is the APoZ. For channel c of a layer, run N validation images through the network, look at every position of the H × W output map for every image, and count how often the value is exactly zero. Divide by the number of positions you looked at.

APoZc=k=1Nj=1Mf ⁣(Oc,j(k)=0)N×M,f(true)=1, f(false)=0\mathrm{APoZ}_c = \frac{\sum_{k=1}^{N}\sum_{j=1}^{M} f\!\left(O_{c,j}(k) = 0\right)}{N \times M}, \qquad f(\text{true}) = 1,\ f(\text{false}) = 0
Average Percentage of Zeros for channel c, with M = H x W positions and N images (Hu et al., 2016, eq. 1)

The slide writes the same thing as zeros divided by batch times height times width. Its example uses a batch of 2, three channels and 4 × 4 maps, so every channel is judged over 2 × 4 × 4 = 32 positions. Count the bold zeros in each grid and the numbers on the slide come out exactly.

Worked example

APoZ for the three channels on the slide

  1. Count zeros per channel in batch 1

    Channel 0: 5. Channel 1: 5. Channel 2: 6.
  2. Count zeros per channel in batch 2

    Channel 0: 6. Channel 1: 7. Channel 2: 8.
  3. Divide the totals by 2 x 4 x 4 = 32

    Channel 0: 11/32 = 0.344. Channel 1: 12/32 = 0.375. Channel 2: 14/32 = 0.438.
  4. Channel 2 is pruned

    Smaller APoZ means a more important channel. Channel 2 is silent most often, so it is the one crossed out on the slide; channels 0 and 1 are kept.

Zero counts verified against the slide grids

Channel 0
5 + 6 = 11 zeros, APoZ 11/32 = 34.4%
Channel 1
5 + 7 = 12 zeros, APoZ 12/32 = 37.5%
Channel 2
6 + 8 = 14 zeros, APoZ 14/32 = 43.8%
Denominator
batch 2 × height 4 × width 4 = 32
The zero positions of batch 1 light up in each channel's map, then the three APoZ bars grow. The tallest bar, channel 2, is crossed out.
SimulatorAPoZ trimmer: click activations to zero and watch the ranking move
channel 0
channel 1
channel 2

Each grid is one 4 × 4 output map after ReLU. A zero cell is a position where the pre-activation was negative. Switch batches to edit the other 16 positions of the same channel.

Channelzeros b1zeros b2totalAPoZbardecision
Channel 05611/3234.4%
keep
Channel 15712/3237.5%
keep
Channel 26814/3243.8%
prune
Denominator32positionsbatch 2 × height 4 × width 4
Pruned channel2APoZ 43.8%highest APoZ loses; a tie goes to the higher channel index

APoZ_c = (z_c,1 + z_c,2) / (2 × 4 × 4)

Direction is the only thing people get wrong here, so state it in words: importance falls as APoZ rises. The paper's operating rule, the procedure it names Network Trimming, is to trim the neurons whose APoZ is more than one standard deviation above the layer's mean, which under a Gaussian assumption on APoZ values rejects about 16% of the neurons in a trimmed layer on average. Trimming is iterative: prune a few high-APoZ layers, retrain with the surviving weights initialized from the pre-trim network rather than from scratch, and repeat. The authors show that training the trimmed architecture from scratch leaves more zero-activation neurons than initializing from the trimmed weights does, so the initialization matters.

Network Trimming results (Hu et al., 2016)

LeNet on MNIST
20-50-500-10 trimmed to 20-24-252-10, 3.85× fewer parameters, accuracy 99.31% to 99.26%
VGG-16, trim CONV5-3 and FC6
Top-5 85.900% before retraining, 90.278% after, above the original 88.444%
VGG-16, trim CONV4, CONV5, FC6, FC7 at once
Top-5 falls to 46.650% before retraining, the reason trimming is done a few layers at a time
Validation set
ImageNet, N = 50,000 images per APoZ measurement
CriterionReadsCostGranularityScore
Magnitude (part 05)Weight values onlyNone, read the tensorAny|w|, Lp norm of a structural set
OBDWeights and hᵢᵢ from a second backward passAbout one gradient computationWeight½ hᵢᵢ wᵢ²
APoZReLU outputs on a validation setOne forward pass over N imagesNeuron or channelFraction of zero activations
RegressionSampled layer inputs and outputsLASSO plus least squares per layerInput channelReconstruction error of Z
The criteria of parts 05 and 06 compared by what they read

The comparison shows a split that matters for your project. Magnitude and OBD are read off the weights and their derivatives. APoZ and the regression criterion of the next concept are data-driven: they need a forward pass over real inputs, so they capture what the network does on your data rather than what its parameters look like, at the price of needing that data available at pruning time.

Quick check

Over a batch of 2 with 4 x 4 maps, channel 2 has 14 zeros and channel 0 has 11. Which is pruned under APoZ?

Recall

What is the Network Trimming operating threshold, what fraction of a layer's neurons does it remove on average, and why does retraining start from the pre-trim weights?

Trim every neuron whose APoZ is more than one standard deviation above the layer's mean, which under a Gaussian assumption on APoZ values removes about 16% of the neurons in that layer. Retraining is initialized from the trimmed network's surviving weights because training the same architecture from scratch leaves more zero-activation neurons behind and recovers less accuracy.

OBD asked what pruning does to the loss. APoZ looked at what a channel emits. He, Zhang and Sun ask a third question that is easier to answer than the first and more precise than the second: after you remove some input channels of a layer, how well can the survivors reproduce the layer's original output? Take one conv layer and sample b positions from real images (the paper used 5000 images with 10 samples each). Unroll each receptive field into a row of a matrix X of shape b × c_i in the slide's simplified picture. The layer's output at those positions is a matrix multiply.

Z=XWT=c=0ci1XcWcTZ = X W^{T} = \sum_{c=0}^{c_i - 1} X_c W_c^{T}
Layer output as a sum of per-input-channel contributions

The second equality is the whole idea. A matrix product can be split by the shared dimension: column c of X times row c of W^T is one b × c_o outer product, and Z is the sum of c_i of them, one per input channel. Removing input channel c means removing exactly one term of that sum. Regression-based pruning attaches a switch β_c to each term and asks which switches can be turned off while keeping the sum close to the original.

argminW,β ZZ^F2=Zc=0ci1βcXcWcTF2subject toβ0Nc\underset{W,\,\beta}{\arg\min}\ \lVert Z - \hat{Z} \rVert_F^2 = \Bigl\lVert Z - \sum_{c=0}^{c_i - 1} \beta_c\, X_c W_c^{T} \Bigr\rVert_F^2 \quad \text{subject to} \quad \lVert \beta \rVert_0 \le N_c
Regression-based channel pruning objective (He, Zhang and Sun, ICCV 2017)

Name every symbol. β is the Channel selection coefficient, a vector of length c_i; β_c = 0 prunes input channel c. N_c is the number of channels allowed to survive, so the L0 norm constraint counts nonzero switches, the same kind of constraint as the pruning formulation of part 01. The objective is the Reconstruction error: the Frobenius norm is the square root of the sum of all squared entries, so its square is just the elementwise squared error summed over the whole b × c_o output. Nothing about the network loss, the labels or the layers downstream appears anywhere.

Setting one beta to zero removes a column of X and the matching row of W^T together. Z keeps its b by c_o shape and is rebuilt as Z hat from the surviving channels.

The figure on the slide shows why the input side is the one that shrinks. X_P loses a column and W_P^T loses the row that multiplied it; the two disappear as a pair, because they were only ever used together. The output still has b rows and c_o columns. The next layer sees an input of the same shape as before, only slightly perturbed, which is what lets the paper prune a very deep network layer by layer and account for the accumulated error by always regressing toward the un-pruned model's output.

Solving it: alternate between selecting and rebuilding

The L0 constraint makes the problem NP-hard, so the paper relaxes it to an L1 penalty, adding λ ||β||₁ to the objective. That turns channel selection into LASSO regression, whose solutions are naturally sparse: as λ grows, more β_c are driven exactly to zero. With two unknowns, β and W, the paper alternates.

StepFixedSolvedSolverOutput
1WβLASSO (L1-relaxed selection)Which input channels survive
2βWLeast squares (closed form)Weights that best rebuild Z from the survivors
The two alternating steps

With W fixed, is linear in β, so the objective is an ordinary least-squares fit in β and the added L1 penalty makes it a LASSO problem that picks the channels. With β fixed, the survivors' weights are re-fitted by ordinary least squares so that they rebuild Z as well as possible, in closed form. A constraint ||W_c||_F = 1 on each channel's weights stops the trivial solution of shrinking β while inflating W. In practice the authors run the selection step repeatedly, raising λ until ||β||₀ drops to the target, and then run the reconstruction step once.

Channel pruning results (He, Zhang and Sun, ICCV 2017)

VGG-16
speedup with 1.0% increase in top-5 error; with tensor factorization at 0.3%
ResNet-50 and Xception-50
speedup at 1.4% and 1.0% extra top-5 error
Fine-tuning
10 epochs, batch 128, learning rate 10⁻⁵
Samples for regression
5000 images × 10 positions each

Quick check

In regression-based channel pruning, what does setting beta_c = 0 do?

Recall

State the regression-based pruning objective and its two alternating steps.

Minimize over W and β the value ||Z - Σ_c β_c X_c W_c^T||_F² subject to ||β||₀ ≤ N_c. Step one fixes W and solves for β by LASSO, which selects channels. Step two fixes β and solves for W by least squares, which rebuilds the output.

The reference list at the end of the deck is a map of where every Pruning criterion in parts 05 and 06 came from, and of what comes next. Reading it as a family tree makes the lecture easier to hold in memory than reading it as nineteen unrelated titles.

CriterionWhat it readsRefPaperWhere taught
MagnitudeWeight values4Han et al., NeurIPS 2015Part 05
Scaling factorTrainable γ per channel11Liu et al., Network Slimming, ICCV 2017Part 05
Second orderLoss curvature hᵢᵢ3LeCun, Denker, Solla, NeurIPS 1989This part
Second order, modernHessian of a layer-wise reconstruction18Frantar and Alistarh, SparseGPT, 2023Pointer
ActivationZero fraction after ReLU14Hu et al., Network Trimming, 2016This part
RegressionLayer output reconstruction16He, Zhang, Sun, ICCV 2017This part
Next-layer statisticsNext layer's reconstruction17Luo, Wu, Lin, ThiNet, ICCV 2017Pointer
First-order TaylorGradient times value on mini-batches15, 13Molchanov et al., ICLR 2017 and CVPR 2019Pointer
Criteria mapped onto the reference list of slide 43

Three of the pointers deserve a sentence each. SparseGPT is the modern descendant of Second-order pruning: it prunes GPT-scale models with 175 billion parameters in one shot to 50 to 60% unstructured sparsity with little loss in perplexity, using Hessian information of a layer-wise reconstruction problem very much like the one in the previous concept. ThiNet selects filters using statistics from the next layer rather than the current one, a cousin of Regression-based pruning. Molchanov's first-order Taylor criterion scores units by gradient times value on mini-batches. It is the same expansion as OBD with the gradient term kept and the Hessian dropped.

Recall

Given the criterion, name the paper and what it reads: magnitude, OBD, APoZ, regression.

Magnitude: Han et al. 2015, weight values. OBD: LeCun, Denker and Solla 1989, the diagonal of the Hessian times the squared weight. APoZ: Hu et al. 2016, the fraction of zero ReLU activations on validation data. Regression: He, Zhang and Sun 2017, the reconstruction error of the layer output.

Recall

Which of the criteria in this part need data pushed through the network, and which read only the parameters?

APoZ needs activations from a forward pass and regression needs sampled layer inputs and outputs, so both are data-driven. Magnitude reads only the weights. OBD reads the weights and h_ii; computing that diagonal does use training data through a second backward pass, but no activations are stored or scored.

Recap

If you remember nothing else

  • Pruning is a perturbation delta W. Its loss cost is approximated by a second-order Taylor expansion with a gradient term, a diagonal Hessian term, cross terms and a cubic remainder.
  • OBD keeps only 1/2 h_ii w_i^2: the quadratic assumption removes the remainder, convergence removes the gradient term, independent deletions remove the cross terms; h_ii is non-negative at a minimum.
  • Magnitude pruning is OBD with every h_ii equal. The full Hessian has n^2 entries; OBD computes only the diagonal by a second back-propagation pass.
  • Removing a neuron deletes a row of a linear weight matrix; removing a conv channel deletes a whole filter. Neuron pruning is coarse-grained weight pruning.
  • APoZ = zeros / (batch x H x W). The slide's channels score 11/32, 12/32 and 14/32 and the largest, channel 2, is pruned. Smaller APoZ means more important.
  • Regression-based pruning minimizes ||Z - sum_c beta_c X_c W_c^T||_F^2 subject to ||beta||_0 <= N_c, alternating LASSO channel selection and least-squares reconstruction. VGG-16 reached 4x speedup at 1.0 percent extra top-5 error.
  • Slide errata: the h_ii denominator on slide 36, the sign convention on slide 34, Network Trimming is 2016 not 2017, and the 'more importance' typo on slide 40.

Sources