大语言模型已变革了自然语言任务的理解与生成方式,但它们存在极高的内存与计算需求。量化技术已成为应对这些挑战的可行方向,同时能兼顾精度保持与能效提升。我们提出CPTQuant,这是一套综合策略,引入了基于相关性(CMPQ)、基于剪枝(PMPQ)和基于泰勒分解(TDMPQ)的混合精度技术。CMPQ基于不同层的典型相关分析调整精度等级;PMPQ根据各层对稀疏性的敏感度逐层优化精度;TDMPQ利用泰勒分解评估每一层对输入扰动的敏感度,进而调整精度。这些策略为敏感度更高的层分配更高精度,同时降低鲁棒性较强层的精度。CPTQuant在BERT、OPT-125M、OPT-350M、OPT-1.3B和OPT-2.7B上评估了性能。我们证明,与Hugging Face FP16相比,该方法可实现最高4倍的压缩比和2倍的效率提升,且精度下降极小。其中PMPQ在实现更高模型压缩率方面表现突出。针对多种大语言模型的敏感度分析显示,初始和末尾30%的层比其余层表现出更高的敏感度。在分类任务中,PMPQ的压缩率比其他方法高11%;而在语言建模任务中,TDMPQ的压缩率高出30%。
英文摘要:
Large language models have transformed the comprehension and generation of natural language tasks, but they come with substantial memory and computational requirements. Quantization techniques have emerged as a promising avenue for addressing these challenges while preserving accuracy and making energy efficient. We propose CPTQuant, a comprehensive strategy that introduces correlation-based (CMPQ), pruning-based (PMPQ), and Taylor decomposition-based (TDMPQ) mixed precision techniques. CMPQ adapts the precision level based on canonical correlation analysis of different layers. PMPQ optimizes precision layer-wise based on their sensitivity to sparsity. TDMPQ modifies precision using Taylor decomposition to assess each layer's sensitivity to input perturbation. These strategies allocate higher precision to more sensitive layers while diminishing precision to robust layers. CPTQuant assesses the performance across BERT, OPT-125M, OPT-350M, OPT-1.3B, and OPT-2.7B. We demonstrate up to 4x compression and a 2x-fold increase in efficiency with minimal accuracy drop compared to Hugging Face FP16. PMPQ stands out for achieving a considerably higher model compression. Sensitivity analyses across various LLMs show that the initial and final 30% of layers exhibit higher sensitivities than the remaining layers. PMPQ demonstrates an 11% higher compression ratio than other methods for classification tasks, while TDMPQ achieves a 30% greater compression ratio for language modeling tasks.
AWEQ: Post-Training Quantization with Activation-Weight Equalization for Large Language Models
School of Computer Science and Technology, Jilin University(吉林大学计算机科学与技术学院);Key Laboratory of Symbolic Computation and Knowledge Engineering of Ministry of Education, Jilin University(吉林大学符号计算与知识工程教育部重点实验室)
Multidisciplinary Faculty of Nador, Mohammed Premier University, Oujda 60000, Morocco(摩洛哥奥伊达大学多学科学院);Laboratory LaSTI, ENSAK, Sultan Moulay Slimane University, Khouribga 54000, Morocco(摩洛哥库尔希布加大学LaSTI实验室)