Structured Pruning › Why Structures Can Be Removed

Michael BrenndoerferFebruary 27, 20263 min read
Language AI HandbookAll chapters
Part 41 of 67Model Compression
Chapter 310Structured Pruning › Why Structures Can Be Removed
Reading section 2 of 13 · Why Structures Can Be Removed · 3 minSection 2 of 13 · 3 min

Book contents

Section 2 of 13 · 3 min read

Structured Pruning › Why Structures Can Be RemovedOne section · Sections in this chapter2 / 13 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

A recurring observation in transformer research is that not all components contribute equally to model quality. Many attention heads appear redundant: when researchers examined BERT's attention patterns, they found that many heads learned similar patterns, and individual heads could be masked off at test time with minimal quality loss. The 2019 paper "Are Sixteen Heads Really Better than One?" by Michel and colleagues showed that many BERT heads could be removed without any fine-tuning and the model would retain most of its performance. This result was surprising at the time because it suggested that the model was substantially over-provisioned for most tasks.

Similarly, analysis of layer-by-layer representations in deep transformers shows that middle layers often produce very similar hidden states, suggesting many computations could be skipped. Gromov and colleagues demonstrated in 2024 that in large language models like Llama 2, angular distances between consecutive layer representations vary dramatically across the depth of the network. Early layers perform large, varied transformations. Late layers also apply significant transformations, particularly those responsible for mapping representations to output token probabilities. But a set of middle layers often pass the representation through nearly unchanged.

This redundancy is not an accident. Large models are typically overparameterized relative to any specific downstream task. During pretraining on broad corpora, the model learns many different capabilities, some of which are irrelevant for a particular application. Fine-tuning on a narrow task does not eliminate the circuits dedicated to irrelevant capabilities; it just reduces their influence on the output. Structured pruning provides a systematic way to find and excise these underutilized components.

The key insight driving all structured pruning methods is that you need a criterion for measuring importance. An importance score tells you which heads, layers, or neurons matter most. Once you have scores, you can rank all components and remove the least important ones until you reach a target size or quality threshold. The challenge is computing reliable importance scores without running an exhaustive ablation study, which would require removing each component individually and evaluating quality, an approach that does not scale to models with hundreds of layers and thousands of heads.

There are three main families of importance criteria. Perturbation-based methods measure the actual quality change from removing a component. Gradient-based methods use the gradient of the loss with respect to component outputs to estimate sensitivity. Activation-based methods measure how active a component is on representative inputs. Each has different computational costs and different accuracy characteristics, and practitioners often combine them.