提出小量化核方法CrossQuant,让大模型压缩后精度几乎不降。
CrossQuant: A Post-Training Quantization Method with Smaller Quantization Kernel for Precise Large Language Model Compression
- 用行列绝对最大值交叉量化激活,缩小量化核
- 对OPT模型量化核<16%,对LLaMA<0.1%,精度损失可忽略
- 适合需要高精度压缩大模型的研究者和工程师
后训练量化(PTQ)是压缩大语言模型(LLMs)的有效技术。尽管许多研究同时量化权重和激活,但激活量化后仍难以保持模型精度。为探究根本原因,我们首次将线性代数中的“核”概念拓展至量化函数,定义“量化核”——指被量化为零的激活元素集合。定量分析表明,量化核越小,量化后模型精度越高。当量化核比例低于19%(OPT模型)或1%(LLaMA模型)时,激活量化至INT8带来的精度损失可忽略。为此,我们提出CrossQuant:一种通过行与列方向绝对最大值向量交叉量化激活的简单高效方法,实现OPT模型约16%、LLaMA模型小于0.1%的量化核。在6.7B至70B参数的LLaMA、OPT模型上实验显示,CrossQuant在语言建模、零样本及少样本任务中保持或提升困惑度与准确率。
原文摘要 · Abstract (English)
Post-Training Quantization (PTQ) is an effective technique for compressing Large Language Models (LLMs). While many studies focus on quantizing both weights and activations, it is still a challenge to maintain the accuracy of LLM after activating quantization. To investigate the primary cause, we extend the concept of kernel from linear algebra to quantization functions to define a new term, "quantization kernel", which refers to the set of elements in activations that are quantized to zero. Through quantitative analysis of the quantization kernel, we find that these elements are crucial for maintaining the accuracy of quantized LLMs. With the decrease of quantization kernel, the precision of quantized LLMs increases. If the quantization kernel proportion is kept below 19% for OPT models and below 1% for LLaMA models, the precision loss from quantizing activations to INT8 becomes negligible. Motivated by the goal of developing a quantization method with small quantization kernel, we propose CrossQuant: a simple yet effective method for quantizing activations. CrossQuant cross-quantizes elements using row and column-wise absolute maximum vectors, achieving a quantization kernel of approximately 16% for OPT models and less than 0.1% for LLaMA models. Experimental results on LLMs (LLaMA, OPT) ranging from 6.7B to 70B parameters demonstrate that CrossQuant improves or maintains perplexity and accuracy in language modeling, zero-shot, and few-shot tasks.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。