Nested quantization of large language models embeds lower-precision models in the bits of a higher-precision one, so one checkpoint serves requests with different latency and accuracy needs without deploying a separate model for each precision. We present NestMSQ (Nested Multi-State Quantization), a post-training quantization (PTQ) method whose INT8 checkpoint provides 4-bit weights for speed and 8-bit weights for accuracy, each with low-bit activations for arithmetic-heavy long prefill (W4A4, W8A8) or with 16-bit activations for bandwidth-heavy low-batch decoding (W4A16, W8A16). The shared checkpoint can switch precision per request and between prefill and decoding without loading another model. During calibration, different weight and activation precisions give the four modes different layer inputs and rounding errors. Compensation-based PTQ offsets rounding errors by adjusting weights still to be quantized. Nested weight precisions already favor different adjustments, while varying activation precision also makes the modes evaluate these errors on different inputs. NestMSQ therefore calibrates each mode on its own inputs and keeps its preferred adjustments separate while choosing each INT8 weight jointly for all modes. Compared with sharing inputs and adjustments, this closes 73% of the W4A4 perplexity gap to a separately quantized model. Across two 8B models, the nested checkpoint stays within 1.3 average-accuracy points of separately quantized models in every mode. For single requests, W4A16 decoding after a W4A4 prefill keeps W4A4 speed and matches W4A16 accuracy on MATH-500. When long-input W4A4 prefill costs accuracy, W8A8 prefill with W4A16 decoding stays within 2.6 points of BF16 on three tasks at 1.96 to 2.61 times its output throughput. This flexibility extends to continuous-batching serving, where precision adapts as the number of parallel requests changes.
翻译:暂无翻译