TL;DR
QuantMLA is the first framework to achieve successful joint INT4 quantization of both the content and RoPE paths in Multi-Head Latent Attention (MLA) models. By using path-specific transformations and function-aligned learning objectives, it achieves up to 3.59× KV-cache compression and a 5.168× boost in serving throughput with minimal impact on model accuracy.
What Problem Does This Paper Address?
Large Language Models (LLMs) are increasingly bottlenecked by the memory and bandwidth required for their Key-Value (KV) cache, especially during long-context generation. While Multi-Head Latent Attention (MLA)—popularized by models like DeepSeek-V3—already reduces cache size by using a compressed "latent" representation, the cache still scales linearly with context length.
Existing quantization methods typically compress the "content" part of the MLA cache to FP8 but leave the "RoPE" (Rotary Positional Embedding) keys at high precision (BF16). This is because RoPE quantization is notoriously difficult; small errors in the positional keys lead to massive distortions in the final attention output. The authors set out to understand why this amplification happens and how to jointly quantize both paths to 4 bits (INT4) or lower without breaking the model.
Methods
The authors introduce QuantMLA, which treats the two paths of MLA differently based on a rigorous error analysis:
- Dual-Path Error Modeling: They established that RoPE-path errors are amplified significantly more than content-path errors for the same level of reconstruction loss (see Figure 2). They developed an operator-error model to explain this through "attention sensitivity" and "directional coupling."
- Function-Aligned Learning: Instead of just minimizing the difference between quantized and original weights, QuantMLA optimizes for the function of each path:
- Content Path: Optimized to reconstruct the final attention output (Output MSE), capturing how errors propagate through both matching and value aggregation.
- RoPE Path: Optimized to reconstruct the positional Query-Key (QK) scores, which the authors theoretically proved bounds the final output distortion.
- Offline-Fusible Transformations: The framework learns specific rotations and scales for each path. Crucially, these are mathematically derived to be "fusible" into the model's existing weights offline. This means the model gets the benefits of optimized quantization without any extra computational overhead during inference.
- Native Low-Bit Kernel: They developed a custom CUDA kernel that integrates unpacking and dequantization directly into the attention calculation, avoiding the need to ever materialize a full-precision cache in memory.
Datasets
- Calibration: WikiText-2 was used to calibrate the quantization parameters and learn the transformations.
- Evaluation: The authors tested across four major MLA model families (DeepSeek-V2/V3/R1, Moonlight, LongCat, and GLM-4.7) using:
- General/Commonsense: MMLU, GSM8K, ARC, PIQA, HellaSwag, WinoGrande.
- Reasoning & Code: GPQA-Diamond, MATH500, AIME25, HumanEval, LiveCodeBench.
- Long Context: RULER S-NIAH (up to 32K context).
Key Insights and Ideas
- The RoPE Sensitivity Gap: The most striking finding is that RoPE-path quantization consistently induces much higher output distortion than content-path quantization for the same mean squared error (MSE). As shown in Figure 2, the RoPE/content error ratio can be as high as 6.86×.
- Error Geometry Matters: The paper shows that it's not just the magnitude of quantization error that matters, but its direction. RoPE errors tend to align with highly sensitive directions in the attention mechanism.
- Decoupled Optimization: Because the two paths serve different functional roles (matching vs. aggregation), they require different optimization targets. Trying to use a single objective for both leads to sub-optimal results.
Key Results
- Joint INT4 Success: QuantMLA enables the first reported joint INT4 caching of both content and RoPE paths. On DeepSeek-V2-Lite, it stays within 0.26 percentage points of the BF16 baseline across a 10-task suite.
- Pushing to INT2: Even when the content cache is pushed down to INT2 (while keeping RoPE at INT4), the model maintains competitive performance on tough reasoning and coding benchmarks, significantly outperforming standard baselines like SmoothQuant or QuaRot.
- System Efficiency:
- Compression: Achieves 3.59× physical cache compression at 128K context compared to BF16.
- Throughput: In a "cache-pressure" scenario (where memory is tight), QuantMLA achieved 5.168× higher whole-job output throughput than BF16 by avoiding the need for frequent recomputation (preemption).
- Latency: The native kernel maintains near-BF16 attention latency despite the overhead of dequantization.
Limitations and Future Work
- Extreme Compression: While INT2 content caching works for some tasks, the authors note larger task-to-task variation, indicating that some benchmarks are highly sensitive to extreme compression.
- Fixed Bit-Width: The current work focuses on uniform bit-widths (e.g., C4R4 for 4-bit content/RoPE). Future work could explore mixed-precision or per-layer bit-width allocation based on the sensitivity analysis provided in the paper.
- Hardware Specificity: The performance gains are currently demonstrated on NVIDIA GPUs; porting the native low-bit kernels to other accelerators (like TPUs or specialized AI chips) remains an open engineering challenge.
Summary updated