LLM-FP4: 4-Bit Floating-Point Quantized Transformers

要約

私たちは、トレーニング後の方法で、大規模言語モデル (LLM) の重みとアクティベーションの両方を 4 ビット浮動小数点値まで量子化するための LLM-FP4 を提案します。
既存のポストトレーニング量子化 (PTQ) ソリューションは主に整数ベースであり、8 ビット未満のビット幅に苦労しています。
整数量子化と比較して、浮動小数点 (FP) 量子化はより柔軟で、ロングテールまたはベル型分布をより適切に処理でき、多くのハードウェア プラットフォームでデフォルトの選択肢として登場しています。
FP 量子化の特徴の 1 つは、そのパフォーマンスが指数ビットとクリッピング範囲の選択に大きく依存することです。
これに関して、最適な量子化パラメータを検索することにより、強力な FP-PTQ ベースラインを構築します。
さらに、活性化分布において高いチャネル間分散パターンと低いチャネル内分散パターンが観察され、これにより活性化の量子化がさらに困難になります。
このパターンは、LLM、BERT、Vision Transformer モデルなど、さまざまなタスク向けに設計されたさまざまなトランスフォーマー モデルにわたって一貫していると認識しています。
これに取り組むために、チャネルごとのアクティベーション量子化を提案し、これらの追加のスケーリング係数を重みの指数関数的なバイアスとして再パラメータ化し、コストは無視できることを示します。
私たちの方法は、初めて、LLaMA-13B の重みと活性化の両方をわずか 4 ビットに量子化することができ、常識的なゼロショット推論タスクで平均スコア 63.1 を達成しました。これは、完全なテストよりわずか 5.8 低いだけです。
従来の最先端モデルを 12.7 ポイントも大幅に上回る高精度モデル。
コードは https://github.com/nbasyl/LLM-FP4 で入手できます。

要約(オリジナル)

We propose LLM-FP4 for quantizing both weights and activations in large language models (LLMs) down to 4-bit floating-point values, in a post-training manner. Existing post-training quantization (PTQ) solutions are primarily integer-based and struggle with bit widths below 8 bits. Compared to integer quantization, floating-point (FP) quantization is more flexible and can better handle long-tail or bell-shaped distributions, and it has emerged as a default choice in many hardware platforms. One characteristic of FP quantization is that its performance largely depends on the choice of exponent bits and clipping range. In this regard, we construct a strong FP-PTQ baseline by searching for the optimal quantization parameters. Furthermore, we observe a high inter-channel variance and low intra-channel variance pattern in activation distributions, which adds activation quantization difficulty. We recognize this pattern to be consistent across a spectrum of transformer models designed for diverse tasks, such as LLMs, BERT, and Vision Transformer models. To tackle this, we propose per-channel activation quantization and show that these additional scaling factors can be reparameterized as exponential biases of weights, incurring a negligible cost. Our method, for the first time, can quantize both weights and activations in the LLaMA-13B to only 4-bit and achieves an average score of 63.1 on the common sense zero-shot reasoning tasks, which is only 5.8 lower than the full-precision model, significantly outperforming the previous state-of-the-art by 12.7 points. Code is available at: https://github.com/nbasyl/LLM-FP4.

arxiv情報

著者 Shih-yang Liu,Zechun Liu,Xijie Huang,Pingcheng Dong,Kwang-Ting Cheng
発行日 2023-10-25 17:59:32+00:00
arxivサイト arxiv_id(pdf)

提供元, 利用サービス

arxiv.jp, Google

カテゴリー: cs.AI, cs.AR, cs.CL, cs.CV パーマリンク