arXiv reaDer
PTQ4ViT:ビジョントランスフォーマーのトレーニング後の量子化フレームワーク
PTQ4ViT: Post-Training Quantization Framework for Vision Transformers
量子化は、ニューラルネットワークを圧縮するための最も効果的な方法の1つであり、畳み込みニューラルネットワーク(CNN)で大きな成功を収めています。最近、ビジョントランスフォーマーはコンピュータービジョンに大きな可能性を示しています。ただし、以前のトレーニング後の量子化方法は、ビジョントランスフォーマーではうまく機能しなかったため、8ビットの量子化でも1%を超える精度の低下が発生しました。したがって、ビジョントランスフォーマーの量子化の問題を分析します。ソフトマックス関数とGELU関数がガウス分布とはかなり異なる後の活性化値の分布を観察します。また、MSEやコサイン距離などの一般的な量子化メトリックは、最適なスケーリング係数を決定するのに不正確であることがわかります。本論文では、これらの活性化値の量子化誤差を低減するために、双均一量子化法を提案した。また、ヘッセガイドメトリックを使用してさまざまなスケーリング係数を評価することを提案します。これにより、少ないコストでキャリブレーションの精度が向上します。ビジョントランスフォーマーの高速量子化を可能にするために、効率的なフレームワークPTQ4ViTを開発します。実験によると、量子化されたビジョントランスフォーマーは、ImageNet分類タスクでほぼロスレスの予測精度(8ビット量子化で0.5%未満の低下)を達成します。
Quantization is one of the most effective methods to compress neural networks, which has achieved great success on convolutional neural networks (CNNs). Recently, vision transformers have demonstrated great potential in computer vision. However, previous post-training quantization methods performed not well on vision transformer, resulting in more than 1% accuracy drop even in 8-bit quantization. Therefore, we analyze the problems of quantization on vision transformers. We observe the distributions of activation values after softmax and GELU functions are quite different from the Gaussian distribution. We also observe that common quantization metrics, such as MSE and cosine distance, are inaccurate to determine the optimal scaling factor. In this paper, we propose the twin uniform quantization method to reduce the quantization error on these activation values. And we propose to use a Hessian guided metric to evaluate different scaling factors, which improves the accuracy of calibration with a small cost. To enable the fast quantization of vision transformers, we develop an efficient framework, PTQ4ViT. Experiments show the quantized vision transformers achieve near-lossless prediction accuracy (less than 0.5% drop at 8-bit quantization) on the ImageNet classification task.
updated: Wed Nov 24 2021 06:23:06 GMT+0000 (UTC)
published: Wed Nov 24 2021 06:23:06 GMT+0000 (UTC)
参考文献 (このサイトで利用可能なもの) / References (only if available on this site)
被参照文献 (このサイトで利用可能なものを新しい順に) / Citations (only if available on this site, in order of most recent)
Amazon.co.jpアソシエイト