Skip to main content

One Weight Bitwidth to Rule Them All

  • Conference paper
  • First Online:
Computer Vision – ECCV 2020 Workshops (ECCV 2020)

Part of the book series: Lecture Notes in Computer Science ((LNIP,volume 12539))

Included in the following conference series:

Abstract

Weight quantization for deep ConvNets has shown promising results for applications such as image classification and semantic segmentation and is especially important for applications where memory storage is limited. However, when aiming for quantization without accuracy degradation, different tasks may end up with different bitwidths. This creates complexity for software and hardware support and the complexity accumulates when one considers mixed-precision quantization, in which case each layer’s weights use a different bitwidth. Our key insight is that optimizing for the least bitwidth subject to no accuracy degradation is not necessarily an optimal strategy. This is because one cannot decide optimality between two bitwidths if one has smaller model size while the other has better accuracy. In this work, we take the first step to understand if some weight bitwidth is better than others by aligning all to the same model size using a width-multiplier. Under this setting, somewhat surprisingly, we show that using a single bitwidth for the whole network can achieve better accuracy compared to mixed-precision quantization targeting zero accuracy degradation when both have the same model size. In particular, our results suggest that when the number of channels becomes a target hyperparameter, a single weight bitwidth throughout the network shows superior results for model compression.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 109.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 139.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    Width-multiplier grows or shrinks the number of channels across the layers with identical proportion for a certain network, e.g., grow the number of channels for all the layers by 2\(\times \).

  2. 2.

    Note that we use width-multiplier to scale model across different sizes.

  3. 3.

    Increase the width of a layer increases the number of output filters for that layer as well as the number of channels for the subsequent layer. Thus, number of parameters and number of operations grow approximately quadratically with the width-multiplier.

  4. 4.

    However, not higher than 4 bits since the 4-bit model has accuracy comparable to the floating-point model.

  5. 5.

    We treat the calculated \(\bar{|{\varvec{w}}|}\) at each training step as a sample and calculate the sample variance across training steps.

