Abstract
At present, the quantification methods of neural network models are mainly divided into post-training quantization (PTQ) and quantization aware training (QAT). Post-training quantization only need a small part of the data to complete the quantification process, but the performance of its quantitative model is not as good as the quantization aware training. This paper presents a novel quantification method called Attention Round. This method gives parameters w the opportunity to be mapped to all possible quantized values, rather than just the two quantized values nearby w in the process of quantization. The probability of being mapped to different quantified values is negatively correlated with the distance between the quantified values and w, and decay with a Gaussian function. In addition, this paper uses the lossy coding length as a measure to assign bit widths to the different layers of the model to solve the problem of mixed precision quantization, which effectively avoids to solve combinatorial optimization problem. This paper also performs quantitative experiments on different models, the results confirm the effectiveness of the proposed method. For ResNet18 and MobileNetV2, the post-training quantization proposed in this paper only require 1,024 training data and 10 minutes to complete the quantization process, which can achieve quantization performance on par with quantization aware training.
Introduction
Deploying deep neural networks on edge devices requires quantization—converting 32-bit floating-point weights and activations into lower-bit integers (like 4-bit or 8-bit) to save memory and power. Currently, practitioners choose between Quantization-Aware Training (QAT), which is accurate but computationally expensive, and Post-Training Quantization (PTQ), which is fast but often suffers significant accuracy drops below 8 bits.
A major bottleneck in existing PTQ methods is the restriction of rounding weights to their two nearest neighbors. This constraint limits the optimization space, preventing the model from finding a global minimum that minimizes task loss. Furthermore, determining optimal bit-widths for mixed-precision quantization remains a complex combinatorial problem. This paper introduces Attention Round to address these limitations.
Methodology
1. Attention Round Mechanism
Unlike previous methods like AdaRound, Attention Round treats quantization as a lossy coding process. It models the quantized weight as the original weight plus a random Gaussian perturbation ($\alpha$).
The core innovation is the "Attention" mechanism: the probability of a weight being mapped to a specific quantized value decays according to a Gaussian function. While closer values receive more "attention" (higher probability), distant values remain accessible during optimization, expanding the search space. The parameter $\alpha$ is trained using a small calibration set to minimize the output error of each layer.
2. Mixed-Precision via Lossy Coding Length
To solve the bit-allocation problem without expensive search algorithms, the authors leverage Rate-Distortion Theory. They calculate the "lossy coding length" of each layer to measure information density. Layers with higher information density are assigned higher bit-widths, while redundant layers are compressed more aggressively. This approach treats quantization fundamentally as a data compression problem, avoiding combinatorial optimization.
Experimental Results
The method was evaluated on the ImageNet classification benchmark using only 1,024 calibration images. The entire quantization process for models like ResNet18 or MobileNetV2 takes approximately 10 minutes.
- 4-bit Weight Quantization: On ResNet18, Attention Round achieved 70.72% accuracy, significantly outperforming AdaRound (68.71%) and Bit-Split (69.11%).
- MobileNetV2 Performance: For this notoriously difficult model, Attention Round achieved 65.67% accuracy for 4-bit weight and activation quantization, whereas previous state-of-the-art PTQ methods like LAPQ struggled at 49.7%.
- Mixed Precision: Using the coding-length strategy, ResNet18 was compressed to 5.5MB with 71.02% accuracy, outperforming the 6-bit fixed-precision version of the same model.
Conclusion
Attention Round effectively closes the performance gap between PTQ and QAT. By expanding the rounding search space and utilizing an information-theoretic approach to bit allocation, the method achieves high accuracy with minimal data and compute time. Future work may involve testing this mechanism on non-vision tasks such as object detection or natural language processing.
Summary updated