Inference time, model size, and accuracy are three key factors in deep model compression. Most of the existing work addresses these three key factors separately as it is difficult to optimize them all at the same time. For example, low-bit quantization aims at obtaining a faster model; weight sharing quantization aims at improving compression ratio and accuracy; and mixed-precision quantization aims at balancing accuracy and inference time. To simultaneously optimize bit-width, model size, and accuracy, we propose pruning ternary quantization (PTQ): a simple, effective, symmetric ternary quantization method. We integrate L2 normalization, pruning, and the weight decay term to reduce the weight discrepancy in the gradient estimator during quantization, thus producing highly compressed ternary weights. Our method brings the highest test accuracy and the highest compression ratio. For example, it produces a 939kb (49$\times$) 2bit ternary ResNet-18 model with only 4\% accuracy drop on the ImageNet dataset. It compresses 170MB Mask R-CNN to 5MB (34$\times$) with only 2.8\% average precision drop. Our method is verified on image classification, object detection/segmentation tasks with different network structures such as ResNet-18, ResNet-50, and MobileNetV2.
翻译:推理时间、模型大小和精度是深度模型压缩中的三个关键因素。现有大多数工作分别处理这三个关键因素,因为同时优化它们具有挑战性。例如,低位量化旨在获得更快的模型;权重共享量化致力于提升压缩比和精度;混合精度量化则旨在平衡精度和推理时间。为同时优化位宽、模型大小和精度,我们提出剪枝三值量化(PTQ):一种简单、有效的对称三值量化方法。我们集成L2归一化、剪枝和权重衰减项,以减小量化过程中梯度估计器中的权重差异,从而生成高度压缩的三值权重。我们的方法实现了最高的测试精度和最高的压缩比。例如,在ImageNet数据集上,它生成一个仅939KB(49倍)的2比特三值ResNet-18模型,精度仅下降4%。它将170MB的Mask R-CNN压缩至5MB(34倍),平均精度仅下降2.8%。该方法在图像分类、目标检测/分割任务中,采用不同网络结构(如ResNet-18、ResNet-50和MobileNetV2)均得到验证。