ChatPaper.aiChatPaper

OmniQuant: 대규모 언어 모델을 위한 전방위 보정 양자화 기술

OmniQuant: Omnidirectionally Calibrated Quantization for Large Language Models

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

초록

대규모 언어 모델(LLM)은 자연어 처리 작업에 혁신을 가져왔습니다. 그러나 이러한 모델의 실질적인 배포는 막대한 메모리와 계산 요구 사항으로 인해 제약을 받고 있습니다. 최근의 사후 학습 양자화(PTQ) 방법은 LLM의 메모리 사용량을 줄이고 계산 효율성을 개선하는 데 효과적이지만, 양자화 매개변수를 수작업으로 설정하기 때문에 성능이 낮고 극도로 낮은 비트 양자화를 처리하지 못하는 문제가 있습니다. 이 문제를 해결하기 위해, 우리는 다양한 양자화 설정에서 우수한 성능을 유지하면서 PTQ의 계산 효율성을 유지하는 OmniQuant 기술을 소개합니다. OmniQuant는 학습 가능한 가중치 클리핑(LWC)과 학습 가능한 등가 변환(LET)이라는 두 가지 혁신적인 구성 요소로 이루어져 있습니다. LWC는 클리핑 임계값을 최적화하여 가중치의 극단적인 값을 조절합니다. 한편, LET는 학습 가능한 등가 변환을 통해 양자화의 어려움을 활성화에서 가중치로 전환하여 활성화 이상치를 처리합니다. 블록 단위 오차 최소화를 사용한 미분 가능 프레임워크 내에서 작동하는 OmniQuant는 가중치 전용 양자화와 가중치-활성화 양자화 모두에 대해 양자화 프로세스를 효율적으로 최적화할 수 있습니다. 예를 들어, 7-70B 크기의 LLaMA-2 모델 패밀리는 128개의 샘플을 사용하여 단일 A100-40G GPU에서 1-16시간 이내에 OmniQuant로 처리할 수 있습니다. 광범위한 실험을 통해 OmniQuant는 W4A4, W6A6, W4A16, W3A16, W2A16과 같은 다양한 양자화 구성에서 우수한 성능을 검증받았습니다. 또한, OmniQuant는 지시 튜닝된 모델에서도 효과적이며, 실제 장치에서 추론 속도와 메모리 감소 측면에서 뚜렷한 개선을 보여줍니다. 코드와 모델은 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