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

R2 Loss:用于模型压缩和量化的范围限制损失

R2 Loss: Range Restriction Loss for Model Compression and Quantization

Apple(苹果公司)

Arnav Kundu, Chungkuk Yoo, Srijan Mishra, Minsik Cho, Saurabh Adya

AI总结:

本文提出范围限制损失(R2-Loss),通过在预训练阶段移除权重异常值并限制其范围,构建低比特量化与压缩友好模型,显著提升了PTQ、QAT及模型压缩在极低比特下的准确率。

摘要:

模型量化和压缩是广泛使用的技术,用于减少推理时的计算资源消耗。尽管最先进的工作在较高比特(如4比特或8比特)下已达到了合理的准确率,但进一步对模型进行量化或压缩(例如1比特或2比特)仍然具有挑战性。为了克服这一挑战,我们关注预训练模型权重中的异常值,这些异常值会干扰有效的低比特量化和压缩。在本工作中,我们提出了范围限制损失(Range Restriction Loss, R2-Loss),通过在预训练期间移除权重中的异常值,来构建对低比特量化和压缩友好的模型。通过有效限制权重范围,我们将整体分布塑造成紧密的形状,以确保高量化比特分辨率,从而使模型压缩和量化技术能够更好地利用其有限的数值表示能力。我们引入了三种不同的损失函数:L-inf R2-Loss、其扩展版本Margin R2-Loss以及一种新的Soft-Min-Max R2-Loss,作为全精度模型训练期间的辅助损失。这些R2-Loss可用于不同场景,例如L-inf和Margin R2-Loss在对称量化中较为有效,而Soft-Min-Max R2-Loss在模型压缩中表现更佳。在我们的实验中,R2-Loss结合最先进的训练后量化(PTQ)、量化感知训练(QAT)和模型压缩技术,提升了低比特量化的准确率。使用R2-Loss后,MobileNet-V2的2比特权重和8比特激活PTQ、MobileNet-V1的2比特权重和激活QAT、以及ResNet18的1比特权重压缩,分别从50.66%提升至59.49%、从55.96%提升至59.05%、从45.54%提升至52.58%。

英文摘要:

Model quantization and compression is widely used techniques to reduce usage of computing resource at inference time. While state-of-the-art works have been achieved reasonable accuracy with higher bit such as 4bit or 8bit, but still it is challenging to quantize/compress a model further, e.g., 1bit or 2bit. To overcome the challenge, we focus on outliers in weights of a pre-trained model which disrupt effective lower bit quantization and compression. In this work, we propose Range Restriction Loss (R2-Loss) for building lower bit quantization and compression friendly models by removing outliers from weights during pre-training. By effectively restricting range of weights, we mold the overall distribution into a tight shape to ensure high quantization bit resolution, therefore allowing model compression and quantization techniques can to utilize their limited numeric representation powers better. We introduce three different, L-inf R2-Loss, its extension Margin R2-Loss and a new Soft-Min-MaxR2-Loss to be used as an auxiliary loss during full-precision model training. These R2-Loss can be used in different cases such as L-inf and Margin R2-Loss would be effective for symmetric quantization, while Soft-Min-Max R2-Loss shows better performance for model compression. In our experiment, R2-Loss improves lower bit quantization accuracy with state-of-the-art post-training quantization (PTQ), quantization-aware training (QAT), and model compression techniques. With R2-Loss, MobileNet-V2 2bit weight and 8bit activation PTQ, MobileNet-V1 2bit weight and activation QAT, ResNet18 1bit weight compression are improved to 59.49% from 50.66%, 59.05% from 55.96%, and 52.58% from 45.54%, respectively.

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

↑