[论文解读] Accurate Neural Training with 4-bit Matrix Multiplications at Standard Formats
本文提出对数无偏量化(LUQ),一种使用标准浮点格式进行4位训练深度神经网络的方法。LUQ通过将梯度随机四舍五入至零或可表示的最小幅度,实现无偏量化,从而在4位训练中达到最先进精度——使用ResNet50在ImageNet上实现1.1%的top-1错误率,经微调后降至0.32%,且无需依赖硬件特定格式或显著计算开销。
Quantization of the weights and activations is one of the main methods to reduce the computational footprint of Deep Neural Networks (DNNs) training. Current methods enable 4-bit quantization of the forward phase. However, this constitutes only a third of the training process. Reducing the computational footprint of the entire training process requires the quantization of the neural gradients, i.e., the loss gradients with respect to the outputs of intermediate neural layers. Previous works separately showed that accurate 4-bit quantization of the neural gradients needs to (1) be unbiased and (2) have a log scale. However, no previous work aimed to combine both ideas, as we do in this work. Specifically, we examine the importance of having unbiased quantization in quantized neural network training, where to maintain it, and how to combine it with logarithmic quantization. Based on this, we suggest a $ extit{logarithmic unbiased quantization}$ (LUQ) method to quantize both the forward and backward phases to 4-bit, achieving state-of-the-art results in 4-bit training without the overhead. For example, in ResNet50 on ImageNet, we achieved a degradation of 1.1%. We further improve this to a degradation of only 0.32% after three epochs of high precision fine-tuning, combined with a variance reduction method -- where both these methods add overhead comparable to previously suggested methods.
研究动机与目标
- 通过使用标准数值格式对前向传播和反向传播均进行量化,实现深度神经网络的完整4位训练。
- 解决低精度训练中反向传播误差的梯度偏差这一关键问题。
- 消除对非标准或专有数值格式(如基数为4的浮点数)的依赖,以提升硬件可移植性。
- 在降低训练期间计算与内存开销的同时,保持高模型精度。
- 证明无偏量化对反向传播至关重要,而对前向传播而言偏差影响较小。
提出的方法
- 提出对数无偏量化(LUQ),用于使用标准FP4格式([1个符号位,3个指数位,0个尾数位])对神经网络梯度进行4位量化。
- 对低于可表示最小幅度α的梯度应用随机量化,将其映射至零或α,以保持无偏梯度估计。
- 在训练过程中动态调整α,确保最大梯度幅度始终可表示。
- 在可表示范围内使用随机舍入,以消除梯度估计中的偏差。
- 将LUQ与现有的INT4权重和激活量化方法(如SAWB)结合,实现完整的4位GEMM计算。
- 引入两种互补方法:通过重采样随机梯度实现方差减少(SMP),以及高精度微调(FNT)以提升收敛性。
实验结果
研究问题
- RQ1为何无偏梯度量化对4位训练至关重要,其与前向传播量化的区别是什么?
- RQ2能否在不损失精度的前提下,有效使用标准数值格式(如基数为2的FP4)进行4位反向传播?
- RQ3在低精度训练中,随机舍入与最近舍入在梯度偏差和模型精度方面有何差异?
- RQ4随机梯度量化的方差有何影响,如何在不破坏无偏性的前提下降低方差?
- RQ5高精度微调能否有效恢复4位训练中损失的精度,其计算成本与先前方法相比如何?
主要发现
- LUQ在使用ResNet50进行完整4位训练时,ImageNet上的top-1错误率为1.1%,优于先前使用非标准格式的最先进方法。
- 经过三个epoch的高精度微调(FNT)后,错误率降低至0.32%,展现出强大的恢复能力。
- 所提出的方差减少方法(SMP)使用两个样本时,计算开销与[23]中两阶段舍入等先前方法相当。
- 使用LUQ的4位训练吞吐量约为FP16训练的8倍,表明效率显著提升。
- LUQ通过专门处理仅指数和仅尾数的操作数,实现了无需乘法的反向传播,并使GEMM硬件面积减少5倍。
- 此前在低比特训练中成本最高的FP32累加器可减小字长,表明存在进一步优化潜力。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。