ChatPaper.aiChatPaper

PrefixQuant:LLMにおいて、静的量子化が動的量子化をプレフィックス付きの外れ値を通じて上回る

PrefixQuant: Static Quantization Beats Dynamic through Prefixed Outliers in LLMs

October 7, 2024
著者: Mengzhao Chen, Yi Liu, Jiahao Wang, Yi Bin, Wenqi Shao, Ping Luo
cs.AI

要旨

大規模言語モデル(LLM)を展開するためには、量子化が必要であり、メモリ効率と推論速度を向上させます。既存の活性化量子化手法は主にチャネル単位の外れ値に対処しており、しばしばトークン単位の外れ値を無視しており、結果としてコストのかかるトークン単位の動的量子化に依存しています。これを解決するために、我々はPrefixQuantという新しい技術を導入し、再トレーニングを必要とせずにオフラインで外れ値トークンを分離します。具体的には、PrefixQuantは高頻度の外れ値トークンを特定し、それらをKVキャッシュにプレフィックスして、推論時に外れ値トークンの生成を防ぎ、量子化を簡素化します。PrefixQuantは、高価なトークン単位の動的量子化を上回る効率的なテンソル単位の静的量子化を可能にする最初の手法であると私たちは認識しています。例えば、W4A4KV4(4ビットの重み、4ビットの活性化、4ビットのKVキャッシュ)Llama-3-8Bでは、PrefixQuantを使用したテンソル単位の静的量子化により、5つの常識的な推論タスクで7.43のWikiText2難解さと71.08%の平均精度を達成し、QuaRotなどの従来のトークン単位の動的量子化手法を上回りました(難解さが0.98改善し、精度が+5.98ポイント向上)。さらに、PrefixQuantを使用したW4A4量子化モデルの推論速度は、FP16モデルより1.60倍から2.81倍速く、QuaRotモデルより1.2倍から1.3倍速いです。私たちのコードはhttps://github.com/ChenMnZ/PrefixQuantで入手可能です。
English
Quantization is essential for deploying Large Language Models (LLMs) by enhancing memory efficiency and inference speed. Existing methods for activation quantization mainly address channel-wise outliers, often neglecting token-wise outliers, leading to reliance on costly per-token dynamic quantization. To address this, we introduce PrefixQuant, a novel technique that isolates outlier tokens offline without re-training. Specifically, PrefixQuant identifies high-frequency outlier tokens and prefixes them in the KV cache, preventing the generation of outlier tokens during inference and simplifying quantization. To our knowledge, PrefixQuant is the first to enable efficient per-tensor static quantization to outperform expensive per-token dynamic quantization. For instance, in W4A4KV4 (4- bit weight, 4-bit activation, and 4-bit KV cache) Llama-3-8B, PrefixQuant with per-tensor static quantization achieves a 7.43 WikiText2 perplexity and 71.08% average accuracy on 5 common-sense reasoning tasks, outperforming previous per-token dynamic quantization methods like QuaRot with 0.98 perplexity improvement and +5.98 points accuracy. Additionally, the inference speed of W4A4 quantized models using PrefixQuant is 1.60x to 2.81x faster than FP16 models and exceeds QuaRot models by 1.2x to 1.3x. Our code is available at https://github.com/ChenMnZ/PrefixQuant.

Summary

AI-Generated Summary

PDF312November 16, 2024