GPLQ:一种通用、实用且闪电般的视觉Transformer量化感知训练方法
GPLQ: A General, Practical, and Lightning QAT Method for Vision Transformers
AI总结:
针对ViT量化中PTQ精度低、QAT成本高的问题,提出GPLQ框架,采用先激活后权重的两阶段策略,实现4比特量化性能媲美FP32,速度提升100倍。
摘要:
视觉Transformer(ViT)在计算机视觉中至关重要,但计算量也很大。模型量化,特别是量化到4比特等低比特宽度,旨在缓解这一困难,然而现有的训练后量化(PTQ)和量化感知训练(QAT)方法表现出显著的局限性。PTQ通常导致严重的精度下降,而QAT虽然实现了高精度,但存在计算成本过高、对下游任务的泛化能力有限、训练不稳定以及缺乏开源代码库等问题。为解决这些挑战,本文提出了通用、实用且闪电般的量化(GPLQ)方法,这是一个专为高效且有效的ViT量化而设计的新框架。GPLQ基于两个关键的经验性见解:激活量化至关重要,以及必须保留模型原有的优化“盆地”以维持泛化能力。因此,GPLQ采用了一种顺序的“先激活、后权重”策略。第一阶段将权重保持在FP32,同时仅用1个epoch通过特征模仿损失来量化激活,以使其保持在相同的“盆地”中,从而保持泛化能力。第二阶段使用PTQ方法量化权重。结果,GPLQ比现有QAT方法快100倍,将内存占用降低到甚至低于FP32训练的水平,并在ImageNet上的准确性和对多种下游任务(包括细粒度视觉分类和目标检测)的泛化能力方面,实现了与FP32模型高度竞争的4比特模型性能。我们将发布一个易于使用的开源工具包,支持多种视觉任务。
英文摘要:
Vision Transformers (ViTs) are essential in computer vision but are computationally intensive, too. Model quantization, particularly to low bit-widths like 4-bit, aims to alleviate this difficulty, yet existing Post-Training Quantization (PTQ) and Quantization-Aware Training (QAT) methods exhibit significant limitations. PTQ often incurs substantial accuracy drop, while QAT achieves high accuracy but suffers from prohibitive computational costs, limited generalization to downstream tasks, training instability, and lacking of open-source codebase. To address these challenges, this paper introduces General, Practical, and Lightning Quantization (GPLQ), a novel framework designed for efficient and effective ViT quantization. GPLQ is founded on two key empirical insights: the paramount importance of activation quantization and the necessity of preserving the model's original optimization ``basin'' to maintain generalization. Consequently, GPLQ employs a sequential ``activation-first, weights-later'' strategy. Stage 1 keeps weights in FP32 while quantizing activations with a feature mimicking loss in only 1 epoch to keep it stay in the same ``basin'', thereby preserving generalization. Stage 2 quantizes weights using a PTQ method. As a result, GPLQ is 100x faster than existing QAT methods, lowers memory footprint to levels even below FP32 training, and achieves 4-bit model performance that is highly competitive with FP32 models in terms of both accuracy on ImageNet and generalization to diverse downstream tasks, including fine-grained visual classification and object detection. We will release an easy-to-use open-source toolkit supporting multiple vision tasks.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。