Introduction
Training Binary Neural Networks (BNNs) offers significant advantages in memory and computational efficiency, yet it typically comes at the cost of substantial accuracy degradation. BNNs compress weights and activations to a single bit (-1 or +1), making them ideal for edge devices. However, the non-differentiable nature of the "sign" function used for binarization makes standard backpropagation impossible. While the "Straight-Through Estimator" (STE) is a common workaround, it often provides poor gradient approximations, particularly near the binarization boundaries.
This paper introduces BNN+, a framework designed to bridge the accuracy gap. BNN+ utilizes a smoother gradient approximator called "SignSwish" and a novel regularization technique that encourages weights toward binary values while maintaining learning capacity.
Methods
The BNN+ framework introduces three primary innovations to the binary training pipeline.
1. SignSwish (SS) Activation
Traditional BNN training often relies on htanh or a simple STE. These methods frequently "saturate," failing to provide useful gradients once weights move outside the [-1, 1] range. BNN+ introduces SignSwish, a bounded and smooth variant of the Swish activation function.
As shown in the figure above, SignSwish is differentiable near the critical -1 and +1 boundaries. By adjusting a hyperparameter $\beta$, the derivative can be controlled to ensure that weights can "flip" signs more easily during the training process, preventing the gradient from vanishing prematurely.
2. Quantization-Aware Regularization
Standard weight decay (L2 regularization) pushes weights toward zero, which is counterproductive for BNNs where the target values are -1 and +1. BNN+ replaces standard decay with two novel regularization functions: Manhattan ($R_1$) and Euclidean ($R_2$).
These functions create a "double-well" potential, as illustrated above. Instead of penalizing large weights, they specifically penalize weights for deviating from the target binary values. This nudges the network toward a binarized state during training without sacrificing the flexibility needed for gradient-based updates.
3. Trainable Scaling Factors
To mitigate information loss from quantization, BNN+ introduces a trainable scaling factor $\alpha$. Unlike fixed scaling factors, $\alpha$ is learned via backpropagation alongside the weights. This allows the network to dynamically adapt the magnitude of its binary outputs to better match the distribution of data in each layer.
Key Results
The BNN+ method was evaluated on the ImageNet (ILSVRC12) dataset using AlexNet and ResNet-18 architectures. The results demonstrate a significant performance boost over existing state-of-the-art binary models:
- ResNet-18: BNN+ achieved 53.0% Top-1 accuracy, significantly outperforming the original BinaryNet (42.2%) and XNOR-Net (51.2%).
- AlexNet: The method reached 46.1% Top-1 accuracy, surpassing XNOR-Net (44.2%) and BinaryNet (41.2%).
Ablation studies confirmed that the combination of SignSwish activation and the new regularization ($R_1$ or $R_2$) consistently yields the best results, outperforming configurations that use only one of these components or standard htanh baselines.
Conclusion and Future Work
BNN+ successfully narrows the performance gap between binary and full-precision networks. By aligning the loss function with the binary architecture and improving gradient flow through SignSwish, the framework enables more effective training of highly compressed models.
However, challenges remain. Like most current BNN research, the first and last layers are typically kept in full precision to avoid a 2-3% accuracy drop. Future work will likely focus on fully binarizing these layers and optimizing the implementation of SignSwish for specific hardware to realize the full potential of these efficiency gains.
Summary updated