Deep Learning with Low Precision by Half-Wave Gaussian Quantization

Zhaowei Cai, Xiaodong He, Jian Sun, Nuno Vasconcelos

Abstract

Deep Neural Networks (DNNs) are computationally intensive, hindering deployment on resource-constrained devices. While weight quantization to 1-bit is well-established, activation quantization often leads to significant accuracy degradation due to gradient mismatch. This paper introduces Half-Wave Gaussian Quantization (HWGQ), a method that enables 1-bit weights and 2-bit activations with minimal accuracy loss. By leveraging the observation that activations follow a half-wave Gaussian distribution after Batch Normalization and employing gradient clipping during backpropagation, HWGQ-Net significantly outperforms previous low-precision models.

Introduction

The deployment of DNNs on mobile and embedded systems is limited by memory and power constraints. Quantization offers a solution by reducing the precision of weights and activations. However, quantizing activations (typically ReLU) is challenging because the step-wise nature of quantization functions is non-differentiable, leading to a "gradient mismatch" between the forward and backward passes. HWGQ-Net addresses this by optimizing the quantizer for the specific statistical distribution of neural activations.

The Half-Wave Gaussian Quantizer

The core innovation is the Half-Wave Gaussian Quantizer (HWGQ). The authors observed that after Batch Normalization, the inputs to an activation function approximately follow a Gaussian distribution. Since the ReLU function $f(x) = \max(0, x)$ suppresses negative values, the resulting activation distribution is a "half-wave Gaussian."

Activation distributions across various layers (pool1 to conv6) showing consistent Gaussian-like behavior after Batch Normalization.

By applying Lloyd’s algorithm, the authors derive mathematically optimal quantization step-levels for this distribution. Because Batch Normalization standardizes data to a zero mean and unit variance, a single pre-calculated optimal quantizer can be applied across the entire network, simplifying implementation.

Addressing Gradient Mismatch

To stabilize training, the authors investigated the backward pass approximation. Standard ReLU has an infinite "tail," which creates large errors when paired with a quantized forward pass that has a finite maximum value. To mitigate this, HWGQ-Net uses Clipped ReLU or Log-tailed ReLU in the backward pass. By clipping gradients for large activation values, the mismatch error is reduced, leading to more stable and effective training.

Experimental Results

The HWGQ-Net was evaluated on the ImageNet (ILSVRC2012) dataset across several architectures, including AlexNet, ResNet, and VGG-Net.

Top-1 Error curves for AlexNet comparing the proposed HWGQ method (BW+Q) against binary weight and sign activation baselines.

Key results include:

  • AlexNet: Achieved 52.7% Top-1 accuracy with 1-bit weights and 2-bit activations, a significant improvement over the previous state-of-the-art (XNOR-Net at 44.2%).
  • ResNet-18: Reached 59.6% Top-1 accuracy, demonstrating the scalability of the method to deeper architectures.
  • Efficiency: The 1-bit weight and 2-bit activation configuration theoretically allows for a ~32x reduction in memory and a corresponding potential speedup by utilizing bitwise operations.

Conclusion

HWGQ-Net bridges the gap between full-precision and low-precision neural networks. By exploiting the predictable statistics of activations and refining the backward gradient approximation, the authors provide a robust framework for high-performance, low-bitwidth deep learning. Future work includes extending quantization to the first and last layers and optimizing hardware implementations for 2-bit arithmetic.

Summary updated

BibTeX
@inproceedings{cai2017deep,
  author = {Zhaowei Cai and Xiaodong He and Jian Sun and Nuno Vasconcelos},
  title = {{Deep Learning with Low Precision by Half-Wave Gaussian Quantization}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2017},
  doi = {10.1109/cvpr.2017.574},
}
Figure