ChatPaper.aiChatPaper

EasyQuant: 대규모 언어 모델을 위한 효율적인 데이터 프리 양자화 알고리즘

EasyQuant: An Efficient Data-free Quantization Algorithm for LLMs

March 5, 2024
저자: Hanlin Tang, Yifu Sun, Decheng Wu, Kai Liu, Jianchen Zhu, Zhanhui Kang
cs.AI

초록

대규모 언어 모델(LLM)은 다양한 작업에서 기존 방법들보다 매우 우수한 성능을 입증했습니다. 그러나 이들의 높은 계산 비용과 메모리 요구량은 실제 배포에 있어 걸림돌이 되고 있습니다. 모델 양자화는 이러한 오버헤드를 줄이기 위한 효과적인 방법입니다. 문제는 대부분의 기존 연구에서 양자화된 모델이 훈련 데이터의 소량 샘플만을 사용하여 보정되었기 때문에, 양자화된 LLM이 알려지지 않은 사례와 작업에 대한 일반화 성능에 영향을 미칠 수 있다는 점입니다. 따라서 본 연구에서는 중요한 질문을 탐구합니다: LLM의 일반화 성능을 보장할 수 있는 데이터 독립적인 양자화 방법을 설계할 수 있을까요? 이 연구에서 우리는 LLM을 위한 훈련이 필요 없고 데이터 독립적인 가중치 전용 양자화 알고리즘인 EasyQuant을 제안합니다. 우리의 관찰에 따르면, 가중치와 양자화 범위에서의 이상치(outlier) 두 가지 요소가 양자화 오류를 줄이는 데 필수적입니다. 따라서 EasyQuant에서는 이상치(1% 미만)를 그대로 유지하고 재구성 오류를 줄이기 위해 양자화 범위를 최적화합니다. 이러한 방법을 통해 우리는 놀랍게도 EasyQuant이 원본 모델과 비슷한 성능을 달성함을 발견했습니다. EasyQuant은 어떠한 훈련 데이터에도 의존하지 않기 때문에, 양자화된 LLM의 일반화 성능이 안전하게 보장됩니다. 또한 EasyQuant은 병렬로 구현될 수 있어, 100B 이상의 LLM에 대해서도 단 몇 분 만에 양자화된 모델을 얻을 수 있습니다. 우리가 아는 한, 우리는 데이터 독립적인 설정 하에서 LLM에 대해 거의 손실 없는 양자화 성능을 달성한 첫 번째 연구이며, 우리의 알고리즘은 데이터 의존적 방법보다 10배 이상 빠르게 실행됩니다.
English
Large language models (LLMs) have proven to be very superior to conventional methods in various tasks. However, their expensive computations and high memory requirements are prohibitive for deployment. Model quantization is an effective method for reducing this overhead. The problem is that in most previous works, the quantized model was calibrated using few samples from the training data, which might affect the generalization of the quantized LLMs to unknown cases and tasks. Hence in this work, we explore an important question: Can we design a data-independent quantization method for LLMs to guarantee its generalization performance? In this work, we propose EasyQuant, a training-free and data-independent weight-only quantization algorithm for LLMs. Our observation indicates that two factors: outliers in the weight and quantization ranges, are essential for reducing the quantization error. Therefore, in EasyQuant, we leave the outliers (less than 1%) unchanged and optimize the quantization range to reduce the reconstruction error. With these methods, we surprisingly find that EasyQuant achieves comparable performance to the original model. Since EasyQuant does not depend on any training data, the generalization performance of quantized LLMs is safely guaranteed. Moreover, EasyQuant can be implemented in parallel so that the quantized model could be attained in a few minutes even for LLMs over 100B. To our best knowledge, we are the first work that achieves almost lossless quantization performance for LLMs under a data-independent setting and our algorithm runs over 10 times faster than the data-dependent methods.
PDF133December 15, 2024