[Paper Review] Integer or Floating Point? New Outlooks for Low-Bit Quantization on Large Language Models
This paper proposes Mixture of Formats Quantization (MoFQ), a layer-wise approach that dynamically selects between INT and FP formats of the same bit-width (e.g., INT8/FP8) to optimize low-bit quantization of large language models. MoFQ achieves state-of-the-art performance in both weight-only and weight-activation quantization, surpassing GPTQ in 4-bit W-only quantization with 10x faster speed and matching full-precision accuracy in 8-bit WA quantization without hardware overhead.
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.
Motivation & Objective
- To investigate whether INT or FP quantization formats are superior for low-bit quantization of large language models.
- To address the lack of consistent superiority of INT or FP formats across different layers due to diverse tensor distributions.
- To develop a practical, hardware-compatible method that selects the optimal format per layer to minimize quantization error.
- To achieve state-of-the-art performance in both weight-only and weight-activation quantization without increasing bit-width or hardware cost.
Proposed method
- The method evaluates quantization error using metrics such as tensor MSE, layer output MSE, or model output MSE to select the optimal format per layer.
- MoFQ selects between INT and FP formats of the same bit-width (e.g., INT8 vs. FP8) on a layer-wise basis, ensuring consistent data type and bit-width per layer.
- The format selection is based on empirical error minimization, with no need for complex hyperparameter tuning or second-order optimization.
- MoFQ is compatible with existing hardware for INT-only quantization and integrates seamlessly with emerging FP8-capable hardware like NVIDIA H100.
- The approach maintains the same bit-width and data type per layer, avoiding additional hardware or memory overhead.
- It supports both weight-only quantization (for model compression) and weight-activation quantization (for inference acceleration).
Experimental results
Research questions
- RQ1Does INT or FP quantization with the same bit-width (e.g., 8-bit) consistently outperform the other across all layers of a large language model?
- RQ2How do tensor distribution characteristics—such as dynamic vs. static, outlier presence, and value range—affect the relative performance of INT and FP quantization?
- RQ3Can a mixed-format strategy that selects the optimal format per layer achieve better quantization accuracy than uniform INT or FP quantization?
- RQ4What is the hardware efficiency trade-off between INT and FP multiply-accumulate units at low bit-widths like 8-bit and 4-bit?
- RQ5Can a simple, low-overhead format selection strategy outperform complex, hyperparameter-intensive methods like GPTQ in 4-bit weight-only quantization?
Key findings
- In 4-bit weight-only quantization, MoFQ achieves performance comparable to or better than GPTQ, with an order of magnitude faster quantization speed.
- For 8-bit weight-activation quantization, MoFQ significantly outperforms both pure INT8 and FP8 methods, achieving model accuracy close to the full-precision FP16 baseline.
- MoFQ achieves state-of-the-art results on multiple benchmarks (WikiText-2, LAMBADA, PIQA, HellaSwag) across LLaMA and OPT models of varying sizes.
- On WikiText-2, MoFQ8 achieves a perplexity of 5.41 on LLaMA-13B, outperforming FP8 (5.41) and INT8 (637.95), with a 92.7% FP8 ratio in the selected format.
- The method maintains minimal accuracy loss across models: for LLaMA-33B, MoFQ8 achieves 0.859 average accuracy on LAMBADA, compared to 0.862 for FP16, with 90.0% of layers using FP8.
- MoFQ incurs no hardware overhead compared to INT-only quantization, as the bit-width and data type per layer remain unchanged.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.