arXiv:2504.14152cs.ARcs.LG2025-04被引 10

提出细粒度混合精度量化,让大模型推理更省电、省内存且不丢精度。

FGMP: Fine-Grained Mixed-Precision Weight and Activation Quantization for Hardware-Accelerated LLM Inference

  • 按敏感度动态分配高低精度,保留关键权重和激活值。
  • 在Llama-2-7B上实现<1%困惑度损失,能耗降14%,内存减30%。
  • 软硬协同设计,支持运行时灵活切换精度,适合部署在边缘设备。

量化是提升大语言模型(LLM)推理效率的关键技术,可利用更节能的低精度数据通路并减少内存占用。然而,如何在不降低准确率的前提下将权重和激活值精确量化至低精度仍具挑战。本文提出细粒度混合精度(FGMP)量化方法,一种后训练阶段的软硬协同设计,可在保持精度的同时将大部分权重与激活值量化至低精度。首先,基于每个数值的扰动及其加权的Fisher信息,制定策略选择需保留高精度的权重与激活块,以最小化模型损失的扰动;其次,提出敏感度加权裁剪方法,增强低精度量化块的准确性;最后,设计硬件加速模块,包括支持块级细粒度混合精度的数据通路,以及可在运行时动态分配激活块精度的混合精度激活量化单元,开销极小。原型使用NVFP4(带微缩放的FP4)作为低精度格式,FP8为高精度格式,在Llama-2-7B模型上对Wikitext-103任务实现<1%困惑度损失,相较全FP8基线设计,推理能耗降低14%,权重内存需求减少30%。

原文摘要 · Abstract (English)

Quantization is a powerful tool to improve large language model (LLM) inference efficiency by utilizing more energy-efficient low-precision datapaths and reducing memory footprint. However, accurately quantizing LLM weights and activations to low precision is challenging without degrading model accuracy. We propose fine-grained mixed precision (FGMP) quantization, a post-training mixed-precision quantization hardware-software co-design methodology that maintains accuracy while quantizing the majority of weights and activations to reduced precision. Our work makes the following contributions: 1) We develop a policy that uses the perturbation in each value, weighted by the Fisher information, to select which weight and activation blocks to keep in higher precision. This approach preserves accuracy by identifying which weight and activation blocks need to be retained in higher precision to minimize the perturbation in the model loss. 2) We also propose a sensitivity-weighted clipping approach for fine-grained quantization which helps retain accuracy for blocks that are quantized to low precision. 3) We then propose hardware augmentations to leverage the efficiency benefits of FGMP quantization. Our hardware implementation encompasses i) datapath support for FGMP at block granularity, and ii) a mixed-precision activation quantization unit to assign activation blocks to high or low precision on the fly with minimal runtime and energy overhead. Our design, prototyped using NVFP4 (an FP4 format with microscaling) as the low-precision datatype and FP8 as the high-precision datatype, facilitates efficient FGMP quantization, attaining <1% perplexity degradation on Wikitext-103 for the Llama-2-7B model relative to an all-FP8 baseline design while consuming 14% less energy during inference and requiring 30% less weight memory.

量化大模型推理混合精度硬件加速

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