arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2401.14895cs.CV
收藏

MPTQ-ViT:面向视觉Transformer的混合精度训练后量化

MPTQ-ViT: Mixed-Precision Post-Training Quantization for Vision Transformer

National Taiwan University(台湾大学)

Yu-Shan Tai, An-Yeu, Wu

AI总结:

针对视觉Transformer低比特量化精度下降问题,提出含SQ-b、OPT-m的混合精度训练后量化框架MPTQ-ViT,在ImageNet上显著优于现有SOTA方法。

摘要:

尽管视觉Transformer(ViT)已在计算机视觉任务中展现出巨大潜力,但其高昂的计算与内存需求为实际应用带来了挑战。现有训练后量化方法通过值重分布或专用量化器来解决ViT中的非正态分布问题。然而,这类方法未考虑激活的不对称性,且依赖手工设置,在低比特量化下往往难以维持性能。为克服这些挑战,我们提出带偏置项的SmoothQuant(SQ-b),以缓解不对称问题并降低截断损失。我们还引入最优缩放因子比例搜索(OPT-m),通过数据依赖机制自动确定量化参数。为进一步提升压缩能力,我们整合上述技术,提出了面向视觉Transformer的混合精度训练后量化框架MPTQ-ViT。我们开发了贪心混合精度量化(Greedy MP),在兼顾模型性能与压缩性的前提下为各层分配比特宽度。我们在ViT、DeiT和Swin上开展的实验表明,该方法在ImageNet数据集上相比当前最优方法(SOTA)实现了显著的精度提升。具体而言,我们提出的方法在单精度4比特ViT上实现了0.90%至23.35%的精度提升,在混合精度5比特全量化ViT上实现了3.82%至78.14%的精度提升。

英文摘要:

While vision transformers (ViTs) have shown great potential in computer vision tasks, their intense computation and memory requirements pose challenges for practical applications. Existing post-training quantization methods leverage value redistribution or specialized quantizers to address the non-normal distribution in ViTs. However, without considering the asymmetry in activations and relying on hand-crafted settings, these methods often struggle to maintain performance under low-bit quantization. To overcome these challenges, we introduce SmoothQuant with bias term (SQ-b) to alleviate the asymmetry issue and reduce the clamping loss. We also introduce optimal scaling factor ratio search (OPT-m) to determine quantization parameters by a data-dependent mechanism automatically. To further enhance the compressibility, we incorporate the above-mentioned techniques and propose a mixed-precision post-training quantization framework for vision transformers (MPTQ-ViT). We develop greedy mixed-precision quantization (Greedy MP) to allocate layer-wise bit-width considering both model performance and compressibility. Our experiments on ViT, DeiT, and Swin demonstrate significant accuracy improvements compared with SOTA on the ImageNet dataset. Specifically, our proposed methods achieve accuracy improvements ranging from 0.90% to 23.35% on 4-bit ViTs with single-precision and from 3.82% to 78.14% on 5-bit fully quantized ViTs with mixed-precision.

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

↑