NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Switchable Precision Neural Networks

Luis Guerra, Bohan Zhuang, Ian Reid, Tom DrummondarXiv 2020

TL;DR

This paper introduces Switchable Precision Neural Networks (SP-Nets), a novel approach to train a single neural network that can dynamically adjust its precision (both weights and activations) on the fly. This allows for on-demand trade-offs between accuracy and efficiency, making it ideal for resource-constrained devices.

What Problem Does This Paper Address?

Deep Neural Networks (DNNs) are computationally expensive and memory-intensive, limiting their deployment on edge devices. While network quantization aims to reduce these costs by using lower precision representations, existing methods typically result in static networks with a fixed precision. This means a single model cannot adapt to varying computational demands or accuracy requirements at runtime. The paper addresses this by proposing a method to train a single, unified network that can switch between different precision levels dynamically, offering a flexible accuracy-efficiency trade-off.

Methods

The core innovation is the Switchable Precision Neural Network (SP-Net). SP-Nets are trained to support multiple quantization levels for both weights and activations. At runtime, the network can select its precision based on immediate needs (e.g., memory, latency, power).

Key techniques include:

  • Switchable Batch Normalization (S-BN): To handle the inconsistent statistics of batch normalization layers across different precision switches, each switch is given its own private BN parameters. This is crucial for enabling proper training of all switches.
  • Self-Distillation: To improve the performance of lower-precision switches, a self-distillation scheme is employed. The full-precision switch acts as a "teacher," providing guidance to the "student" lower-precision switches through both output distribution matching (KL divergence) and intermediate feature map matching (L2 loss).
  • Multiple Quantizers: The SP-Net framework is demonstrated with three different quantization strategies: Tanh-based, ReLU-based, and Logarithmic quantizers, allowing for flexibility in how precision is reduced.
  • Slimmable Architecture Integration: The SP-Net concept is combined with network slimming (reducing the number of channels) to further enhance flexibility, creating "Slimmable SP-Nets."

Datasets

  • ImageNet: Used for evaluating the ResNet-18 and MobileNet architectures.
  • Tiny ImageNet: A downsampled version of ImageNet (64x64 images, 200 classes), used for evaluating ResNet-18.

Key Insights and Ideas

  • Dynamic Precision is Achievable: The paper demonstrates that it's possible to train a single network that can adapt its precision on the fly, offering a much more flexible solution than static quantization.
  • S-BN is Critical for Training: The success of training multiple precision switches hinges on using independent batch normalization parameters for each switch. Without it, training suffers significantly.
  • Self-Distillation Boosts Low-Precision Performance: The proposed self-distillation method effectively guides lower-precision switches, significantly improving their accuracy and bringing them closer to the performance of higher-precision counterparts.
  • Flexibility Beyond Quantization: Combining switchable precision with network slimming creates a powerful framework for devices that need to adapt to a wide range of resource constraints.

Key Results

  • Competitive Accuracy: SP-Nets achieve accuracy comparable to independently trained quantized models, with the full-precision switch often performing best. For example, on ResNet-18 for ImageNet, SP-Nets with 32-bit weights and 32-bit activations achieved 68.1% accuracy, very close to the independently trained model's 69.5%.
  • Efficiency-Accuracy Trade-off: The SP-Net framework allows for a smooth trade-off. For instance, on Tiny ImageNet with ResNet-18, switching from 32-bit to 1-bit activations (with 1-bit weights) resulted in a significant drop in accuracy (from 49.0% to 43.5%) but drastically reduced computational cost.
  • Self-Distillation Benefits: The self-distillation method consistently improved accuracy across various switches, as shown in Table 6 for ResNet-18 on Tiny ImageNet.
  • MobileNet Sensitivity: The MobileNet architecture, known for its sensitivity to quantization, showed a more pronounced impact from switchable precision compared to ResNet-18.

Limitations and Future Work

  • Overfitting in Intermediate Switches: The authors note that intermediate switches sometimes show superior validation performance to the full-precision switch, which they attribute to potential overfitting.
  • LogQuant Complexity: The modified LogQuant quantizer, while aiming for simplicity, might have been negatively impacted by the removal of the FSR parameter and the choice of base, leading to suboptimal performance compared to expectations.
  • Future Directions:
    • Universally Slimmable SP-Nets: Extending the concept to allow for continuous, on-demand width and precision adjustments for each layer independently.
  • Mixed Precision SP-Nets: Developing methods to find optimal layer-wise bitwidths for weights and activations.

Summary updated

BibTeX
@misc{guerra2020switchable,
  author = {Luis Guerra and Bohan Zhuang and Ian Reid and Tom Drummond},
  title = {{Switchable Precision Neural Networks}},
  year = {2020},
  eprint = {2002.02815},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2002.02815},
}
Figure