Manuscript Offprint

arXiv:2610.23064

BaGuaLu-2: Taming Dynamic Memory Fluctuation for Efficient MoE Model Training over 10,000 GPUs

Mingshu Zhai, Minkun Guo, Hongrui Lian, Shuangyu Li, Qi Zhang, Chen Hu, Xiawei Du, Yuyang Jin, Zan Zong, Jidong Zhai

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Mingshu Zhai

Tsinghua University

Beijing, China

zhaims22@mails.tsinghua.edu.cn

Minkun Guo

Tsinghua University

Qingcheng.AI

Beijing, China

gmk21@mails.tsinghua.edu.cn

Hongrui Lian

Tsinghua University

Qingcheng.AI

Beijing, China

lianhr24@mails.tsinghua.edu.cn

Shuangyu Li

Tsinghua University

Beijing, China

lishuang22@mails.tsinghua.edu.cn

Qi Zhang

Tsinghua University

Beijing, China

qi_zhang@tsinghua.edu.cn

Chen Hu

Unaffiliated

Beijing, China

hclearner2@gmail.com

Xiawei Du

Tsinghua University

Beijing, China

duxw25@mails.tsinghua.edu.cn

Yuyang Jin ∗^{*}

Tsinghua University

Beijing, China

jinyuyang@tsinghua.edu.cn

Zan Zong ∗^{*}

University of Science and Technology Beijing

Beijing, China

zongzan@ustb.edu.cn

Jidong Zhai ∗^{*}

Tsinghua University

Beijing, China

zhaijidong@tsinghua.edu.cn

Abstract—Fine-grained Mixture-of-Experts (MoE) is the de facto architecture for scaling large language models. However, dynamic expert load imbalance causes severe memory fluctuations that degrade training efficiency. Existing systems rely on static memory provisioning: they either over-provision, leaving GPU memory idle during normal execution, or under-provision, inviting out-of-memory crashes and costly manual rollbacks when load spikes occur. To address these challenges, we propose BaGuaLu-2, a large-scale MoE training system that eliminates this dilemma through flexible provisioning. By transforming memory allocation from a static, one-time tuning choice into a continuous and fine-grained control. BaGuaLu-2 grants exact activation memory on demand for each training batch. Furthermore, it offsets any dynamic management overhead through system optimizations. BaGuaLu-2 demonstrates exceptional scalability, training a model with 1040 billion parameters across 12,288 GPUs while sustaining over 2 EFlops at 35% MFU. Compared with state-of-the-art systems, BaGuaLu-2 delivers 1.14×1.14\times and 1.13×1.13\times average throughput improvements over Megatron-Kuai and AdaPipe, respectively.

I. INTRODUCTION

Large language models (LLMs) have demonstrated remarkable capabilities across domains, driving an ever-growing demand for larger and more capable models. To meet this demand, fine-grained Mixture-of-Experts (MoE) has emerged as the dominant architecture for scaling LLMs [1]–[7], as it increases model capacity without proportionally increasing the computation per token. Accelerating MoE training process has become a major focus in current systems research.

A fundamental characteristic of the MoE architecture is its dynamic sparse routing mechanism, which inherently introduces expert load imbalance. We observe this phenomenon consistently when scaling training to clusters comprising tens of thousands of GPUs. In approximately 2.9% of training iterations, imbalanced load exhibits maximum 2.6×2.6\times spikes. The imbalanced load leads to dynamic memory fluctuation, where training jobs have the risk to exceed physical hardware capacity and triggering Out-of-Memory (OOM) errors, which halt the training process. In response to the huge memory requirement of large-scale model training, existing systems optimize GPU memory usage from multiple angles. For weight and optimizer-states, model parallelism [8] and ZeRO [9] effectively shards these memory usage across devices. For activation memory, systems rely on recomputation [10] and offloading [11] to reduce peak consumption. However, these static approaches fail to resolve dynamic memory fluctuation introduced by load imbalance.

