Uncertainty-aware Binary Neural Networks

Junhe Zhao, Linlin Yang, Baochang Zhang, Guodong Guo, David S. Doermann

Abstract

Binary Neural Networks (BNNs) offer significant efficiency gains for edge deployment but are plagued by training instability due to frequent weight sign flips. This paper introduces the Uncertainty-aware BNN (UaBNN), which utilizes a novel c-sign (certainty-sign) function to quantify and minimize weight uncertainty. By selectively updating binary states only when certainty increases, UaBNN stabilizes optimization and achieves state-of-the-art performance on competitive benchmarks like ImageNet.

Introduction

Deploying deep learning models on resource-constrained IoT and wearable devices requires extreme compression. Binary Neural Networks (BNNs) address this by quantizing weights and activations to 1-bit (+1 or -1), replacing expensive floating-point multiplications with efficient bitwise XNOR and popcount operations. Despite their efficiency, BNNs typically suffer from a significant accuracy gap compared to full-precision models.

The Instability Problem in BNNs

A primary cause of performance degradation in BNNs is the instability of the binarization process. During training, latent full-precision weights near zero are highly sensitive. A minute gradient update can cause a weight to cross the zero threshold, flipping its binary state (e.g., from +1 to -1).

Comparison of real-valued and binary kernels during training. Standard BNNs suffer from frequent sign flips in near-zero weights, leading to instability.

As shown in the figure above, these frequent flips create "noisy" optimization directions, slowing convergence and preventing the network from reaching a high-quality local minimum. Conventional BNN training ignores this intrinsic uncertainty, treating a weight of 0.001 with the same confidence as a weight of 0.999.

Proposed Method: Uncertainty-aware BNN (UaBNN)

To mitigate this, the authors propose the Uncertainty-aware Binary Neural Network (UaBNN). The core innovation is the explicit modeling of weight uncertainty to control the binarization process.

Measuring Uncertainty

The framework introduces a Gaussian-based metric to quantify the uncertainty of latent weights. Uncertainty is maximized at zero and decays as weights move toward the target binary values of +1 or -1.

The c-sign (Certainty-Sign) Function

UaBNN replaces the standard sign() function with a novel c-sign function. Unlike the standard sign function that flips immediately upon a threshold crossing, c-sign evaluates the uncertainty of the new state. A binary flip is only permitted if the new state is more "certain" than the previous state or if the uncertainty falls below an adaptive threshold.

Visualization of weight uncertainty and the c-sign function. (a) Uncertainty decreases as the real value moves away from zero. (b) The c-sign function stabilizes the binary state compared to the standard sign function.

Asynchronous Updates

During backpropagation, latent weights are updated via standard gradients. However, the forward-pass binary states are updated asynchronously based on the c-sign check. If a weight is deemed too uncertain, its binary state is temporarily frozen, ensuring that the network's total binarization uncertainty decreases monotonically over time.

Experimental Results

The UaBNN framework was evaluated on several standard benchmarks, demonstrating superior performance over existing state-of-the-art (SOTA) methods.

  • CIFAR-10/100: Using a Wide ResNet (WRN22) backbone, UaBNN achieved 93.37% on CIFAR-10 and 72.01% on CIFAR-100, outperforming strong baselines like BONN and PCNN.
  • ImageNet: On the large-scale ILSVRC12 dataset, UaBNN with a ResNet18 architecture reached 60.6% Top-1 accuracy, surpassing other 1-bit networks such as IR-Net and Bi-Real Net.
  • General Applicability: The c-sign function acts as a plug-and-play component. When integrated into the highly optimized ReActNet, it provided a 0.5% Top-1 accuracy boost (from 61.4% to 61.9%) even in a reduced training regime.

Conclusion

UaBNN addresses a fundamental flaw in BNN training by introducing uncertainty awareness. By dampening the "flip rate" of sensitive weights through the c-sign function, the method provides a more stable optimization path. This approach not only improves final accuracy but also offers a robust, generalizable improvement for various 1-bit architectures. Future work will explore applying these principles to more complex vision tasks like object detection.

Summary updated

BibTeX
@inproceedings{zhao2021uncertainty,
  author = {Junhe Zhao and Linlin Yang and Baochang Zhang and Guodong Guo and David S. Doermann},
  title = {{Uncertainty-aware Binary Neural Networks}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2021},
  doi = {10.24963/ijcai.2021/474},
}
Figure