Balanced Quantization: An Effective and Efficient Approach to Quantized Neural Networks

Shuchang Zhou, Yuzhi Wang, He Wen, Qinyao He, Yuheng Zou

Abstract

Quantization is a critical technique for deploying deep neural networks on edge devices with limited memory and computational power. However, standard uniform quantization methods often suffer from low "effective bitwidth" because neural network weights typically follow a bell-shaped distribution, leading to underutilized quantization bins. This paper proposes Balanced Quantization, a method that uses histogram equalization to ensure each quantization level represents an equal number of parameters. By maximizing the information entropy of quantized weights, this approach significantly improves the accuracy of ultra-low bitwidth models (2-bit and 4-bit) without introducing any computational overhead during inference.

The Inefficiency of Uniform Quantization

To facilitate deployment on smartphones or IoT sensors, researchers represent weights and activations using low-precision integers (e.g., 4-bit) instead of 32-bit floats. While this reduces memory footprint and enables fast bitwise operations, the distribution of neural network parameters poses a challenge.

Weight distribution in a typical neural network layer showing the bell-shaped curve and outliers.

As shown in the figure above, weights typically follow a Gaussian-like distribution centered at zero. When uniform quantization is applied—dividing the range between the minimum and maximum values into equal steps—the majority of parameters are crowded into the central bins, while the outer bins remain sparsely populated. This results in a low Effective Bitwidth, where a 2-bit model (offering 4 possible values) might effectively use only two values for 90% of its weights. This loss of information capacity is a primary driver of accuracy degradation in low-bitwidth networks.

Balanced Quantization Methodology

The core objective of Balanced Quantization is to "rebalance" the weight distribution so that each quantization bin is utilized equally, thereby maximizing the information carried by the weights.

Histogram Equalization and Recursive Partitioning

Instead of using equal-sized steps in value, the authors determine quantization boundaries based on percentiles. For instance, in a 2-bit model, the 25th, 50th, and 75th percentiles of the weight distribution serve as the thresholds. To find these thresholds efficiently, the algorithm employs recursive partitioning, splitting the data by its median at each step.

The Mean Approximation

Sorting large weight tensors to find medians during training is computationally expensive. To address this, the authors propose approximating the median with the mean. This shortcut is significantly faster on modern hardware and, empirically, often yields slightly better accuracy than the exact median.

Training with Straight-Through Estimator (STE)

Since quantization is a non-differentiable operation, the authors utilize the Straight-Through Estimator (STE) during training. This allows gradients to bypass the quantization step during backpropagation, enabling the model to learn weights that are optimized for the balanced distribution. Crucially, because the rebalancing is integrated into the training process, the final deployed model uses standard bitwise operations with zero additional inference overhead.

Experimental Results

The effectiveness of Balanced Quantization was evaluated across computer vision and language modeling tasks.

  • Computer Vision: On the ImageNet (ILSVRC12) dataset, a 4-bit GoogLeNet model achieved a 12.7% top-5 error rate, a substantial improvement over the 16.6% error rate of previous state-of-the-art quantized models. For AlexNet, a 2-bit version (16x reduction in size) maintained accuracy within 2% of the full 32-bit floating-point baseline.
  • Language Modeling: Testing on the Penn Treebank dataset with LSTMs and GRUs, a 2-bit model using Balanced Quantization achieved a Perplexity Per Word (PPW) of 123, compared to 155 for standard imbalanced quantization.

Key Insights and Future Work

The study highlights that "balance" is often more critical than "precision" in low-bitwidth regimes. By forcing a balanced distribution, the method maximizes the entropy of quantized weights, making the model more robust to outliers that typically skew uniform quantization bins.

While effective for weights, the authors note that histogram equalization introduces a small "equalization error" by constraining the weight space. Future research directions include applying similar balancing techniques to activations and exploring non-balanced distributions that favor sparsity for specialized hardware accelerators.

Summary updated

BibTeX
@article{zhou2017balanced,
  author = {Shuchang Zhou and Yuzhi Wang and He Wen and Qinyao He and Yuheng Zou},
  title = {{Balanced Quantization: An Effective and Efficient Approach to Quantized Neural Networks}},
  journal = {J. Comput. Sci. Technol.},
  year = {2017},
  doi = {10.1007/s11390-017-1750-y},
}
Figure