References

  1. Bengio, Y., Léonard, N., Courville, A.: Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432 (2013)

  2. Cai, H., Zhu, L., Han, S.: ProxylessNAS: direct neural architecture search on target task and hardware. arXiv preprint arXiv:1812.00332 (2018)

  3. Chin, T.W., Ding, R., Zhang, C., Marculescu, D.: Towards efficient model compression via learned global ranking. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020

    Google Scholar 

  4. Choi, J., Chuang, P.I.J., Wang, Z., Venkataramani, S., Srinivasan, V., Gopalakrishnan, K.: Bridging the accuracy gap for 2-bit quantized neural networks (QNN). arXiv preprint arXiv:1807.06964 (2018)

  5. Ding, R., Chin, T.W., Liu, Z., Marculescu, D.: Regularizing activation distribution for training binarized deep networks. In: The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2019

    Google Scholar 

  6. Dong, Z., Yao, Z., Gholami, A., Mahoney, M., Keutzer, K.: HAWQ: Hessian aWare quantization of neural networks with mixed-precision. arXiv preprint arXiv:1905.03696 (2019)

  7. Frankle, J., Carbin, M.: The lottery ticket hypothesis: finding sparse, trainable neural networks. In: International Conference on Learning Representations (2019). https://openreview.net/forum?id=rJl-b3RcF7

  8. He, K., Zhang, X., Ren, S., Sun, J.: Deep residual learning for image recognition. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 770–778 (2016)

    Google Scholar 

  9. He, Y., Liu, X., Zhong, H., Ma, Y.: AddressNet: shift-based primitives for efficient convolutional neural networks. In: 2019 IEEE Winter Conference on Applications of Computer Vision (WACV), pp. 1213–1222. IEEE (2019)

    Google Scholar 

  10. Hou, L., Kwok, J.T.: Loss-aware weight quantization of deep networks. In: International Conference on Learning Representations (2018). https://openreview.net/forum?id=BkrSv0lA-

  11. Howard, A.G., et al.: MobileNets: efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861 (2017)

  12. Huang, G., Liu, S., van der Maaten, L., Weinberger, K.Q.: CondenseNet: an efficient DenseNet using learned group convolutions. Group 3(12), 11 (2017)

    Google Scholar 

  13. Jacob, B., et al.: Quantization and training of neural networks for efficient integer-arithmetic-only inference. In: The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018

    Google Scholar 

  14. Jung, S., et al.: Learning to quantize deep networks by optimizing quantization intervals with task loss. In: The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2019

    Google Scholar 

  15. Krizhevsky, A., Hinton, G., et al.: Learning multiple layers of features from tiny images. Technical report, Citeseer (2009)

    Google Scholar 

  16. Li, H., Kadav, A., Durdanovic, I., Samet, H., Graf, H.P.: Pruning filters for efficient convnets (2017)

    Google Scholar 

  17. Louizos, C., Reisser, M., Blankevoort, T., Gavves, E., Welling, M.: Relaxed quantization for discretized neural networks. In: International Conference on Learning Representations (2019). https://openreview.net/forum?id=HkxjYoCqKX

  18. Meller, E., Finkelstein, A., Almog, U., Grobman, M.: Same, same but different: recovering neural network quantization error through weight factorization. In: Chaudhuri, K., Salakhutdinov, R. (eds.) Proceedings of the 36th International Conference on Machine Learning. Proceedings of Machine Learning Research, vol. 97, pp. 4486–4495, Long Beach. PMLR, 09–15 June 2019. http://proceedings.mlr.press/v97/meller19a.html

  19. Mishra, A., Nurvitadhi, E., Cook, J.J., Marr, D.: WRPN: wide reduced-precision networks. In: International Conference on Learning Representations (2018). https://openreview.net/forum?id=B1ZvaaeAZ

  20. Nagel, M., van Baalen, M., Blankevoort, T., Welling, M.: Data-free quantization through weight equalization and bias correction. arXiv preprint arXiv:1906.04721 (2019)

  21. Rastegari, M., Ordonez, V., Redmon, J., Farhadi, A.: XNOR-net: ImageNet classification using binary convolutional neural networks. In: Leibe, B., Matas, J., Sebe, N., Welling, M. (eds.) ECCV 2016. LNCS, vol. 9908, pp. 525–542. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-46493-0_32

    Chapter  Google Scholar 

  22. Sandler, M., Howard, A., Zhu, M., Zhmoginov, A., Chen, L.C.: MobileNetV2: inverted residuals and linear bottlenecks. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4510–4520 (2018)

    Google Scholar 

  23. Sheng, T., Feng, C., Zhuo, S., Zhang, X., Shen, L., Aleksic, M.: A quantization-friendly separable convolution for MobileNets. In: 2018 1st Workshop on Energy Efficient Machine Learning and Cognitive Computing for Embedded Applications (EMC2), pp. 14–18. IEEE (2018)

    Google Scholar 

  24. Simonyan, K., Zisserman, A.: Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556 (2014)

  25. Stamoulis, D., et al.: Designing adaptive neural networks for energy-constrained image classification, In: Proceedings of the International Conference on Computer-Aided Design, p. 23. ACM (2018)

    Google Scholar 

  26. Stamoulis, D., et al.: Single-path NAS: designing hardware-efficient convnets in less than 4 hours. arXiv preprint arXiv:1904.02877 (2019)

  27. Tan, M., Chen, B., Pang, R., Vasudevan, V., Le, Q.V.: MnasNet: platform-aware neural architecture search for mobile. arXiv preprint arXiv:1807.11626 (2018)

  28. Theis, L., Korshunova, I., Tejani, A., Huszár, F.: Faster gaze prediction with dense networks and fisher pruning. arXiv preprint arXiv:1801.05787 (2018)

  29. Wang, K., Liu, Z., Lin, Y., Lin, J., Han, S.: HAQ: hardware-aware automated quantization with mixed precision. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8612–8620 (2019)

    Google Scholar 

  30. Wu, B., et al.: Shift: a zero flop, zero parameter alternative to spatial convolutions. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 9127–9135 (2018)

    Google Scholar 

  31. Wu, B., Wang, Y., Zhang, P., Tian, Y., Vajda, P., Keutzer, K.: Mixed precision quantization of convnets via differentiable neural architecture search. arXiv preprint arXiv:1812.00090 (2018)

  32. Yang, J., et al.: Quantization networks. In: The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2019

    Google Scholar 

  33. Ye, J., Lu, X., Lin, Z., Wang, J.Z.: Rethinking the smaller-norm-less-informative assumption in channel pruning of convolution layers (2018)

    Google Scholar 

  34. Yu, R., et al.: NISP: pruning networks using neuron importance score propagation. In: The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018

    Google Scholar 

  35. Yuan, X., Ren, L., Lu, J., Zhou, J.: Enhanced Bayesian compression via deep reinforcement learning. In: The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2019

    Google Scholar 

  36. Zhao, R., Hu, Y., Dotzel, J., De Sa, C., Zhang, Z.: Improving neural network quantization without retraining using outlier channel splitting. In: Chaudhuri, K., Salakhutdinov, R. (eds.) Proceedings of the 36th International Conference on Machine Learning, Proceedings of Machine Learning Research, vol. 97, pp. 7543–7552, Long Beach. PMLR, 09–15 June 2019. http://proceedings.mlr.press/v97/zhao19c.html

  37. Zhao, R., Hu, Y., Dotzel, J., Sa, C.D., Zhang, Z.: Building efficient deep neural networks with unitary group convolutions. In: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 11303–11312 (2019)

    Google Scholar 

  38. Zhou, A., Yao, A., Guo, Y., Xu, L., Chen, Y.: Incremental network quantization: towards lossless CNNS with low-precision weights. In: International Conference on Learning Representations (2017). https://openreview.net/forum?id=HyQJ-mclg

  39. Zhou, S., Wu, Y., Ni, Z., Zhou, X., Wen, H., Zou, Y.: DoReFa-Net: training low bitwidth convolutional neural networks with low bitwidth gradients. arXiv preprint arXiv:1606.06160 (2016)

  40. Zhu, C., Han, S., Mao, H., Dally, W.J.: Trained ternary quantization. In: International Conference on Learning Representations (2017). https://openreview.net/forum?id=S1_pAu9xl

  41. Zhuang, Z., et al.: Discrimination-aware channel pruning for deep neural networks. In: Advances in Neural Information Processing Systems, pp. 883–894 (2018)

    Google Scholar 

