Heterogeneous Bitwidth Binarization in Convolutional Neural Networks

Joshua Fromm, Shwetak Patel, Matthai Philipose

Introduction

Deep Convolutional Neural Networks (CNNs) are computationally expensive, making them difficult to deploy on mobile or embedded devices. Binarization—reducing 32-bit floating-point weights to just 1 or 2 bits—is a popular solution that drastically reduces model size and speeds up computation using bitwise operations.

However, most existing methods are homogeneous: every parameter in a layer (or the entire model) uses the same bitwidth. This creates a rigid "performance gap." A 1-bit model is incredibly fast but often loses significant accuracy, while a 2-bit model is more accurate but doubles the number of operations. Standard hardware like CPUs and GPUs enforce this homogeneity because they are designed to process blocks of data with uniform types.

This paper introduces Heterogeneous Bitwidth Neural Networks (HBNNs), a novel approach where individual parameters within a layer can have different bitwidths. By leveraging custom hardware like FPGAs and ASICs that can handle arbitrary bitwidths at the operation level, the authors demonstrate that mixing 1-bit, 2-bit, and 3-bit parameters can find a vastly superior "sweet spot" between efficiency and accuracy.

The Method: Heterogeneous Residual Error Binarization

The authors propose Heterogeneous Residual Error Binarization, which builds on standard residual binarization (where a value is approximated by a sign bit, and subsequent bits reduce the remaining error).

To manage varying bitwidths, they introduce a mask tensor ($M$). This mask shares the same shape as the weight tensor and specifies exactly how many bits each individual parameter should receive. During training, the binarization function only computes additional bits for parameters that haven't reached their assigned limit.

The "Middle-Out" Selection Strategy

The most critical challenge in heterogeneous binarization is deciding which parameters deserve more bits. The authors tested several heuristics:

  • Top-Down: Allocating more bits to larger absolute values.
  • Bottom-Up: Allocating more bits to smaller absolute values.
  • Middle-Out: Allocating more bits to values furthest from the mean.
Comparison of bit selection techniques showing Middle-Out's superiority.

They discovered that the Middle-Out strategy is the clear winner. The intuition is straightforward: values very close to the mean are already well-represented by the first bit (the sign). Adding more bits to these "average" values provides diminishing returns. By focusing the "bit budget" on outliers that are far from the mean, the network can represent the weight distribution much more accurately.

Key Results: Bridging the Accuracy Gap

The researchers evaluated their approach on standard computer vision benchmarks, including CIFAR-10 and ImageNet, testing HBNNs against state-of-the-art models like AlexNet and MobileNet.

  • Matching 2-bit Accuracy with 1.4 bits: On ImageNet, a 1.4-bit HBNN version of AlexNet achieved 55.2% Top-1 accuracy. This essentially matches the 55.3% accuracy of a standard homogeneous 2-bit model while using approximately 30% fewer bits.
Top-1 Accuracy vs. Average Bitwidth for AlexNet.
  • MobileNet Gains: For MobileNet—a model already heavily optimized for efficiency—the 1.4-bit HBNN reached 64.7% Top-1 accuracy, representing a massive jump over the 52.9% achieved by standard 1-bit versions.
  • Hardware Efficiency: In FPGA simulations (ZC706), the authors showed that a 1.2-bit model could achieve significantly higher accuracy than a 1-bit model with only a marginal increase in power and logic area. Crucially, a full 2-bit model often wouldn't fit on the same chip without sacrificing parallelism, whereas the 1.2-bit HBNN fits comfortably.
  • Distribution Insensitivity: Surprisingly, as long as the average bitwidth is maintained and the Middle-Out heuristic is used, the exact ratio of 1-bit to 3-bit parameters doesn't matter much. This significantly simplifies the hyperparameter search.

Limitations and Future Work

While HBNNs offer a compelling new paradigm for model compression, there are practical limitations:

  • CPU/GPU Incompatibility: The primary limitation is that HBNNs do not provide speedups on standard CPUs or GPUs. These general-purpose processors cannot efficiently handle "sparse" bitwidths across a single tensor.
  • Heuristic vs. Learned: While "Middle-Out" is highly effective, it remains a manual heuristic. Future work could involve learning the optimal bitwidth for each parameter during training using reinforcement learning or gradient-based optimization techniques.
  • Training Overhead: Maintaining the mask tensor and performing the sorting required for the Middle-Out strategy adds complexity and time to the training phase, though it does not affect inference speed on custom hardware.

Ultimately, this paper is a prime example of hardware-algorithm co-design, proving that designing algorithms specifically for the flexibility of FPGAs and ASICs can unlock efficiencies impossible under the constraints of general-purpose processors.

Summary updated

BibTeX
@inproceedings{fromm2018heterogeneous,
  author = {Joshua Fromm and Shwetak Patel and Matthai Philipose},
  title = {{Heterogeneous Bitwidth Binarization in Convolutional Neural Networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2018},
  url = {https://openreview.net/forum?id=rJNIcuZ_-S},
}
Figure