实现近乎无损的多精度模型快速切换,节省存储并提升训练效率。
Nearly Lossless Adaptive Bit Switching
- 采用双次量化方法,用最高整数精度替代全精度,减少存储开销。
- 提出自适应学习率缩放,缓解多精度联合训练中的梯度干扰问题。
- 支持图像分类、检测、分割及大模型任务,适用于多种硬件场景。
模型量化广泛用于压缩和加速深度神经网络(DNN)。传统量化感知训练(QAT)采用统一位宽,难以适配不同硬件与传输需求,导致训练与存储成本高。为此,本文提出一次性联合训练多精度方案。以往方法或存储更大FP32模型以保证精度,或仅存更小INT8模型但因共享量化参数牺牲精度。本文引入双次量化方法,充分挖掘量化表示范围,实现近乎无损的位宽切换,同时通过最高整数精度降低存储开销。此外,发现联合训练中不同精度间存在竞争性干扰,主因是反向传播时量化尺度梯度不一致。为此提出自适应学习率缩放(ALRS)技术,动态调节各精度的学习率以优化训练过程。进一步将双次量化扩展至混合精度训练,并设计基于海森矩阵的随机位切换策略(HASB)。ImageNet-1K分类实验表明,本方法在多精度与混合精度场景下均优于现有最优方案。验证还覆盖目标检测、语义分割及大模型任务。代码已开源:https://github.com/haiduo/Double-Rounding。
原文摘要 · Abstract (English)
Model quantization is widely applied for compressing and accelerating deep neural networks (DNNs). However, conventional Quantization-Aware Training (QAT) focuses on training DNNs with uniform bit-width. The bit-width settings vary across different hardware and transmission demands, which induces considerable training and storage costs. Hence, the scheme of one-shot joint training multiple precisions is proposed to address this issue. Previous works either store a larger FP32 model to switch between different precision models for higher accuracy or store a smaller INT8 model but compromise accuracy due to using shared quantization parameters. In this paper, we introduce the Double Rounding quantization method, which fully utilizes the quantized representation range to accomplish nearly lossless bit-switching while reducing storage by using the highest integer precision instead of full precision. Furthermore, we observe a competitive interference among different precisions during one-shot joint training, primarily due to inconsistent gradients of quantization scales during backward propagation. To tackle this problem, we propose an Adaptive Learning Rate Scaling (ALRS) technique that dynamically adapts learning rates for various precisions to optimize the training process. Additionally, we extend our Double Rounding to one-shot mixed precision training and develop a Hessian-Aware Stochastic Bit-switching (HASB) strategy. Experimental results on the ImageNet-1K classification demonstrate that our methods have enough advantages to state-of-the-art one-shot joint QAT in both multi-precision and mixed-precision. We also validate the feasibility of our method on detection and segmentation tasks, as well as on LLMs task. Our codes are available at https://github.com/haiduo/Double-Rounding.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。