Two-Bit Networks for Deep Learning on Resource-Constrained Embedded Devices

Wenjia Meng, Zonghua Gu, Ming Zhang, Zhaohui WuarXiv 2017

Introduction

Deep Convolutional Neural Networks (CNNs) are notoriously resource-intensive, often requiring hundreds of megabytes of memory and billions of floating-point operations for inference. This high demand makes deploying state-of-the-art AI on "edge" devices—such as smartphones, IoT sensors, or embedded controllers—extremely challenging. While previous research into weight compression (e.g., binary or ternary networks) has attempted to mitigate these requirements, these methods often suffer from significant accuracy degradation on large-scale tasks like ImageNet.

Two-Bit Networks (TBNs) address this by quantizing weights to four values: $\{-2, -1, 1, 2\}$. By utilizing the full representational capacity of a 2-bit integer, TBNs bridge the performance gap between highly compressed models and their full-precision counterparts while remaining hardware-friendly.

Methodology

The core of the TBN approach lies in maximizing bit-width efficiency and ensuring a stable training process for discrete weights.

Optimal Quantization

To convert high-precision weights ($W$) to two-bit weights ($\tilde{W}$), the authors minimize the quantization error (L2-norm) such that $W \approx \alpha\tilde{W}$. They derive a closed-form solution for an optimal scaling factor $\alpha$ that adjusts the quantized values to best fit the original weight distribution. Weights are assigned to the set $\{-2, -1, 1, 2\}$ based on deterministic thresholds.

Training with Shadow Weights

Because gradients cannot be computed directly on discrete values, TBNs employ "shadow weights"—high-precision copies maintained during training. In the forward pass, weights are discretized for execution. During the backward pass, gradients are calculated based on these discretized weights but applied to the high-precision shadow weights. This allows the model to accumulate small updates that eventually shift a weight from one discrete state to another.

Experimental Evaluation

The authors evaluated TBNs on the ImageNet (ILSVRC2012) dataset using the ResNet-18 architecture as a primary benchmark.

Accuracy Performance

TBNs demonstrate a superior balance between compression and performance. On ImageNet, TBNs achieved a top-5 accuracy of 84.5% and a top-1 accuracy of 62.6%, significantly outperforming Binary Weight Networks and XNOR-Net.

Accuracy comparison of TBNs against other quantization methods on ImageNet.

Memory Efficiency and Hardware Friendliness

The memory reduction provided by TBNs is dramatic. For a VGG-19 network, the memory requirement drops from 1024MB (double precision) to just 32MB. Furthermore, TBNs enable shift-based arithmetic; multiplying by 2 or -2 in digital logic requires only a bit-shift and a sign flip. This allows expensive floating-point multiplications to be replaced by simple additions, subtractions, and shifts.

Memory footprint reduction using Two-Bit quantization across different architectures.

Conclusion and Future Work

TBNs represent a critical threshold for maintaining accuracy on complex datasets while drastically reducing resource requirements. While this work focuses on weight-only quantization for CNNs, future research could extend these techniques to activations or Recurrent Neural Networks (RNNs). Additionally, physical hardware benchmarks on FPGAs or ASICs would further quantify the power and latency advantages of this shift-based arithmetic approach.

Summary updated

BibTeX
@misc{meng2017two,
  author = {Wenjia Meng and Zonghua Gu and Ming Zhang and Zhaohui Wu},
  title = {{Two-Bit Networks for Deep Learning on Resource-Constrained Embedded Devices}},
  year = {2017},
  eprint = {1701.00485},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1701.00485},
}
Figure