arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.14866cs.LGcs.AIcs.CL
收藏

APTQ:面向大语言模型的注意力感知训练后混合精度量化

APTQ: Attention-aware Post-Training Mixed-Precision Quantization for Large Language Models

School of Microelectronics, Southern University of Science and Technology(南方科技大学微电子学院);Department of Electrical and Electronic Engineering, University of Hong Kong(香港大学电机电子工程学系)

Ziyi Guan, Hantao Huang, Yupeng Su, Hong Huang, Ngai Wong, Hao Yu

AI总结:

本文提出 APTQ,一种结合权重二阶信息与注意力输出非线性影响、以 Hessian 迹指导位宽分配的 LLM 训练后混合精度量化方法,在低比特下取得接近全精度的效果。

摘要:

大语言模型(LLM)极大推动了自然语言处理范式的发展。然而,其高昂的计算负载和庞大的模型规模给边缘设备部署带来了严峻挑战。为此,我们提出面向 LLM 的 APTQ(Attention-aware Post-Training Mixed-Precision Quantization,注意力感知训练后混合精度量化),该方法不仅考虑各层权重的二阶信息,还首次考察注意力输出对整个模型的非线性影响。我们利用 Hessian 迹作为混合精度量化的敏感度指标,确保在有依据地降低精度的同时保持模型性能。实验表明,APTQ 优于以往的量化方法:在 C4 数据集上,平均位宽为 4 bit 时达到 5.22 的困惑度,几乎与全精度相当。此外,APTQ 在 LLaMa-7B 和 LLaMa-13B 上、平均位宽为 3.8 时分别取得 68.24% 和 70.48% 的最先进零样本准确率,证明了其生成高质量量化 LLM 的有效性。

英文摘要:

Large Language Models (LLMs) have greatly advanced the natural language processing paradigm. However, the high computational load and huge model sizes pose a grand challenge for deployment on edge devices. To this end, we propose APTQ (Attention-aware Post-Training Mixed-Precision Quantization) for LLMs, which considers not only the second-order information of each layer's weights, but also, for the first time, the nonlinear effect of attention outputs on the entire model. We leverage the Hessian trace as a sensitivity metric for mixed-precision quantization, ensuring an informed precision reduction that retains model performance. Experiments show APTQ surpasses previous quantization methods, achieving an average of 4 bit width a 5.22 perplexity nearly equivalent to full precision in the C4 dataset. In addition, APTQ attains state-of-the-art zero-shot accuracy of 68.24\% and 70.48\% at an average bitwidth of 3.8 in LLaMa-7B and LLaMa-13B, respectively, demonstrating its effectiveness to produce high-quality quantized LLMs.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