STaMP: Sequence Transformation and Mixed Precision for Low-Precision Activation Quantization

Marco Federici, Riccardo Del Chiaro, Boris van Breugel, Paul N. Whatmough, Markus Nagel

TL;DR

STaMP (Sequence Transformation and Mixed Precision) is a novel quantization strategy that drastically reduces the accuracy loss of 4-bit generative models by exploiting local correlations in text and images. By applying linear transformations along the sequence dimension and keeping just a few "high-energy" tokens at higher precision, it achieves state-of-the-art efficiency with minimal computational overhead.

What Problem Does This Paper Address?

To run massive generative AI models (like Llama 3 or PixArt-Σ) on edge devices, we need to shrink them. Quantization—reducing the precision of weights and activations from 16-bit floats to 8-bit or even 4-bit integers—is the standard tool for this.

However, when we push activations down to 4 bits, accuracy usually falls off a cliff. This is primarily due to "outliers"—specific values in the data that are much larger than the rest, forcing the quantization scale to be so wide that the smaller, more common values lose all detail.

Existing solutions (like SmoothQuant or QuaRot) try to fix this by rotating or scaling the feature dimension (the channels). This paper identifies a major missed opportunity: these methods completely ignore the sequence dimension (the pixels in an image or tokens in a sentence), where data is often highly correlated and predictable.

Methods

The authors propose STaMP, which combines two key ideas to tackle activation outliers:

  1. Sequence Transformation: Drawing inspiration from classical media compression (like JPEG), they apply a linear transformation—specifically the Discrete Wavelet Transform (DWT) or Discrete Cosine Transform (DCT)—along the sequence dimension. Because neighboring pixels or words are similar, these transforms "concentrate" the signal's energy into just a few tokens at the start of the sequence.
  2. Mixed Precision: Once the energy is concentrated, they keep a small number of these "heavy-hitter" tokens (e.g., the first 64) at 8-bit precision while quantizing the vast majority of the remaining tokens to 4-bit.
Quantization Error Comparison

The beauty of this approach is that the transformation is invertible and linear. It can be applied before a linear layer and inverted afterward, effectively "hiding" the quantization noise from the model's weights. While DCT is mathematically optimal for energy concentration, the authors favor DWT (specifically the Haar wavelet) because it is computationally cheaper ($O(ds)$ complexity) and easier to implement efficiently on hardware.

Datasets

The researchers evaluated STaMP across both Vision and Language domains:

  • Large Vision Models (LVMs): PixArt-Σ and SANA, evaluated on the COCO and MJHQ datasets.
  • Large Language Models (LLMs): Llama 3 (8B), Llama 3.2 (1B and 3B), and Qwen 2.5 (3B).
  • Benchmarks: Perplexity on Wikitext-2, image quality via SQNR (Signal-to-Quantized-Noise Ratio), Image Reward, and common reasoning tasks (ARC, HellaSwag, Piqa, etc.).

Key Insights and Ideas

  • The "JPEG" for Activations: Just as JPEG uses DCT to concentrate image energy into low frequencies to save space, STaMP uses sequence transforms to concentrate activation energy into a few tokens. This makes the "outlier" problem much easier to manage.
  • Orthogonality is Key: STaMP doesn't replace existing feature-based methods like QuaRot; it complements them. Because STaMP operates on the sequence dimension and others operate on the feature dimension, you can use both simultaneously for even better results.
  • Efficiency over Complexity: While the Karhunen-Loève Transform (KLT) is theoretically the best for energy concentration, it's too slow. The authors show that DWT provides a "good enough" approximation with significantly less math, making it viable for real-time inference.
  • Mixed Precision is Cheap: Keeping 64 tokens at 8-bit in a sequence of thousands adds negligible memory overhead (roughly 1.5% for PixArt-Sigma) but provides a massive boost in signal quality.

Key Results

  • Visual Quality: In 4-bit activation tests on PixArt-Σ, standard quantization produced images filled with "snow" and artifacts (SQNR of 0.64). Adding STaMP boosted the SQNR to 5.00 and, when combined with feature transforms, reached 11.47, producing images nearly indistinguishable from the 16-bit original.
Visual Quality Improvements with STaMP
  • LLM Performance: For the Llama 3.2 1B model, standard 4-bit quantization (RTN) resulted in a massive perplexity of 1795 (essentially broken). Adding STaMP brought that down to 700. When combined with SmoothQuant, it dropped further to 407.
  • Reasoning Tasks: On the "Average" of several LLM reasoning tasks, STaMP consistently added 1-3% accuracy across different base quantization methods, proving it is a robust "add-on" for any quantization pipeline.
  • Low Overhead: The DWT transform adds less than 5% latency to the total runtime on a modern GPU (A100), a small price to pay for enabling 4-bit execution.

Limitations and Future Work

  • LLM Decode Phase: STaMP is highly effective for the "prefill" phase (processing the initial prompt) where the whole sequence is available. However, during the "decode" phase (generating one word at a time), there is no sequence to transform yet. The authors note it remains useful for prompt-processing, which is often compute-bound.
  • Layer Specificity: The authors found that STaMP has little effect on certain layers (like attn2.to_out in LVMs) because those layers depend on pooled textual embeddings that lack the necessary local correlation.
  • Hardware Support: While the theoretical FLOPs are low, full speedups require specialized CUDA kernels or hardware support for mixed-precision matrix multiplication (e.g., mixing int4 and int8) to be fully realized in production.

Summary updated

BibTeX
@inproceedings{federici2026stamp,
  author = {Marco Federici and Riccardo Del Chiaro and Boris van Breugel and Paul N. Whatmough and Markus Nagel},
  title = {{STaMP: Sequence Transformation and Mixed Precision for Low-Precision Activation Quantization}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=suB4wYViDt},
}
Figure