arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2209.06383cs.CV
收藏

基于MLP的视觉模型的Quantization分析

Analysis of Quantization on MLP-based Vision Models

Peking University(北京大学);University of California, Berkeley(加州大学伯克利分校)

Lingran Zhao, Zhen Dong, Kurt Keutzer

摘要:

量化是一种广泛采用的模型压缩技术,它通过将神经网络中的浮点权重和激活转换为低位整数来获得有效的模型。量化已被证明在卷积神经网络和基于变换器的模型上工作良好。尽管这些模型很体面,但最近的研究表明,基于MLP的模型能够在从计算机视觉、NLP到3D点云的各种任务上实现相当的结果,同时由于并行性和网络简单性而实现更高的吞吐量。然而,正如我们在论文中所展示的,直接将量化应用于基于MLP的模型将导致显著的精度下降。根据我们的分析,两个主要问题导致了准确性差距:1)基于MLP的模型中的激活范围可能太大而无法量化,以及2)基于MLP的模型中的特定组件对量化敏感。因此,我们建议1)应用LayerNorm来控制激活的量化范围,2)利用有界激活函数,3)对激活应用百分位量化,4)使用我们改进的称为多令牌混合MLP的模块,以及5)对敏感操作应用线性非对称量化器。配备了上述技术,我们的Q-MLP模型可以在ImageNet上实现79.68%的准确度,8位均匀量化(模型大小30 MB)和78.47%的准确度,4位量化(15 MB)。

英文摘要:

Quantization is wildly taken as a model compression technique, which obtains efficient models by converting floating-point weights and activations in the neural network into lower-bit integers. Quantization has been proven to work well on convolutional neural networks and transformer-based models. Despite the decency of these models, recent works have shown that MLP-based models are able to achieve comparable results on various tasks ranging from computer vision, NLP to 3D point cloud, while achieving higher throughput due to the parallelism and network simplicity. However, as we show in the paper, directly applying quantization to MLP-based models will lead to significant accuracy degradation. Based on our analysis, two major issues account for the accuracy gap: 1) the range of activations in MLP-based models can be too large to quantize, and 2) specific components in the MLP-based models are sensitive to quantization. Consequently, we propose to 1) apply LayerNorm to control the quantization range of activations, 2) utilize bounded activation functions, 3) apply percentile quantization on activations, 4) use our improved module named multiple token-mixing MLPs, and 5) apply linear asymmetric quantizer for sensitive operations. Equipped with the abovementioned techniques, our Q-MLP models can achieve 79.68% accuracy on ImageNet with 8-bit uniform quantization (model size 30 MB) and 78.47% with 4-bit quantization (15 MB).

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

↑