OmniQuant: Omnischaal gekalibreerde kwantisatie voor grote taalmodelen
OmniQuant: Omnidirectionally Calibrated Quantization for Large Language Models
August 25, 2023
Auteurs: Wenqi Shao, Mengzhao Chen, Zhaoyang Zhang, Peng Xu, Lirui Zhao, Zhiqian Li, Kaipeng Zhang, Peng Gao, Yu Qiao, Ping Luo
cs.AI
Samenvatting
Grote taalmodellen (LLMs) hebben een revolutie teweeggebracht in taken voor natuurlijke taalverwerking. Hun praktische inzet wordt echter belemmerd door hun enorme geheugen- en rekenvereisten. Hoewel recente post-training kwantiseringsmethoden (PTQ) effectief zijn in het verminderen van het geheugengebruik en het verbeteren van de rekenkundige efficiëntie van LLMs, hanteren ze handmatig gemaakte kwantiseringsparameters, wat leidt tot lage prestaties en niet in staat is om extreem lage-bit kwantisering aan te pakken. Om dit probleem aan te pakken, introduceren we een Omnidirectioneel gekalibreerde Kwantiseringstechniek (OmniQuant) voor LLMs, die goede prestaties levert in diverse kwantiseringsinstellingen terwijl de rekenkundige efficiëntie van PTQ behouden blijft door efficiënt verschillende kwantiseringsparameters te optimaliseren. OmniQuant bestaat uit twee innovatieve componenten, waaronder Leerbaar Gewicht Clippen (LWC) en Leerbare Gelijkwaardige Transformatie (LET). LWC moduleert de extreme waarden van gewichten door het clippingsdrempel te optimaliseren. Ondertussen pakt LET activeringsuitbijters aan door de uitdaging van kwantisering van activeringen naar gewichten te verplaatsen via een leerbare gelijkwaardige transformatie. Door te werken binnen een differentieerbaar raamwerk met bloksgewijze foutminimalisatie, kan OmniQuant het kwantiseringsproces efficiënt optimaliseren voor zowel gewicht-alleen als gewicht-activeringskwantisering. Bijvoorbeeld, de LLaMA-2 modellenfamilie met een grootte van 7-70B kan worden verwerkt met OmniQuant op een enkele A100-40G GPU binnen 1-16 uur met 128 samples. Uitgebreide experimenten valideren de superieure prestaties van OmniQuant in diverse kwantiseringsconfiguraties zoals W4A4, W6A6, W4A16, W3A16 en W2A16. Daarnaast toont OmniQuant effectiviteit in instructie-getunede modellen en levert het opmerkelijke verbeteringen in inferentiesnelheid en geheugenreductie op echte apparaten. Codes en modellen zijn beschikbaar op 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.