Binarized Neural Networks

Itay Hubara, Matthieu Courbariaux, Daniel Soudry · DOI

TL;DR

This paper introduces Binarized Back Propagation (BBP), a novel training algorithm that allows for fully binarized neural networks (BNNs) where both weights and activations are binary during both training and inference. This approach significantly reduces computational complexity and memory footprint, enabling near state-of-the-art performance on challenging image classification tasks with substantial potential for energy efficiency gains.

What Problem Does This Paper Address?

Deep neural networks (DNNs), particularly Convolutional Neural Networks (CNNs), have achieved remarkable success in tasks like object recognition. However, their computational demands, especially the massive number of multiply-accumulate (MAC) operations, make them inefficient for deployment on resource-constrained hardware and lead to high energy consumption. While previous work explored quantizing weights or activations, this paper tackles the challenge of achieving high performance with fully binarized networks, meaning both weights and activations are restricted to just two values (-1 and +1) throughout the entire process, from training to inference. This extreme binarization promises significant improvements in computational efficiency and memory usage.

Methods

The core innovation of this paper is the Binarized Back Propagation (BBP) algorithm. BBP enables the training of Binarized Deep Neural Networks (BDNNs) by introducing a method to compute gradients for binary weights and neurons.

Key aspects of the BBP method include:

  • Binarized Back Propagation (BBP): This algorithm allows for binary weights and binary neurons during both forward and backward propagation. Crucially, it retains the precision of the stored weights for gradient accumulation.
  • Binary Operations: At test time, BDNNs are fully binarized, replacing MAC operations with computationally inexpensive binary XNOR and population count (popcount) operations.
  • Stochastic and Deterministic Binarization: For training, a stochastic binarization is used to introduce noise, acting as a form of regularization. For inference, deterministic binarization (using the sign function) is employed.
  • Hard Tanh and Clipping: The paper utilizes the "hard tanh" (HT) function and clipping operations to manage the range of activations and weights, which is crucial for the binarization process.
  • Shift-Based Batch Normalization: To address the computational cost of standard batch normalization, the authors propose a shift-based approximation that avoids multiplications, further enhancing efficiency.
  • Shift-based AdaMax (S-AdaMax): An optimization technique that uses only bitwise and shift operations, aligning with the overall goal of binarization.

Datasets

The paper evaluates BDNNs on the following standard image classification datasets:

  • Permutation Invariant MNIST: A benchmark for handwritten digit recognition.
  • CIFAR-10: A dataset of 32x32 color images across 10 classes.
  • SVHN (Street View House Numbers): A dataset of house numbers from Google Street View images.

The authors used architectures similar to those employed in previous binarization research (e.g., BinaryConnect) and applied standard preprocessing techniques where applicable.

Key Insights and Ideas

  • Binarization as Regularization: The paper posits that the noise introduced by stochastic binarization during training acts as a form of regularization, helping to prevent overfitting. This is analogous to the concept of dropout.
  • Hardware Efficiency Potential: The complete replacement of multiplications with bitwise operations (XNOR and popcount) is a major driver for significant energy and speed improvements on specialized hardware.
  • Near State-of-the-Art Performance: Despite the extreme binarization, the proposed BBP algorithm achieves performance comparable to state-of-the-art methods that use full-precision weights. This suggests that binarization does not necessarily lead to a drastic accuracy drop.
  • Kernel Repetition in CNNs: The paper highlights that in CNNs with binary weights, the number of unique kernels is significantly reduced, leading to further computational savings through kernel repetition.

Key Results

  • Classification Accuracy: BDNNs trained with BBP achieved competitive results:
  • 1.4% error rate on permutation invariant MNIST.
  • 10.15% error rate on CIFAR-10.
  • 2.53% error rate on SVHN. These results are reported as near state-of-the-art, comparable to or better than many existing binarized networks and competitive with some full-precision models.

  • Computational Efficiency: The paper emphasizes that BBP replaces multiplications with XNOR and popcount operations, leading to a potential speedup of two orders of magnitude and a similar reduction in energy consumption, especially when implemented on specialized hardware.

  • Memory Reduction: Binarizing weights and neurons reduces memory requirements by at least a factor of 16 (from 16-bit floating point to 1-bit precision).

Limitations and Future Work

  • Hardware Dependency for Full Potential: While the algorithms are presented, the full realization of the claimed speed and energy gains relies on dedicated hardware that can efficiently implement binary operations.
  • Approximation in Batch Normalization: The proposed shift-based batch normalization is an approximation, and its impact on performance across all architectures might require further investigation.
  • Search for Ideal Algorithm: The authors acknowledge that an ideal algorithm that avoids storing full-precision weights entirely (even during training) is still an open area of research.
  • Extending to Other Models: The paper suggests extending BBP to other network architectures and larger, more complex datasets like ImageNet.
  • Interpretable Representations and Hashing: The potential for BDNNs to enable interpretable binary representations and efficient hashing is mentioned as a future direction.
  • Spiking Neural Networks: The authors believe BBP could be beneficial for scalable training of spiking neural networks, opening avenues in computational neuroscience.

Summary updated

BibTeX
@inproceedings{hubara2016binarized,
  author = {Itay Hubara and Matthieu Courbariaux and Daniel Soudry},
  title = {{Binarized Neural Networks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2016},
  url = {https://openreview.net/forum?id=ryV9W_WuWS},
}
Figure