arXiv:2605.15250cs.LGcs.AI2026-05被引 1

GQLA让大模型在不同硬件上自动切换推理路径,兼顾效率与通用性。

GQLA: Group-Query Latent Attention for Hardware-Adaptive Large Language Model Decoding

论文配图:GQLA: Group-Query Latent Attention for Hardware-Adaptive Large Language Model Decoding
图 1 · 摘自论文原文
  • 在MLA基础上引入分组查询机制,同一组权重支持两种推理路径。
  • 单个模型在H100和H20上均达理论峰值性能,缓存压缩至28.125%。
  • 无需重训练即可转换预训练GQA模型,适合多硬件部署场景。

多头潜在注意力(MLA)在DeepSeek-V2/V3中使用,将键值联合压缩为低秩潜在表示,几乎完美匹配H100的计算带宽天花板。但其训练权重仅暴露一种解码路径——吸收后的MQA形式,导致高效推理依赖于H100级计算-带宽比,丧失沿头轴的张量并行能力,并在消费级推理卡如受限出口的H20上无法获得多令牌预测(MTP)收益。本文提出分组查询潜在注意力(GQLA),对MLA进行最小修改,使训练权重同时暴露两种代数等价的解码路径:与MLA相同的吸收型MQA路径,以及每组扩展缓存的GQA路径。运行时根据目标硬件选择最优路径,无需重训练、无需定制内核。单组GQLA权重可同时适配H100(MQA-absorb, s_q=1)与H20(GQA + MTP, s_q=2)的理论峰值,且在GQA路径上支持最多8路零冗余张量并行。为避免从头预训练,将TransMLA扩展为TransGQLA,可将预训练的GQA检查点转换为GQLA模型;在LLaMA-3-8B上,其在MQA-absorb路径下将每令牌KV缓存压缩至基线GQA的28.125%,同时在分组路径上保持GQA级流量结构。

原文摘要 · Abstract (English)

Multi-head Latent Attention (MLA), the attention used in DeepSeek-V2/V3, jointly compresses keys and values into a low-rank latent and matches the H100 roofline almost perfectly. Its trained weights, however, expose only one decoding path - an absorbed MQA form - which ties efficient inference to H100-class compute-bandwidth ratios, forfeits tensor parallelism along the head axis, and yields no Multi-Token Prediction (MTP) gain on commodity inference GPUs such as the export-restricted H20. We propose Group-Query Latent Attention (GQLA), a minimal modification of MLA whose trained weights expose two algebraically equivalent decoding paths over the same parameters: an MQA-absorb path identical to MLA's, and a GQA path with a per-group expanded cache. The runtime picks the path that matches the target hardware - no retraining, no custom kernels - so a single set of GQLA weights pins the rooflines of both H100 (MQA-absorb, s_q=1) and H20 (GQA + MTP, s_q=2), while supporting up to 8-way zero-redundancy tensor parallelism on the GQA path. To avoid pretraining from scratch we extend TransMLA into TransGQLA, which converts a pretrained GQA checkpoint into a GQLA model; on LLaMA-3-8B it compresses the per-token KV cache to 28.125% of the GQA baseline on the MQA-absorb path while structurally preserving GQA-level traffic on the per-group path.

大模型推理注意力机制硬件适配缓存优化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。