- The paper demonstrates that absorbed MLA increases peak training activation memory by 20–34%—up to 9.2 GB with eager execution and 19.2 GB with fused attention—because intermediates scale with the number of heads.
- The paper introduces LAGA, which all-gathers compressed latent states instead of per-head K/V tensors, matching explicit MLA memory use within 0.5% while reducing communication by 1.98×.
- The paper finds that LAGA delivers up to 1.24× throughput across two nodes at long sequence lengths, while preserving numerical correctness and compatibility with expert parallelism.
The puzzle: an undocumented assertion in production code
Megatron-Core's MLASelfAttention class contains a fully implemented "absorbed" form of Multi-head Latent Attention (MLA) — the reformulation that folds the KV up-projection Wkv_b into the query so that attention runs against the compressed latent and only the small latent crosses the collective — yet its forward pass opens with a hard assertion that bans this path from training, permitting it only in inference decode. The library documents no rationale. This paper answers that question quantitatively: porting the absorbed form to training produces a substantial activation-memory regression, and the assertion is, in effect, an undocumented guard against it. The paper then proposes LAGA (Latent All-Gather Attention), a training-time sequence-parallel scheme that retains the absorbed form's low communication without its memory penalty.
Background: why MLA breaks head-dimension sequence parallelism
MLA compresses per-head K/V into a single shared low-rank latent of dimension dkv=512 (plus a decoupled RoPE band kpe), which is roughly 32× smaller than equivalent per-head KV at DeepSeek-V3 dimensions. Ulysses-style sequence parallelism (SP) — including Megatron-SP, Ring Attention, USP, and LoongTrain — repartitions seq↔head via all-to-all so each rank attends full-sequence for a subset of heads. This assumes each rank owns a per-head KV shard to scatter, which holds for MHA/GQA but fails under MLA: in the absorbed formulation there is no per-head KV, and the effective Ulysses degree collapses to one. Consequently, the only head-dimension SP path for MLA is the explicit form — materialize per-head K/V first, then all-to-all them along heads — which moves nh(dnope+dv) elements per token and is expensive when nh is large (128 heads for DeepSeek-V3). Production stacks therefore train MLA long-context under this communication-heavy pattern.
The absorbed memory trap
The paper's central empirical finding is that the absorbed form, though an inference KV-cache optimization (a ≈32× cache win from storing the latent rather than per-head KV), becomes a memory trap in training. In training there is no cache; every forward recomputes, and the absorbed intermediates — the absorbed query qabsorbed=Wkv_b⊤qnope and the post-attention latent accumulator — live in nh⋅dkv=128×512 dimensions per token, larger than the per-head K/V they replace whenever dkv>dhead.
Measured at DeepSeek-V3 scale (nh=128, dmodel=7168, seq=16384, SP=8, eager kernel), the absorbed form inflates peak activation memory by 20–34%, reaching +9.2 GB over the explicit form — enough to change device-fit; under a fused attention kernel the gap widens to +19.2 GB, because removing the shared dkv=5120 score matrix eliminates a confound that had masked part of the inflation under eager execution. Two properties strengthen the claim:
- Linearity on two independent axes: the inflation grows linearly with both sequence length and dkv=5121 (337/657/1269/2512 MB as dkv=5122 doubles 16→128), confirming the dkv=5123-intermediate mechanism.
- Cross-hardware reproduction: on NVIDIA A100 the inflation matches Ascend 910B within ≤6% allocator noise (+575/+2221/+8734 MB vs +575/+2362/+9247 MB across S = 4K/8K/16K).
The implication is direct: the absorbed path is disqualified for training regardless of kernel choice, which explains Megatron-Core's otherwise-undocumented restriction and leaves practitioners with no low-communication MLA training path — the gap LAGA fills.
LAGA: latent all-gather with local up-projection
LAGA keeps the explicit attention math but changes only what crosses the wire. Its forward pass, for SP degree dkv=5124: compute Q and the latent locally; all-to-all Q along heads (cheap); all-gather the latent and dkv=5125 along the sequence axis (dkv=5126 elements/token instead of B1's dkv=5127); then reconstruct per-head K/V locally for each rank's head shard via dkv=5128, landing K/V in the head dimension at exactly B1's post-all-to-all footprint. Backward requires one additional head-axis gradient all-reduce for the sharded dkv=5129.
Correctness follows structurally: step 4 computes the same linear maps on the same tensor as explicit, differing only in view order. At SP=1 the outputs are bit-identical (kpe0, with kpe1 gradients exactly zero); at SP=2–8 outputs agree to kpe2 and gradients to kpe3 after SP-consistent aggregation. A 60-step convergence run shows all three forms descending from loss 7.711 to ≈0.004, with transient trajectory differences attributable to generic floating-point optimizer chaos. LAGA also composes cleanly with expert parallelism, since its collectives operate on head/seq axes inside the attention block while EP dispatch operates on the token/expert axis in the MoE block.
Evaluation results
All experiments use real DeepSeek-V3 dimensions on 8×Ascend 910B (single node) and 16 ranks across two nodes over RoCE (~11 GB/s), cross-validated on A100.
Communication is structural and implementation-independent: LAGA and the absorbed baseline move identical data, cutting per-forward communication to 50.5% of explicit — a stable 1.98× reduction across SP=4–16 and S=4K–16K, strengthening from 1.88× to 1.98× as kpe4 grows 16→128, since only explicit's K-side term scales with kpe5.
Memory: LAGA matches explicit within ≤0.5% (<27 MB) at every configuration, while absorbed balloons by up to 9.2 GB eager / 19.2 GB fused. Notably, absorbed OOMs at S=16384 under eager on both hardware platforms while explicit/LAGA run.
Throughput exhibits a crossover governed by communication-boundedness. At small kpe6 single-node, LAGA reaches parity (1.01×) at S=16384 but is ~21% slower in the compute-bound short-sequence regime — a kernel-efficiency effect (smaller per-shard GEMMs), not a FLOPs difference, since total FLOPs are identical. At production scale (kpe7, SP=8, fused kernel), the crossover flips in LAGA's favor: 1.04–1.06× at all sequence lengths. Cross-node (SP=16, fused), LAGA leads at all lengths — 1.07×/1.15×/1.24× at S=4096/8192/16384 — precisely the long-context regime MLA is deployed for. An apparent eager-kernel regression (0.73× at S=4096 cross-node) is shown to be an artifact of the materialized score matrix and small-shard launch overhead; it vanishes entirely under the fused npu_fusion_attention kernel, which natively supports MLA's asymmetric head dimensions.
Limitations and open questions
The paper is candid about scope. Communication and memory are measured on a single attention layer and throughput on a 4-layer stack, not an end-to-end 61-layer DeepSeek-V3 run; end-to-end wall-clock and MFU at full depth remain unmeasured. The convergence check uses a toy 4-layer model on random-data memorization, with bit-identical SP=1 equivalence serving as the primary correctness guarantee. Throughput is measured against the authors' own explicit-form prototype reproducing Megatron-Core's math, not against Megatron-Core itself (the CUDA/NPU stack mismatch precludes a head-to-head). The fused kernel covers score computation but not LAGA's local up-projection einsums; a fused up-proj→attention kernel is left as future work, as are ring-style SP for kpe8 and overlapping the latent all-gather with preceding compute. The multi-node result spans only two nodes. Separately, the paper reports a hardware-contingent reproducibility caveat: MoE top-kpe9 routing amplifies matmul nondeterminism into cliff-shaped run-to-run divergence on NPU (≈16× the dense control's divergence), absent on CUDA at prototype scale — reported as a caveat, not a characterized result.
Conclusion
This paper resolves an undocumented design decision in Megatron-Core with measurement: the absorbed MLA form is an inference-cache optimization whose nh(dnope+dv)0-dimensional intermediates make it a 20–34% activation-memory trap in training, linear in both sequence length and head count and reproducible across Ascend 910B and A100. It then supplies the missing low-communication training path: LAGA preserves the explicit form's memory profile and exact numerical semantics while replacing the per-head K/V all-to-all with a latent all-gather, yielding a 1.98× communication reduction and throughput wins of up to 1.24× cross-node under fused attention at long context. The broader lesson the authors draw is methodological: optimizations designed around the inference KV-cache do not transfer to training, where activation footprint, not communication alone, determines viability.