Abstract
Binary Neural Networks (BNNs) are highly efficient for edge devices but notoriously difficult to train because their binarization functions are non-differentiable. This paper introduces a novel Fast and Slow Gradient Generation (FSG) method that uses hypernetworks to learn optimal gradient approximations. By combining immediate, current-step gradients ("fast") with historical gradient momentum ("slow") processed via a Mamba-based architecture, FSG achieves faster convergence and state-of-the-art accuracy, narrowing the gap between binary and full-precision models.
Introduction
To deploy deep learning models on resource-constrained devices like smartphones or drones, researchers often use Binary Neural Networks (BNNs). BNNs constrain network weights to just two values (-1 and +1), drastically reducing memory usage and speeding up inference. However, the sign function used for binarization has a derivative of zero almost everywhere, breaking standard backpropagation.
Traditionally, a "Straight-Through Estimator" (STE) is used to provide a heuristic derivative, but this creates a "gradient mismatch" that degrades accuracy. Recent hypernetwork-based methods attempt to learn gradient approximations dynamically but often ignore historical gradient information—a crucial component of stable optimization in standard training (e.g., SGD with Momentum).
The Fast and Slow Gradient Generation (FSG) Method
The authors propose the Fast and Slow Gradient Generation (FSG) method, which decomposes the gradient approximation task into two parallel hypernetworks used during training:
- Fast-net (The "Fast" Gradient): A Multi-Layer Perceptron (MLP) that processes current full-precision weights and gradients to generate an immediate update.
- Slow-net (The "Slow" Gradient): A momentum generator that utilizes a Historical Gradient Storage (HGS) module. It employs Mamba, a highly efficient state-space model, to process time-series gradient data, filtering noise to produce a stable momentum gradient.
- Layer Recognition Embeddings (LRE): Learnable embeddings that allow the Slow-net to distinguish between different network layers, preventing cross-layer interference.
The final gradient update is a weighted combination of these two components. Ablation studies revealed that the best performance occurs when the current gradient dominates (optimal $\beta \approx 0.3$), while the historical momentum acts as a stabilizing guide.
Experimental Results
The FSG method was evaluated on CIFAR-10 and CIFAR-100 benchmarks using various ResNet architectures.
State-of-the-Art Accuracy
On CIFAR-100 with ResNet-56, FSG achieved 69.48% accuracy, significantly outperforming STE (64.78%) and previous hypernetwork methods like LSTMFC (66.48%). On CIFAR-10 with ResNet-32, the model reached 91.42% accuracy, coming within 1% of the full-precision baseline (92.13%).
Convergence and Sensitivity Analysis
Loss curves indicate that FSG converges faster and reaches lower final loss values than competing methods like STE or FCGrad. The authors also found that Mamba's selective state-space mechanism is particularly effective at filtering the erratic noise inherent in historical gradient sequences compared to standard LSTMs.
Conclusion
The FSG method demonstrates that momentum is as vital for learned gradient approximations as it is for standard optimizers. By leveraging Mamba's ability to model long-range dependencies in gradient history, FSG provides a robust solution to the gradient mismatch problem in BNNs. While the method introduces training-time overhead, the resulting models maintain the inference-time efficiency required for edge deployment while achieving near-full-precision accuracy.
Summary updated