MassAlloc Attention:让注意力自行分配其计算资源
研究论文 · 2026/09/29
FullAttn 常将可忽略的归一化质量分配给大量因果分数空间,但密集核在形成每个 QK 块后仍执行完整的后分数路径。我们提出 MALA,一种融合注意力原语,保留对每个合法因果交互的分数访问,并利用归一化贡献分配后分数计算。前向使用其演化的在线 softmax 归一化器,反向重用最终归一化器,仅使用标准注意力状态推导嵌套保留支持。一个通用容差控制训练和推理,实现工作的自适应保留。MALA 减少了低贡献的后分数计算。在 8K 的匹配工作研究中,在完全匹配的总后分数工作下,MALA 接近每实例参考质量预言机,平均遗漏质量为 0.0188% 对 0.0182%。在 1K 到 32K 令牌的上下文长度中,相同容差保持相对于参考的低输出和梯度误差。在更广泛的控制联想回忆比较中,MALA 随上下文增长紧密跟踪 FullAttn,在 8K 达到 89.67% 准确率,而 FullAttn 为 89.97%。在 128K 令牌的张量并行注意力算子基准中,MALA 相对于 FullAttn 将训练中的前向和反向延迟减少 2.2 倍和 3.0 倍,推理中的解码延迟减少 1.6 倍。在 0.6B 到 14B 参数的缩放定律训练中,MALA 在困惑度上紧密跟踪 FullAttn,同时减少总训练 FLOPs。由此产生的 14B 模型和来自单独继续训练的 32B 模型在知识、推理和长上下文检索分数上与 FullAttn 相当。这些结果表明,根据归一化注意力贡献分配后分数计算可以保留 FullAttn 的评估能力,同时减少注意力计算。
该研究提出了一种根据注意力贡献自适应分配计算的方法,在保持模型能力的同时显著减少注意力计算和延迟,对高效训练和推理具有重要价值。
FullAttn often assigns negligible normalized mass to much of the causal score space, yet dense kernels execute the complete post-score path after forming each QK tile. We introduce MALA, a fused attention primitive that preserves score access to every legal causal interaction and uses normalized contribution to allocate post-score computation. Forward uses its evolving online-softmax normalizer, while backward reuses the finalized normalizer to derive nested retained support using only standard attention state. A common tolerance governs training and inference, allowing for adaptive retention of the work. MALA reduces low-contribution post-score computation. A matched-work study at 8K isolates the benefit of distribution-adaptive allocation: under exactly matched total post-score work, MALA approaches a per-instance reference-mass oracle, with mean omitted mass of 0.0188% versus 0.0182%. Across context lengths from 1K to 32K tokens, the same tolerance maintains low output and gradient errors relative to the reference. Across a broader controlled associative-recall comparison, MALA closely tracks FullAttn as context grows, reaching 89.67% accuracy at 8K compared with 89.97% for FullAttn. In an attention-operator benchmark at 128K tokens with tensor parallelism, MALA reduces forward and backward latency during training by 2.2x and 3.0x and decoding latency during inference by 1.6x relative to FullAttn. Across scaling-law training from 0.6B to 14B parameters, MALA closely tracks FullAttn in perplexity while reducing total training FLOPs. The resulting 14B models and 32B models from separate continued training achieve comparable knowledge, reasoning, and long-context retrieval scores to FullAttn. These results indicate that allocating post-score computation according to normalized attention contributions can retain the evaluated capabilities of FullAttn while reducing attention computation.