ChatPaper.aiChatPaper

OmniQuant: 大規模言語モデルのための全方向較正量子化

OmniQuant: Omnidirectionally Calibrated Quantization for Large Language Models

August 25, 2023
著者: Wenqi Shao, Mengzhao Chen, Zhaoyang Zhang, Peng Xu, Lirui Zhao, Zhiqian Li, Kaipeng Zhang, Peng Gao, Yu Qiao, Ping Luo
cs.AI

要旨

大規模言語モデル(LLM)は自然言語処理タスクに革命をもたらしました。しかし、その実用的な展開は、膨大なメモリと計算リソースの要件によって妨げられています。最近の学習後量子化(PTQ)手法は、LLMのメモリフットプリントを削減し、計算効率を向上させるのに有効ですが、量子化パラメータを手動で設定するため、性能が低く、極端な低ビット量子化に対応できません。この問題を解決するため、我々はLLM向けの全方向較正量子化(OmniQuant)技術を提案します。OmniQuantは、PTQの計算効率を維持しつつ、様々な量子化パラメータを効率的に最適化することで、多様な量子化設定において優れた性能を発揮します。OmniQuantは、学習可能な重みクリッピング(LWC)と学習可能な等価変換(LET)という2つの革新的なコンポーネントで構成されています。LWCは、クリッピング閾値を最適化することで重みの極値を調整します。一方、LETは、学習可能な等価変換を通じて、量子化の課題を活性化から重みに移すことで、活性化の外れ値に対処します。ブロック単位の誤差最小化を用いた微分可能なフレームワーク内で動作するOmniQuantは、重みのみの量子化と重み-活性化の量子化の両方に対して、量子化プロセスを効率的に最適化できます。例えば、7Bから70BのサイズのLLaMA-2モデルファミリーは、128サンプルを使用して、単一のA100-40G GPU上で1〜16時間以内にOmniQuantで処理できます。広範な実験により、OmniQuantがW4A4、W6A6、W4A16、W3A16、W2A16といった多様な量子化設定において優れた性能を発揮することが検証されました。さらに、OmniQuantは指示チューニングされたモデルにおいても有効性を示し、実デバイス上での推論速度とメモリ削減において顕著な改善をもたらします。コードとモデルはhttps://github.com/OpenGVLab/OmniQuantで公開されています。
English
Large language models (LLMs) have revolutionized natural language processing tasks. However, their practical deployment is hindered by their immense memory and computation requirements. Although recent post-training quantization (PTQ) methods are effective in reducing memory footprint and improving the computational efficiency of LLM, they hand-craft quantization parameters, which leads to low performance and fails to deal with extremely low-bit quantization. To tackle this issue, we introduce an Omnidirectionally calibrated Quantization (OmniQuant) technique for LLMs, which achieves good performance in diverse quantization settings while maintaining the computational efficiency of PTQ by efficiently optimizing various quantization parameters. OmniQuant comprises two innovative components including Learnable Weight Clipping (LWC) and Learnable Equivalent Transformation (LET). LWC modulates the extreme values of weights by optimizing the clipping threshold. Meanwhile, LET tackles activation outliers by shifting the challenge of quantization from activations to weights through a learnable equivalent transformation. Operating within a differentiable framework using block-wise error minimization, OmniQuant can optimize the quantization process efficiently for both weight-only and weight-activation quantization. For instance, the LLaMA-2 model family with the size of 7-70B can be processed with OmniQuant on a single A100-40G GPU within 1-16 hours using 128 samples. Extensive experiments validate OmniQuant's superior performance across diverse quantization configurations such as W4A4, W6A6, W4A16, W3A16, and W2A16. Additionally, OmniQuant demonstrates effectiveness in instruction-tuned models and delivers notable improvements in inference speed and memory reduction on real devices. Codes and models are available at https://github.com/OpenGVLab/OmniQuant.
PDF180December 15, 2024