Before you move a control in the demo, say what you expect to change.
Foundation reference
MoE Serving & Scheduling: Token Dispatch, All-to-All, Disaggregated Parallelism
In MoE inference the busiest expert sets each layer's latency, so uneven routing slows the whole batch.
Study guide
Where to start
Why does sparsity trade arithmetic for a scheduling problem, in which load is bursty and uneven and the busiest expert sets the latency?
How to study this pagePredict · Check · Generalize · Continue
Compare what the demo shows with the key equation and with the papers cited below.
Identify the part of the idea that survives a change of notation or model, so you can recognize it in another paper or system.
The newer notebook covers the same concept and has an interactive demo.
Why It Matters for Modern Models
- In MoE inference the busiest expert sets each layer's latency, so uneven routing slows the whole batch.
- With experts spread across devices, every MoE layer needs two all-to-all exchanges (dispatch and combine), whose cost is set by network bandwidth rather than arithmetic.
- MegaScale-Infer reports up to 1.90× higher throughput per GPU than earlier systems by running attention and expert FFNs on separate GPUs (Zhu et al., 2025).
- These constraints apply to any served MoE model, such as Mixtral or DeepSeek-V2, and explain many of their deployment choices.
- This page combines LLM Serving and MoE: it covers what changes when a routed model is served to many users at once.
Questions to Think About
- Why does each MoE layer need two collective communications (dispatch and combine) in addition to its matrix multiplications?
- How many tokens must each expert receive for its matrix multiplications to run efficiently during decoding, and what limits the batch size (KV-cache memory, latency targets)?
- What does expert parallelism change about scaling: expert placement, routing-induced traffic and micro-batching, rather than only tensor parallelism?
- When is it worth placing attention and expert FFNs on separate GPUs, and how does pipelining micro-batches keep both pools busy?
Interactive Demos
Core Math
If you prefer intuition first, try the demos above, then come back for the math.
Serving an MoE model turns sparse computation into a scheduling problem: routing decides how much work and communication each device gets.
Token dispatch (all-to-all exchange):
In each MoE layer, every token is sent to its chosen experts and the results are sent back. For a batch of tokens:
where is the hidden dimension and the bytes per element; the factor 2 counts dispatch and combine. This is an upper bound reached when every routed token leaves its device.
Stragglers (routing skew):
When routing is uneven, the layer waits for the busiest expert:
where is the number of tokens routed to expert , is the achieved floating-point throughput of the device holding it, and is 4 for an expert with two weight matrices (6 for a gated expert with three), at 2 operations per multiply-add. Even when the average load is low, the busiest expert sets the layer time and the other experts sit partly idle.
Disaggregation:
MegaScale-Infer places attention and expert FFNs on separate GPU pools, sized independently, and splits each batch into micro-batches that alternate between the two pools so that neither waits for the other (Zhu et al., 2025). The cost is extra communication between the pools.