arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1609.07061cs.NEcs.LG
收藏

量化神经网络:用低精度权重和激活训练神经网络

Quantized Neural Networks: Training Neural Networks with Low Precision Weights and Activations

Technion - Israel Institute of Technology(以色列理工学院);Université de Montréal(蒙特利尔大学);Columbia University(哥伦比亚大学)

Itay Hubara, Matthieu Courbariaux, Daniel Soudry, Ran El-Yaniv, Yoshua Bengio

摘要:

我们介绍了一种训练量化神经网络(QNN)的方法--精度极低的神经网络(例如,1位)权重和激活。在训练时,量化的权重和激活用于计算参数梯度。在前向过程中,QNN大大减少了内存大小和访问,并将大多数算术运算替换为逐位运算。因此,预计功耗将大幅降低。我们在MNIST、CIFAR-10、SVHN和ImageNet数据集上训练了QNN。由此产生的QNN实现了与32位对应物相当的预测精度。例如,我们的AlexNet的量化版本具有1位权重和2位激活,达到了$51\%$ top-1的准确度。此外,我们将参数梯度也转换为6位,这使得梯度计算仅使用逐位操作。量化的递归神经网络在Penn Treebank数据集上进行了测试,并且仅使用4位就实现了与32位对应物相当的精度。最后但并非最不重要的是,我们编程了一个二进制矩阵乘法GPU内核,使用它可以比使用未优化的GPU内核快7倍地运行我们的MNIST QNN,而不会损失任何分类精度。QNN代码可在线获得。

英文摘要:

We introduce a method to train Quantized Neural Networks (QNNs) --- neural networks with extremely low precision (e.g., 1-bit) weights and activations, at run-time. At train-time the quantized weights and activations are used for computing the parameter gradients. During the forward pass, QNNs drastically reduce memory size and accesses, and replace most arithmetic operations with bit-wise operations. As a result, power consumption is expected to be drastically reduced. We trained QNNs over the MNIST, CIFAR-10, SVHN and ImageNet datasets. The resulting QNNs achieve prediction accuracy comparable to their 32-bit counterparts. For example, our quantized version of AlexNet with 1-bit weights and 2-bit activations achieves $51\%$ top-1 accuracy. Moreover, we quantize the parameter gradients to 6-bits as well which enables gradients computation using only bit-wise operation. Quantized recurrent neural networks were tested over the Penn Treebank dataset, and achieved comparable accuracy as their 32-bit counterparts using only 4-bits. Last but not least, we programmed a binary matrix multiplication GPU kernel with which it is possible to run our MNIST QNN 7 times faster than with an unoptimized GPU kernel, without suffering any loss in classification accuracy. The QNN code is available online.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