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

理解训练后量化对大型语言模型的影响

Understanding the Impact of Post-Training Quantization on Large Language Models

Freshworks Inc(Freshworks公司)

Somnath Roy

AI总结:

本文系统分析了训练后量化对 LLMs 的影响,比较 nf4、fp4、int8 等量化方法在不同模型系列上的推理速度、内存占用、生成质量及对温度等超参数的敏感性,为模型部署中的量化选择提供依据。

摘要:

大型语言模型(LLMs)的规模正在迅速增长,参数数量已成为许多商业模型(如 ChatGPT、Claude 和 Bard)成功的关键因素。即使是最近发布的面向商业用途的公开可访问模型,如 Falcon 和 Llama2,也配备了数十亿参数。参数数量的显著增加使得部署和运行成本非常高昂。面向大型神经网络(尤其是 LLMs)的量化领域取得了显著进展,使这些模型能够部署在消费级 GPU 上,从而变得更加易于获取。量化模型通常表现出与其未量化基础模型相当的性能水平。尽管如此,我们对这些量化模型如何响应超参数(如 temperature、max new tokens 和 topk,尤其是对于下一个词预测)的全面理解仍存在显著差距。本分析揭示,nf4 和 fp4 是同样熟练的 4 位量化技术,具有相似的属性,如推理速度、内存消耗和生成内容的质量。研究发现,在较低温度下,nf4 在 llama2 系列模型中表现出对温度变化更强的鲁棒性,而 fp4 和 fp4-dq 被证明是 falcon 系列模型更合适的选择。值得注意的是,一般而言,不同规模的 4 位量化模型在 0.5 到 0.8 的温度范围内表现出更高的温度敏感性,这与它们未量化的对应模型不同。此外,int8 量化与显著较慢的推理速度相关,而未量化的 bfloat16 模型在所有规模的模型中都始终产生最快的推理速度。

英文摘要:

Large language models (LLMs) are rapidly increasing in size, with the number of parameters becoming a key factor in the success of many commercial models, such as ChatGPT, Claude, and Bard. Even the recently released publicly accessible models for commercial usage, such as Falcon and Llama2, come equipped with billions of parameters. This significant increase in the number of parameters makes deployment and operation very costly. The remarkable progress in the field of quantization for large neural networks in general and LLMs in particular, has made these models more accessible by enabling them to be deployed on consumer-grade GPUs. Quantized models generally demonstrate comparable performance levels to their unquantized base counterparts. Nonetheless, there exists a notable gap in our comprehensive understanding of how these quantized models respond to hyperparameters, such as temperature, max new tokens, and topk, particularly for next word prediction. The present analysis reveals that nf4 and fp4 are equally proficient 4-bit quantization techniques, characterized by similar attributes such as inference speed, memory consumption, and the quality of generated content. the study identifies nf4 as displaying greater resilience to temperature variations in the case of the llama2 series of models at lower temperature, while fp4 and fp4-dq proves to be a more suitable choice for falcon series of models. It is noteworthy that, in general, 4-bit quantized models of varying sizes exhibit higher sensitivity to temperature in the range of 0.5 to 0.8, unlike their unquantized counterparts. Additionally, int8 quantization is associated with significantly slower inference speeds, whereas unquantized bfloat16 models consistently yield the fastest inference speeds across models of all sizes.

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

↑