Abstract
As Large Language Models (LLMs) scale, the memory and computational requirements for deployment become increasingly prohibitive. Post-training quantization (PTQ) is a critical technique for mitigating these costs, yet standard scalar quantization methods often suffer from mathematical inefficiencies. This paper introduces NestQuant, a novel PTQ framework that utilizes the 8-dimensional Gosset lattice ($E_8$) to quantize weights, activations, and KV-caches. By transitioning from scalar to vector quantization, NestQuant achieves state-of-the-art perplexity on the Llama-3 family, significantly reducing the quality gap between quantized and full-precision models while maintaining practical inference speeds.
Introduction
The deployment of LLMs is characterized by two distinct bottlenecks: the compute-bound "pre-fill" phase and the memory-bound token generation phase. While weight-only quantization has reached a level of maturity, the simultaneous quantization of weights, activations, and the Key-Value (KV) cache remains a significant challenge. Most existing methods rely on uniform scalar quantization, which rounds individual values to the nearest grid point. However, this approach is fundamentally inefficient in high-dimensional spaces.
In high dimensions, Gaussian-distributed data—which LLM activations typically resemble following specific transforms—tends to cluster within a spherical volume. A standard hypercubic grid (the result of scalar quantization) fails to capture this geometry effectively, wasting approximately 32% of its "bitspace" on the empty corners of the cube. This lack of "shaping gain" forces a compromise between granular precision and the risk of clipping outliers. NestQuant addresses this by employing Vector Quantization (VQ) based on self-similar nested lattices.
Methodology
The Gosset Lattice ($E_8$)
NestQuant utilizes the 8-dimensional Gosset lattice ($E_8$) as its fundamental quantization unit. The $E_8$ lattice is mathematically significant as the densest sphere packing in eight dimensions. Beyond its density, it is chosen for its computational properties: there exists a highly efficient algorithm for finding the closest lattice point, which is essential for maintaining low-latency inference in LLMs.
Random Rotations and the Multi-Beta Strategy
To ensure that data distributions are amenable to lattice quantization, NestQuant applies randomized Hadamard transforms to both weights and activations. This process spreads out outliers and ensures the data is more "Gaussian-like."
To manage the high dynamic range of LLM activations, the framework introduces a Multi-Beta Strategy. This involves using a union of Voronoi codes at different scales ($\beta$). By selecting the optimal scale for a specific vector, the quantizer can minimize both granular rounding errors and massive overload errors (clipping), providing a more flexible fit than a single-scale grid.
Quantization-Aware LDLQ (QA-LDLQ)
Standard weight quantization algorithms, such as GPTQ, often falter when activations are also quantized because they do not account for the noise introduced into the input stream. NestQuant introduces Quantization-Aware LDLQ, an optimization process that adjusts model weights specifically to compensate for the noise generated by low-precision activations. This method effectively dampens the "noise amplification" seen in the deeper layers of large models like Llama-3-70B.
Experimental Results
NestQuant was evaluated across the Llama-2 and Llama-3 model families, focusing on 4-bit quantization across all components (W4A4KV4). The primary metric for quality was perplexity on the Wikitext2 dataset, supplemented by zero-shot reasoning benchmarks including ARC, Hellaswag, and PIQA.
Perplexity and Accuracy
NestQuant demonstrates "uniform superiority" over previous state-of-the-art (SOTA) methods:
- Llama-3-8B: At 4-bit precision, NestQuant achieved a perplexity of 6.6, compared to the FP16 baseline of 6.14. This significantly outperforms SpinQuant (7.3) and QuaRot (8.2).
- Llama-3-70B: The framework reached a perplexity of 3.61, closely approaching the FP16 baseline of 2.86 and surpassing OstQuant (4.01).
- Gap Reduction: Overall, NestQuant reduced the "perplexity gap"—the loss in model quality attributable to quantization—by more than 55% compared to Meta’s SpinQuant.
Computational Efficiency
While vector quantization is historically viewed as computationally expensive, NestQuant proves its viability through optimized CUDA kernels. A hardware-friendly variant, NestQuantM, maintains speeds faster than FP16 baselines on modern GPUs, demonstrating that the mathematical gains of the Gosset lattice do not come at the cost of deployment practicality.
Conclusion and Future Work
NestQuant represents a significant step forward in LLM compression by making high-dimensional vector quantization practical for real-world inference. By leveraging the shaping gains of the $E_8$ lattice and introducing quantization-aware weight optimization, it sets a new standard for 4-bit model performance.
Future research may explore the integration of NestQuant with Quantization-Aware Training (QAT) to further close the gap with full-precision models. Additionally, as hardware evolves, the development of specialized vector-processing units could further unlock the theoretical speed advantages of lattice-based quantization.
Summary updated