DeepShift:迈向无乘法神经网络
摘要
卷积神经网络(CNN)推理所需的高计算、内存和功耗预算,是模型部署到边缘计算平台(如移动设备和物联网)的主要瓶颈。此外,即使在高端服务器上,训练CNN也耗时耗力。卷积层和全连接层由于大量使用乘法,是计算预算的主要来源。我们提出通过引入两种新操作来缓解此问题:卷积移位和全连接移位,它们在训练和推理期间用按位移位和符号翻转替代乘法。在推理时,两种方法仅需5位(或更少)来表示权重。这类使用卷积移位和全连接移位的神经网络架构被称为DeepShift模型。我们提出两种训练DeepShift模型的方法:DeepShift-Q训练约束为2的幂的常规权重,以及DeepShift-PS直接训练移位值和符号翻转值。我们取得了与基线非常接近甚至在部分情况下更高的准确率。将ResNet18、ResNet50、VGG16和GoogleNet的预训练32位浮点基线模型转换为DeepShift并训练15至30个epoch后,其Top-1/Top-5准确率高于原始模型。最后,我们实现了卷积移位和全连接移位的GPU内核,并显示出在推理ResNet18时相比未优化的基于乘法的GPU内核延迟时间减少25%。代码可在 https://github.com/mostafaelhoushi/DeepShift 获取。
引用
@article{arxiv.1905.13298,
title = {DeepShift: Towards Multiplication-Less Neural Networks},
author = {Mostafa Elhoushi and Zihao Chen and Farhan Shafiq and Ye Henry Tian and Joey Yiwei Li},
journal= {arXiv preprint arXiv:1905.13298},
year = {2021}
}
备注
-Added results for 8-bit and 16-bit fixed point activations, as well as 5-bit, 4-bit, 3-bit, and 2-bit weights. - Added link to GitHub code - Updated and fixed the training algorithm - Introduced 2 approaches for backward and forward pases - Showed better results for training from scratch on CIFAR10 and Imagenet - Added implementation on NVIDIA's GPU -Accepted in CVPR Mobile AI 2021 Workshop