Abstract
How can we quantize large language models while preserving accuracy? Quantization is essential for deploying large language models (LLMs) efficiently. Binary-coding quantization (BCQ) and uniform quantization (UQ) are promising quantization schemes that have strong expressiveness and optimizability, respectively. However, neither scheme leverages both advantages. In this paper, we propose UniQuanF (Unified Quantization with Flexible Mapping), an accurate quantization method for LLMs. UniQuanF harnesses both strong expressiveness and optimizability by unifying the flexible mapping technique in UQ and BCQ’s non-uniform quantization levels. We propose unified initialization, and local and periodic mapping techniques to optimize the parameters in UniQuanF precisely. After optimization, our unification theorem removes computational and memory overhead, allowing us to utilize the superior accuracy of UniQuanF without extra deployment costs induced by the unification. Experimental results demonstrate that UniQuanF outperforms existing UQ and BCQ methods, achieving up to 4.60% higher accuracy on GSM8K benchmark.
Introduction: The Challenge of LLM Compression
As Large Language Models (LLMs) grow in size, deploying them on consumer hardware becomes nearly impossible without quantization—the process of reducing the precision of model weights (e.g., from 16-bit floats to 4-bit integers). Currently, the field is split between two main strategies:
- Uniform Quantization (UQ): The industry standard. It is easy to optimize because the "buckets" for weights are evenly spaced. However, it is "stiff" and often fails to fit the actual distribution of weights accurately.
- Binary-coding Quantization (BCQ): Highly expressive because it allows for non-uniform spacing, meaning it can "hug" the data more closely. However, it is notoriously difficult to optimize for LLMs, often leading to poor accuracy despite its theoretical potential.
The authors identify a missed opportunity: UQ has mature optimization tools, while BCQ has a superior underlying structure. UniQuanF (Unified Quantization with Flexible Mapping) is designed to capture the strengths of both.
Methods: The UniQuanF Framework
UniQuanF bridges the gap between UQ and BCQ through three key innovations:
- The UniQuan Framework: The authors mathematically prove that UQ is a restricted version of BCQ. By integrating UQ’s transformation steps (scaling and shifting) directly into BCQ’s mapping process, they allow the model to explore a much wider range of quantization levels during training.
- Unified Initialization: Instead of starting from scratch, UniQuanF jointly initializes parameters using both a grid search (from UQ) and alternating updates (from BCQ). This ensures the optimization starts in a high-quality "neighborhood."
- Local and Periodic Mapping: To speed up optimization, the authors exploit "temporal sparsity." They observed that 99.97% of weights stay in their original or adjacent buckets during training. By only checking neighboring buckets every few steps, they drastically reduce computational overhead.
- The Unification Theorem: This mathematical proof allows the complex, optimized parameters to be collapsed back into a standard BCQ format. Consequently, the final model runs on existing fast BCQ kernels (like LUT-GEMM) with zero extra cost in memory or speed.
Key Insights: Optimization vs. Expressiveness
The core realization of this work is that UQ’s success stems not from uniform levels being inherently better, but from more mature optimization techniques. By porting these optimization tricks to the flexible BCQ structure, UniQuanF unlocks significant performance gains.
As shown in case studies, UniQuanF naturally assigns more "buckets" near zero (where most weights reside) and fewer for outliers. This "dense-near-zero" mapping preserves accuracy better than uniform spacing. Furthermore, because of the Unification Theorem, UniQuanF provides a "free lunch"—superior accuracy with the deployment speed of a simple scheme.
Experimental Results
The researchers evaluated UniQuanF across popular LLMs, including Llama-3 (8B and 70B) and Mistral 7B, using benchmarks like MMLU, WikiText2, and GSM8K. Calibration was performed using 128 token sequences from the C4 dataset.
UniQuanF consistently outperformed state-of-the-art methods like FlexRound and OmniQuant:
- Mathematical Reasoning: On GSM8K, UniQuanF achieved up to 4.60% higher accuracy than the best UQ methods.
- General Knowledge: On MMLU, it outperformed FlexRound by 1-3% across different model sizes.
- Low Bit-Width Performance: Gains were most pronounced at 3-bit quantization, where standard schemes often fail. For Llama-3 8B, UniQuanF maintained significantly lower perplexity than competitors.
Limitations and Future Work
UniQuanF currently focuses on weight-only quantization. While this addresses memory bottlenecks, activation quantization remains a separate challenge for future exploration. Additionally, the authors plan to investigate unifying other UQ techniques (like AWQ or GPTQ) into this framework and exploring even more exotic non-uniform quantization schemes.
Summary updated