Towards Optimization-Friendly Binary Neural Network

Nianhui Guo, Joseph Bethge, Hong Guo, Christoph Meinel, Haojin YangTMLR 2023

Abstract

Binary neural networks (BNNs) are a promising approach for compressing and accelerating deep learning models, especially in resource-constrained environments. However, the optimization gap between BNNs and their full-precision counterparts has long been an open problem limiting their performance. In this work, we propose a novel optimization pipeline to enhance the performance of BNNs. The main approach includes three key components: (1) BNext, a strong binary baseline based on an optimization-friendly basic block design, (2) knowledge complexity, a simple yet effective teacher-selection metric taking the capacity gap between teachers and binary students under consideration, (3) consecutive knowledge distillation (CKD), a novel multi-round optimization technique to transfer high-confidence knowledge from strong teachers to low-capacity BNNs. We empirically validate the superiority of the method on several vision classification tasks CIFAR-10/100 & ImageNet. For instance, the BNext family outperforms previous BNNs under different capacity levels and contributes the first binary neural network to reach the state-of-the-art 80.57% Top-1 accuracy on ImageNet with 0.82 GOPS.

Introduction

Binary Neural Networks (BNNs) represent a significant frontier in model compression, utilizing 1-bit weights and activations to achieve theoretical 32x memory reduction and up to 58x CPU speedup. Despite this potential, BNNs have historically suffered from an "optimization gap" compared to full-precision models. This gap arises primarily from two issues: the non-differentiability of the binarization function, which necessitates the use of Straight-Through Estimators (STE) that lead to gradient mismatch, and the presence of rugged, discontinuous loss landscapes that trap models in poor local minima. Previous attempts to mitigate these issues often resulted in performance lags of approximately 10% compared to standard models like ResNet-18.

Methodology

To address these challenges, the authors introduce the BNext architecture and a specialized optimization pipeline. The BNext architecture utilizes Information Recoupling (Info-RCP) to recover semantic information lost during binarization. This is achieved through an adaptive structure that scales and shifts outputs via BatchNorm and PReLU, combined with an attention branch to recouple pre- and post-binarization information. Furthermore, Element-wise Shortcut Multiplication (ELM-Attention) is integrated to calibrate binary block outputs dynamically, which significantly smooths the loss landscape.

The BNext basic block architecture featuring Info-RCP and ELM-Attention modules.

The training pipeline is further enhanced through Knowledge Complexity (KC) and Consecutive Knowledge Distillation (CKD). KC is a metric that balances a teacher's accuracy against its parameter count to avoid the "strong teacher trap," where excessive capacity gaps between a high-precision teacher and a 1-bit student lead to poor generalization. CKD implements a multi-round distillation strategy where the student learns from a sequence of teachers with increasing complexity, effectively acting as a knowledge relay.

Experimental Results

The BNext family sets a new benchmark for BNNs on the ImageNet (ILSVRC-2012) dataset. BNext-L achieved a milestone 80.57% Top-1 accuracy with only 0.82 GOPS. This marks the first time a BNN has reached this level of performance, making it competitive with modern full-precision architectures like ConvNext-T or Swin-T. Smaller variants like BNext-18 also show substantial improvements, reaching 67.9% accuracy and far outperforming classic models like XNOR-Net (51.2%) and BiRealNet (56.4%).

BNext achieves a milestone 80% Top-1 accuracy on ImageNet and exhibits a smoother loss landscape compared to traditional BNNs.

Visualizations of the loss landscape reveal that BNext's architectural design results in a smooth, convex-like profile similar to full-precision ResNet-18, contrasting sharply with the jagged landscapes of traditional BNNs like BinaryNet-18. Hardware tests on ARM-based edge devices (Banana Pi M5) demonstrated a 20.1x speedup for 1-bit convolutions over standard CPU implementations, highlighting the practical potential of the architecture.

Conclusion

BNext demonstrates that BNNs can achieve high accuracy through optimization-friendly architectural design and strategic knowledge distillation. While the current implementation uses some mixed-precision components (e.g., in Info-RCP modules) and requires significant training overhead due to the multi-stage distillation, it successfully bridges the long-standing performance gap. Future work aims to release optimized GPU kernels to further bridge the gap between theoretical speedups and real-world deployment performance.

Summary updated

BibTeX
@article{guo2023towards,
  author = {Nianhui Guo and Joseph Bethge and Hong Guo and Christoph Meinel and Haojin Yang},
  title = {{Towards Optimization-Friendly Binary Neural Network}},
  journal = {Accepted by TMLR},
  year = {2023},
  url = {https://openreview.net/forum?id=4Hq816XDDG},
}
Figure