README.md
December 5, 2025 ยท View on GitHub
๐ Introduction
This is the official PyTorch implementation of the paper A&B BNN: Add&Bit-Operation-Only Hardware-Friendly Binary Neural Network, published in CVPR 2024.

๐ Abstract
Binary neural networks utilize 1-bit quantized weights and activations to reduce both the model's storage demands and computational burden. However, advanced binary architectures still incorporate millions of inefficient and non-hardware-friendly full-precision multiplication operations. A&B BNN is proposed to directly remove part of the multiplication operations in a traditional BNN and replace the rest with an equal number of bit operations, introducing the mask layer and the quantized RPReLU structure based on the normalizer-free network architecture. The mask layer can be removed during inference by leveraging the intrinsic characteristics of BNN with straightforward mathematical transformations to avoid the associated multiplication operations. The quantized RPReLU structure enables more efficient bit operations by constraining its slope to be integer powers of 2. Experimental results achieved 92.30%, 69.35%, and 66.89% on the CIFAR-10, CIFAR-100, and ImageNet datasets, respectively, which are competitive with the state-of-the-art. Ablation studies have verified the efficacy of the quantized RPReLU structure, leading to a 1.14% enhancement on the ImageNet compared to using a fixed slope RLeakyReLU. The proposed add&bit-operation-only BNN offers an innovative approach for hardware-friendly network architecture.
๐ ๏ธ Requirements
- python==3.8
- pytorch==2.0.1
๐ป Usage
Network Architecture
The network definitions are located in the ./Network directory.
Training
We provide training scripts for both CIFAR and ImageNet datasets. The training process is divided into two steps.
- CIFAR:
Train_Cifar_step1.ipynbandTrain_Cifar_step2.ipynb - ImageNet:
Train_ImageNet_step1.ipynbandTrain_ImageNet_step2.ipynb
Inference
The inference scripts are located in the ./Inference directory.
- CIFAR-10:
./Inference/CIFAR10.ipynb - CIFAR-100:
./Inference/CIFAR100.ipynb - ImageNet:
./Inference/ImageNet.ipynb
๐ค Pre-trained Models
The pre-trained models can be downloaded below. The codes for inference can be found in ./Inference.
Download Links:
๐ Main Results
| Dataset | Structure | # Params | Top-1 Acc | Downloadable |
|---|---|---|---|---|
| CIFAR10 | ReActNet-18 | 11.18 M | 91.94% | โ |
| ReActNet-A | 28.32 M | 89.44% | โ | |
| CIFAR100 | ReActNet-18 | 11.23 M | 69.35% | โ |
| ReActNet-A | 28.41 M | 63.23% | โ | |
| ImageNet | ReActNet-18 | 11.70 M | 61.39% | โ |
| ReActNet-34 | 21.82 M | 65.19% | โ | |
| ReActNet-A | 29.33 M | 66.89% | โ |
๐ Citation
If you find our code useful for your research, please consider citing:
@inproceedings{ma2024b,
title={A\&B BNN: Add\&Bit-Operation-Only Hardware-Friendly Binary Neural Network},
author={Ma, Ruichen and Qiao, Guanchao and Liu, Yian and Meng, Liwei and Ning, Ning and Liu, Yang and Hu, Shaogang},
booktitle={2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
pages={5704--5713},
year={2024},
organization={IEEE}
}