Manuscript Offprint

arXiv:2611.03577

Sonar-MoE: In-Backward Expert Updates for Memory-Efficient Mixture-of-Experts Training

Avni Mittal, Avinash Anand, Ashutosh Kumar, Dikshant Kukreja, Kritarth Prasad, Chaitanya Lakhchaura, Rishitej Reddy Vyalla, Erik Cambria, Zhengkui Wang, Rajiv Ratn Shah

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

ABSTRACT

Most parameters of a Mixture-of-Experts (MoE) model belong to its experts, and standard training keeps every expert gradient in GPU memory until the optimizer step. This memory grows with the number and size of the experts, so it rises as MoE models scale. We introduce SONAR-MOE, which updates each expert tensor during the backward pass and frees its gradient right away. It brings optimizer-in-backward from dense models to batched MoE expert tensors, so the GPU never holds more than one layer of expert gradients. When we fine-tune OLMoE-1B-7B and Granite-3.1-3B-A800M in bf16 with two expert-kernel backends, SONAR-MOE lowers peak memory by 19% to 22%. Its updates are bitwise identical to standard training without expert gradient clipping, and held-out loss stays within 0.003 of all baselines. Each step also takes 17% to 23% less time than standard training with global-norm clipping. Updating whole batched tensors rather than individual experts is what keeps SONAR-MOE fast, as it avoids a 20% to 72% slowdown while using the same memory. SONAR-MOE matches optimizer-in-backward over all parameters in memory and speed while still clipping the dense parameters.

1 INTRODUCTION

Mixture-of-Experts (MoE) models scale their parameter count without a matching increase in per-token compute, since each token is routed to only a few of many experts (Shazeer et al., 2017; Lepikhin et al., 2021; Fedus et al., 2022; Jiang et al., 2024a; DeepSeek-AI, 2024). The cost is paid in memory. A model that activates one billion parameters per token still has to keep the weights, gradients and optimizer state of every parameter during training. In OLMoE-1B-7B (Muennighoff et al., 2024), for example, the experts hold 6.44B of the 6.92B parameters, and their bf16 gradients alone take 12.9 GB. On a single GPU, this gradient memory alone can decide whether fine-tuning fits at all.

Much of this gradient memory is held for no reason. A standard training step runs the whole backward pass and only then calls the optimizer, so the gradient of the last MoE layer waits in memory until the backward pass has reached the first layer. An element-wise optimizer such

as AdamW (Loshchilov & Hutter, 2019) does not need this wait, since the update of a tensor depends only on that tensor's gradient and optimizer state. Prior work on dense models fuses the update into the backward pass (Lv et al., 2024b;a; Lewandowski & Kosson, 2023), and PyTorch provides a hook that fires as soon as a parameter's gradient is ready (Paszke et al., 2019). Updating every parameter this way frees all gradient memory, but it gives up global-norm clipping, because no gradient survives to the end of the step. In an MoE the experts hold almost all of the gradient memory, so it is enough to update only the experts early.

We introduce SONAR-MOE, which updates the experts inside the backward pass. It attaches a hook to each batched expert tensor of every MoE layer, and when the tensor's gradient is ready, the hook applies a fused AdamW update and frees the gradient, so the GPU holds at most one layer of expert gradients at any time (Figure 2). All other parameters keep the standard path with global-norm clipping. The placement of the hooks also matters. Expert weights can be stored per expert or as batched tensors (Gale et al., 2023; Tan et al., 2024; Guo et al., 2025), and SONAR-MOE hooks the batched tensors. With EE experts per layer and LL MoE layers, per-expert hooks fire 2EL2EL times per step, while one hook per batched weight tensor fires only 2L2L times. On OL-MoE (E=64E=64, L=16L=16) this is 32 hook calls per step instead of 2,048, for the same update and the same memory.

In bf16 fine-tuning, SONAR-MOE lowers peak memory from 55.6 to 43.6 GB on OLMoE and by 21.4% on Granite-

*Equal contribution ¹Microsoft, India ²Singapore Institute of Technology, Singapore ³MIDAS Lab, Indian Institute of Technology Kanpur, Kanpur, India ⁴Indian Institute of Technology Delhi, New Delhi, India ⁵Indraprastha Institute of Information Technology Delhi, New Delhi, India ⁶Nanyang Technological University, Singapore. Correspondence to: Avni Mittal avni.mittal2002@gmail.com.

Proceedings of the 8th MLSys Conference, Santa Clara, CA, USA, 2025. Copyright 2025 by the author(s).

Figure

Figure 1. Alpaca fine-tuning of OLMoE-1B-7B and Granite-3.1-3B-A800M for 2,000 steps with the SonicMoE and ScatterMoE backends, standard training with global-norm clipping (baseline) vs. SONAR-MOE. (a) Training loss on OLMoE; (b) peak GPU memory; (c) throughput averaged over steps 201–2,000.

3.1-3B-A800M (Figure 1). Its updates are bitwise identical to those of standard training without expert-gradient clipping, and held-out loss stays within 0.003 of every baseline. Each step is also 19–23% shorter than in standard training with global-norm clipping (Table 1). Two effects shorten the step. The expert gradients skip the global-norm clipping kernels, which gives most of the saving, and on Granite the in-backward updates fill GPU time that would otherwise sit idle, which cuts a further 11.6% at the same update rule. Applying optimizer-in-backward to all parameters reaches the same memory and speed but cannot clip any gradient. SONAR-MOE matches it on both while keeping global-norm clipping for the dense parameters. Our contributions are:

  • SONAR-MOE, which updates each batched expert tensor inside the backward pass and frees its gradient at once. Retained expert-gradient memory is bounded by one layer, peak memory falls by 21.6% (OLMoE) and 21.4% (Granite), and the updates are bitwise identical to standard training without expert-gradient clipping (§4, §5.2).

  • A speedup over standard training, with steps 19–23% shorter than under global-norm clipping, and a kernel-level profile that explains it. The expert gradients skip the clipping kernels, and on Granite the AdamW kernels run in otherwise idle GPU time (§5.3). Hooking batched tensors rather than single experts keeps this speed, since per-expert hooks make steps 20–72% slower (§4.3).

  • A direct comparison with all-parameter optimizer-in-backward, which SONAR-MOE matches in memory and speed while keeping global-norm clipping, and a measured operating range across batch sizes, gradient checkpointing, 8-bit AdamW and gradient accumulation (§5.5, §5.6).

References (41)