[Paper Review] BMXNet: An Open-Source Binary Neural Network Implementation Based on MXNet
BMXNet is an open-source, MXNet-based library implementing Binary Neural Networks (BNNs) that use xnor and popcount operations for efficient inference and training. It achieves up to 29× model size reduction and 125× speedup over standard GEMM by binarizing weights and activations, with support for both full binary and quantized networks on CPU and GPU.
Binary Neural Networks (BNNs) can drastically reduce memory size and accesses by applying bit-wise operations instead of standard arithmetic operations. Therefore it could significantly improve the efficiency and lower the energy consumption at runtime, which enables the application of state-of-the-art deep learning models on low power devices. BMXNet is an open-source BNN library based on MXNet, which supports both XNOR-Networks and Quantized Neural Networks. The developed BNN layers can be seamlessly applied with other standard library components and work in both GPU and CPU mode. BMXNet is maintained and developed by the multimedia research group at Hasso Plattner Institute and released under Apache license. Extensive experiments validate the efficiency and effectiveness of our implementation. The BMXNet library, several sample projects, and a collection of pre-trained binary deep models are available for download at https://github.com/hpi-xnor
Motivation & Objective
- Address the challenge of deploying large deep learning models on low-power devices such as mobile and IoT systems.
- Reduce memory footprint and computational cost in deep neural networks through binary and quantized weight and activation representations.
- Enable efficient inference and training of BNNs using bit-wise operations (xnor and popcount) instead of floating-point arithmetic.
- Provide a modular, drop-in replacement framework for MXNet that supports both binary and low-bit quantized networks with flexible bit-width control.
- Demonstrate practical deployment of BNNs on mobile platforms via Android and iOS applications using pre-trained models.
Proposed method
- Introduces QActivation, QConvolution, and QFullyConnected layers as drop-in replacements for standard MXNet layers, supporting configurable bit-widths via the 'act_bit' parameter.
- Employs sign-based binarization of weights and activations, storing 32/64 binary values per 32/64-bit word to reduce memory usage by up to 32×.
- Performs matrix multiplication using xnor and popcount operations instead of standard GEMM, significantly accelerating computation on CPUs with POPCNT instruction support.
- Accelerates the xnor GEMM kernel using OpenMP (xnor_64_omp), achieving up to 125× speedup over naive GEMM and 50× over CBLAS-ATLAS.
- Supports hybrid training strategies by avoiding binarization in the first and last layers to preserve accuracy, following prior work.
- Enables arbitrary bit-width quantization (2–31 bits) for weights and activations, extending beyond binary networks to support mixed-precision models.
Experimental results
Research questions
- RQ1Can a BNN framework built on MXNet achieve significant model compression and computational efficiency while maintaining competitive classification accuracy?
- RQ2How does the performance of xnor-based GEMM compare to standard GEMM and CBLAS-ATLAS in terms of speed and memory usage on CPU?
- RQ3What is the impact of binarizing only selected layers (e.g., avoiding binarization in first and last layers) on model accuracy and model size?
- RQ4To what extent can binary and quantized networks be effectively deployed on mobile platforms like Android and iOS?
- RQ5Can a modular, open-source BNN library be designed to interoperate seamlessly with existing MXNet components and support both CPU and GPU execution?
Key findings
- BMXNet achieves up to 29× model size reduction by storing 32 binary weights per 32-bit word, reducing MNIST model size from 47MB to 1.6MB.
- The xnor_64_omp kernel achieves 125× speedup over a naive GEMM implementation and 50× speedup over CBLAS-ATLAS on a 4-core CPU with POPCNT support.
- On MNIST, the binary LeNet model achieves 97.3% test accuracy, comparable to full-precision models, with a model size of only 1.6MB.
- On CIFAR-10, the binary model reaches 84.2% test accuracy, demonstrating strong performance despite binarization.
- On ImageNet with ResNet-18, the fully binarized model achieves 61% top-1 accuracy, while a partially binarized version with only the first stage in full precision improves to 84% top-1 accuracy with minimal size increase.
- Mobile applications for Android and iOS successfully classify live camera feeds using a binarized ResNet-18 model, confirming real-world deployability.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.