SDQ: Stochastic Differentiable Quantization with Mixed Precision

Xijie Huang, Zhiqiang Shen, Shichao Li, Zechun Liu, Xianghong Hu, Jeffry Wicaksana, Eric P. Xing, Kwang-Ting Cheng · DOI

Introduction

Quantization—the process of reducing the bitwidth of neural network weights and activations—is a cornerstone of efficient deep learning deployment. By moving from 32-bit floating-point representations to low-bit integers (e.g., 2, 3, or 4 bits), models can run on resource-constrained edge devices like smartphones and FPGAs with significantly reduced memory footprints and faster execution.

However, a "one-size-fits-all" approach to quantization often leads to unnecessary accuracy loss. Mixed Precision Quantization (MPQ) addresses this by assigning different bitwidths to different layers based on their sensitivity to noise. The challenge lies in the search: with dozens of layers and multiple bitwidth options, the configuration space is astronomical. Traditional search methods like Reinforcement Learning (RL) or Neural Architecture Search (NAS) are computationally prohibitive. This paper introduces Stochastic Differentiable Quantization (SDQ), a framework that automates bitwidth discovery through a differentiable, stochastic process.

The SDQ Framework

SDQ simplifies the search for optimal mixed-precision configurations by treating bitwidth selection as a continuous optimization problem. The framework consists of three primary components:

1. Stochastic Strategy Generation

Instead of making a discrete, "hard" choice for a layer's bitwidth during training, SDQ employs Differentiable Bitwidth Parameters (DBPs). These parameters act as probability factors. During the forward pass, a layer’s weights are stochastically quantized between two adjacent bitwidths (for example, choosing between 3-bit and 4-bit). To enable backpropagation through this discrete selection, the authors utilize the Gumbel-Softmax trick, which provides a differentiable approximation of the categorical distribution. This allows the model to learn the optimal bitwidth for each layer alongside its weights.

2. Entropy-aware Bin Regularization (EBR)

Once the optimal bitwidths are identified, the model enters a fine-tuning phase. A common failure mode in low-bit quantization is "weight collapse," where weights cluster into a few values, wasting the available representational capacity of the chosen bitwidth. EBR addresses this by encouraging weights to distribute themselves across all available quantization "bins" (maximizing entropy) while simultaneously minimizing the variance within each bin to reduce quantization noise.

3. Knowledge Distillation (KD)

To further recover accuracy lost during the compression process, SDQ utilizes Knowledge Distillation. A high-accuracy, full-precision "teacher" model guides the low-precision "student" model, ensuring that the quantized network retains as much of the original feature representation as possible.

Experimental Results

The researchers evaluated SDQ across several standard benchmarks, including CIFAR-10, ImageNet-1K, and COCO. The results demonstrate that SDQ not only matches but often exceeds the performance of both uniform quantization and full-precision baselines.

  • ImageNet-1K (ResNet18): SDQ achieved a 71.7% top-1 accuracy with an average bitwidth of 3.85. This represents a 1.2% improvement over the 32-bit full-precision baseline (70.5%).
  • ImageNet-1K (MobileNetV2): The model achieved 72.0% accuracy (compared to 71.9% for full-precision) with an average of 3.79 bits.
  • Object Detection: On the COCO dataset using YOLOv4-tiny, SDQ reached a mean Average Precision (mAP) comparable to 8-bit models while maintaining the hardware footprint of a 4-bit model.

Beyond accuracy, SDQ-optimized models showed superior hardware efficiency. On a Bit Fusion accelerator, the SDQ ResNet18 model was faster (46.18ms vs 48.99ms) and more energy-efficient than standard 4-bit models.

Key Insights

Smoothness and Optimization

A critical finding of the paper is that stochastic quantization creates a significantly smoother loss landscape compared to traditional linear interpolation methods. This smoothness allows the optimizer to navigate the complex search space more effectively, avoiding local minima that often plague other differentiable quantization techniques.

The Regularization Effect

Perhaps the most striking insight is that quantization, when handled via SDQ and EBR, can act as a form of regularization. By forcing weights into discrete bins and optimizing their distribution, the model is discouraged from overfitting, allowing a sub-4-bit model to generalize better than its 32-bit counterpart.

Layer Sensitivity

The learned bitwidth strategies revealed that "downsample" layers—those responsible for reducing spatial resolution—are highly sensitive and almost always require higher precision. Conversely, many intermediate layers are highly redundant and can be compressed significantly without impacting the final output.

Limitations and Future Work

While SDQ represents a significant step forward, some constraints remain. Currently, the framework focuses on layer-wise quantization; while it can theoretically support kernel-wise quantization (different bits for different filters), current hardware accelerators struggle to exploit such fine-grained mixed precision efficiently. Additionally, the search phase in this study kept activation precision fixed to maintain stability. Future iterations of SDQ may look to jointly optimize both weight and activation bitwidths to unlock further efficiency gains.

Summary updated

BibTeX
@inproceedings{huang2022sdq,
  author = {Xijie Huang and Zhiqiang Shen and Shichao Li and Zechun Liu and Xianghong Hu and Jeffry Wicaksana and Eric P. Xing and Kwang-Ting Cheng},
  title = {{SDQ: Stochastic Differentiable Quantization with Mixed Precision}},
  booktitle = {International Conference on Machine Learning},
  year = {2022},
  url = {https://openreview.net/forum?id=nC10flk30Cu},
}
Figure