Skip to main content
QUICK REVIEW

[论文解读] Quantized Neural Networks: Training Neural Networks with Low Precision Weights and Activations

Itay Hubara, Matthieu Courbariaux|arXiv (Cornell University)|Sep 22, 2016
Neural Networks and Applications参考文献 53被引用 1,420
一句话总结

本文以极低精度(权重/激活 1 位,梯度量化到 6 位)训练神经网络,并在 MNIST、CIFAR-10、SVHN 和 ImageNet 上展示具有竞争力的准确率,同时强调显著的硬件与能耗优势。

ABSTRACT

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.

研究动机与目标

  • 引入低精度权重和激活的量化神经网络(QNNs),用于训练与推理。
  • 证明 QNNs 在标准基准测试中能达到与 32 位网络相当的准确度。
  • 将参数梯度量化,并探索 6 位梯度在训练效率中的作用。
  • 在 MNIST、CIFAR-10、SVHN、ImageNet 以及语言模型上评估 QNNs 以评估其多样性。
  • 讨论二值化网络的硬件影响与能效。

提出的方法

  • 在前向传播中使用确定性或随机二值化,将权重与激活约束为 +1 或 -1。
  • 通过直通估计器在离散化步骤上传播梯度。
  • 引入基于移位的批量归一化(SBN),以减少训练过程中的乘法运算。
  • 提出基于移位的 AdaMax 优化,以最小化乘法操作。
  • 采用线性与对数量化方案对权重/激活/梯度进行量化(基于 AP2 的量化)。
  • 对梯度和参数更新使用实值累加器,以保持 SGD 的有效性。

实验结果

研究问题

  • RQ1神经网络是否可以在 1 位权重与激活的情况下进行训练和部署且不会显著损失精度?
  • RQ2量化梯度到较小位宽(如 6 位)对训练性能的影响是什么?
  • RQ3在极低精度下,QNNs 在大规模数据集(如 ImageNet)上的表现如何?
  • RQ4与全精度网络相比,QNNs 的能量与内存效率的影响是什么?
  • RQ5QNNs 是否也能扩展到循环模型和语言任务并保持可比的准确性?

主要发现

  • BNN/BNN 变体的训练可以实现 1 位权重和 2 位激活,并在 ImageNet 上具有竞争力的 Top-1/Top-5 准确率(如 AlexNet 的 Top-1 41.8%,Top-5 67.1%;GoogleNet 的 Top-1 47.1%,Top-5 69.1%。
  • 采用 4 位权重与激活的二值化网络在 ImageNet 上的 Top-1 误差大约下降 5.5–5.6%(例如 4 位的 GoogleNet Top-1 为 66.5%;6 位权重/激活/梯度时 Top-1 为 66.4%)。
  • 6 位量化梯度训练导致性能下降较小(例如某些配置的图中显示 46.8% 的退化)。
  • 在 Penn Treebank 的语言模型上,4 位权重/激活可在某些 RNN/LSTM 设置中达到与 32 位相近的准确度(如 4 位 RNN/LSTM,激活/权重均为 4 位)。
  • 前向传递的内存与能量成本在 BNNs 下大幅降低(内存减少 32 倍,内存访问减少 32 倍;XNOR-count 替代了大量 MACs)。
  • 硬件内核实现(二值矩阵乘法)可带来显著加速(如 MNIST 的 BNN 在 GPU 上无精度损失地加速 7 倍)。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。