A Training-Memory Regression in MLA Sequence Parallelism: Why Megatron-Core Forbids Absorption, and LAGA -- a Communication-Efficient Fix
Changzheng Ma
Abstract
Multi-head Latent Attention (MLA) ships two implementations in Megatron-Core: an explicit form used for training and an absorbed form -- which slashes collective communication by gathering only the compressed latent -- that is fully implemented but hard-asserted out of training (the forward opens with "assert not (self.training and self.cachemlalatents)"), allowed only in inference decode. The library documents no reason. We show the restriction is well-founded and quantify why: ported to training, the absorbed form is a memory trap -- its intermediates live in nh x dkv dimensions per token, larger than the per-head K/V they replace -- inflating activation memory by 20-34%, up to 9.2 GB at DeepSeek-V3 scale (nh=128, seq=16384, SP=8, eager kernel; the gap widens to 19.2 GB under a fused kernel), enough to change device-fit. This measurement, validated on two axes (linear in seq and nh) and cross-verified on NVIDIA A100, explains the otherwise-undocumented restriction and leaves practitioners with no low-communication MLA training path. We then provide one. LAGA (Latent All-Gather Attention) keeps the absorbed form's latent-gather communication but rejects the absorb reformulation, instead reconstructing per-head K/V locally from the gathered latent. On 8x Ascend 910B at real DeepSeek-V3 dimensions, LAGA cuts collective communication 1.98x, matches explicit memory within 0.5%, is bit-identical to explicit at SP=1 and equivalent to within 1e-3 at SP=2-8, and under a fused attention kernel improves attention-block throughput 1.04-1.06x single-node and 1.07-1.24x cross-node -- leading at all sequence lengths in the cross-node regime MLA is deployed for.
Create a lesson
Related papers
Supercharging Olmo-core for Efficient and Scalable MoE Training
Shared title terminology · Tianhua Tao, Akshita Bhagia, Dirk Groeneveld et al.
Decode Token Parallelism: Memory-Efficient Distributed Attention Parallelism for Scalable LLM Decoding
Shared title terminology · Susav Shrestha, Brad Settlemyer, Narasimha Reddy
Twig: Parallel and Memory-Efficient Tree Speculative Decoding for Hybrid-Attention LLMs
Shared title terminology · Li Wang, Yi Su, Xiabao Wu et al.
Controlled Periodic Synchronization for Efficient Data-Parallel Training
Shared title terminology · Imane Ettifouri, Mostapha Zbakh, Claude Tadonki
SmartSwap: Swap-Based Memory Optimization for LLM Training under Varying Operator Sequences
Shared title terminology · Zibo Wang, Yuhang Zhou, Zhibin Wang et al.
StarMPI-SVD: Distributed-Memory Parallel Star-M Tensor SVD
Shared title terminology · Naman Pesricha, Grey Ballard, Srinivas Eswar et al.