Expert Parallel Communication Design: MoE Dispatch and Combine in Practice
This article explains how dispatch and combine communication work in Mixture-of-Experts (MoE) models under expert parallelism. It covers data flow estimation, throughput-vs-latency tradeoffs, key kernel design points such as metadata precomputation, hierarchical communication, overlap, low-precision transfer, and buffer management, and addresses load imbalance as a critical system-level issue.
From Sparse Activation to Dedicated Communication
Mixture-of-Experts (MoE) models split the feed-forward layer into multiple expert networks. Each input token passes through only a few experts selected by a router—typically top-k, where k is much smaller than the total number of experts. This sparse activation allows the model to scale parameters while keeping per-token computation manageable.
When the number of experts exceeds the memory capacity of a single GPU, experts are sharded across multiple GPUs, forming Expert Parallelism (EP). In this setup, the GPU that hosts a token is often different from the GPUs that host its target experts. Each forward pass must first send tokens to the target GPUs, and after expert computation, send the results back to the original GPUs. These two steps are called dispatch and combine, respectively.
From a communication pattern perspective, each GPU may send data to all other GPUs, and the receiving volume depends on routing outcomes. This is irregular all-to-all communication. Unlike regular collective communication, the amount of data exchanged per call is not fixed in advance, so it cannot be easily handled with fixed-size buffers and static scheduling tables.
How Dispatch and Combine Work
The dispatch phase involves three core tasks. First, based on the router output, compute which expert each token should go to and which GPU hosts that expert. Second, count the number of tokens each destination GPU will receive and compute write offsets so the sender can pack data contiguously. Third, perform the actual data transfer, writing the token hidden states and necessary metadata into the peer’s buffer.
Combine is the reverse process. After expert computation, the outputs of each token from multiple experts must return to the original GPU and be weighted-summed according to routing weights. This requires the system to record each token’s original position and weight; otherwise, results cannot be correctly reconstructed.
The communication volume can be estimated with a general formula. If each GPU has T tokens, hidden dimension H, each element occupies B bytes, and routing uses top-k, then the upper bound of data sent per GPU during dispatch is approximately T × k × H × B bytes. This excludes metadata and ignores tokens sent to local experts. The combine phase moves data in the opposite direction with similar volume.
This formula shows that increasing top-k or hidden dimension increases communication load linearly. That is a key reason model design must carefully weigh the value of k.
High Throughput vs. Low Latency: Trade-offs in Different Scenarios
The same communication logic faces very different constraints depending on the scenario. The table below summarizes the main differences.
| Dimension | Training & Long-Sequence Prefill | Decoding Inference |
|---|---|---|
| Message size per call | Large batch, high volume | Small batch, small messages |
| Primary metric | Throughput, i.e., bandwidth utilization | Latency, especially tail latency |
| Main bottleneck | Link bandwidth and congestion | Startup overhead and synchronization waits |
| Common strategy | Chunked pipelining, overlap with compute | Reduce synchronization points, streamline kernel launches |
During training, each step processes a large number of tokens. As long as bandwidth utilization is high, per-step time shrinks. During decoding, only a few tokens are generated at a time, and messages are tiny. Synchronization overhead, kernel launch time, and network round-trip latency dominate.
Therefore, a communication library often needs to provide different execution paths for these two modes. A single set of parameters cannot cover all scenarios.
Key Design Points for Communication Kernels
1. Compute Routing Metadata First, Then Move Data
Efficient implementations typically proceed in two steps. A lightweight kernel first counts tokens per destination GPU, then uses a prefix sum to determine write ranges. A data-movement kernel then writes directly into those ranges. This reduces contention from atomic operations and avoids intermediate reordering.
2. Hierarchy: Reduce Cross-Node Traffic
The interconnect bandwidth within a node is generally higher than network bandwidth between nodes. If the same token must be sent to multiple experts on the same node, it can be sent across nodes only once, then forwarded internally to each expert. This hierarchical approach noticeably reduces duplicate cross-node transfers. The cost is that the implementer must manage two levels of buffers and handle two stages of synchronization.
3. Overlap Communication with Computation
In an MoE layer, communication and expert computation have data dependencies, but different micro-batches can be pipelined. Slice a batch into chunks so that the combine of chunk A runs in parallel with the dispatch or computation of chunk B. This hides part of the communication time. Implementation requires separate execution streams and careful buffer management to ensure a buffer is not overwritten before being read.
4. Low-Precision Transfer
To reduce bandwidth usage, some implementations transmit activations at lower precision and convert back to compute precision on the receiving side. The benefit depends on whether bandwidth is the real bottleneck. Also, the precision loss must be evaluated and validated with numerical comparisons.
5. Buffers and Flow Control
The receive buffer size limits how many pending tokens can be accommodated. Too small a buffer forces senders to wait. Too large a buffer consumes excessive GPU memory. A reasonable approach is to set a capacity upper bound based on historical routing statistics, and apply a clear strategy when the bound is exceeded: queueing, batched sending, or truncation based on a capacity factor.
Load Imbalance: The Core Problem Beyond the Communication Library
The router does not necessarily distribute tokens uniformly across experts. Some experts may be persistently popular, causing their GPUs to receive far more data than average. Because communication must wait for the slowest GPU, load imbalance can become a serious bottleneck. This is not solved purely by communication kernels; it requires system-level measures such as load balancing losses, dynamic expert placement, or capacity-based routing. The article’s original text is cut off at this point, but the key observation remains: communication design and workload balancing must be considered together to achieve optimal performance.
