ChatPaper.aiChatPaper

OmniQuant: Omnidirektional kalibrierte Quantisierung für große Sprachmodelle

OmniQuant: Omnidirectionally Calibrated Quantization for Large Language Models

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

Zusammenfassung

Große Sprachmodelle (LLMs) haben die Aufgaben der natürlichen Sprachverarbeitung revolutioniert. Ihre praktische Anwendung wird jedoch durch ihren immensen Speicher- und Rechenbedarf erschwert. Obwohl aktuelle Methoden der Post-Training-Quantisierung (PTQ) effektiv den Speicherbedarf reduzieren und die Recheneffizienz von LLMs verbessern, verwenden sie handgefertigte Quantisierungsparameter, was zu geringer Leistung führt und bei extrem niedriger Bit-Quantisierung versagt. Um dieses Problem zu lösen, führen wir eine omnidirektional kalibrierte Quantisierungstechnik (OmniQuant) für LLMs ein, die in verschiedenen Quantisierungseinstellungen gute Leistung erzielt und gleichzeitig die Recheneffizienz von PTQ durch effiziente Optimierung verschiedener Quantisierungsparameter beibehält. OmniQuant besteht aus zwei innovativen Komponenten: Learnable Weight Clipping (LWC) und Learnable Equivalent Transformation (LET). LWC moduliert die Extremwerte der Gewichte durch Optimierung des Clipping-Schwellenwerts. LET hingegen behandelt Ausreißer in den Aktivierungen, indem es die Herausforderung der Quantisierung von Aktivierungen auf Gewichte durch eine lernfähige äquivalente Transformation verschiebt. Innerhalb eines differenzierbaren Frameworks, das blockweise Fehlerminimierung verwendet, kann OmniQuant den Quantisierungsprozess effizient für sowohl Gewichts- als auch Gewichts-Aktivierungs-Quantisierung optimieren. Beispielsweise kann die LLaMA-2-Modellfamilie mit einer Größe von 7-70B mit OmniQuant auf einer einzelnen A100-40G-GPU innerhalb von 1-16 Stunden unter Verwendung von 128 Stichproben verarbeitet werden. Umfangreiche Experimente bestätigen die überlegene Leistung von OmniQuant in verschiedenen Quantisierungskonfigurationen wie W4A4, W6A6, W4A16, W3A16 und W2A16. Zusätzlich zeigt OmniQuant Wirksamkeit bei instruktionsoptimierten Modellen und erzielt bemerkenswerte Verbesserungen in der Inferenzgeschwindigkeit und Speicherreduzierung auf realen Geräten. Codes und Modelle sind verfügbar unter 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