Abstract
Although LLM inference has emerged as a critical workload for many downstream applications, efficiently inferring LLMs is challenging due to the substantial memory footprint and bandwidth requirements. In parallel, compute capabilities have steadily outpaced both memory capacity and bandwidth over the last few decades, a trend that remains evident in modern GPU hardware and exacerbates the challenge of LLM inference. As such, new algorithms are emerging that trade increased computation for reduced memory operations. To that end, we present XQuant, which takes advantage of this trend, enabling an order-of-magnitude reduction in memory consumption through low-bit quantization with substantial accuracy benefits relative to state-of-the-art KV cache quantization methods. We accomplish this by quantizing and caching the layer input activations X, instead of using standard KV caching, and then rematerializing the Keys and Values on-the-fly during inference. This results in an immediate 2$\times$ memory savings compared to KV caching. By applying XQuant, we achieve up to $\sim 7.7\times$ memory savings with $<0.1$ perplexity degradation compared to the FP16 baseline. Furthermore, our approach leverages the fact that X values are similar across layers. Building on this observation, we introduce XQuant-CL, which exploits the cross-layer similarity in the X embeddings for extreme compression. Across different models, XQuant-CL attains up to 10$\times$ memory savings relative to the FP16 baseline with only 0.01 perplexity degradation, and 12.5$\times$ memory savings with only $0.1$ perplexity degradation.
The Memory Wall in LLM Inference
Large Language Model (LLM) inference is currently constrained by a "Memory Wall." While GPU compute power (FLOPs) has grown exponentially, memory capacity and bandwidth have lagged. During inference, the KV cache—which stores the representations of all previous tokens—grows linearly with sequence length. For long-context tasks or large batches, this cache becomes a massive bottleneck, forcing the GPU to spend most of its time waiting for data movement rather than processing. Existing solutions that quantize the KV cache to 2 or 4 bits often suffer from significant accuracy degradation because Keys and Values have complex distributions with "outliers" that are difficult to compress.
Methodology: X-Rematerialization
XQuant introduces a paradigm shift by caching input activations ($X$) instead of the standard Key-Value (KV) pairs. Since $K = XW_k$ and $V = XW_v$, the model can recompute $K$ and $V$ during the attention step. This "rematerialization" trades abundant compute cycles for scarce memory bandwidth.
Beyond basic rematerialization, XQuant employs two key innovations:
- XQuant-CL (Cross-Layer): Transformers utilize a residual stream, meaning input $X$ changes minimally between layers. XQuant-CL exploits this by caching the first layer in high precision and only storing the deltas (differences) for subsequent layers. These deltas have a smaller range, facilitating ultra-low bit-width quantization (e.g., 2-bit).
- SVD for GQA: For models using Grouped-Query Attention (GQA), XQuant uses Singular Value Decomposition (SVD) to project $X$ into a lower-dimensional latent space before caching, ensuring the footprint remains smaller than a standard KV cache.
Performance and Compression Results
Evaluations across benchmarks like WikiText-2, C4, and LongBench demonstrate that XQuant significantly outperforms existing state-of-the-art (SOTA) methods like KVQuant and KIVI.
Key results include:
- Extreme Compression: XQuant-CL achieved 12.5× memory savings relative to the FP16 baseline with only a 0.1 perplexity degradation.
- High Fidelity: At 3-bit quantization, XQuant-CL achieved 10× savings with a negligible 0.01 perplexity loss, surpassing non-uniform quantization schemes.
- Hardware Efficiency: On H100 GPUs, XQuant supports sequence lengths up to 40.6K tokens without recomputation becoming a latency bottleneck, as the extra compute is effectively "hidden" by memory stalls.
Conclusion
XQuant demonstrates that the rapidly increasing compute capabilities of modern hardware can be leveraged to eliminate the memory bottleneck in LLM inference. By shifting the focus from KV caching to activation rematerialization and cross-layer delta compression, XQuant achieves near-FP16 accuracy while providing an order-of-magnitude reduction in memory consumption.
Summary updated