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

视觉Transformer的补丁级混合精度量化

Patch-wise Mixed-Precision Quantization of Vision Transformer

Institute of Automation, Chinese Academy of Sciences(中国科学院自动化研究所);School of Artificial Intelligence, University of Chinese Academy of Sciences(中国科学院大学人工智能学院)

Junrui Xiao, Zhikai Li, Lianwei Yang, Qingyi Gu

AI总结:

本文提出补丁级混合精度量化(PMQ)方法,通过轻量级全局度量和帕累托前沿自动分配位精度,并利用补丁级模块重分配位宽,降低ViTs推理复杂度,实验证明大幅减少搜索成本。

摘要:

随着新兴硬件开始支持混合位宽算术计算,混合精度量化被广泛用于降低神经网络的复杂度。然而,视觉Transformer(ViTs)需要复杂的自注意力计算来保证学习强大的特征表示,这使得ViTs的混合精度量化仍然具有挑战性。在本文中,我们提出了一种新颖的补丁级混合精度量化(PMQ)方法,用于ViTs的高效推理。具体来说,我们设计了一个轻量级的全局度量,其速度比现有方法更快,用于衡量ViTs中每个组件对量化误差的敏感性。此外,我们还引入了一种帕累托前沿方法,根据敏感性自动分配最优位精度。为了进一步降低推理阶段自注意力的计算复杂度,我们提出了一种补丁级模块,用于在每一层重新分配补丁的位宽。在ImageNet数据集上的大量实验表明,我们的方法大大降低了搜索成本,并促进了混合精度量化在ViTs中的应用。

英文摘要:

As emerging hardware begins to support mixed bit-width arithmetic computation, mixed-precision quantization is widely used to reduce the complexity of neural networks. However, Vision Transformers (ViTs) require complex self-attention computation to guarantee the learning of powerful feature representations, which makes mixed-precision quantization of ViTs still challenging. In this paper, we propose a novel patch-wise mixed-precision quantization (PMQ) for efficient inference of ViTs. Specifically, we design a lightweight global metric, which is faster than existing methods, to measure the sensitivity of each component in ViTs to quantization errors. Moreover, we also introduce a pareto frontier approach to automatically allocate the optimal bit-precision according to the sensitivity. To further reduce the computational complexity of self-attention in inference stage, we propose a patch-wise module to reallocate bit-width of patches in each layer. Extensive experiments on the ImageNet dataset shows that our method greatly reduces the search cost and facilitates the application of mixed-precision quantization to ViTs.

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

↑