← ml-viz MoE blog post

Mixture of Experts: Routing, Collapse & Serving

Sparse MoE replaces one monolithic FFN with N specialist experts and a router that activates only top-k per token. Decoupling total parameters from per-token FLOPs unlocks huge capacity—but creates three engineering problems: expert buffer overflow, router collapse during training, and batch-dependent serving memory bandwidth. Tabs 1–2 are computed live from seeded browser simulations; Tab 3 combines published specs + formula.

Token-to-expert routing & capacity buffers

computed live
Each of the 32 tokens in a batch computes softmax router probabilities pi(x) = softmax(h(x) / T) and routes to its top-k experts. Fixed-buffer MoE caps each expert at capacity = ceil(C · Ttok · k / N) slots: excess tokens overflow and are dropped (falling back to the residual stream), while unused slots become wasted padding. Toggle Dropless MoE to see variable-sized block-sparse execution eliminate both.

Expert capacity buffers (32 tokens × 2 = 64 routed slots)

Hover or tap any token block for routing details
assigned (rank #1 expert) assigned (rank #2+ expert) dropped (overflow > capacity) unused buffer padding capacity limit

Token-to-expert routing probability matrix pi(xt)

Cell shade = softmax probability · dark outline = selected top-k · red cross = dropped