PrefixQuant: Statische Quantisatie verslaat Dynamische door Vooraf Geplaatste Uitschieters in LLM's
PrefixQuant: Static Quantization Beats Dynamic through Prefixed Outliers in LLMs
October 7, 2024
Auteurs: Mengzhao Chen, Yi Liu, Jiahao Wang, Yi Bin, Wenqi Shao, Ping Luo
cs.AI
Samenvatting
Quantisering is essentieel voor het implementeren van Grote Taalmodellen (LLM's) door het geheugenefficiëntie en inferentiesnelheid te verbeteren. Bestaande methoden voor activatiekwantisering richten zich voornamelijk op kanaaluitbijters, waarbij vaak tokenuitbijters worden verwaarloosd, wat leidt tot afhankelijkheid van kostbare dynamische kwantisering per token. Om dit aan te pakken, introduceren we PrefixQuant, een nieuwe techniek die offline outlier tokens isoleert zonder opnieuw te trainen. Specifiek identificeert PrefixQuant hoogfrequente outlier tokens en plaatst ze als voorvoegsels in de KV-cache, waardoor de generatie van outlier tokens tijdens inferentie wordt voorkomen en de kwantisering wordt vereenvoudigd. Naar ons weten is PrefixQuant de eerste die efficiënte statische kwantisering per tensor mogelijk maakt om dure dynamische kwantisering per token te overtreffen. Bijvoorbeeld, in W4A4KV4 (4-bit gewicht, 4-bit activatie en 4-bit KV-cache) Llama-3-8B behaalt PrefixQuant met statische kwantisering per tensor een perplexiteit van 7.43 op WikiText2 en een gemiddelde nauwkeurigheid van 71.08% op 5 taken voor gezond verstand, waarbij eerdere methoden voor dynamische kwantisering per token zoals QuaRot worden overtroffen met een verbetering van 0.98 in perplexiteit en +5.98 punten nauwkeurigheid. Bovendien is de inferentiesnelheid van W4A4 gekwantiseerde modellen met PrefixQuant 1.60x tot 2.81x sneller dan FP16-modellen en overtreft deze QuaRot-modellen met 1.2x tot 1.3x. Onze code is beschikbaar op 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