TL;DR
Researchers have uncovered a critical privacy vulnerability called Quantamination, where "per-tensor" dynamic quantization in batched inference allows an adversary to recover a co-batched user's sensitive data. By observing tiny perturbations in their own output logits, an attacker can achieve near-100% token recovery in LLMs and exact image identification in classification models.
What Problem Does This Paper Address?
To make Large Language Model (LLM) serving economically viable, providers use two main tricks: batching (processing multiple users' requests simultaneously to saturate the GPU) and quantization (converting high-precision 16-bit numbers to 8-bit integers or floats to save memory and compute).
Ideally, users in a batch should be isolated. However, this paper reveals that dynamic quantization—where the scaling factors for these 8-bit numbers are calculated on-the-fly based on the input data—can break this isolation. If a framework calculates a single scaling factor for the entire batch (per-tensor quantization), one user's "outlier" values will change the quantization parameters for everyone else in that batch. This creates a side channel where a victim's private data "contaminates" the adversary's output.
Methods
The authors introduce the Quantamination attack, which exploits the shared min/max calculations used to determine quantization scales ($\alpha$) and zero points ($\beta$).
- The Side Channel: In per-tensor dynamic quantization, the scale is determined by the global maximum and minimum values across the entire batch. If the victim's activations contain a very large value, the scale increases for the whole batch, slightly changing the rounding errors in the adversary's own activations.
- LLM Token Recovery: The attacker co-locates their request with a victim's. During the "decode" phase (where tokens are generated one by one), the attacker observes the log-probabilities of their own output. They then iteratively "guess" the victim's token by testing candidates from the vocabulary. The candidate that produces the same numerical perturbation in the attacker's logits as seen during the victim's real run is identified as the secret token.
- Classification Attack: For image models, the attacker uses a similar "score-based" approach to compare the observed logit perturbations against a candidate set of images to identify which specific image the victim is processing.
The paper evaluates both white-box (local model access) and black-box (API-only access) scenarios.
Datasets
The study evaluates the attack across several models and datasets:
- LLMs: TinyStories-1M, Pythia-70M, and SmolLM2-135M.
- Text Datasets: TinyStories (in-distribution), WikiText, and AG News (out-of-distribution).
- Classification: MNIST (handwritten digits) using a 3-layer CNN, ResNet18, and ResNet50.
- Frameworks Surveyed: vLLM, SGLang, ONNX Runtime, and PyTorch.
Key Insights and Ideas
- The "Worst-Case" Optimization: Per-tensor dynamic quantization is a "lose-lose-lose" scenario. It is less accurate than per-token quantization, often slower on modern GPUs (due to the need for global synchronization across the batch), and, as this paper proves, a major security risk.
- Numerical Artifacts as Signal: What we usually dismiss as "rounding noise" in 8-bit computation actually carries a high-fidelity signature of the input data.
- Contextual Acceleration: The attack gets easier as it progresses. In LLMs, once the first few tokens are recovered, the language model's own "priors" (predicting the next likely word) drastically narrow the search space, making the attack much faster than a random brute-force search.
- Framework Defaults Matter: The researchers found that popular frameworks like vLLM (default FP8 mode) and ONNX Runtime still use or recommend these vulnerable per-tensor configurations.
Key Results
- Near-Perfect Recovery: The attack achieved 99.6% to 100% accuracy in recovering victim tokens across all tested LLMs.
- Significant Speedup: Using language model priors, the attack was 18–25x faster than random searching for general-purpose models. For specialized models (TinyStories), it was up to 59x faster.
- Image Identification: In the classification setting, the attack achieved 100% success in identifying the exact victim image when it existed within the attacker's candidate set.
- Vulnerability Surface: The authors identified that while INT8 paths in LLM frameworks have mostly moved to the safer "per-token" quantization, the newer FP8 (8-bit floating point) implementations often default back to the vulnerable "per-tensor" approach.
Limitations and Future Work
- Non-Determinism: Real-world production APIs often have "noise" from hardware heterogeneity or complex sampling algorithms (like top-p or min-p) that might mask these tiny logit differences. Preliminary tests on OpenRouter showed that even at "temperature 0," outputs aren't perfectly deterministic.
- Class-Level Inference: While identifying an exact image is easy, inferring just the class (e.g., "is this a picture of a cat?") when the exact image isn't in the candidate set proved much more difficult, yielding only marginal improvements over random guessing.
- Mitigation: The primary recommendation is simple but vital: switch to per-token (or per-row) dynamic quantization. This isolates the quantization parameters to each individual sequence, effectively closing the side channel without sacrificing the performance benefits of quantization.
Summary updated