MQuant通过静态量化让多模态大模型推理更快更准,适合部署在设备上。
MQuant: Unleashing the Inference Potential of Multimodal Large Language Models via Full Static Quantization
- 为视觉和文本模态分别设置量化尺度,解决分布差异问题。
- 在W4A8下实现近似浮点精度(<1%损失),推理延迟降低30%。
- 专为多模态模型设计,适合资源受限设备部署。
多模态大语言模型(MLLMs)因能理解多源输入而受到广泛关注,但其庞大的参数量和高计算需求严重制约实际部署。虽然量化是压缩模型和降低延迟的有效手段,但其在MLLMs上的应用仍不充分。本文提出MQuant,一种针对多模态大语言模型的后训练量化(PTQ)框架,以应对三大挑战:(a)视觉标记数量大导致的高推理延迟;(b)视觉与文本标记分布差异;(c)Hadamard变换引入的极端异常值。为此,MQuant引入三项技术:模态特定静态量化(MSQ),为视觉与文本标记分配不同静态缩放因子;注意力不变灵活切换(AIFS),重排序标记以保留因果注意力并消除逐标记缩放开销;旋转幅度抑制(RMS),缓解在线Hadamard旋转带来的权重异常。在五个主流MLLMs(包括Qwen-VL、MiniCPM-V、CogVLM2)上,MQuant在W4A8设置下实现接近浮点精度(<1%性能下降),同时将推理延迟降低高达30%,显著优于现有基线方法。代码已开源:https://github.com/StiphyJay/MQuant。
原文摘要 · Abstract (English)
Multimodal large language models (MLLMs) have garnered widespread attention due to their ability to understand multimodal input. However, their large parameter sizes and substantial computational demands severely hinder their practical deployment and application.While quantization is an effective way to reduce model size and inference latency, its application to MLLMs remains underexplored. In this paper, we propose MQuant, a post-training quantization (PTQ) framework designed to tackle the unique challenges of multimodal large language models (MLLMs). Conventional quantization often struggles with MLLMs because of (a) high inference latency from large visual token counts, (b) distributional disparities between visual and textual tokens, and (c) extreme outliers introduced by Hadamard-based transformations. To address these issues, MQuant introduces: Modality-Specific Static Quantization (MSQ), assigning distinct static scales for visual vs. textual tokens; Attention-Invariant Flexible Switching (AIFS), reordering tokens to preserve casual attention while eliminating expensive token-wise scale computations; Rotation Magnitude Suppression (RMS), mitigating weight outliers arising from online Hadamard rotations. On five mainstream MLLMs (including Qwen-VL, MiniCPM-V, CogVLM2), MQuant under W4A8 achieves near-floating-point accuracy (<1% degradation) while reducing inference latency by up to 30%, significantly outperforming existing PTQ baselines. Our MQuant effectively bridges the gap for efficient and accurate MLLMs inference in resource-constrained devices. Code has been released in https://github.com/StiphyJay/MQuant.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。