COE 592Lecture 4.2Part 03
From sensitivity curves to per-layer ratios
Pick an accuracy threshold, read off each layer's pruning rate where its curve crosses it, and see why this heuristic ignores the interaction between layers.
- Concepts
- 3
- Slides
- 18-23
- Reading
- 18 min
Why this part matters
Part 02 ended with a wall of six curves and no numbers. This part is the step that converts that chart into the six per-layer ratios you actually type into a pruning script, and it is the exact place where an exam will hand you a small accuracy table, a threshold and a parameter count per layer, and ask for the per-layer rates and the overall rate.
It is also the baseline that every automated method in the rest of the lecture is judged against. AMC and NetAdapt exist because the threshold read-off has a specific, nameable flaw, so for the research project you need to be able to run this heuristic, defend it as a cheap starting point, and say precisely why it falls short. One horizontal line, six crossings, one weighted sum, one honest caveat. That is the whole part.
By the end you can
- Read a sensitivity chart and classify layers as sensitive or redundant from the slope of their curves.
- Apply the threshold rule to read off a pruning rate for every layer, including layers that never cross T.
- Compute the overall pruning rate as a parameter-weighted average and adjust T until it meets a target.
- Explain in one sentence why the result is sub-optimal, using the words single-layer sweep and interaction.
- Connect the limits of the heuristic to the motivation for automated pruning in the next two parts.
Put your finger on the 80% column of the VGG-11 chart and read straight down. The green L1 curve is still at about 92% accuracy. The blue L0 curve has already dropped to about 71%. Same network, same dataset, same pruning ratio, and the two layers are twenty points apart. That gap is the entire reason per-layer pruning ratios exist, and it is what the six curves are there to expose.
Recall what each curve is. Sensitivity analysis prunes one layer L_i alone at ratios r in {0, 0.1, ..., 0.9}, measures the accuracy at each ratio with every other layer left dense, then moves on to the next layer and repeats. The result is one accuracy versus ratio line per layer. Every line starts at the same place, the dense accuracy of about 93% on CIFAR-10, so the starting point carries no information at all. What differs is the slope: how soon and how steeply each line bends down as r grows. That slope is the layer's sensitivity.
| Layer | At 70% pruned | At 80% pruned | At 90% pruned | Verdict |
|---|---|---|---|---|
| L0 | 83.5% | 71% | 32% | Most sensitive: bends first, falls off a cliff |
| L1 | 93% | 92% | 85% | Most redundant: flat almost to the end |
| L2 | 91.5% | 89.5% | 79% | Redundant: still about 79% at 90% |
| L3 | 91.5% | 85.5% | 51% | Moderate: bends late, drops hard at 90% |
| L4 | 90.5% | 77% | 39% | Sensitive past 70% |
| L5 | 92% | 90% | 82% | Redundant: about 82% at 90% |
The rule that falls out of the table is simple. A curve that stays flat as r grows belongs to a redundant layer: most of its weights can go with no visible cost, so it should be pruned hard. A curve that bends early belongs to a sensitive layer: its weights are doing work that nothing else in the network can absorb, so it should be pruned gently. The slide summarizes it as "some layers are less sensitive to pruning" (L1, the flattest) and "some layers are more sensitive to pruning" (L0, the steepest), and the whole point of drawing all six on one axis is that you can rank them by eye.
Why the first layer is the fragile one
L0 being the most sensitive is not a quirk of this run. Han et al. (2015), the paper the chart's method comes from, report the same pattern on AlexNet: "The first convolutional layer, which interacts with the input image directly, is most sensitive to pruning. We suspect this sensitivity is due to the input layer having only 3 channels and thus less redundancy than the other convolutional layers" (section 5, Figure 6). Their Figure 6 also shows convolutional layers as a group being more sensitive than fully connected layers, which is the same story at coarser resolution: the layers with the fewest weights per unit of work have the least slack. A 3 x 3 kernel over three input channels has 27 weights per filter; removing 80% of them leaves five, and five numbers cannot describe an edge detector.
Recall
Which VGG-11 layer in the chart is most sensitive, and what physical reason does Han et al. give?
Quick check
On the VGG-11 chart, which layer tolerates 90 percent pruning best, and what does that say about it?
Now draw one dashed horizontal line across the chart just under 80% accuracy, where the slide puts it (measured against the gridlines it sits at about 79%). Walk along the blue L0 curve from the left. It sits above the line through 60%, is still above it at 70% (about 83.5%), and has dropped to 71% by 80%. Somewhere between those two grid points it crossed the line, at roughly 73% pruning. That crossing is L0's pruning rate. Do the same for the orange L3 (about 82%) and the steep red L4, whose 80% point sits just under the line: strict interpolation puts the crossing at about 78.5%, and the slide rounds its drawn guide up to 80%. L1, the flat red L2 and L5 never reach the line inside the sweep, so they get the largest tested rate, 90%, which is where the slide draws its last vertical guide.
Pruning rates read off at T of about 79 to 80 percent (from the dashed guides on the slide)
- L0
- about 73%: crosses T between the 70% and 80% points
- L1
- 90% or beyond: still about 85% accuracy at the last swept ratio
- L2
- 90% or beyond: about 79% accuracy at 90%, on the line
- L3
- about 82%: crosses just past the 80% point
- L4
- about 78% by interpolation; the slide rounds its drawn guide up to 80%
- L5
- 90% or beyond: about 82% accuracy at 90%
That is the whole mechanism, and it deserves to be stated as an algorithm rather than a picture, because the exam version comes as a table, not a chart. Choose an accuracy threshold T. For each layer, the pruning ratio is the largest swept ratio whose accuracy is still at or above T. Layers whose curves never dip below T inside the sweep get the maximum swept ratio.
The read-off table above and the worked example below follow the slide's drawn guides, which use the chart form and interpolate between grid points. By the strict table form L0 and L4 would snap to 70% and L3 to 80%, and exact interpolation puts L4 at about 78.5%, so the slide's 80% guide for L4 is a rounding of its own chart. The formula is the exam rule; the guides are how the slide applies it by eye.
From six rates to one overall rate
The slide bullet reads "pick a degradation threshold T such that the overall pruning rate is desired", and the word overall hides a calculation students routinely get wrong. The overall rate is not the average of the six numbers. It is the fraction of all weights removed, so each layer's rate is weighted by how many weights that layer has. A 90% rate on a layer with 2.36 million weights removes far more than a 73% rate on a layer with 1,728.
T is the one knob. If R comes out below the target, lower T: every curve now runs further right before it crosses, so every r_i grows or stays pinned at the maximum swept ratio, and R never falls. If the pruned network turns out too inaccurate, raise T and no rate can grow. The loop is: pick T, read off six rates, compute R, compare with the target, move T, repeat. It converges in a handful of iterations because R is monotone in T.
Worked example
What the slide's T buys on VGG-11
Assign illustrative weight counts
The slide does not say which six layers L0 to L5 are, so take the first six 3 x 3 conv layers of VGG configuration A (Simonyan and Zisserman, Table 1) with biases ignored: 3 x 64 x 9 = 1,728, 64 x 128 x 9 = 73,728, 128 x 256 x 9 = 294,912, 256 x 256 x 9 = 589,824, 256 x 512 x 9 = 1,179,648, 512 x 512 x 9 = 2,359,296. Total 4,499,136. These counts are illustrative; the read-off rule does not depend on them, but R does.Multiply each rate by its count
Rates in layer order are 0.73, 0.90, 0.90, 0.82, 0.80, 0.90, taken from the slide's drawn guides rather than the strict grid rule: exact interpolation puts L4 at 0.785, and the 0.80 here is the slide's rounding of that guide. So 1,728 x 0.73 + 73,728 x 0.90 + 294,912 x 0.90 + 589,824 x 0.82 + 1,179,648 x 0.80 + 2,359,296 x 0.90 is about 3,883,778 weights pruned.Divide by the total
R = 3,883,778 / 4,499,136 = 86.3%. About 615,358 weights remain.Weighted versus unweighted
Quantity Value Why it differs Unweighted mean of the six rates 84.2% Treats the 1,728-weight L0 like the 2.36M-weight L5 Parameter-weighted rate R 86.3% The big late layers are pruned at 80 to 90%, so R is higher Weights remaining 615,358 of 4,499,136 About one in seven survives Compression factor 7.3x 1 / (1 - 0.863)
The simulator below runs this loop on curves digitized from the slide, so at its default T of 79% the interpolated crossings land within about a point and a half of the slide's guides (L4 reads 78.5% against the drawn 80%) and R reads 86.0% against the worked example's 86.3%. Drag T and watch all six vertical guides move at once; switch between snapping to the 10% grid and interpolating between grid points; and read R, the unweighted mean and the compression factor as they update. Try T at 90 first, then 70, and note which direction R moves.
| Layer | Shape (illustrative) | Rate | Accuracy there | Weights | Pruned |
|---|---|---|---|---|---|
| L0 | 3 x 64 x 3 x 3 | 73.6% | 79.0% | 1,728 | 1,272 |
| L1 | 64 x 128 x 3 x 3 | 90.0% | 85.0% | 73,728 | 66,355 |
| L2 | 128 x 256 x 3 x 3 | 90.0% | 79.0% | 294,912 | 265,421 |
| L3 | 256 x 256 x 3 x 3 | 81.9% | 79.0% | 589,824 | 482,972 |
| L4 | 256 x 512 x 3 x 3 | 78.5% | 79.0% | 1,179,648 | 926,242 |
| L5 | 512 x 512 x 3 x 3 | 90.0% | 82.0% | 2,359,296 | 2,123,366 |
Drag T down and every vertical guide slides right at once: one knob moves all six rates. Drag it up and the guides retreat, so a higher T prunes less. The six curves are digitized from the slide chart, and the default T of 79% is where the slide draws its dashed line, a hair under the 80 mark. The weight counts are illustrative: the first six 3 x 3 conv layers of VGG configuration A with biases ignored, since the slide does not say which layers L0 to L5 are. Snap mode returns the last grid point still at or above T; interpolate mode places the crossing between grid points, which is what the dashed guides on the slide do.
The exam version: a table instead of a chart
On paper you will get an accuracy table for two or three layers, a threshold and a weight count per layer. The procedure is identical. Read each row until the accuracy falls below T, take the last ratio that was still at or above T, weight by the counts, and add.
| Layer | r = 50% | r = 60% | r = 70% | r = 80% | r = 90% |
|---|---|---|---|---|---|
| A (100,000 weights) | 90% | 84% | 70% | 52% | 30% |
| B (400,000 weights) | 95% | 93% | 91% | 86% | 75% |
| C (500,000 weights) | 95% | 95% | 94% | 93% | 90% |
Worked example
Three layers, T = 90 percent
Read each row
A is at 90% at r = 50 and 84% at 60, so r_A = 50%. B is at 91% at 70 and 86% at 80, so r_B = 70%. C is still at 90% at the last ratio, so r_C = 90%.Weight by the counts
100,000 x 0.5 + 400,000 x 0.7 + 500,000 x 0.9 = 50,000 + 280,000 + 450,000 = 780,000.Divide by the total
R = 780,000 / 1,000,000 = 78%. 220,000 weights remain, a compression of about 4.5x. The unweighted mean would have been 70%, which is wrong.One sentence on optimality
The rates come from single-layer sweeps, so the accuracy of pruning A, B and C together is never measured and is usually below T. The next concept explains why.
Recall
State the rule that turns one layer's sensitivity curve into a pruning rate.
Recall
Your overall pruning rate comes out below target. Do you raise or lower T, and why?
Recall
Three layers with 100k, 400k and 500k weights read off at 50, 70 and 90 percent. What is the overall rate?
Quick check
You raise the accuracy threshold T from 80 percent to 88 percent on the sensitivity chart. What happens to the per-layer pruning rates read off the curves?
Quick check
Layer A has 200,000 weights and crosses T at 60 percent, B has 300,000 and crosses at 80 percent, C has 500,000 and crosses at 90 percent. Overall pruning rate?
Take two of the rates you just read off. L0 pruned to 73% on its own costs about 14 points (93 down to the line at 79). L4 pruned to 80% on its own costs about 16 points. Now prune both at once. L4 was trained on features that flow through a dense L0. Its tolerance to losing 80% of its weights was measured with those features intact, and that condition no longer holds. The network now sees both perturbations at the same time, and the combined drop is usually larger than either single-layer drop, and the chart contains no measurement of it.
| Experiment | Accuracy | Drop |
|---|---|---|
| L0 pruned to 73%, nothing else touched | 93 to about 79 | about 14 points, measured on the chart |
| L4 pruned to 80%, nothing else touched | 93 to about 77 | about 16 points, measured on the chart |
| Both pruned at once | not on any curve | usually more than either single drop, never measured by the sweep |
The slide asks "is this optimal?" and answers itself: "maybe not. We do not consider the interaction between layers." The next slide of the source deck puts it even more directly, "sensitivity analysis ignores the interaction between layers, sub-optimal". The reason is built into the procedure. Each curve is a one-dimensional slice of accuracy along one layer's axis, taken with every other layer frozen dense. The read-off then treats those axes as independent, as if you could add up six separate tolerances and get the tolerance of the whole. Layers are not independent. That is the Layer interaction the heuristic leaves out, and it is why T is only a proxy for the accuracy you will actually get, not a guarantee.
Every other layer stays dense while one layer is pruned.
Each rate assumes the other five layers are still dense.
Losses compound. Fine-tuning recovers some of the gap.
Why the heuristic ignores interactions on purpose
The omission is a cost decision, not an oversight. The sweep needs (layers) x (ratios) evaluations, 6 x 9 = 54 here, each a forward pass over the validation set. Measuring every joint setting would need 9^6 = 531,441 evaluations for six layers, and real networks have dozens of layers. The AMC paper says exactly this about hand-crafted rules: "as the layers in deep neural networks are not independent, these rule-based pruning policies are non-optimal, and doesn't transfer from one model to another model", and "the design space has exponential complexity, which is infeasible to be solved by greedy, rule-based methods" (He et al., 2018, section 1). The heuristic trades optimality for a search that finishes in an afternoon.
Two things keep it usable in practice. First, Fine-tuning after pruning (part 06) recovers a large share of the compounded loss, so the read-off does not have to be exact, only in the right region. Second, it is the starting point that the automated methods improve on rather than throw away. NetAdapt removes filters from one layer per iteration, re-measures accuracy after a short fine-tune, and keeps the best proposal, so interactions get folded in one step at a time (Yang et al., 2018). AMC goes further and learns the whole per-layer assignment as one policy, rewarded on the accuracy of the jointly pruned network (He et al., 2018). Both are Automated pruning, and both exist because the single-layer sweep leaves accuracy on the table.
Recall
In one sentence, why is the threshold read-off sub-optimal?
Recall
How many evaluations does the sweep cost for six layers and nine ratios, and how many would a full joint search cost?
Quick check
Why does pruning every layer at its threshold-read rate usually lose more accuracy than T predicts?
Recap
If you remember nothing else
- Sensitivity is the slope of a layer's accuracy versus ratio curve. L0 (first conv, 3-channel input) is the most sensitive, L1 the most redundant.
- The threshold rule: r_i is where the curve crosses T. In table form it is the largest swept ratio at or above T; in chart form it is the interpolated crossing between grid points. Layers that never cross T get the maximum swept ratio.
- With T at about 79 to 80 percent (the slide's dashed line) the guides read off roughly 73, 90+, 90+, 82, 80 and 90+ percent for L0 to L5.
- The overall rate is parameter-weighted, not the mean of the six rates. With illustrative VGG-11 counts it is about 86 percent (7.3x) against an unweighted 84 percent.
- Higher T keeps more weights, lower T prunes more. Tune T until the overall rate hits the target.
- Every curve is a single-layer experiment, so simultaneous pruning compounds losses the chart never measured. T is a proxy and the assignment is sub-optimal.
- Han et al. used this heuristic successfully (9x on AlexNet, 13x on VGG-16 with iterative retraining). AMC and NetAdapt exist because a better joint assignment exists.
Sources
- MIT 6.5940 TinyML and Efficient Deep Learning Computing, Fall 2024DocsMIT HAN LabCourse page for Lecture 4, Pruning and Sparsity Part II, the source of this deck(opens in a new tab)
- Lecture 4 slides: Pruning and Sparsity Part IIDocsMIT HAN LabVGG-11 on CIFAR-10 sensitivity chart, the threshold bullet, and the interaction between layers slide(opens in a new tab)
- Lecture 4 video: Pruning and Sparsity Part IIVideoMIT HAN LabSpoken walkthrough of the sensitivity analysis and threshold read-off(opens in a new tab)
- Learning both Weights and Connections for Efficient Neural NetworksPaperHan, Pool, Tran and Dally, NIPS 2015Section 5: first conv layer most sensitive, thresholds set from sensitivity, 9x AlexNet and 13x VGG-16(opens in a new tab)
- AMC: AutoML for Model Compression and Acceleration on Mobile DevicesPaperHe, Lin, Liu, Wang, Li and Han, ECCV 2018Layers are not independent, rule-based policies are non-optimal, exponential design space(opens in a new tab)
- NetAdapt: Platform-Aware Neural Network Adaptation for Mobile ApplicationsPaperYang et al., ECCV 2018One layer simplified per iteration, the highest short-term accuracy proposal kept(opens in a new tab)
- Very Deep Convolutional Networks for Large-Scale Image RecognitionPaperSimonyan and Zisserman, ICLR 2015Table 1, configuration A (VGG-11) channel widths used for the illustrative per-layer weight counts(opens in a new tab)
- What is the State of Neural Network Pruning?PaperBlalock, Ortiz, Frankle and Guttag, MLSys 2020Global versus layerwise budget allocation changes accuracy at a fixed model size(opens in a new tab)
- Distiller documentation: pruning algorithms, sensitivity prunerDocsIntel LabsSensitivity analysis as an empirical starting guess for per-layer thresholds in a production toolkit(opens in a new tab)