Download references

Acknowledgement

This research was supported in part by NSF CCF Grant No. 1815899, NSF CSR Grant No. 1815780, and NSF ACI Grant No. 1445606 at the Pittsburgh Supercomputing Center (PSC).

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Ting-Wu Chin .

Editor information

Editors and Affiliations

1 Electronic supplementary material

Below is the link to the electronic supplementary material.

Supplementary material 1 (pdf 534 KB)

Appendices

A Clipping Point for Quantization-aware Training

As mentioned earlier, \({\varvec{a}}\in \mathbb {R}^{C_{out}}\) denotes the vector of clipping factors which is selected to minimize \(\Vert Q({\varvec{W}}_{i,:}) - {\varvec{W}}_{i,:} \Vert ^2_2\) by assuming \({\varvec{W}}_{i,:}~\sim \mathcal {N}(0, \sigma ^2{\varvec{I}})\). More specifically, we run simulations for weights drawn from a zero-mean Gaussian distribution with several variances and identify the best \({a}_i^*=\arg \min _{{a}_i}\Vert Q_{{a}_i}({\varvec{W}}_{i,:}) - {\varvec{W}}_{i,:} \Vert ^2_2\) empirically. According to our simulation, we find that one can infer \({a}_i\) from the sample mean \(\bar{|{\varvec{W}}_{i,:}|}\), which is shown in Fig. 7. As a result, for the different precision values considered, we find \(c = \frac{\bar{|{\varvec{W}}_{i,:}|}}{{a}_i^*}\) via simulation and use the obtained c to calculate \({a}_i\) on-the-fly throughout training.

Fig. 7.
figure 7

Finding best \({a}_i\) for different precision values empirically through simulation using Gaussian with various \(\sigma ^2\).

B Network Architectures

For the experiments in Sect. 4.2, the ResNets used are detailed in Table 4. Specifically, for the points in Fig. 1a, we consider ResNet20 to ResNet56 with width-multipliers of \(0.5\times , 1\times , 1.5\times \), and \(2\times \) for the 4-bit case. Based on these values, we consider additional width-multipliers \(2.4\times \) and \(2.8\times \) for the 2-bit case and \(2.5\times , 3\times , 3.5\times ,\) and \(3.9\times \) for the 1-bit case. We note that the right-most points in Fig. 1a is a \(10\times \) ResNet26 for the 4 bits case. On the other hand, VGG11 is detailed in Table 6 for which we consider width-multipliers from \(0.25\times \) to \(2\times \) with a step of 0.25 for the 4 bits case (blue dots in Fig. 1c). The architecture details for Inv-ResNet26 used in Fig. 2b is shown in Table 5. The architecture of MobileNetV2 used in the CIFAR-100 experiments follows the original MobileNetV2 (Table 2 in [22]) but we change the stride of all the bottleneck blocks to 1 except for the fifth bottleneck block, which has a stride of 2. As a result, we down-sample the image twice in total, which resembles the ResNet design for the CIFAR experiments [8]. Similar to VGG11, we consider width-multipliers from \(0.25\times \) to \(2\times \) with a step of 0.25 for MobileNetV2 for the 4 bits case (blue dots in Fig. 1b).

Table 4. ResNet20 to ResNet56
Table 5. Inv-ResNet26
Table 6. VGGs

C Proof for Proposition 5.1

Based on the definition of variance, we have:

$$\begin{aligned} \mathrm {Var}(\frac{1}{d}\sum _{i=1}^d |{\varvec{w}}_i|)&:= \mathbb {E}\left[ \left( \frac{1}{d}\sum _{i=1}^d |{\varvec{w}}_i| \right) ^2 - \left( \mathbb {E}\frac{1}{d}\sum _{i=1}^d |{\varvec{w}}_i| \right) ^2\right] \\&= \mathbb {E}\left[ \left( \frac{1}{d}\sum _{i=1}^d |{\varvec{w}}_i| \right) ^2 - \frac{2\sigma ^2}{\pi } \right] \\&= \frac{1}{d^2} \mathbb {E}\left( \sum _{i=1}^d |{\varvec{w}}_i| \right) ^2 - \frac{2\sigma ^2}{\pi }\\&= \frac{\sigma ^2}{d} + \frac{d-1}{d} \rho \sigma ^2 - \frac{2\sigma ^2}{\pi }. \end{aligned}$$

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Chin, TW., Chuang, P.IJ., Chandra, V., Marculescu, D. (2020). One Weight Bitwidth to Rule Them All. In: Bartoli, A., Fusiello, A. (eds) Computer Vision – ECCV 2020 Workshops. ECCV 2020. Lecture Notes in Computer Science(), vol 12539. Springer, Cham. https://doi.org/10.1007/978-3-030-68238-5_7

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-68238-5_7

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-68237-8

  • Online ISBN: 978-3-030-68238-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics