Skip to main content
Back

Ends Soon: Get 20% off all AlphaSignal Pro subscriptions. Subscribe here.

Prime Intellect's Mega MoE Trains DeepSeek 5x Faster by Fixing GPU Bottlenecks

Prime Intellect fused distributed load balancing into their Mega MoE kernel, delivering up to 6x faster MoE layers under skew with bit-exact results.

Paper, Full Access
  • Prime Intellect fused distributed load balancing into their Mega MoE kernel, bit-exact with the baseline.
  • Up to 6x faster MoE layers under heavy expert skew, 1.2-1.6x on real DeepSeek-V4 routing.
  • Hot experts get replicated to idle GPUs; weights stream over NVLink behind computation.
  • Planning runs on-GPU in tens of microseconds and is compatible with torch.compile and CUDA graphs.
  • Communication buffers shrink 3-3.4x, enabling 64K tokens per GPU in 14 GiB vs ~170 GiB.
  • Available on Model Factory dedicated clusters for Hopper and Blackwell.

Prime Intellect has added dynamic expert replication to its Mega MoE kernel. During each mixture-of-experts layer, the fused planner moves part of an overloaded expert’s token workload and a temporary copy of its weights to GPUs with spare capacity. Moving that work while computation is underway reduces straggler latency and communication-buffer pressure without changing the router’s expert selections.

The busiest GPU sets the clock

Mixture-of-experts models route each token to a small subset of available experts. Under expert parallelism, each GPU owns a fixed group of those experts. When one rank receives three times the average token load, it takes roughly three times as long to process its assignments, leaving the other ranks waiting at the layer boundary.

Recorded DeepSeek-V4-Flash training traces show the busiest GPU carrying 1.3 to 1.6 times the average load on typical steps and up to 1.9 times the average in the most skewed layers. Data-parallel replicas amplify the delay because every replica must wait for its slowest expert-parallel group before training can continue.

Timeline comparing an overloaded GPU with fused expert load balancing
Fused balancing redistributes work that would otherwise leave peer GPUs idle while the busiest rank finishes.

Planning stays on the GPU

Inside the fused kernel, each GPU counts how many locally originating token assignments target every expert. It then writes those counts directly into peer GPU memory and runs the same small greedy assignment over the shared table. The approach adapts the least-loaded strategy described in the LLEP paper, assigning excess tokens and temporary expert replicas to the least-loaded GPUs with available foreign slots.

For EP 8 configurations, peer writes travel over NVLink without a CPU round trip or separate collective call. Prime Intellect reports multi-node operation at EP 16 and EP 32 over InfiniBand. The implementation limits overhead and memory use through several design choices:

  • Foreign slots, which hold temporary expert copies, are pooled across the model’s MoE layers instead of being reserved separately for every layer.
  • Planning takes tens of microseconds and leaves tensor shapes unchanged, preserving compatibility with torch.compile and CUDA graphs.
  • When the planner finds no useful spill assignment, the layer follows the standard Mega MoE execution path.

Copies run behind the matrix math

Copying expert weights can delay the layer if transfers sit on its critical path. Mega MoE overlaps those transfers with computation by assigning dispatch warps, groups of GPU threads that move data, alongside the warps performing matrix multiplications on each streaming multiprocessor. Once a GPU has fetched its token rows, matrix work begins while dispatch warps copy lent expert weights directly into helper GPUs’ foreign slots. A release-store readiness flag prevents the helper from starting until the copied weights are visible.

During backpropagation, each helper writes its portion of a borrowed expert’s weight gradient into an FP32 slot. A gather kernel sums those partial gradients in a fixed order. Prime Intellect reports that this ordering preserves the baseline weight-gradient result, while published checks found bit-for-bit identical outputs and input gradients relative to Mega MoE.

Skew determines the payoff

Prime Intellect evaluated the kernel with synthetic expert skew, recorded DeepSeek-V4 routing, and a production reinforcement-learning trace. The figures below are vendor-reported layer-level comparisons against Mega MoE.

Reported fused load-balancing results
Workload Configuration Reported result
Heavy synthetic skew Multiple tested configurations Up to 6x faster
DeepSeek-V4-Flash synthetic layer H200, 256 experts, top-6 routing, EP 8 At extreme skew, fused time rose 40% from the balanced case, compared with 7.4x for Mega MoE. The fused kernel was 5.3x faster.
DeepSeek-V4-Flash synthetic layer B300, 256 experts, top-6 routing, EP 8 At extreme skew, fused time rose 38%, compared with 6.1x for Mega MoE. The fused kernel was 4.4x faster.
Recorded DeepSeek-V4 routing Replayed layer traces 1.20x faster on average and up to 1.64x on the most skewed layers
Recorded routing on Blackwell B300, MXFP8, 64K tokens per GPU 1.22x faster on average
Production reinforcement learning Routing skew measured across 112 B300 GPUs 1.32x faster
Multi-node expert parallelism EP 16 and EP 32 over InfiniBand 1.41x faster at EP 16 and 1.48x faster at EP 32
Speedups from replaying recorded DeepSeek-V4 expert-routing patterns
Recorded routing traces produce smaller gains than extreme synthetic skew, with the largest improvements concentrated in heavily imbalanced layers.

Speedup rises with routing skew because a larger share of the busiest rank’s work can move to idle hardware. Higher expert-parallel degrees also leave more ranks waiting behind a single straggler, increasing the value of redistribution in the reported multi-node runs.

Bounded plans shrink buffers

Mega MoE must provision receive buffers for a routing pattern in which every sender directs its tokens to one receiver. The fused planner caps the amount assigned to each GPU and processes larger workloads in bounded chunks, replacing that open-ended receive requirement with a predictable allocation.

At 64K tokens per GPU, Prime Intellect reports that the balanced kernel completed the layer in four chunks using 14.4 GiB of communication memory. The corresponding Mega MoE worst-case allocation was roughly 170 GiB and could not fit on the tested GPU. Across the broader benchmark set, the company reports communication-memory reductions of up to 3.4x.

Where developers can run it

Prime Intellect lists fused load balancing as available through Model Factory dedicated clusters. Published support covers the following hardware, numeric formats, and expert-parallel topologies:

Category Published support
Hopper H200 with BF16 or blockwise FP8
Blackwell B200 and B300 with MXFP8 or NVFP4
Single node EP 8 over NVLink
Multiple nodes EP 16 or EP 32 over InfiniBand

Because routing skew varies by model, layer, and training phase, per-rank token counts provide the clearest estimate of likely benefit. A persistent gap between the busiest rank and the mean indicates work that the planner can offload. Prime Intellect reports that integration requires no routing-hyperparameter changes.