
Distributed AI inference increasingly relies on Mixture of Experts (MoE) models, where different expert networks are distributed across multiple GPUs. When a router assigns tokens to experts hosted on different devices, the inference system must transfer token data to the appropriate GPUs and return the computed results. This creates an All-to-All communication pattern that can significantly influence inference latency, throughput and cluster scalability. Its performance depends not only on network bandwidth, but also on token distribution, expert placement, message size, communication scheduling and the efficiency of dispatch and combine operations.
1. Why All-to-All Communication Matters in Distributed AI Inference
Large AI inference systems often distribute model computation across multiple GPUs to accommodate model size, increase serving capacity and process concurrent requests. Dense models generally follow relatively predictable tensor-parallel or pipeline-parallel communication patterns. MoE models introduce an additional requirement: tokens must be routed dynamically to selected expert networks.
When experts are distributed across GPUs, a token generated on one GPU may need to be processed by an expert on another GPU. The system must exchange token activations, execute the expert computation and return the results to the original sequence or request context.
This process creates two major communication phases:
Dispatch: Sends tokens and associated routing information to the GPUs hosting their selected experts.
Combine: Returns expert outputs to the appropriate source ranks and reconstructs the required token order and weighted results.
These operations form the core All-to-All communication path in many expert-parallel inference deployments. As the number of GPUs and concurrent requests increases, communication efficiency becomes an important factor in overall serving performance.
2. How MoE Routing Creates All-to-All Traffic
A Mixture of Experts layer contains multiple expert networks and a router. Instead of sending every token through every expert, the router selects a subset of experts for each token, commonly determined by a Top-K routing configuration.
For example, a Top-2 configuration selects two experts for each token. If those experts are located on different GPUs, the token's activation data must be transferred to the corresponding devices.
Consider a simplified deployment with four GPU ranks:
GPU 0 hosts Experts 0 and 1.
GPU 1 hosts Experts 2 and 3.
GPU 2 hosts Experts 4 and 5.
GPU 3 hosts Experts 6 and 7.
If a token is assigned to Expert 1 and Expert 6, its activation data must reach GPU 0 and GPU 3. Other tokens in the same batch may be assigned to entirely different combinations of experts.
As a result, each GPU may send data to several other GPUs and receive data from multiple sources. This many-to-many exchange is the defining characteristic of All-to-All communication.
3. The Dispatch and Combine Process
The All-to-All process is generally organized around the execution of an MoE layer.
| Stage | Operation | Data involved | Purpose |
|---|---|---|---|
| 1. Router | Expert selection | Token representations, expert indices and routing weights | Determines which experts process each token |
| 2. Dispatch | All-to-All exchange | Token activations and routing metadata | Transfers tokens to the ranks hosting selected experts |
| 3. Expert computation | Local grouped computation | Received token batches | Runs the assigned expert networks |
| 4. Combine | Return exchange | Expert outputs and routing information | Returns results to the originating ranks |
| 5. Aggregation | Weighted combination | Returned expert outputs and router weights | Reconstructs the final MoE layer output |
Dispatch and combine are closely related but are not identical operations. Dispatch distributes tokens according to expert ownership. Combine performs the reverse mapping, returning expert results and applying the required aggregation.
Efficient implementations can integrate data movement, token permutation and buffer placement into optimized communication kernels. This reduces intermediate processing and unnecessary memory traffic.
4. All-to-All vs AllGather and ReduceScatter
All-to-All is not the only way to distribute data across expert-parallel ranks. Some implementations use AllGather followed by ReduceScatter to achieve related communication behavior.
With AllGather, each rank receives data from all participating ranks. This can distribute more token data than necessary when each token is routed to only a small subset of experts. ReduceScatter then combines partial results and distributes output segments among ranks.
Direct All-to-All dispatch can avoid sending a token to ranks that do not host any of its selected experts.
| Communication pattern | Data movement | Potential advantage | Consideration |
|---|---|---|---|
| AllGather + ReduceScatter | Broad data exchange across participating ranks | Can be useful for particular parallel layouts and implementations | May transfer data to ranks that do not own selected experts |
| All-to-All dispatch and combine | Routes tokens to ranks hosting selected experts | Can avoid unnecessary distribution when Top-K is much smaller than EP size | Requires efficient routing, packing and receive-buffer management |
| Fused or specialized exchange | Combines communication with selected data-processing operations | Can reduce intermediate buffers and kernel overhead | Depends on hardware, software backend and workload support |
The appropriate approach depends on expert placement, parallelism configuration, message size and the communication backend. All-to-All is not automatically faster in every deployment.
5. Communication Volume and Top-K Routing
The amount of data exchanged by an MoE layer depends on the number of tokens, hidden-state dimensions, activation precision and routing configuration.
For a simplified dispatch model, the approximate activation payload sent to selected experts can be expressed as:
Dispatch payload:
\(V_{\text{dispatch}}\approx T\times K\times H\times S\)
Where T is the number of local tokens, K is the number of selected experts per token, H is the hidden-state dimension and S is the number of bytes per activation element.
This expression assumes that each token-to-expert assignment is counted as a separate payload. Actual network traffic may differ because of local expert assignments, packing, quantization, metadata, padding, protocol overhead and implementation-specific buffer layouts.
For example, a Top-2 routing configuration can generate up to two expert assignments per token. When the expert-parallel group contains many more ranks than the Top-K value, direct routing may avoid distributing every token to every rank.
However, Top-K alone does not determine communication cost. The number of tokens assigned to each destination rank and the proportion of local versus remote expert assignments are also important.
6. Expert Parallelism and GPU Placement
Expert Parallelism (EP) distributes different expert networks across multiple GPU ranks. Each rank stores and executes a subset of the experts, while the router determines where each token should be processed.
When EP spans multiple GPUs within a server, communication may use high-bandwidth GPU interconnects such as NVLink, depending on the platform. When experts are distributed across servers, token exchange may traverse the network fabric through RDMA-capable adapters and high-speed switching infrastructure.
The physical placement of experts therefore affects the communication path:
Same GPU: The selected expert can process the token locally without inter-GPU network transfer.
Same server: Data may move through a high-bandwidth intra-node GPU interconnect.
Different servers: Data generally traverses NICs and the data center switching fabric.
Good placement can increase locality and reduce expensive cross-node transfers. Poor placement may concentrate traffic on a small number of network links or create uneven communication demand between servers.
7. Intra-Node and Inter-Node All-to-All
Distributed inference systems often use a combination of intra-node and inter-node communication. These two domains have different bandwidth, latency and resource characteristics.
| Characteristic | Intra-node exchange | Inter-node exchange |
|---|---|---|
| Physical path | GPU-to-GPU links within a server | GPU, NIC, switch and remote NIC path |
| Common interconnect | NVLink or other supported accelerator interconnects | InfiniBand or Ethernet-based RDMA networking |
| Communication overhead | Depends on GPU topology, link utilization and memory movement | Also includes NIC, transport and network-fabric overhead |
| Scaling concern | GPU interconnect bandwidth and topology | Network bandwidth, routing, congestion and endpoint placement |
| Optimization focus | Locality and efficient GPU data movement | Message aggregation, path utilization and communication scheduling |
A hybrid design can keep frequently communicating experts within a server or high-bandwidth domain while using the data center network for remote expert traffic. This approach requires balancing model placement, GPU utilization and the capacity of the available interconnects.
8. All-to-All Communication During Prefill and Decode
Inference workloads commonly contain two phases: prefill and decode. Their token counts and communication characteristics can differ significantly.
Prefill phase
During prefill, the model processes the input prompt. A request may contain many input tokens, creating a relatively large batch of tokens for MoE routing. Dispatch and combine can therefore involve substantial data movement.
When multiple prompts are processed together, the number of tokens routed through the expert-parallel group may increase further. This can make aggregate communication bandwidth an important performance factor.
Decode phase
During decode, the model generates output tokens iteratively. Each sequence typically contributes a smaller number of newly generated tokens per step than during prefill, although continuous batching can combine tokens from many active sequences.
Smaller communication messages can make latency, kernel launch overhead and synchronization more visible. A communication backend optimized for large data transfers may not be the best choice for small decode batches.
The system should therefore evaluate prefill and decode separately rather than assuming that one All-to-All configuration is optimal for both phases.
9. Token Distribution and Expert Load Imbalance
All-to-All traffic is influenced by how the router distributes tokens across experts. Even when each token selects the same number of experts, different experts may receive very different numbers of tokens.
If one GPU hosts several heavily selected experts, it may receive substantially more data than other ranks. This creates an imbalance in both communication volume and expert computation.
Potential consequences include:
Uneven receive-buffer sizes across ranks.
Longer processing time on overloaded expert GPUs.
Idle periods on ranks that finish their expert computation earlier.
Uneven utilization of NICs and network links.
Higher tail latency for requests affected by overloaded destinations.
Expert load balancing can address some of these problems through improved expert placement, redundant expert copies or runtime reassignment mechanisms where supported. These techniques must be evaluated alongside model accuracy, memory consumption and communication overhead.
10. Communication Latency and Message Size
All-to-All performance depends on both the amount of data transferred and the time required to coordinate the exchange.
For a simplified communication model, the time required to transfer a message can be approximated as:
\(T_{\text{comm}}\approx \alpha+\frac{V}{B_{\text{eff}}}\)
Where \(\alpha\) represents fixed communication overhead, V is the transferred data volume and \(B_{\text{eff}}\) is the effective bandwidth.
This is a simplified model. Real All-to-All operations involve multiple destinations, synchronization, routing, message scheduling, memory operations and possible contention. Their performance cannot always be represented by a single message-size equation.
For small token batches, fixed overhead may dominate. For larger batches, effective bandwidth and congestion become more important.
Inference systems must therefore optimize both latency and throughput, rather than focusing exclusively on peak network bandwidth.
11. Network Topology and All-to-All Traffic Distribution
All-to-All communication can place traffic across many pairs of GPU ranks. The network topology determines the physical paths used to carry this traffic.
A leaf-spine Clos fabric provides multiple paths between different leaf groups and can scale to large endpoint populations. However, the actual performance depends on uplink capacity, routing behavior and the distribution of destination traffic.
Important topology considerations include:
Leaf uplink capacity: Determines how much traffic can leave each server-facing switch.
Spine capacity: Determines aggregate bandwidth between leaf groups.
Path diversity: Provides multiple routes for distributed traffic.
Oversubscription: Can limit simultaneous inter-server communication.
Network locality: Determines whether frequently communicating ranks are connected through shorter or higher-bandwidth paths.
A balanced fabric helps reduce capacity bottlenecks, but it does not eliminate localized congestion when many token transfers target the same expert rank or network output.
12. InfiniBand and RoCE for Distributed Inference
High-performance All-to-All communication often relies on efficient data movement between GPUs across server boundaries. RDMA-capable networking can reduce CPU involvement and provide low-overhead data transfer when supported by the hardware and software stack.
| Design area | InfiniBand | RoCE over Ethernet |
|---|---|---|
| Network infrastructure | InfiniBand switches and compatible adapters | Ethernet switches and RDMA-capable NICs |
| Data movement | InfiniBand transport and RDMA capabilities | RDMA over Converged Ethernet |
| Congestion management | InfiniBand-specific fabric and congestion mechanisms | Often uses ECN-based congestion signaling and transport response; PFC may be used where required |
| Scaling considerations | Fabric routing, adapter configuration and network capacity | QoS, ECN, queue management, routing and end-to-end consistency |
| Deployment focus | Dedicated high-performance interconnect infrastructure | High-performance Ethernet integrated with data center networking |
Both approaches can support distributed AI inference. The appropriate choice depends on existing infrastructure, endpoint support, operational requirements and workload characteristics.
For RoCE deployments, congestion management should be designed across the complete network path. PFC should not be treated as a substitute for adequate capacity planning or effective congestion control.
13. All-to-All Communication Backends and Optimized Kernels
Modern inference frameworks provide different communication backends to implement expert-parallel token exchange. These implementations can differ in their data movement model, synchronization behavior, memory layout and optimization target.
| Backend or approach | General characteristics | Typical consideration |
|---|---|---|
| NCCL-based All-to-All | Uses collective communication primitives for distributed token exchange | Performance depends on topology, message size and collective configuration |
| DeepEP | Provides specialized expert-parallel communication kernels for dispatch and combine | Supports different throughput and latency-oriented communication paths |
| One-sided All-to-All | Uses direct remote memory operations where supported | Can reduce handshake and intermediate data-movement overhead |
| Two-sided exchange | Coordinates sending and receiving operations between ranks | Requires suitable synchronization and buffer management |
| Fused communication and computation | Combines selected data movement with expert processing | Can reduce intermediate kernel and memory overhead, subject to workload support |
There is no universally optimal backend. The best implementation depends on GPU architecture, interconnect topology, expert-parallel group size, token count, activation precision and inference latency targets.
Framework support also changes over time. Backend availability and configuration options should be checked against the deployed version of the inference framework rather than assumed to be identical across releases.
14. Buffer Management and Token Permutation
Before token activations can be exchanged, they must be organized according to their destination ranks and experts. This commonly involves counting assignments, calculating offsets and placing token data into communication buffers.
After receiving the data, each rank organizes tokens into groups suitable for its local expert computations. Following expert execution, the outputs must be mapped back to their original source ranks and token positions.
Buffer management affects both performance and memory usage:
Receive capacity: Must accommodate the expected number of tokens arriving at each rank.
Token ordering: Must preserve the mapping between tokens, experts and source ranks.
Padding: May be required for alignment or efficient grouped computation.
Temporary memory: Additional buffers can increase GPU memory consumption.
Synchronization: Communication and computation must coordinate access to shared buffers.
Optimized implementations can combine permutation with communication to reduce extra memory operations. However, buffer sizing must still account for uneven token distribution and workload variability.
15. Quantization and Its Effect on Communication Volume
Inference systems frequently use reduced-precision formats to lower memory consumption and improve computation efficiency. The activation format also affects the amount of data exchanged during All-to-All communication.
For the same number of token elements, a lower-byte representation can reduce the raw activation payload. For example, BF16 and FP16 commonly use two bytes per element, while FP8 uses one byte per element.
However, actual communication formats may include additional scale information, metadata or packing requirements. Some implementations also convert activations before dispatch or after receiving them.
| Format | Typical storage per element | Communication consideration |
|---|---|---|
| FP32 | 4 bytes | Higher payload size |
| BF16 | 2 bytes | Common reduced-precision activation format |
| FP16 | 2 bytes | Common reduced-precision activation format |
| FP8 | 1 byte | May require scale metadata and format-specific handling |
| FP4 | Typically 0.5 byte per value when packed | May require additional scaling information and specialized packing |
Reduced payload size can improve communication efficiency, but quantization must preserve the numerical behavior required by the model. Communication optimization and model precision should be evaluated together.
16. Prefill and Decode Require Different Communication Strategies
Prefill and decode have different workload characteristics, so an All-to-All implementation optimized for one phase may not be ideal for the other.
| Factor | Prefill | Decode |
|---|---|---|
| Token volume | Often larger due to prompt processing | Usually fewer new tokens per sequence per iteration |
| Communication pattern | Can generate larger dispatch and combine payloads | Can involve frequent smaller exchanges |
| Primary concern | Aggregate throughput and efficient data movement | Latency, synchronization and per-step overhead |
| Batching | Prompt batching can create large token groups | Continuous batching combines active sequences |
| Optimization focus | High-throughput communication kernels | Low-latency exchange and reduced coordination overhead |
Disaggregated serving architectures may also separate prefill and decode resources. In those systems, the expert-parallel communication pattern must be considered alongside the data transfer between serving stages.
17. Common All-to-All Performance Bottlenecks
Uneven expert assignments
Some expert ranks receive more tokens than others, increasing their communication and computation time.
Insufficient inter-node bandwidth
Cross-server traffic may exceed the available uplink or network-fabric capacity, especially when expert placement creates many remote assignments.
Small-message overhead
During decode, smaller token batches can make synchronization and kernel launch overhead more significant than raw bandwidth.
Excessive data movement
Unnecessary replication, repeated permutation or inefficient buffer layouts can increase memory traffic and communication volume.
Network congestion
Destination hotspots and uneven routing can cause localized queue buildup even when aggregate fabric capacity appears sufficient.
GPU and NIC imbalance
Different GPU-to-NIC paths or unequal endpoint capabilities can prevent ranks from achieving consistent communication performance.
18. Measuring All-to-All Performance in Inference Systems
Performance evaluation should measure the complete dispatch and combine path rather than relying only on theoretical network bandwidth.
| Metric | What it measures | Why it matters |
|---|---|---|
| Dispatch latency | Time required to distribute tokens to expert ranks | Identifies overhead before expert computation |
| Combine latency | Time required to return expert outputs | Measures the cost of result aggregation |
| Effective bandwidth | Useful payload transferred per unit of time | Shows actual communication efficiency |
| Per-rank token count | Number of tokens received by each expert rank | Reveals routing imbalance |
| GPU utilization | Compute activity during expert execution | Shows whether communication leaves GPUs waiting |
| Network utilization | Traffic on NICs and switch ports | Identifies constrained links and uneven path usage |
| Queue and congestion metrics | Network queue occupancy and congestion signals | Helps distinguish capacity problems from endpoint limitations |
| End-to-end inference latency | Request processing time | Connects communication performance to user-visible serving behavior |
Measurements should cover different batch sizes, sequence lengths, Top-K values and expert-parallel group sizes. Prefill and decode should be evaluated separately, and tail latency should be considered alongside average latency.
19. Practical Optimization Approaches
Improving All-to-All communication requires coordination across model placement, GPU topology, network architecture and inference software.
Optimize expert placement: Place frequently communicating experts within suitable high-bandwidth domains where possible.
Balance expert load: Monitor token counts per expert and avoid persistent concentration on a small number of ranks.
Choose suitable parallelism: Evaluate EP size and its interaction with tensor and data parallelism.
Select the appropriate backend: Benchmark available communication implementations for the actual GPU and network configuration.
Reduce unnecessary data movement: Use direct routing and efficient token packing where supported.
Improve buffer management: Minimize redundant copies and use appropriate receive-buffer sizing.
Match communication to workload phase: Evaluate throughput-oriented and latency-oriented paths separately.
Validate the network fabric: Check uplink capacity, path utilization, congestion and physical link health.
Measure end-to-end behavior: Confirm that improvements in dispatch and combine reduce actual inference latency or increase serving throughput.
Optimization should be based on measured workload behavior. Reducing communication volume may not improve performance if expert computation or synchronization is already the dominant bottleneck.
20. Conclusion
All-to-All communication is a central component of distributed MoE inference. It connects token routing with expert execution by moving activations to the GPUs that host selected experts and returning the computed results to their original ranks.
Its performance depends on token distribution, Top-K routing, expert placement, GPU interconnects, network-fabric capacity, buffer management and communication backend efficiency. Prefill and decode also introduce different communication requirements, making workload-aware optimization important for production inference systems.
As MoE models and distributed inference clusters continue to scale, efficient dispatch and combine operations will remain essential to controlling communication overhead. A balanced GPU fabric, appropriate expert placement and optimized All-to-All kernels can help maintain predictable performance across increasingly large AI serving deployments.
Evaluate optical transceiver and interconnect options for GPU clusters, high-bandwidth switching fabrics and scalable data center networks.
Contact C-LIGHT
TEL:+86 132 6656 7067




















































>
>
>
>
>
>
>
>