Abstract
Binary Neural Networks (BNNs) offer significant memory and computational efficiency by using 1-bit weights and activations. However, the non-differentiable nature of the sign function leads to gradient mismatch during training. BiPer introduces a periodic binarization function—a square wave—and its trigonometric surrogate to enable differentiable training. By controlling the angular frequency $\omega_0$, BiPer allows for a mathematical trade-off between quantization error and gradient stability, achieving state-of-the-art performance on ImageNet and CIFAR-10.
Introduction
The quest for efficient deep learning has led to the development of Binary Neural Networks (BNNs), which compress 32-bit floating-point values into single bits (+1 or -1). This compression provides a 32x reduction in memory footprint and up to 58x speedup on CPUs. Despite these advantages, training BNNs is challenging because the standard binarization function, $\text{sign}(x)$, has a zero gradient almost everywhere, preventing standard backpropagation.
The Gradient Mismatch Problem
To circumvent the zero-gradient issue, researchers typically use a Straight-Through Estimator (STE). While the forward pass uses $\text{sign}(x)$, the backward pass uses a smooth surrogate like $\text{tanh}(x)$ or the identity function. This discrepancy, known as gradient mismatch, introduces noise into the weight updates, often leading to significant accuracy degradation or training instability.
The BiPer Method
BiPer (Binary Periodic) addresses these challenges by replacing the standard threshold-based binarization with a periodic approach.
Periodic Binarization
Instead of a single transition at zero, BiPer uses a periodic square wave for the forward pass: $$w^q = \text{sign}(\sin(\omega_0 w))$$ This function toggles between +1 and -1 across the weight domain. For the backward pass, the continuous sine function $\sin(\omega_0 w)$ serves as the differentiable surrogate.
Frequency Control and Two-Stage Training
The angular frequency $\omega_0$ serves as a critical hyperparameter. Higher frequencies can reduce quantization error but may lead to gradient instability. The training process follows a two-stage pipeline:
- Stage 1: Training with real-valued weights and binary activations.
- Stage 2: Fine-tuning the full model with binarized weights using the BiPer function.
Experimental Results
The authors evaluated BiPer on CIFAR-10 and ImageNet using various architectures, including ResNet and VGG.
Performance on ImageNet
BiPer achieved state-of-the-art results on ImageNet. For ResNet-18, it reached 61.4% Top-1 accuracy, surpassing previous methods like ReCU. On ResNet-34, it achieved 65.73% Top-1 accuracy.
The Stability-Accuracy Trade-off
A key finding is the relationship between the frequency $\omega_0$ and model performance. As shown in the experimental analysis, there is an optimal frequency range that maximizes precision.
Beyond a certain point, increasing $\omega_0$ (which theoretically reduces quantization error) leads to a drop in precision due to increased gradient instability. This empirical result confirms the theoretical trade-off between error minimization and training stability.
Conclusion
BiPer demonstrates that periodic functions can effectively bridge the gap between full-precision and binary neural networks. By providing a tunable mechanism to balance quantization error and gradient flow, it sets new benchmarks for BNN accuracy. Future work may explore dynamic frequency annealing and applications in object detection and segmentation.
Summary updated