NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

QuaRot: Outlier-Free 4-Bit Inference in Rotated LLMs

Saleh Ashkboos, Amirkeivan Mohtashami, Maximilian L. Croci, Bo Li, Pashmina Cameron, Martin Jaggi, Dan Alistarh, Torsten Hoefler, James Hensman

TL;DR

QuaRot introduces a quantization scheme that enables end-to-end 4-bit inference for Large Language Models (LLMs) by using randomized rotations to eliminate activation outliers. By applying Hadamard transformations to the model's internal representations, the authors achieve near-lossless 4-bit quantization of weights, activations, and the KV cache, delivering up to 3.33× prefill speedups and significant memory savings on consumer-grade hardware.

What Problem Does This Paper Address?

Quantizing LLMs to 4 bits is a "holy grail" for efficient inference, but it faces a major hurdle: activation outliers. While model weights are generally well-behaved and easy to compress, activations (the intermediate signals passing through the network) often contain specific channels with values significantly larger than the rest.

Standard quantization methods struggle with these outliers because they force the quantization grid to cover a huge range, which destroys the precision for the majority of "normal" values. Previous solutions either kept these outliers in higher precision (mixed-precision) or used complex calibration-heavy scaling. Mixed-precision approaches are difficult to implement efficiently in hardware kernels, often negating the speed benefits of quantization. QuaRot aims for a "pure" 4-bit solution where all matrix multiplications happen in low precision without needing to track specific outlier channels.

Methods

The core innovation of QuaRot is the use of Computational Invariance through orthogonal rotations. The authors leverage the fact that if you rotate the input to a linear layer by an orthogonal matrix $Q$ and rotate the weights by $Q^T$, the output remains mathematically identical.

  1. Randomized Hadamard Transformations: The authors apply these rotations to the hidden states of the LLM. Because Hadamard matrices are orthogonal and have entries of $\pm 1/\sqrt{d}$, multiplying by them effectively "smears" the energy of outlier features across all dimensions. As shown in Figure 1, this transforms a spikey distribution into a dense, uniform one that is much easier to quantize.
Figure 1: The distributions of activations at the input to the FFN block in LLAMA2-7B model, in the tenth layer. Left: using the default configuration as downloaded from Hugging Face. Right: after processing using QuaRot. The processed distribution has no outliers, leading to superior quantization.
  1. Weight Fusing: Many of these rotations are fused directly into the weight matrices offline. For example, the RMSNorm scaling is absorbed into adjacent weights, and the rotation matrices are pre-multiplied into the weights, meaning there is zero runtime overhead for these specific transformations.
  2. Online Hadamard Kernels: For parts of the network where rotations cannot be fused (like before the down-projection in the Feed-Forward Network), the authors insert fast, online Walsh-Hadamard Transform (WHT) kernels.
  3. Attention & KV Cache Rotation: The authors extend this logic to the attention mechanism, rotating keys and queries to ensure the KV cache—often the primary memory bottleneck during long-sequence generation—can also be stored in 4 bits.

Datasets

The authors evaluated QuaRot across several standard benchmarks:

  • Language Generation: WikiText-2 was used to measure perplexity, a standard metric for how well the model retains its linguistic capabilities.
  • Zero-Shot Tasks: A suite of six tasks including PIQA, WinoGrande, HellaSwag, ARC (Easy and Challenge), and LAMBADA to test general reasoning and knowledge retrieval.
  • Models: The primary evaluation was performed on the LLaMA-2 family (7B, 13B, and 70B parameters), with additional results provided for LLaMA-3 and Phi-3-mini.

Key Insights and Ideas

  • Outliers are a Coordinate System Artifact: The paper suggests that outliers aren't inherent to the information the model processes, but rather how that information is oriented in the high-dimensional space. By simply changing the "viewpoint" (rotating), the outliers disappear.
  • End-to-End 4-Bit is Possible: Unlike previous work that required keeping some layers or features in 8-bit or 16-bit, QuaRot demonstrates that a unified 4-bit pipeline for weights, activations, and KV cache is viable.
  • Hardware-Friendly Incoherence: By making the activations "incoherent" (uniform), the authors can use simple round-to-nearest (RTN) quantization for activations, which is much easier to implement in high-performance CUDA kernels than mixed-precision logic.

Key Results

QuaRot achieves impressive performance, particularly on larger models where the relative error of quantization tends to decrease:

  • Accuracy: For LLaMA2-70B, the 4-bit model (A4W4KV4) shows a perplexity loss of only 0.47 on WikiText-2 and retains 99% of the zero-shot performance compared to the FP16 baseline.
  • Speed: On an NVIDIA RTX 3090, QuaRot achieved up to 3.33× speedup in the prefill stage for LLaMA2-70B.
Prefill speedups for different batch sizes.
  • Memory: The 4-bit KV cache enables massive memory savings during the decoding phase—up to 3.89×—which is critical for serving models with long context windows.
  • Lossless 6/8-bit: The authors show that for 6-bit and 8-bit quantization, QuaRot is essentially lossless and requires no calibration data.

Limitations and Future Work

  • Model Sensitivity: The authors noted that LLaMA-3 is significantly more sensitive to quantization than LLaMA-2, showing a larger accuracy gap even with QuaRot. This suggests that newer training techniques might be making models less robust to bit-width reduction.
  • Kernel Optimization: While the speedups are significant, the authors mention that their CUDA kernels could be further optimized, for instance, by fusing the quantization operations directly into the MatMul kernels.
  • Architecture Extensions: The current work focuses on standard Transformer architectures. Extending this to Mixture-of-Experts (MoE) or models with different normalization schemes remains an open area for research.

Summary updated

BibTeX
@inproceedings{ashkboos2024quarot,
  author = {Saleh Ashkboos and Amirkeivan Mohtashami and Maximilian L. Croci and Bo Li and Pashmina Cameron and Martin Jaggi and Dan Alistarh and Torsten Hoefler and James Hensman},
  title = {{QuaRot: Outlier-Free 4-Bit Inference in Rotated LLMs}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=dfqsW38v1X},
}
Figure