arXiv:2410.13461cs.LGcs.CL2024-10ICLR被引 18

分阶段动态调整量化精度,显著提升大模型推理速度与内存效率。

Progressive Mixed-Precision Decoding for Efficient LLM Inference

  • 按推理阶段特点差异分配不同精度,避免统一量化损失。
  • 在NVIDIA GPU上实现1.4至12.2倍的矩阵乘加速,NPU上提速3.8至8.0倍。
  • 适合资源受限设备部署,兼顾性能与生成质量,适用于真实场景。

尽管大型语言模型(LLMs)在各类任务中展现出巨大潜力,但其在资源受限设备上的部署仍面临计算与内存需求过高的挑战。量化通过将权重存储于低精度,成为有效解决方案。然而,采用极低精度(如2/3比特)虽能显著缓解解码阶段的内存瓶颈,却导致性能严重下降。现有方法未能充分考虑不同推理阶段在计算模式、冗余性和对近似敏感度上的差异,采用统一量化策略。本文提出一种面向阶段的新型方法,针对预填充阶段强化上下文提取,针对解码阶段优化内存带宽利用。进一步提出渐进式混合精度解码(PMPD),允许生成序列越往后越降低精度,并设计多种精度切换调度器,支持任务自适应或提示自适应的动态决策。在多种语言任务上的广泛评估表明,在NVIDIA GPU上,相比fp16模型,PMPD实现1.4–12.2倍的矩阵向量乘法加速;在专为LLM优化的NPU上,吞吐量相较fp16模型提升3.8–8.0倍,最高达统一量化方法的1.54倍,同时保持输出质量不变。

原文摘要 · Abstract (English)

In spite of the great potential of large language models (LLMs) across various tasks, their deployment on resource-constrained devices remains challenging due to their excessive computational and memory demands. Quantization has emerged as an effective solution by storing weights in reduced precision. However, utilizing low precisions (i.e.~2/3-bit) to substantially alleviate the memory-boundedness of LLM decoding, still suffers from prohibitive performance drop. In this work, we argue that existing approaches fail to explore the diversity in computational patterns, redundancy, and sensitivity to approximations of the different phases of LLM inference, resorting to a uniform quantization policy throughout. Instead, we propose a novel phase-aware method that selectively allocates precision during different phases of LLM inference, achieving both strong context extraction during prefill and efficient memory bandwidth utilization during decoding. To further address the memory-boundedness of the decoding phase, we introduce Progressive Mixed-Precision Decoding (PMPD), a technique that enables the gradual lowering of precision deeper in the generated sequence, together with a spectrum of precision-switching schedulers that dynamically drive the precision-lowering decisions in either task-adaptive or prompt-adaptive manner. Extensive evaluation across diverse language tasks shows that when targeting Nvidia GPUs, PMPD achieves 1.4$-$12.2$\times$ speedup in matrix-vector multiplications over fp16 models, while when targeting an LLM-optimized NPU, our approach delivers a throughput gain of 3.8$-$8.0$\times$ over fp16 models and up to 1.54$\times$ over uniform quantization approaches while preserving the output quality.

大模型推理量化精度调度高效部署

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。