TL;DR
This paper introduces Quantizable DNNs (Q-DNNs), a novel framework that allows a single deep learning model to switch its bit-width (e.g., from 32-bit down to 1-bit) on the fly during execution without any retraining. By using a multi-task learning approach with consistency-based losses and specialized batch normalization, Q-DNNs not only offer deployment flexibility but often outperform individually trained quantized models.
What Problem Does This Paper Address?
Deep Neural Networks (DNNs) are often quantized—reducing the precision of weights and activations from 32-bit floats to lower bit-widths like 4-bit or 1-bit—to run efficiently on mobile and embedded devices. However, standard quantization is a "one-size-fits-all" approach: once a model is trained for a specific bit-width, it cannot easily switch to another without significant accuracy loss or expensive retraining.
In real-world scenarios, hardware varies (e.g., a Tesla T4 supports 8-bit, while an FPGA might use custom 2-bit logic), and resource availability can change dynamically. The authors tackle the challenge of creating a single "parent" model that can be instantly "re-quantized" to any desired bit-mode at runtime while maintaining high performance across all of them.
Methods
The authors propose three key innovations to make DNNs "quantizable":
- Consistency-based Training Objective: Instead of training each bit-mode independently, they treat them as sub-tasks in a multi-task framework. The 32-bit (full-precision) mode acts as a "parent" model. During training, lower-bit modes are encouraged to produce predictions consistent with the 32-bit mode using a Kullback-Leibler (KL) divergence loss, similar to knowledge distillation.
- Bit-Specific Batch Normalization (BSBN): Different bit-widths produce feature maps with different statistical distributions. Using a single shared Batch Normalization (BN) layer leads to conflicts. BSBN assigns private BN parameters (mean, variance, and optionally learnable affine transforms) to each bit-mode, allowing them to coexist in the same model without interference.
- Thresholds Alignment: To allow switching between arbitrary bit-widths (e.g., from a 4-bit stored model to a 2-bit execution mode), the authors re-design the quantizer. They ensure that the quantization thresholds of lower-bit modes are a strict subset of those in higher-bit modes. This mathematical alignment enables a "Switch function" that can perfectly map weights between modes.
Datasets
The researchers evaluated their approach on two standard computer vision benchmarks:
- CIFAR100: A dataset of 60,000 small color images across 100 classes.
- ImageNet: A large-scale dataset with over 1.2 million training images across 1,000 classes, used to test the scalability of the method on architectures like AlexNet and ResNet-18.
Key Insights and Ideas
- Mutual Regularization: Surprisingly, training for multiple bit-widths simultaneously helps the full-precision model. The lower-bit modes act as a form of regularization (similar to Dropout), forcing the model to focus on the most critical information. This led to a 0.71% accuracy gain for the 32-bit mode on CIFAR100.
- The 1-Bit "Mutation": The authors discovered that while 2-bit to 4-bit weights maintain a Gaussian-like distribution, 1-bit weights "mutate" into a Bernoulli distribution. This makes 1-bit mode fundamentally different and sometimes incompatible with other modes in very compact architectures like ResNet-18.
- Efficiency in Training: Training one Quantizable AlexNet takes only about 0.9x the time of training the individual quantized versions separately, because they all share the same data loading and augmentation pipeline.
Key Results
- Superior Accuracy: On CIFAR100, Q-DNNs outperformed individually trained quantized models by 2.81% to 3.29% across various bit-modes.
- ImageNet Performance: For AlexNet on ImageNet, the Q-DNN achieved gains across the board, including a 4.08% improvement in the 2-bit mode compared to a standalone 2-bit model.
- Seamless Switching: Thanks to Threshold Alignment, a model stored in 4-bit can be instantly converted to 3-bit or 2-bit at runtime with negligible overhead and no loss in precision relative to the "parent" weights.
Limitations and Future Work
- Compact Model Sensitivity: In very compact models like ResNet-18 on ImageNet, the aggressive regularization from 1-bit mode can actually hurt the performance of the 32-bit parent (a 1.33% degradation was noted). The authors suggest that 1-bit mode might need to be excluded in such cases.
- Future Directions: The authors propose combining Q-DNNs with Automated Machine Learning (AutoML) to automatically find the optimal bit-width for different layers of the network, further pushing the boundaries of efficiency and accuracy.
Summary updated