arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2305.12356cs.LGcs.AI
收藏

整数还是浮点数?大型语言模型低位量化新展望

Integer or Floating Point? New Outlooks for Low-Bit Quantization on Large Language Models

Shanghai Jiao Tong University(上海交通大学);Peking University(北京大学);Microsoft Research Asia(微软亚洲研究院)

Yijia Zhang, Lingran Zhao, Shijie Cao, Wenqiang Wang, Ting Cao, Fan Yang, Mao Yang, Shanghang Zhang, Ningyi Xu

AI总结:

本研究比较了大型语言模型中低位INT与FP量化格式,发现最佳格式因层而异,提出混合格式量化(MoFQ)逐层选择最优格式,在W-only和WA场景下均达SOTA且无硬件开销。

摘要:

大型语言模型(LLM)的高效部署需要低位量化来最小化模型大小和推理成本。虽然低位整数格式(如INT8/INT4)一直是传统选择,但新兴的低位浮点格式(如FP8/FP4)提供了引人注目的替代方案,并获得了如NVIDIA H100 GPU等前沿硬件的支持。然而,对于LLM量化,低位INT与FP格式的优越性仍不明确。在本研究中,我们对相同位宽的INT和FP量化进行了比较分析,揭示了由于张量分布的复杂性和多样性,最佳量化格式在不同层间存在差异。因此,我们提出混合格式量化(MoFQ),在逐层基础上选择最佳格式。这种简单有效的方法在LLaMA上的多种任务测试中,于仅权重(W-only)和权重-激活(WA)训练后量化场景下均取得了最先进结果。在4位W-only量化中,MoFQ超越GPTQ,无需复杂超参调优且量化速度快一个数量级。而在8位WA量化中,MoFQ显著优于纯INT/FP方法,性能接近全精度模型。值得注意的是,由于位宽不变,MoFQ相比纯INT/FP量化不产生硬件开销。

英文摘要:

Efficient deployment of large language models (LLMs) necessitates low-bit quantization to minimize model size and inference cost. While low-bit integer formats (e.g., INT8/INT4) have been the conventional choice, emerging low-bit floating-point formats (e.g., FP8/FP4) offer a compelling alternative and are gaining support from cutting-edge hardware, such as NVIDIA's H100 GPU. However, the superiority of low-bit INT versus FP formats for quantization on LLMs remains unclear. In this study, we conduct a comparative analysis of INT and FP quantization with the same bit-width, revealing that the optimal quantization format varies across different layers due to the complexity and diversity of tensor distribution. Consequently, we advocate the Mixture of Formats Quantization (MoFQ), which selects the optimal format on a layer-wise basis. This simple yet effective approach achieves state-of-the-art results in both weight-only (W-only) and weight-activation (WA) post-training quantization scenarios when tested on LLaMA across various tasks. In 4-bit W-only quantization, MoFQ surpasses GPTQ without complex hyperparameter tuning and with an order of magnitude faster quantization speed. While in 8-bit WA quantization, MoFQ significantly outperforms INT/FP-only methods, achieving performance close to the full precision model. Notably, MoFQ incurs no hardware overhead compared to INT/FP-only quantization, as the bit-width remains unchanged.

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

↑