① Pruning
This stage uses the method of Han et al. (2015) as is. After normal training learns which connections are important, weights below a threshold are removed and the remaining weights are retrained. For AlexNet and VGG-16, this reduces the number of weights by 9× and 13×.
The resulting sparse matrix is stored in a format that records the nonzero values and their positions (CSR or CSC). With a nonzero elements and n rows (or columns), this format requires 2a+n+1 numbers. Positions are recorded not as absolute addresses but as differences from the previous element, using 8 bits for convolutional layers and 5 bits for fully connected layers. When a difference exceeds that range, a zero-valued filler element is inserted.
② Quantization (weight sharing)
The n weights of a layer, W={w1,…,wn}, are partitioned into k clusters C={c1,…,ck}. The partition is found with one-dimensional k-means, minimizing the within-cluster sum of squares (Eq. (2) in the paper).
argCmini=1∑kw∈ci∑∣w−ci∣2
Weights in the same cluster share the same value (the centroid). Only the table of shared values (the codebook) and an index per weight indicating which shared value it uses are stored. With k shared values, each index needs only log2k bits. Weights are not shared across layers.
After quantization, the shared values are fine-tuned by retraining. The gradient of the loss L with respect to a shared value Ck is the sum of the gradients of the weights that use it (Eq. (3)). Iij is the index of weight Wij, and 1(⋅) is a function that is 1 when the condition holds and 0 otherwise.
∂Ck∂L=i,j∑∂Wij∂L∂Ck∂Wij=i,j∑∂Wij∂L1(Iij=k)
The right side of the figure at the top is the example from Figure 3 of the paper. 4 × 4 = 16 weights are grouped into four shared values (2.00, 1.50, 0.00, −1.00), and each weight is represented by a 2-bit index. After retraining, the shared values move to 1.96, 1.48, −0.04, and −0.97.
When n connections, each represented with b bits, share k values, the compression rate is as follows (Eq. (1)).
r=nlog2k+kbnb
In the figure's example, r=16⋅32/(16⋅2+4⋅32)=3.2.
③ Huffman coding
Huffman coding is a lossless compression method that assigns shorter codes to more frequent symbols. Both the quantized weight indices and the position differences in the sparse matrix have skewed value distributions (weights cluster around two peaks, and most position differences are below 20). As a result, Huffman coding shrinks the model by a further 20–30%. It requires no training and is applied after all retraining is finished.