[Paper Review] FlexRound: Learnable Rounding based on Element-wise Division for Post-Training Quantization
FlexRound proposes a learnable rounding mechanism for post-training quantization (PTQ) that uses element-wise division to jointly optimize a common quantization grid size and per-weight scaling factors, enabling flexible, magnitude-aware quantization. It achieves state-of-the-art performance on image classification, NLP understanding, and generation tasks, including efficient 4-bit quantization of large language models with minimal accuracy drop.
Post-training quantization (PTQ) has been gaining popularity for the deployment of deep neural networks on resource-limited devices since unlike quantization-aware training, neither a full training dataset nor end-to-end training is required at all. As PTQ schemes based on reconstructing each layer or block output turn out to be effective to enhance quantized model performance, recent works have developed algorithms to devise and learn a new weight-rounding scheme so as to better reconstruct each layer or block output. In this work, we propose a simple yet effective new weight-rounding mechanism for PTQ, coined \emph{FlexRound}, based on element-wise division instead of typical element-wise addition such that FlexRound enables jointly learning a common quantization grid size as well as a different scale for each pre-trained weight. Thanks to the reciprocal rule of derivatives induced by element-wise division, FlexRound is inherently able to exploit pre-trained weights when updating their corresponding scales, and thus, flexibly quantize pre-trained weights depending on their magnitudes. We empirically validate the efficacy of FlexRound on a wide range of models and tasks. To the best of our knowledge, our work is the first to carry out comprehensive experiments on not only image classification and natural language understanding but also natural language generation. Moreover, we demonstrate, for the first time, that large language models can be efficiently quantized, with only a negligible impact on performance compared to half-precision baselines, achieved by reconstructing the output in a block-by-block manner. Our code is available at \url{https://github.com/onliwad101/FlexRound_LRQ}.
Motivation & Objective
- To address the performance degradation in post-training quantization (PTQ) caused by rigid, uniform rounding schemes.
- To enable more effective quantization of pre-trained models by adapting scaling per weight based on magnitude.
- To develop a learnable rounding mechanism that jointly optimizes grid size and per-weight scales without requiring full retraining.
- To demonstrate the effectiveness of the method across diverse tasks, including natural language generation and large language models.
- To show that 4-bit quantization of large language models can be achieved with near-half-precision performance using block-wise output reconstruction.
Proposed method
- FlexRound replaces traditional element-wise addition in weight rounding with element-wise division to enable gradient flow that respects the magnitude of pre-trained weights.
- It jointly learns a shared quantization grid size and individual scale factors for each pre-trained weight via a differentiable rounding mechanism.
- The method leverages the reciprocal rule of derivatives in division to allow pre-trained weights to guide scale updates, enabling magnitude-aware quantization.
- Scales are optimized via gradient descent using a reconstruction loss on layer/block outputs, minimizing the approximation of quantization-induced loss degradation.
- The approach supports per-channel and per-tensor quantization and is applied block-wise to reconstruct outputs in a manner that preserves model performance.
- It is compatible with existing PTQ frameworks and can be integrated into existing quantization pipelines with minimal modification.
Experimental results
Research questions
- RQ1Can a learnable rounding mechanism based on element-wise division outperform existing PTQ methods in terms of accuracy and flexibility?
- RQ2Does magnitude-aware scaling via division improve quantization performance, especially for large weights?
- RQ3Can FlexRound effectively enable low-bit (e.g., 4-bit) quantization of large language models with minimal performance degradation?
- RQ4How does FlexRound compare to AdaRound and other state-of-the-art PTQ methods across diverse tasks, including image classification, NLP understanding, and generation?
- RQ5Is block-wise output reconstruction effective for maintaining performance in high-parameter models like LLaMA-33B under low-precision quantization?
Key findings
- FlexRound achieves state-of-the-art results on image classification and NLP understanding benchmarks, outperforming AdaRound and other PTQ methods.
- On WikiText2, FlexRound with 8-bit weights achieves a perplexity of 5.73 for LLaMA-7B, compared to 6.19 for AdaRound, demonstrating a 7.3% relative improvement.
- For 4-bit quantization, FlexRound reduces perplexity to 5.63 for LLaMA-7B on WikiText2, outperforming AdaRound's 5.72 and showing minimal degradation from half-precision baselines.
- On PTB, FlexRound with 8-bit weights achieves a perplexity of 9.28 for LLaMA-7B, compared to 9.85 for AdaRound, a 6.1% relative improvement.
- With 3-bit weights, FlexRound maintains a perplexity of 5.88 for LLaMA-7B on WikiText2, significantly outperforming AdaRound's 6.41, indicating strong low-bit quantization capability.
- For LLaMA-33B, FlexRound with 4-bit weights achieves a perplexity of 4.32 on WikiText2, only 0.26 higher than the half-precision baseline of 4.06, demonstrating near-precision performance.
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.