Standard Deviation-Based Quantization for Deep Neural Networks

Amir Ardakani, Arash Ardakani, Brett H. Meyer, James J. Clark, Warren J. GrossarXiv 2022

Abstract

Quantization of deep neural networks is a promising approach that reduces the inference cost, making it feasible to run deep networks on resource-restricted devices. Inspired by existing methods, we propose a new framework to learn the quantization intervals (discrete values) using the knowledge of the network's weight and activation distributions, i.e., standard deviation. Furthermore, we propose a novel base-2 logarithmic quantization scheme to quantize weights to power-of-two discrete values. Our proposed scheme allows us to replace resource-hungry high-precision multipliers with simple shift-add operations. According to our evaluations, our method outperforms existing work on CIFAR10 and ImageNet datasets and even achieves better accuracy performance with 3-bit weights and activations when compared to the full-precision models. Moreover, our scheme simultaneously prunes the network's parameters and allows us to flexibly adjust the pruning ratio during the quantization process.

Introduction

Deep Neural Networks (DNNs) have achieved remarkable success across various domains but remain notoriously resource-intensive. Their high memory requirements and reliance on high-precision floating-point multiplications hinder deployment on resource-constrained "edge" devices like smartphones and embedded sensors. Quantization—the process of mapping continuous values to small discrete integers—is a primary strategy to mitigate these costs. However, standard quantization often suffers from a significant accuracy-efficiency trade-off. Existing techniques frequently overlook the statistical distribution of the data or rely on unstable learnable parameters. This research addresses these gaps by introducing a quantization framework that leverages the statistical "shape" of weight and activation distributions.

Methodology

The proposed framework, developed by researchers at McGill University, centers on three primary innovations designed to optimize the quantization process:

1. $\sigma$-Based Clipping and Pruning

Unlike traditional methods that learn a static clipping threshold, this approach defines the threshold as $\alpha \cdot \sigma$, where $\sigma$ is the standard deviation of the weights or activations. This makes the quantizer inherently aware of the data distribution's density. By incorporating $\sigma$, the training gradients become sensitive to the entire distribution rather than just outliers, leading to more stable learning. This mechanism also creates a natural "pruning area" around zero, where small values are effectively zeroed out.

Visualization of the quantization function, illustrating the pruning area, transition boundaries, and clipping thresholds.

2. Base-2 Logarithmic Quantization

To further enhance hardware efficiency, weights are mapped to power-of-two discrete values (e.g., $0, \pm 1, \pm 2, \pm 4$). This allows for the replacement of expensive high-precision multipliers with significantly cheaper bit-shift and addition operations, a critical advantage for low-power hardware.

3. Advanced Training Techniques

To ensure high accuracy at low bit-widths, the authors employ two specialized training strategies:

  • Improved Progressive Training: A gradual transition from high-bit to low-bit models, utilizing parameter re-scaling to prevent "pruning shock" and gradient vanishing.
  • Two-Phase Training: Weights tend to cluster near transition boundaries. By freezing quantization parameters in a second phase, the model reduces gradient noise, boosting final performance.

Experimental Results

The framework was rigorously evaluated on the CIFAR10 and ImageNet benchmarks across several architectures, including ResNet-18, ResNet-20, and ResNet-50.

Performance Benchmarks

A key finding is that the proposed 3-bit models can actually outperform their full-precision counterparts. For instance, on CIFAR10 with a ResNet-20 architecture, the 3-bit version achieved 92.23% accuracy, surpassing the 32-bit baseline of 91.74%.

Comparison of accuracy across different quantization methods and training techniques on the CIFAR10 dataset.

Efficiency and Pruning

On ImageNet, the 3-bit ResNet-18 outperformed other shift-add networks like DeepShift and INQ, achieving a Top-1 accuracy of 70.04%. Furthermore, the method offers flexible pruning; a 3-bit ResNet-18 could have 40% of its weights pruned with less than a 1% drop in accuracy compared to the full-precision model. The adaptive nature of the $\sigma$-based threshold also led to 10x faster convergence compared to prior state-of-the-art shift-add methods.

Conclusion and Future Work

This standard deviation-based quantization framework demonstrates that low-precision models can achieve state-of-the-art performance while being hardware-friendly. By replacing multipliers with shift-add operations and enabling flexible pruning, it paves the way for efficient DNN deployment on the edge. Future research will explore the application of this method to Transformer architectures, which dominate natural language processing and are increasingly prevalent in computer vision. Additionally, future work will involve benchmarking on physical hardware such as FPGAs or ASICs to quantify real-world power and latency improvements.

Summary updated

BibTeX
@misc{ardakani2022standard,
  author = {Amir Ardakani and Arash Ardakani and Brett H. Meyer and James J. Clark and Warren J. Gross},
  title = {{Standard Deviation-Based Quantization for Deep Neural Networks}},
  year = {2022},
  eprint = {2202.12422},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2202.12422},
}
Figure