應用於卷積神經網絡之雙精度分離式量化
Separate Quantization with Dual Precisions for Convolutional Neural Networks
摘要
隨著在本地端運行深度學習推理的需求增加,許多增進深度學習運行效率的方法已被提出,尤其是針對卷積神經網絡。量化減低運算的位元數,帶來模型尺寸的降低並提高了運算效率。最先進的八位元量化能夠保持優秀的準確度,並逐漸得到來自軟體庫及硬體架構的支援。進一步降低位元數可能有潛在的益處,但通常需要對模型進行微調或重新訓練才能彌補準確度的損失。此過程耗時且需要強大的運算資源。我們提出了雙精度分離式量化—將大多數值小的資料量化成四位元;剩餘少數值大的資料量化成八位元。為了節省在運行過程中對每層的輸出進行排序的成本,我們在校準過程中為每層選取最小化原始與量化數據之間歐式距離的閾值。實驗結果表明我們的方法在AlexNet,DenseNet-121及 MobileNetV2上可維持小於一個百分點的準確度損失,無需微調。
With the increasing needs of on-devices deep learning inference, many efficient methods for deep learning, especially convolutional neural networks are proposed. Quantization reduces the bitwidth of operations for smaller model size and improvements in computation efficiency. State-of-the-art 8-bit quantization is able to maintain good accuracy and increasingly getting more supports in libraries and hardware architectures. Low-bit quantization could be beneficial but generally requires fine-tuning or retraining to make up accuracy loss, which is time-consuming and takes great computing power. We propose separate quantization with dual precisions (4 plus 8 bits) to quantize the majority of small data to 4 bits and the remaining large data to 8 bits separately. To save the sorting overhead at runtime for activations, layer-wise thresholds that minimize the L2-distance between full-precision and quantized data are decided in a calibration process. Experiments show that our method brings less than 1% top-1 and top-5 accuracy loss on AlexNet, DenseNet-121, and MobileNetV2 without the need of fine-tuning