Differentiable Fine-grained Quantization for Deep Neural Network Compression

Hsin-Pai Cheng, Yuanjun Huang, Xuyang Guo, Yifei Huang, Feng Yan, Hai Li, Yiran ChenarXiv 2018

Introduction

As deep neural networks (DNNs) transition from high-performance data centers to resource-constrained mobile and IoT devices, model compression has become a critical necessity. Quantization—the process of reducing the number of bits used to represent weights—is a primary strategy for achieving this. However, most existing methods employ "coarse-grained" quantization, applying a uniform bit-depth across all layers. This paper introduces a differentiable approach to mixed-precision quantization, enabling networks to automatically discover the optimal bit-depth for each individual layer.

The Problem: Uniformity vs. Sensitivity

Uniform quantization is inherently inefficient because neural network layers are not created equal. Some layers are highly sensitive to noise and require high precision to maintain accuracy, while others are redundant enough to tolerate aggressive compression. Manually determining the ideal bit-depth for dozens of layers presents a prohibitive combinatorial challenge. This research addresses this by transforming the discrete selection of bit-widths into a continuous, differentiable optimization problem.

Methodology: Differentiable Fine-grained Quantization

The core innovation lies in the use of Softmax relaxation to bridge the gap between discrete bit choices and gradient-based optimization. Instead of a hard selection between quantization levels (e.g., binary vs. 8-bit), the output of a layer is modeled as a weighted sum of different quantization schemes, where the weights ($\alpha$) represent learnable probabilities.

The authors implement a bi-level optimization framework:

  1. Model Size Minimization: The objective function penalizes the total number of bits used across the network.
  2. Accuracy Constraints: The optimization ensures that validation loss does not exceed a specific threshold ($\theta$).

Because the search space is continuous, standard backpropagation can update both the model weights ($w$) and the quantization probabilities ($\alpha$) simultaneously. Once the search converges, the highest-probability bit-depth is locked in for each layer, and the model undergoes a final fine-tuning phase to recover performance.

Key Insights and Layer Distribution

A significant finding of this work is that hardware-related constraints, such as bit-width, can be optimized using the same mathematical principles as neural network weights. The algorithm naturally identifies the "sensitivity" of each layer, allocating more resources where they are most needed.

Layer-wise bit-width distribution comparing the proposed method to a uniform baseline.

As visualized in the layer-wise distribution, the resulting models often adopt a "mixed-precision" architecture where middle layers are compressed more aggressively than the initial or final layers. Furthermore, this quantization method is orthogonal to weight pruning; combining the two could potentially yield compression rates as high as 900x.

Experimental Results

The proposed method was evaluated on MNIST and CIFAR-10 (using VGG-16) to demonstrate its scalability to complex architectures.

  • MNIST: Achieved 28x compression with 98.20% accuracy, significantly outperforming 8-bit quantization (4x) while maintaining higher accuracy than uniform binary quantization (32x).
  • CIFAR-10 (VGG-16): Achieved 30x compression with 83.06% accuracy.
Accuracy vs. Compression Rate for VGG-16 on CIFAR-10.

As shown in the performance comparison, the differentiable approach (marked by the green square) provides a superior trade-off between accuracy and compression compared to traditional uniform quantization methods (the dashed blue line). While uniform binary quantization can reach 32x compression, its accuracy drops sharply to 81.56%, whereas the proposed method maintains a much higher performance profile at a comparable 30x compression rate.

Conclusion

By relaxing the search for bit-widths into a continuous optimization problem, this paper provides a robust framework for automated model compression. The results demonstrate that fine-grained, mixed-precision models can achieve extreme compression levels with minimal accuracy loss. Future work will focus on expanding the search space to include more intermediate bit-depths (e.g., 2-bit, 4-bit) and developing specialized hardware kernels to translate these theoretical gains into real-world inference speedups.

Summary updated

BibTeX
@misc{cheng2018differentiable,
  author = {Hsin-Pai Cheng and Yuanjun Huang and Xuyang Guo and Yifei Huang and Feng Yan and Hai Li and Yiran Chen},
  title = {{Differentiable Fine-grained Quantization for Deep Neural Network Compression}},
  year = {2018},
  eprint = {1810.10351},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1810.10351},
}
Figure