Abstract
The inherent heavy computation of deep neural networks prevents their widespread applications. A widely used method for accelerating model inference is quantization, by replacing the input operands of a network using fixed-point values. Then the majority of computation costs focus on the integer matrix multiplication accumulation. In fact, high-bit accumulator leads to partially wasted computation and low-bit one typically suffers from numerical overflow. To address this problem, we propose an overflow aware quantization method by designing trainable adaptive fixed-point representation, to optimize the number of bits for each input tensor while prohibiting numeric overflow during the computation. With the proposed method, we are able to fully utilize the computing power to minimize the quantization loss and obtain optimized inference performance. To verify the effectiveness of our method, we conduct image classification, object detection, and semantic segmentation tasks on ImageNet, Pascal VOC, and COCO datasets, respectively. Experimental results demonstrate that the proposed method can achieve comparable performance with state-of-the-art quantization methods while accelerating the inference process by about 2 times.
Introduction
Deep Neural Networks (DNNs) are computationally expensive, making their deployment on edge devices like smartphones and IoT sensors challenging. Quantization is a common strategy to mitigate this, converting 32-bit floating-point weights and activations into 8-bit integers. However, a hidden bottleneck exists in the Multiply-Accumulate (MAC) operations that dominate DNN workloads. While multiplying two 8-bit numbers results in a 16-bit product, summing thousands of these products often requires a 32-bit accumulator to avoid numerical overflow.
The 16-bit Accumulator Bottleneck
Modern mobile CPUs, particularly those using ARM NEON instructions, can process twice as many 16-bit operations in a single instruction compared to 32-bit operations. If inference engines could safely use 16-bit accumulators, they could theoretically double their throughput. The challenge lies in preventing the "overflow" that occurs when the sum of products exceeds the 16-bit limit, which typically leads to catastrophic accuracy loss.
Methods: Overflow Aware Quantization (OAQ)
To bridge the gap between hardware capability and numerical stability, the authors introduce Overflow Aware Quantization (OAQ). This approach consists of two main components:
Adaptive Integer Representation
The method introduces a trainable scaling factor, $\alpha$. Instead of using a fixed bit-width, $\alpha$ adjusts the "float-bit-width" to scale the range of quantized values. By increasing $\alpha$, the range is narrowed, effectively "squeezing" the values so their sum is guaranteed to fit within a 16-bit container without overflowing.
Quantization Overflow Aware Training (QOAT)
Since overflow is a discrete event, standard gradient descent cannot directly optimize for it. The authors implement a Quantization node in the training graph that simulates 16-bit accumulation.
As shown in Figure 3, if an overflow is detected ($N_o > 0$), the system increases $\alpha$ to shrink the value range. Conversely, if no overflow occurs, it gradually decreases $\alpha$ to expand the range and regain numerical precision. This allows the model to learn the maximum possible precision for each specific layer that the hardware can handle.
Experimental Results
The researchers evaluated OAQ across several computer vision tasks, including image classification (ImageNet), object detection (Pascal VOC, MS COCO), and semantic segmentation.
- Inference Speedup: On ARM-based processors (Allwinner V328 and MTK8167s), OAQ achieved a 2x speedup over standard TFLite and a 1.85x speedup over the NCNN framework.
- Accuracy Preservation: OAQ consistently outperformed other low-bit methods. On MobileNet-v1, it achieved 70.87% Top-1 accuracy, nearly matching the 8-bit baseline (70.10%) while being significantly faster.
- Task Sensitivity: The study revealed that detection models are highly sensitive to overflow, where even a 0.01% overflow rate can be detrimental. OAQ successfully managed these sensitivities, reducing the performance drop in semantic segmentation from 10.9% (standard PACT) to just 1.8%.
Conclusion
Overflow Aware Quantization provides a robust framework for maximizing hardware utilization on mobile devices. By making the training process aware of potential numerical overflows, the method unlocks the performance potential of 16-bit accumulators without sacrificing model accuracy. Future research may apply this logic to specialized AI accelerators like NPUs and DSPs, which often have even more rigid hardware constraints.
Summary updated