[KongchangAI]
· 2 min read· 1,084 words

NestMSQ: Nested Multi-State Quantization Makes LLM Inference Fast and Accurate

NestMSQ: Nested Multi-State Quantization Makes LLM Inference Fast and Accurate

NestMSQ enables a single INT8 checkpoint to switch between 4/8-bit precision per request, balancing latency and accuracy.

NestMSQ proposes nested multi-state quantization, embedding low-precision models within high-precision bits so a single INT8 checkpoint offers W4A4, W8A8, W4A16, and W8A16 modes without separate deployments. Calibrating each mode separately and jointly selecting INT8 weights narrows the W4A4 perplexity gap by 73%. On 8B models, per-mode accuracy is within 1.3 points of separately quantized models, and W8A8 prefilling plus W4A16 decoding achieves 1.96–2.61× BF16 throughput within 2.6 points of BF16.

In large language model deployment, latency and accuracy often trade off against each other: pursuing low latency means accepting quantization loss, while pursuing high accuracy means bearing greater computational overhead. NestMSQ proposes a nested multi-state quantization scheme that lets a single INT8 checkpoint flexibly switch between different precision modes, eliminating the need to deploy a separate model for each precision level.

NestMSQ paper title

Nested Quantization: One Checkpoint, Multiple Precisions

The core idea of Nested Quantization is to embed low-precision models within the bits of high-precision models. This way, a single checkpoint can simultaneously serve requests with different latency and accuracy requirements. As a post-training quantization (PTQ) method, NestMSQ's INT8 checkpoint can provide 4-bit weights (speed-first) and 8-bit weights (accuracy-first), paired with low-bit activations for arithmetic-intensive long prefilling (W4A4, W8A8), or with 16-bit activations for bandwidth-intensive low-batch decoding (W4A16, W8A16). The shared checkpoint can switch precision within a single request and between the prefill and decode phases without reloading another model.

Post-training quantization (PTQ) and quantization-aware training (QAT) are the two main paths for model compression. PTQ directly maps weights and activations to low precision after model training is complete, requiring no retraining; it has low deployment cost and strong generality, but accuracy loss is relatively harder to control. QAT, on the other hand, simulates quantization error during the training phase, letting model parameters actively adapt to low-precision representations; it typically achieves better accuracy but requires substantial compute and labeled data. NestMSQ falls under the PTQ category, and its challenge lies in this: without error adaptation during training, it can only rely on compensation over calibration data to offset rounding errors, so the design of the calibration strategy directly determines final accuracy.

Notations such as W4A4 and W8A8 denote the bit widths of weights (Weight) and activations (Activation). Weights determine model storage size and memory access bandwidth, while activations determine the computational precision and arithmetic intensity of matrix multiplication. W4A4 compresses both to 4 bits, offering the highest compute efficiency but the greatest accuracy loss, making it suitable for the compute-intensive prefill phase; W8A8 maintains 8 bits for more stable accuracy; W4A16 and W8A16 retain 16-bit activations and halve weight memory access, making them suitable for the bandwidth-constrained, small-batch decode phase. Understanding this distinction is the prerequisite for grasping NestMSQ's mode-switching logic.

The Calibration Challenge: Each Mode "Sees" Different Data

Quantization accuracy loss mainly comes from rounding errors. Compensation-based PTQ offsets these errors by adjusting weights that have not yet been quantized, but nested weight precisions already prefer different adjustment schemes, and changes in activation precision cause each mode to evaluate errors on different inputs. In other words, the four modes (W4A4, W8A8, W4A16, W8A16) face different layer inputs and rounding errors during calibration. If inputs and adjustments are shared, the compensation effect is compromised.

NestMSQ's solution is to calibrate each mode separately on its own inputs, preserving each mode's preferred adjustments, while jointly selecting each INT8 weight for all modes. Compared with sharing inputs and adjustments, this strategy narrows the gap between W4A4 perplexity and separately quantized models by 73%.

Compensation-based PTQ (such as GPTQ-style methods) quantizes weights layer by layer and, after quantizing part of the weights, uses forward propagation results on calibration data to adjust the remaining unquantized weights so that the layer output approximates the full-precision output as closely as possible. Its effectiveness depends heavily on two things: whether the calibration inputs represent the true distribution, and whether the error compensation objective is consistent with final accuracy. In nested quantization, different bit-width modes have different sensitivities to the rounding errors of the same set of INT8 weights, and changes in activation precision alter each layer's input distribution, so the calibration inputs and error surfaces each mode "sees" are not the same. NestMSQ has each mode calibrate independently on its own inputs and then jointly select shared INT8 weights, essentially finding a common compromise among multiple error objectives.

Perplexity is the most commonly used intrinsic evaluation metric for language models, measuring the model's predictive uncertainty over a given text sequence; a lower value indicates the model is more "confident" about the correct next word. It is easy to compute and correlates reasonably well with human judgment, so it is often used as a quick proxy for quantization accuracy. However, perplexity does not directly reflect downstream task performance, so NestMSQ's empirical tests also include task-level evaluations such as MATH-500 to verify whether the narrowed perplexity gap translates into actual capability retention.

Empirical Performance: Balancing Accuracy and Speed

On two 8B models, the nested checkpoint's average accuracy gap versus separately quantized models is within 1.3 percentage points in every mode. For single-request scenarios, W4A4 prefilling followed by W4A16 decoding preserves W4A4's speed while achieving accuracy on MATH-500 comparable to W4A16. When long-input W4A4 prefilling causes accuracy loss, W8A8 prefilling paired with W4A16 decoding keeps the gap versus BF16 within 2.6 percentage points across three tasks, while output throughput reaches 1.96 to 2.61 times that of BF16.

Dynamic Precision in Continuous Batching

This flexibility also extends to continuous batching serving scenarios: as the number of parallel requests changes, the system can adaptively adjust precision. When there are few requests and bandwidth is constrained, it uses high-bit activations; when there are many requests and compute is intensive, it switches to low-bit modes, thereby maintaining a balance between throughput and quality under dynamic load.

NestMSQ's value lies in turning "precision selection" from a deployment decision into a runtime decision, giving LLM serving systems a finer-grained means of performance tuning.

One-line Summary

NestMSQ uses nested quantization to let a single INT8 checkpoint switch between 4/8-bit precision per request, balancing latency and accuracy.

Paragraph Summary

NestMSQ proposes nested multi-state quantization, embedding low-precision models within the bits of high-precision models so that a single INT8 checkpoint can simultaneously provide four precision modes—W4A4, W8A8, W4A16, and W8A16—without deploying a separate model for each precision. To address the problem that each mode has different calibration inputs and rounding errors, NestMSQ calibrates each mode separately and jointly selects INT8 weights, narrowing the W4A4 perplexity gap by 73%. On two 8B models, the average accuracy gap versus separately quantized models is within 1.3 percentage points across modes; W8A8 prefilling plus W4A16 decoding stays within 2.6 percentage points of BF16, with output throughput reaching 1.96 to 2.61 times that of BF16. The scheme also supports dynamically adjusting precision with the number of parallel requests in continuous batching, turning precision selection from a deployment decision into a runtime decision.

#NestMSQ#nested quantization#post-training quantization#LLM inference#INT8 checkpoint#W4A4#quantization accuracy
Share:

Related articles