Abstract
Compressing large neural networks is an important step for their deployment in resource-constrained computational platforms. In this context, vector quantization is an appealing framework that expresses multiple parameters using a single code, and has recently achieved state-of-the-art network compression on a range of core vision and natural language processing tasks. Key to the success of vector quantization is deciding which parameter groups should be compressed together. Previous work has relied on heuristics that group the spatial dimension of individual convolutional filters, but a general solution remains unaddressed. In this paper we make the observation that the weights of two adjacent layers can be permuted while expressing the same function. We then establish a connection to rate-distortion theory and search for permutations that result in networks that are easier to compress. Finally, we rely on an annealed quantization algorithm to better compress the network and achieve higher final accuracy. We show results on image classification, object detection, and segmentation, reducing the gap with the uncompressed model by 40 to 70% w.r.t. the current state of the art.
Introduction
Deep neural networks are notoriously resource-intensive, requiring massive memory and computation, which makes deploying them on mobile or edge devices difficult. While Vector Quantization (VQ)—representing groups of weights with a single "code" from a learned codebook—is a powerful compression tool, it has a major Achilles' heel: grouping.
How do you decide which weights should be compressed together? Previous methods relied on simple heuristics (like grouping spatial dimensions of a filter) that fail for pointwise ($1 \times 1$) convolutions or fully connected layers, which dominate modern architectures. If the "wrong" weights are grouped, the resulting quantization error becomes so high that the model's accuracy never fully recovers, even after fine-tuning.
The PQF Framework
The proposed PQF (Permute, Quantize, and Fine-tune) framework addresses this by exploiting the mathematical symmetry of neural networks. The approach consists of three distinct stages:
- Permute: The authors observe that you can permute the output neurons of one layer and the input neurons of the next layer using the same permutation matrix without changing the network's output. Using rate-distortion theory, they show that quantization error is lower-bounded by the determinant of the weight covariance matrix. They use a stochastic local search to find permutations that minimize this determinant, effectively making the weight vectors more "compact" and easier to cluster.
- Quantize: Once the weights are reordered, they use Stochastic Relaxation of K-Means (SR-C). This is an annealed version of k-means that adds noise to the subvectors and gradually decays it, helping the algorithm escape local minima to find a better codebook than standard k-means.
- Fine-tune: Finally, they fix the permutations and the discrete codes but allow the codebook "centroids" (the actual values representing the weights) to be updated via standard gradient descent on the original task loss.
Experimental Results
The authors evaluated PQF on standard computer vision benchmarks, including ImageNet (classification) and MS COCO 2017 (object detection and segmentation). PQF consistently outperformed previous state-of-the-art methods like "Bit Goes Down" (BGD):
- ResNet-50 on ImageNet: Achieved 72.18% top-1 accuracy at only ~3 MB (a 31x compression ratio). This is a ~4% absolute improvement over previous SOTA at that size.
- Mask R-CNN on COCO: Compressed the model to 6.6 MB (26x compression) while maintaining a Box AP of 36.3, closing the gap to the uncompressed model by 60-70% compared to prior work.
Key Insights and Conclusion
A central finding of the paper is the clear inverse correlation between initial reconstruction error and final accuracy: the lower the error after the "Permute" and "Quantize" steps, the higher the final accuracy after fine-tuning. This justifies the effort spent on reordering weights before compression.
While PQF sets a new standard for high-ratio compression, challenges remain in finding optimal permutations for highly complex, non-standard network graphs and reducing the GPU time required for the final fine-tuning stage. Nevertheless, by treating network invariance as an optimization tool, PQF provides a principled way to search for the best network configuration for quantization.
Summary updated