QuantMLA:面向低比特MLA KV缓存的功能对齐双路径量化

·

研究论文 · 2026/10/12

多头部潜在注意力(MLA)通过紧凑缓存和分离的RoPE路径实现高效注意力,但缓存内存仍随上下文长度和批量大小线性增长。本文建立了MLA双路径量化误差的系统模型,刻画了其对注意力输出失真的不同影响,并解释了RoPE路径误差的显著放大。基于此分析,我们提出QuantMLA,一种面向功能的低比特双路径量化框架。我们推导了路径特定的变换空间,在保持全精度计算的同时可离线融合到模型参数中,消除在线变换开销。在这些空间内,QuantMLA学习路径特定的变换,并采用功能对齐的目标:注意力输出重建捕获内容路径的耦合匹配和聚合误差,而位置QK重建保留RoPE引起的注意力logits分量,并给出了输出失真的理论界限。在四个MLA模型系列上,QuantMLA首次实现了内容缓存和RoPE缓存的联合INT4缓存,且精度下降极小。进一步将内容缓存压缩至INT2,同时保持RoPE键缓存为INT4,在具有挑战性的推理和代码基准上仍保持竞争力。我们开发了原生低比特MLA注意力内核,将解包和反量化直接集成到注意力计算中。物理缓存布局在128K上下文下提供3.59倍压缩,而在缓存压力服务负载下,整体作业输出吞吐量比BF16高5.168倍。代码将在接收后发布。

该研究解决了MLA模型在长上下文和大批量场景下的缓存内存瓶颈,通过创新的双路径量化方法在极低比特下保持模型精度,并提供了高效的硬件内核实现,对大规模部署具有重要价值。

Multi-Head Latent Attention (MLA) enables expressive multi-head attention with compact caches for its content and decoupled RoPE paths, yet cache memory still scales linearly with context length and batch size. In this work, we establish a systematic model of MLA's dual-path quantization errors, characterizing their distinct effects on attention-output distortion and explaining the pronounced amplification of RoPE-path errors. Guided by this analysis, we introduce QuantMLA, a function-aligned framework for low-bit dual-path quantization. We derive path-specific transformation spaces that preserve full-precision computation while remaining fully fusible into model parameters offline, eliminating online transformation overhead. Within these spaces, QuantMLA learns path-specific transformations with function-aligned objectives: attention-output reconstruction captures the content path's coupled matching and aggregation errors, while positional QK reconstruction preserves the RoPE-induced component of the attention logits and admits a theoretical bound on output distortion. Across four MLA model families, QuantMLA enables, to our knowledge, the first reported joint INT4 caching of the content and RoPE caches with minimal accuracy degradation. Further compressing the content cache to INT2 while retaining the RoPE key cache at INT4 maintains competitive performance on challenging reasoning and code benchmarks. We develop a native low-bit MLA attention kernel that integrates unpacking and dequantization directly into attention computation. The physical cache layout provides 3.59x compression at 128K context, while a cache-pressure serving workload achieves 5.168x higher whole-job output throughput than BF16. The code will be released upon acceptance.

阅读原文

参与讨论