[Paper Review] A streamlined AlexNet with 1-bit weights, 2-bit activations
This paper presents a streamlined deployment framework for quantized neural networks (QNNs) on mobile CPUs by converting floating-point operations to integer equivalents, using bit-serial matrix multiplication, and applying channel-interleaved lowering. It achieves a 3.5× speedup over an optimized 8-bit baseline on a quantized AlexNet with 1-bit weights and 2-bit activations.
Running Deep Neural Network (DNN) models on devices with limited computational capability is a challenge due to large compute and memory requirements. Quantized Neural Networks (QNNs) have emerged as a potential solution to this problem, promising to offer most of the DNN accuracy benefits with much lower computational cost. However, harvesting these benefits on existing mobile CPUs is a challenge since operations on highly quantized datatypes are not natively supported in most instruction set architectures (ISAs). In this work, we first describe a streamlining flow to convert all QNN inference operations to integer ones. Afterwards, we provide techniques based on processing one bit position at a time (bit-serial) to show how QNNs can be efficiently deployed using common bitwise operations. We demonstrate the potential of QNNs on mobile CPUs with microbenchmarks and on a quantized AlexNet, which is 3.5x faster than an optimized 8-bit baseline. Our bit-serial matrix multiplication library is available on GitHub at https://git.io/vhshn
Motivation & Objective
- Address the challenge of deploying low-precision quantized neural networks (QNNs) efficiently on mobile CPUs with limited support for few-bit integer operations.
- Overcome performance bottlenecks caused by floating-point operations, inefficient bit masking, and lack of native support for 1–4-bit integer arithmetic in ISAs.
- Enable high-performance inference on mobile devices by transforming QNNs into fully integer-based computations with minimal accuracy loss.
- Demonstrate significant speedups on real-world models like AlexNet using optimized bit-serial and interleaved lowering techniques.
Proposed method
- Streamline QNNs by absorbing floating-point scaling factors (e.g., from batch normalization and alpha-scaling) into integer thresholds, eliminating floating-point operations in inference.
- Implement a bit-serial GEMM (General Matrix Multiplication) library that processes one bit plane at a time using bitwise operations (AND, shift, OR) to handle 1-bit weights and 2-bit activations efficiently.
- Apply channel-interleaved lowering to pack multiple channels into a single word, reducing bit-packing overhead and improving data locality and memory access patterns.
- Integrate the optimized inference engine into a Caffe-based framework, allowing selective use of gemmlowp (for 8-bit layers) and BitSerialGEMM (for 1-bit/2-bit layers) per layer.
- Use a hybrid execution strategy: 8-bit layers use gemmlowp for accuracy, while 1-bit/2-bit layers use BitSerialGEMM for speed, with floating-point used only for non-matrix operations.
- Optimize memory access and computation by reordering and packing bit planes to maximize parallelism and reduce bit-level masking costs.
Experimental results
Research questions
- RQ1Can floating-point operations in QNNs be fully eliminated without significant accuracy loss through threshold-based streamlining?
- RQ2How effective is bit-serial matrix multiplication using only bitwise operations for 1-bit weights and 2-bit activations on commodity mobile CPUs?
- RQ3To what extent does channel-interleaved lowering reduce the overhead of bit-packing and improve performance in low-precision inference?
- RQ4What performance gains can be achieved on real-world models like AlexNet when deploying 1-bit/2-bit QNNs using the proposed optimization stack?
- RQ5Can the combination of streamlining, bit-serial GEMM, and interleaved lowering outperform standard 8-bit inference on mobile CPUs?
Key findings
- The proposed BitSerialGEMM library achieves a 3.5× speedup over an optimized 8-bit baseline on a quantized AlexNet with 1-bit weights and 2-bit activations.
- Fully-quantized 1-bit/2-bit fully-connected layers achieve up to 50× speedup due to higher arithmetic intensity and efficient bit-serial computation.
- Bit-serial matrix multiplication on convolutional layers provides a 4× speedup compared to baseline 8-bit inference, with performance limited by lowering overhead.
- Channel-interleaved lowering reduces lowering time by up to 10× compared to standard lowering, significantly improving performance on early layers with large filters.
- The 8-bit first and last layers account for 33% of execution time in the optimized pipeline, indicating that further quantization of these layers could yield additional speedups.
- The overall inference throughput reaches 7.7 frames per second with the full optimization stack, compared to 2.2 with the baseline, demonstrating strong real-world performance gains.
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.