Binary Neural Networks (BNNs) offer massive potential for edge computing by representing weights and activations with just a single bit (-1 or +1). This 1-bit quantization can yield up to 32x memory reduction and nearly 60x theoretical speedups. However, training BNNs is notoriously difficult.
SURGE (SURrogate GradiEnt Adaptation) is a novel training framework designed to fix the "broken" gradients inherent in 1-bit quantization. By introducing a learnable, full-precision auxiliary path during training that is entirely discarded at inference, SURGE achieves state-of-the-art results across vision and language tasks with zero additional computational cost for the end user.
The Problem: Broken Gradients in 1-Bit Quantization
The core challenge in training BNNs lies in the binarization function (typically the sign function). Because it is non-differentiable—its derivative is zero almost everywhere—standard backpropagation fails. Researchers traditionally rely on the Straight-Through Estimator (STE), which bypasses the issue by approximating the derivative as an identity function or clipping it to a fixed range (e.g., [-1, 1]).
This standard approach suffers from two major flaws:
- Gradient Mismatch: The hand-crafted STE is a crude first-order approximation that fails to accurately reflect the true loss landscape, leading to biased weight updates.
- Information Loss: Fixed-range gradient clipping zeros out gradients for values outside the [-1, 1] range. This discards valuable optimization information, effectively "killing" neurons that could otherwise contribute to learning.
The SURGE Framework
To overcome the limitations of STE, SURGE introduces a "dual-path" architecture designed to provide a more accurate, learnable gradient without changing the model's final binary output.
Dual-Path Gradient Compensator (DPGC)
For every binarized layer, SURGE adds a parallel full-precision "auxiliary" branch. During the forward pass, the framework employs a clever "detach" trick:
$$output = f_{binary}(x) - f_{aux}(x).detach() + f_{aux}(x)$$
This equation ensures that the forward output is mathematically identical to a standard BNN. However, during backpropagation, the gradient flows smoothly through the full-precision auxiliary branch. This allows the network to capture higher-order gradient information that the standard STE misses.
Adaptive Gradient Scaler (AGS)
Simply adding gradients from two paths can lead to instability if one path dominates the other. To solve this, SURGE derives a theoretically optimal scaling factor ($\lambda$) based on the ratio of the gradient norms from the binary and auxiliary branches. This dynamically balances their contributions, ensuring the auxiliary path smoothly "compensates" for the binary path without destabilizing the training process.
Inference Efficiency
Crucially, once training is complete, the auxiliary branch is entirely discarded. The resulting model is a standard BNN with no extra overhead, preserving all the speed and memory benefits of 1-bit quantization.
Key Insights
- Recovering "Dead" Gradients: While STE zeros out gradients for a vast majority of activations, SURGE "recovers" these regions. This allows the model to utilize informative gradients that were previously discarded.
- Learnable vs. Hand-crafted: Instead of trying to design a better static approximation for the sign function (like a polynomial or sigmoid curve), SURGE uses a parameterized full-precision branch to learn the best compensation dynamically.
- Theoretical Grounding: The scaling factor isn't a heuristic guess. The authors provide a formal proof deriving the optimal $\lambda$ to minimize the error between the surrogate gradient and an "ideal" reference gradient.
- Architecture Agnostic: The method works seamlessly for both Convolutional Neural Networks (CNNs) and Transformers, making it a highly versatile tool for binarization.
State-of-the-Art Results
SURGE was evaluated across a wide variety of benchmarks, consistently outperforming previous state-of-the-art binarization methods:
- Image Classification (ImageNet-1K): A SURGE-trained ResNet-18 achieved 62.0% Top-1 accuracy in one-stage training. This is a 0.6% improvement over the previous best (RBONN) and a massive 3.9% jump over IR-Net.
- Object Detection (PASCAL VOC): Using the Faster R-CNN framework, SURGE surpassed the previous SOTA (IDa-Det) by 0.5% mAP.
- Language Understanding (GLUE): Applied to a binarized BERT-base model, SURGE outperformed BiT by an average of 1.4% across tasks and beat BiBERT by a staggering 8.9%.
- Real-world Speedup: When deployed on an ARM Cortex-A55 (using the BOLT library), the SURGE-trained ResNet-18 achieved a 4.1x actual speedup compared to its real-valued counterpart.
Limitations and Future Directions
Because SURGE maintains a full-precision auxiliary path during training, it requires slightly more memory (+7.6%) and time (+25%) compared to standard BNN training.
To mitigate this, the authors suggest a "SURGE*" variant that uses 1x1 kernels for the auxiliary path. This reduces the time overhead to just 14.4% while maintaining most of the accuracy gains. Future work will explore even more efficient auxiliary structures, such as low-rank decompositions or saliency-aware layer compensation, to further reduce the training-time footprint.
Summary updated