Rotation Invariant Quantization for Model Compression

Joseph Kampeas, Yury Nahshan, Hanoch Kremer, Gil Lederman, Shira Zaloshinski, Zheng Li, Emir Haleva · DOI

Abstract

Deploying large-scale neural networks on resource-constrained edge devices necessitates aggressive model compression. Traditional post-training quantization (PTQ) methods often rely on fixed bit-rates across all layers, failing to account for varying layer sensitivities and the theoretical entropy limits of weight distributions. This paper introduces Rotation Invariant Quantization (RIQ), a novel PTQ technique that treats quantization as a global rate-distortion optimization problem. By leveraging the rotation-invariant properties of weight distributions and a single-parameter optimization strategy, RIQ achieves up to 50x compression ratios with minimal accuracy loss, effectively reaching the theoretical entropy limit of model weights.

Introduction

As modern deep learning models scale to billions or even trillions of parameters, the hardware requirements for deployment have become a significant bottleneck. While quantization—reducing the precision of model weights—is a standard approach to mitigate memory and compute costs, most existing methods are "fixed-rate." These methods assign a uniform bit-width (e.g., 4-bit or 8-bit) to every layer, which is inherently inefficient.

RIQ shifts the paradigm from asking "How much accuracy can I get for a fixed bit-rate?" to the dual question: "What is the minimum bit-rate required to maintain a specific accuracy budget?" By focusing on the entropy limit—the theoretical minimum bits needed to represent data without information loss—RIQ enables a more fluid, mixed-precision approach that respects the unique contribution of each layer to the model's final output.

Methodology

The RIQ algorithm is built upon three core pillars designed to optimize the trade-off between model size and performance.

1. Rotation Invariance and Spherical Distributions

The authors utilize cosine distance as the primary measure of weight distortion. Because both the weight norm and the cosine distance are invariant to rotations, the authors mathematically demonstrate that the optimal quantization strategy should also be rotation-invariant. They prove that the rate-distortion minimizing distribution for neural networks is a "spherical distribution." Consequently, RIQ designs quantization "bin widths" for each layer to be proportional to that layer's norm, ensuring that the quantization grid scales naturally with the weight distribution.

2. Single-Parameter Global Optimization

Unlike traditional mixed-precision methods that require complex, multi-variable optimization or reinforcement learning to determine per-layer bit-widths, RIQ simplifies the search space to a single global parameter ($k$). By searching for the optimal value of $k$, the algorithm automatically determines the ideal bit-rate for every layer based on its sensitivity and size. This allows for "fluid" precision; for example, a layer might effectively utilize 3.4 bits per symbol, providing much tighter compression than integer-only constraints.

3. High-Speed Entropy Coding

To bridge the gap between quantized values and the theoretical entropy limit, RIQ employs Asymmetric Numeral Systems (ANS). ANS is a high-speed entropy coder that compresses the quantized weights down to their minimum representation. As a post-training method, RIQ is remarkably efficient, capable of compressing a ResNet-50 model in less than a minute on a standard CPU without requiring any retraining.

Experimental Evaluation

The researchers evaluated RIQ across a diverse array of architectures and tasks to demonstrate its versatility:

  • Computer Vision: ImageNet classification using VGG-16, ResNet-50, and Vision Transformers (ViT); object detection on COCO using YOLOv5.
  • Natural Language Processing: SQuAD dataset using DistilBERT.
  • Large Language Models: Llama-7b.
  • Sparse Models: Pruned versions of VGG and ResNet to test the synergy between pruning and quantization.

Key Results

RIQ consistently outperforms standard PTQ baselines across all benchmarks:

  • VGG-16: Achieved a 19.4x compression ratio on dense models and a 52.9x ratio on pruned models, with less than 0.4% accuracy degradation.
  • ResNet-50: Reached 7.3x compression with a negligible 0.26% drop in Top-1 accuracy.
  • NLP Performance: On DistilBERT, RIQ achieved nearly 8x compression with an F1 score drop of only 0.08%.
  • Calibration Efficiency: The algorithm is highly robust, requiring as few as three real images to calibrate and accurately predict performance on the full validation set.

Discussion and Insights

Synergy with Pruning

One of the most significant findings is the multiplicative effect of RIQ when applied to sparse models. While pruning reduces the number of parameters, RIQ aggressively compresses the remaining weights. This combination allows for extreme compression ratios that are unattainable by either method in isolation.

The QAT Gap and Hardware Constraints

Despite its state-of-the-art performance for PTQ, RIQ still faces a performance gap compared to Quantization-Aware Training (QAT). QAT allows weights to adapt to the quantization process during training, effectively shifting the rate-distortion curve. Furthermore, while entropy-coded weights (via ANS) are excellent for storage and memory bandwidth, they currently require a decompression step before computation. Current deep learning hardware is largely optimized for fixed 4-bit or 8-bit integer arithmetic rather than the variable-length entropy-coded formats produced by RIQ.

Conclusion

Rotation Invariant Quantization (RIQ) provides a mathematically grounded and computationally efficient framework for model compression. By treating quantization as a global optimization problem and leveraging rotation invariance, RIQ pushes post-training compression to its theoretical limits. Future work involves exploring more granular partitions within layers and integrating rotation-invariant insights directly into the training process to further close the gap with QAT.

Summary updated

BibTeX
@misc{kampeas2023rotation,
  author = {Joseph Kampeas and Yury Nahshan and Hanoch Kremer and Gil Lederman and Shira Zaloshinski and Zheng Li and Emir Haleva},
  title = {{Rotation Invariant Quantization for Model Compression}},
  year = {2023},
  eprint = {2303.03106},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2303.03106},
}
Figure