arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2006.10518cs.LGstat.ML
收藏

改进后训练神经Quantization:逐层校准和分层编程

Improving Post Training Neural Quantization: Layer-wise Calibration and Integer Programming

Habana Labs – An Intel company(Habana Labs——英特尔旗下公司);Technion(以色列理工学院)

Itay Hubara, Yury Nahshan, Yair Hanani, Ron Banner, Daniel Soudry

摘要:

最近,后训练量化方法得到了相当大的关注,因为它们使用简单,只需要一个小的未标记的校准集。这个小数据集不能用于微调模型,而不会出现显著的过度拟合。相反,这些方法仅使用校准集来设置激活的动态范围。然而,当使用低于8位时,这些方法总是导致显著的准确性降低(除了在小数据集上)。在这里,我们的目标是打破8位的障碍。为此,我们通过在校准集上优化其参数来分别最小化每层的量化误差。我们凭经验证明,这种方法是:(1)比标准的微调方法更不容易过度拟合,甚至可以在非常小的校准集上使用;(2)比以前的方法更强大,它只设置激活的动态范围。此外,我们演示了如何最佳地分配每一层的位宽,同时约束精度下降或模型压缩,提出了一种新的整数规划制定。最后,我们建议模型全局统计调整,以纠正量化过程中引入的偏差。总之,这些方法为视觉和文本模型产生了最先进的结果。例如,在ResNet 50上,我们获得了不到1%的准确性下降-在所有层中使用4位权重和激活,但最小的两个。我们开源了我们的代码。

英文摘要:

Lately, post-training quantization methods have gained considerable attention, as they are simple to use, and require only a small unlabeled calibration set. This small dataset cannot be used to fine-tune the model without significant over-fitting. Instead, these methods only use the calibration set to set the activations' dynamic ranges. However, such methods always resulted in significant accuracy degradation, when used below 8-bits (except on small datasets). Here we aim to break the 8-bit barrier. To this end, we minimize the quantization errors of each layer separately by optimizing its parameters over the calibration set. We empirically demonstrate that this approach is: (1) much less susceptible to over-fitting than the standard fine-tuning approaches, and can be used even on a very small calibration set; and (2) more powerful than previous methods, which only set the activations' dynamic ranges. Furthermore, we demonstrate how to optimally allocate the bit-widths for each layer, while constraining accuracy degradation or model compression by proposing a novel integer programming formulation. Finally, we suggest model global statistics tuning, to correct biases introduced during quantization. Together, these methods yield state-of-the-art results for both vision and text models. For instance, on ResNet50, we obtain less than 1\% accuracy degradation --- with 4-bit weights and activations in all layers, but the smallest two. We open-sourced our code.

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

↑