MegaFlux: Skew-Resilient MoE Megakernels via Pipelined Expert Replication

Jianzhu Yao, Siva Kumar Sastry Hari, Vignesh Balaji, Sana Damani, Insu Jang, Pramod Viswanath, Christos KozyrakisarXiv 2026

TL;DR

MegaFlux introduces a system for dynamic expert replication within persistent Mixture-of-Experts (MoE) megakernels to eliminate GPU stragglers caused by routing skew. By pipelining replica weight transfers and gradient reductions directly into the computation schedule, it achieves geometric-mean speedups of $1.45\times$ for forward passes and $1.28\times$ for backward passes on NVIDIA B200 GPUs.

What Problem Does This Paper Address?

In Mixture-of-Experts (MoE) models, a "router" sends tokens to specific "experts" (small neural networks). To scale these models, researchers use Expert Parallelism (EP), where different GPUs host different experts. However, real-world data is often skewed; a few "hot" experts might receive the vast majority of tokens, while others sit idle.

Under fixed expert placement, the overloaded GPUs become stragglers, forcing the entire system to wait for them to finish. While you can replicate these hot experts to underloaded GPUs, doing so traditionally introduces significant overhead: you have to move large weight matrices to the new GPUs before computation starts and aggregate gradients back to the original owner during training. MegaFlux aims to make this replication "free" (or nearly so) by hiding these communication costs behind actual computation.

Methods

MegaFlux builds on the concept of megakernels—fused GPU kernels that handle communication and computation simultaneously. Its approach consists of two main pillars:

  1. On-Device Planner: A fast, greedy algorithm that runs on the GPU in microseconds. It looks at the current routing distribution and decides which experts to replicate and where to send specific blocks of tokens, all while staying within a fixed "replica budget" per GPU.
  2. Pipelined Execution: This is the core innovation. Instead of treating weight transfer and computation as sequential steps, MegaFlux overlaps them:
  3. Forward Pass: A replica starts computing its first projection (FC1) as soon as the first set of weights arrives, even while the weights for the second projection (FC2) are still in flight.
  4. Backward Pass: The system prioritizes producing gradients for replicated experts across all GPUs. This allows the "owner" GPU to start reducing (aggregating) completed gradient tiles while other GPUs are still computing different parts of the gradient.

The implementation targets the NVIDIA Blackwell (B200) architecture, utilizing native block-scaled MMA for low-precision formats like MXFP4 and MXFP8.

Datasets

The authors evaluated MegaFlux using routing profiles captured from state-of-the-art MoE models:

  • Qwen3-30B-A3B: Used for inference routing profiles (serving PG19 and InfiniteBench).
  • OLMoE-1B-7B: Used for training routing profiles (training on DCLM, OpenWebMath, Algebraic Stack, and StarCoder Python).
  • DeepSeek-V4-Pro: Used for end-to-end inference evaluation within the vLLM framework using the LongBench-Pro benchmark.
  • Synthetic Workloads: The authors also used Zipf distributions to stress-test the system under controlled levels of extreme skew.

Key Insights and Ideas

  • Phase-Level Readiness: You don't need the entire expert to start working. By splitting the readiness check between the two weight matrices of an MoE layer, MegaFlux hides 56–76% of the weight transfer cost in the forward pass.
  • Prioritizing Replicas in Backward: In training, the bottleneck is often the final gradient reduction. By forcing all GPUs to finish replicated expert work first, the reduction can happen concurrently with the remaining unique expert work, hiding nearly 100% of the reduction overhead.
  • Block-Granular Planning: Instead of moving individual tokens, the planner works with "tile-aligned token blocks." This ensures that the work shifted to a replica perfectly matches the GPU's hardware execution units, avoiding the inefficiency of partial tiles.
  • Communication Reuse: MegaFlux doesn't use separate "worker" threads for moving weights; it reuses the existing communication warps within the megakernel as they finish their primary tasks, progressively increasing bandwidth for weight transfers.

Key Results

  • Speedups: Across 147 configurations on eight B200 GPUs, MegaFlux achieved geometric-mean speedups of $1.45\times$ (forward) and $1.28\times$ (backward) over fixed-placement baselines.
  • Peak Performance: In cases of extreme skew, speedups reached as high as $2.14\times$ for forward and $2.64\times$ for backward passes.
  • Comparison to Prior Art: MegaFlux outperformed other specialized MoE libraries, including UltraEP ($1.74\times$ faster in forward) and Mixture-of-Kittens ($1.84\times$ faster in forward).
  • End-to-End Impact: When integrated into vLLM for DeepSeek-V4-Pro, it delivered a 1.13–1.26$\times$ median speedup for the prefill stage of inference.

Limitations and Future Work

  • Single NVLink Domain: The current evaluation is limited to a single node of 8 GPUs. The authors note that topology-aware, cross-node replication (where bandwidth is much lower) is a necessary next step.
  • Runtime Gating: For workloads that are already well-balanced, the overhead of planning and potential weight transfers can lead to a slight regression (up to 9%). A "gate" that only enables replication when a certain skew threshold is met is suggested for future implementation.
  • Planner Cost Models: The current planner uses a fixed heuristic for reduction costs; a more principled, workload-adaptive cost model could further optimize training performance.

Summary updated

BibTeX
@misc{yao2026megaflux,
  author = {Jianzhu Yao and Siva Kumar Sastry Hari and Vignesh Balaji and Sana Damani and Insu Jang and Pramod Viswanath and Christos Kozyrakis},
  title = {{MegaFlux: Skew-Resilient MoE Megakernels via Pipelined Expert Replication}},
  year = {2026},
  eprint = {2610.00671},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.00671},
}
Figure