DeepShift:面向无乘法的神经网络
DeepShift: Towards Multiplication-Less Neural Networks
摘要:
推断卷积神经网络(CNN)的高计算、存储器和功率预算是模型部署到边缘计算平台的主要瓶颈,例如,移动设备和IoT。此外,即使在高级服务器上,训练CNN也是时间和精力密集型的。卷积层和全连接层,因为它们大量使用乘法,是这个计算预算的主要贡献者。我们建议通过引入两种新的操作来缓解这个问题:卷积移位和全连接移位,它们在训练和推理过程中用逐位移位和符号翻转取代乘法。在推理过程中,这两种方法都只需要5位(或更少)来表示权重。这一系列神经网络架构(使用卷积移位和全连接移位)被称为DeepShift模型。我们提出了两种训练DeepShift模型的方法:DeepShift-Q,它训练约束为2的幂的规则权重; DeepShift-PS,它直接训练移位和符号翻转的值。达到了非常接近基线的精度,在某些情况下精度更高。将ResNet 18、ResNet 50、VGG 16和GoogleNet的预训练32位浮点基线模型转换为DeepShift,并对它们进行15到30个epoch的训练,结果是Top-1/Top-5的准确率高于原始模型。最后但并非最不重要的是,我们实现了卷积移位和全连接移位GPU内核,与未优化的基于乘法的GPU内核相比,在推断ResNet 18时,延迟时间减少了25%。代码可以在https://github.com/mostafaelhoushi/DeepShift上找到。
英文摘要:
The high computation, memory, and power budgets of inferring convolutional neural networks (CNNs) are major bottlenecks of model deployment to edge computing platforms, e.g., mobile devices and IoT. Moreover, training CNNs is time and energy-intensive even on high-grade servers. Convolution layers and fully connected layers, because of their intense use of multiplications, are the dominant contributor to this computation budget. We propose to alleviate this problem by introducing two new operations: convolutional shifts and fully-connected shifts which replace multiplications with bitwise shift and sign flipping during both training and inference. During inference, both approaches require only 5 bits (or less) to represent the weights. This family of neural network architectures (that use convolutional shifts and fully connected shifts) is referred to as DeepShift models. We propose two methods to train DeepShift models: DeepShift-Q which trains regular weights constrained to powers of 2, and DeepShift-PS that trains the values of the shifts and sign flips directly. Very close accuracy, and in some cases higher accuracy, to baselines are achieved. Converting pre-trained 32-bit floating-point baseline models of ResNet18, ResNet50, VGG16, and GoogleNet to DeepShift and training them for 15 to 30 epochs, resulted in Top-1/Top-5 accuracies higher than that of the original model. Last but not least, we implemented the convolutional shifts and fully connected shift GPU kernels and showed a reduction in latency time of 25% when inferring ResNet18 compared to unoptimized multiplication-based GPU kernels. The code can be found at https://github.com/mostafaelhoushi/DeepShift.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。