FlexQuant: A Flexible and Efficient Dynamic Precision Switching Framework for LLM Quantization

Fangxin Liu, Zongwu Wang, JinHong Xia, Junping Zhao, Shouren Zhao, Jinjin Li, Jian Liu, Li Jiang, Haibing Guan

Abstract

The rapid advancement of large language models (LLMs) has exacerbated the memory bottleneck due to the widening gap between model parameter scaling and hardware capabilities. While post-training quantization techniques effectively reduce memory overhead, existing methods predominantly rely on static quantization strategies, which struggle to adapt to dynamic workloads. To address this, we propose FlexQuant, a dynamic precision-switching framework that optimizes the trade-off between inference speed and accuracy. Leveraging model perplexity entropy and Kullback-Leibler divergence, FlexQuant enables fine-grained, layer-wise mixed-precision quantization and dynamically adjusts bit-widths during each token generation. FlexQuant provides a comprehensive analysis of quantization strategies, introduces a precision requirement model for optimal switching, and implements efficient fine-grained precision management. Evaluations demonstrate that FlexQuant achieves a 1.3× end-to-end speedup across diverse language tasks with negligible accuracy loss introduced. This framework offers a flexible and adaptive solution for efficient LLM deployment.

Introduction

Large Language Models (LLMs) are scaling at an astronomical rate—roughly 240-fold every two years—vastly outstripping the 3.1-fold improvement in memory hardware capabilities over the same period. This "memory wall" makes deploying state-of-the-art LLMs prohibitively expensive and slow. While quantization (converting high-precision weights to lower bit-widths like 4-bit or 8-bit) is the standard solution to reduce memory overhead, most existing methods are static, applying a fixed precision regardless of the workload.

LLM inference is inherently dynamic. The "decoding" phase, where text is generated token-by-token, is heavily bottlenecked by memory bandwidth. While lower precision (e.g., INT4) speeds up this process, applying it statically across the entire model often leads to unacceptable accuracy drops. FlexQuant addresses this by treating quantization as a sliding scale, switching precision on-the-fly to optimize the speed-accuracy trade-off.

The FlexQuant Framework

FlexQuant introduces a dynamic precision-switching mechanism that distinguishes between the prefill and decoding stages of inference. It starts in INT8 (W8A8) during the prefill stage to maximize accuracy and then dynamically swaps in INT4 weights for specific layers during the decoding stage.

FlexQuant framework overview showing the transition from the Prefill Stage to the dynamic Decode Stage.

Unlike previous "progressive" methods that downshift the entire model at once, FlexQuant performs fine-grained, layer-wise switching. This is made possible by an efficient fine-grained precision management system that targets the memory-intensive decoding phase.

Metrics for Dynamic Switching

The framework relies on two primary metrics to manage precision effectively:

  1. Perplexity Entropy (PPLE): This metric determines when to switch. PPLE measures the "uncertainty" of the model's predictions. As an LLM generates more tokens in a sequence, its "fault tolerance" often increases—the gap between the most likely next word and the runner-up grows. When the moving average of PPLE drops below a controllable threshold, FlexQuant identifies that the model is "confident" enough to handle lower precision.
  2. KL Divergence Analysis: This determines which layers to switch. Not all layers are equally sensitive to quantization. By analyzing Kullback–Leibler (KL) divergence offline, FlexQuant identifies robust layers that can be compressed to 4-bit with minimal distribution shift, prioritizing them for downshifting.
Smoothed Perplexity Entropy (PPLE) decreases as more tokens are generated, indicating increased model confidence.

Experimental Evaluation

FlexQuant was evaluated across several standard benchmarks, including CNN/DM (news summarization), DialogSum (dialogue summarization), IWSLT (translation), and LongWriter (long-context generation up to 10,000+ words).

Key results include:

  • Speedup: FlexQuant achieved a 1.3× end-to-end speedup on long-context tasks compared to FP16 baselines.
  • Accuracy Preservation: On the challenging LongWriter task, static INT8 and INT4 quantization caused Rouge-L scores to plummet (to 46 and 26, respectively). FlexQuant maintained significantly higher quality, matching the performance of much heavier models (e.g., a score of 89.43 with the FQ-1.3 configuration).
  • Tunability: The framework allows users to adjust the PPLE trigger to prioritize either extreme speed or maximum fidelity, providing a level of flexibility missing in static schemes.

Limitations and Future Work

While FlexQuant offers significant improvements, it currently requires storing multiple copies of weights (e.g., INT8 and INT4) to allow for rapid switching, which increases the total storage footprint. Future work will focus on integrating Key-Value (KV) cache quantization, which becomes a bottleneck in extremely long sequences, and optimizing hardware kernels for even lower bit-widths (e.g., 2-bit) to further enhance speedups.

Summary updated

BibTeX
@inproceedings{liu2025flexquant,
  author = {Fangxin Liu and Zongwu Wang and JinHong Xia and Junping Zhao and Shouren Zhao and Jinjin Li and Jian Liu and Li Jiang and Haibing Guan},
  title = {{FlexQuant: A Flexible and Efficient Dynamic Precision Switching Framework for LLM Quantization}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2025},
  url = {https://openreview.net/forum?id=FzhrrKtedR},
}
Figure