Existing training systems are trapped in a rigid dilemma: as shown in Figure 1(b), if the system over-provisions memory to avoid OOM errors, GPU memory is wasted during most of the iterations, resulting in persistently low Model FLOPs Utilization (MFU). Conversely, if the system under-provisions memory to maximize MFU, it cannot dynamically respond to memory spikes at runtime. Upon encountering a spike, the system crashes and requires manual intervention. Restart and set the system in a conservative, over-provisioning memory configuration. Once the spike passes and the operator wishes to restore the high-throughput under-provisioned configuration,

∗^{*}Corresponding authors

Figure

(a) Training Memory Demand Breakdown.

Figure

(b) Existing Training System Memory Footprint.

Figure

(c) Existing System Training Performance.

Fig. 1: Dynamic memory fluctuation of MoE model training. yet another manual restart is required. Every such restart incurs significant performance overhead.

We identify activation memory as the root cause of both the memory bottleneck and the fluctuation at scale. Figure 1(a) shows the per-GPU memory demand breakdown in large-scale training. Weight and optimizer-state memory can be distributed across GPUs and remains stable across iterations. Activation memory, in contrast, cannot be effectively distributed—larger clusters require proportionally more input data to maintain compute density—and fluctuates unpredictably due to expert load imbalance caused by MoE's dynamic sparse routing. Thus, dynamically managing activation memory is the key to addressing the efficiency and stability challenges of large-scale MoE training. However, existing systems' activation memory management suffers from two fundamental deficiencies.

Static Memory Provisioning. Existing systems treat activation provisioning as a coarse-grained, fixed policy: the policy is determined before training and cannot be adjusted at runtime. For example, although AdaPipe [10] supports adaptive recomputation across pipeline stages, each pipeline stage remains a fixed strategy throughout training. This prevents the system from responding to per-batch memory fluctuation.

Large Memory Mitigation Overhead. The extra computation or communication introduced by activation mitigation is directly exposed on the critical path and cannot be overlapped. For example, the activation offloading in Megatron-Kuai [11] achieves only limited overlap at inter-layer boundaries. Activation mitigation therefore becomes a pure performance penalty, and systems tend to minimize its use, further limiting the scope

Figure

Fig. 2: Training Memory Footprint with flexible-provisioning. for memory optimization.

Constrained by these deficiencies, existing systems can only make a static binary choice between over-provision and under-provision. They are unable to dynamically allocate exactly the resources needed based on the actual memory fluctuation of each training iteration. We propose flexible activation provisioning, which transform activation memory provisioning from a static choice into continuous control, thereby achieving fully-utilized GPU memory. As shown in Figure 2, this enables the system to tame dynamic memory fluctuation in both regimes: (i) when MoE load imbalance is moderate, the system applies steady activation mitigation to enable high-throughput parallelism, consuming almost all available memory; (ii) when load imbalance is severe, the system dynamically intensifies activation mitigation to prevent OOM, avoiding the far greater cost of a cold restart. We design three techniques to realize flexible-provisioning at training runtime.

Activation Memory Modeling ( §IV§IV). We design an activation memory cost model, which can accurately predict activation memory usage and mitigation time consumption. It guides the following runtime memory provisioning strategies.

Adaptive Activation Provisioning ( §V−A§V-A). Considering pipeline schedule phase and current MoE imbalance load, we apply flexible memory budget for each micro batch. Within a batch, operators can use different mitigation strategies, giving the system continuous control over memory consumption.

Fused Dual-Batch Execution ( §V−B§V-B). We propose interleaved execution for adjacent micro batch to avoid directly exposing activation mitigation overhead on the critical path. Using a light-weight runtime solver, mitigation operations are inserted into hardware bubble so that the execution overhead is hidden.

These techniques are implemented in BaGuaLu-2, a large-scale MoE training system. We scale up to 12,288 GPUs for training 1040 billion parameters MoE model. BaGuaLu-2 achieves throughput of over 2 EFlops and an MFU of 35%. Compared with state-of-the-art training systems Megatron-Kuai [11] and AdaPipe [10], BaGuaLu-2 improves both training stability and peak performance, with average throughput gains of 1.14×1.14\times and 1.13×1.13\times, respectively.

References (35)