Skip to main content
QUICK REVIEW

[论文解读] LSQ+: Improving low-bit quantization through learnable offsets and better initialization

Yash Bhalgat, Jinwon Lee|arXiv (Cornell University)|Apr 20, 2020
Advanced Neural Network ApplicationsComputer Science参考文献 28被引用 17
一句话总结

LSQ+ 通过引入可学习的非对称量化方法,结合可训练的缩放因子和偏移参数,提升了低比特量化性能,实现了对现代网络中常见负激活值(如使用 Swish 类激活函数的网络)的精确量化,同时采用基于均方误差(MSE)的初始化策略以稳定训练。在 EfficientNet 和 MixNet 上实现了最先进性能,相较于 LSQ,在 W2A2 量化下准确率最高提升 5.6%。

ABSTRACT

Unlike ReLU, newer activation functions (like Swish, H-swish, Mish) that are frequently employed in popular efficient architectures can also result in negative activation values, with skewed positive and negative ranges. Typical learnable quantization schemes [PACT, LSQ] assume unsigned quantization for activations and quantize all negative activations to zero which leads to significant loss in performance. Naively using signed quantization to accommodate these negative values requires an extra sign bit which is expensive for low-bit (2-, 3-, 4-bit) quantization. To solve this problem, we propose LSQ+, a natural extension of LSQ, wherein we introduce a general asymmetric quantization scheme with trainable scale and offset parameters that can learn to accommodate the negative activations. Gradient-based learnable quantization schemes also commonly suffer from high instability or variance in the final training performance, hence requiring a great deal of hyper-parameter tuning to reach a satisfactory performance. LSQ+ alleviates this problem by using an MSE-based initialization scheme for the quantization parameters. We show that this initialization leads to significantly lower variance in final performance across multiple training runs. Overall, LSQ+ shows state-of-the-art results for EfficientNet and MixNet and also significantly outperforms LSQ for low-bit quantization of neural nets with Swish activations (e.g.: 1.8% gain with W4A4 quantization and upto 5.6% gain with W2A2 quantization of EfficientNet-B0 on ImageNet dataset). To the best of our knowledge, ours is the first work to quantize such architectures to extremely low bit-widths.

研究动机与目标

  • 解决在现代网络(如 EfficientNet 和 MixNet)中使用 ReLU 类激活函数时,低比特量化(2–4 比特)导致的显著准确率下降问题。
  • 克服标准可学习量化方案(如 LSQ)的局限性,后者因假设量化范围为无符号而丢弃负激活值。
  • 在无需额外符号位的情况下,实现对具有符号性、非负受限激活函数(如 Swish、H-swish)的现代架构的高效量化。
  • 通过提出更鲁棒的缩放因子和偏移参数初始化方案,减少基于梯度量化训练中的不稳定性。
  • 证明 LSQ+ 能够首次成功将 EfficientNet 和 MixNet 量化至极低比特宽度(如 W2A2),并保持高准确率。

提出的方法

  • 提出一种基于可学习缩放因子 $ s $ 和偏移量 $ \beta $ 的非对称激活量化方案,使量化范围可偏移,以适应负激活值。
  • 引入可微分量化函数 $ \hat{x} = \text{clamp}\left( \text{round}\left( \frac{x - \beta}{s} \right), 0, 2^b - 1 \right) \cdot s + \beta $,其中 $ b $ 为比特宽度。
  • 采用基于均方误差(MSE)的初始化方法,最小化初始化阶段原始激活与量化激活之间的重建误差。
  • 采用量化感知训练(QAT)进行模型训练,通过反向传播联合优化网络权重以及量化参数 $ s $ 和 $ \beta $。
  • 将该方法同时应用于权重和激活,对于无激活函数的层(如 squeeze-excite 层或最终全连接层)采用对称量化。
  • 在 ImageNet 上使用标准配置进行评估,通过多次随机种子实验比较训练稳定性。
Figure 1: Figure shows the scale parameter of weight quantizer in blocks.1.conv.0 layer of EfficientNet-B0 before and after finetuning with LSQ and LSQ+ initializations. For both experiments, we used configuration 4 for activation quantization. As shown, LSQ init of the scale is further from the con
Figure 1: Figure shows the scale parameter of weight quantizer in blocks.1.conv.0 layer of EfficientNet-B0 before and after finetuning with LSQ and LSQ+ initializations. For both experiments, we used configuration 4 for activation quantization. As shown, LSQ init of the scale is further from the con

实验结果

研究问题

  • RQ1使用可学习非对称量化与可训练偏移量,是否能显著减少在具有 Swish 类激活函数的现代网络中低比特量化带来的准确率损失?
  • RQ2所提出的基于 MSE 的初始化方案是否相比最小-最大值或 LSQ 式初始化,能带来更稳定的训练性能(跨多次运行)?
  • RQ3LSQ+ 是否能成功将 EfficientNet 和 MixNet 量化至极低比特宽度(如 W2A2、W3A3)并保持高准确率,从而在该量化范围内树立新的 SOTA?
  • RQ4所学习的偏移量 $ \beta $ 在各层之间如何变化?其是否适应激活分布,而非固定为最小激活值?
  • RQ5LSQ+ 的性能增益是否仅限于基于 Swish 的架构,还是可推广至其他激活函数和网络类型?

主要发现

  • 在 EfficientNet-B0 上,LSQ+ 在 W4A4 量化下相比 LSQ 提升 1.8% 准确率,在 W2A2 量化下最高提升达 5.6%,展现出低比特量化下的最先进性能。
  • 基于 MSE 的初始化显著降低了多次训练运行中的性能方差:LSQ+ 在 W2A2 量化下达到 $ 46.8 \pm 1.9\% $ 准确率,而使用最小-最大值初始化仅为 $ 43.8 \pm 4.7\% $。
  • 所学习的偏移量 $ \beta $ 通常为负值且具有层特定性,表明网络能够学习将量化范围偏移以更好地覆盖激活分布。
  • 将 $ \beta $ 固定为最小激活值($ x_{\text{min}} $)时,W4A4 量化下仅达到 72.5% 的 top-1 准确率,而学习得到的 $ \beta $ 可达 73.8%,证明端到端优化的优势。
  • LSQ+ 在 ReLU 基础的 ResNet18 上保持或提升性能,表明其可作为 LSQ 的即插即用替代方案,适用于任意网络架构。
  • 推理阶段无运行时开销,因为非对称量化通过标准定点运算高效实现。
Figure 2: Layerwise $\beta$ values after covergence for EfficientNet-B0
Figure 2: Layerwise $\beta$ values after covergence for EfficientNet-B0

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。