Skip to main content
Interactive 3D/MoE Router - Expert Selection Heatmap
Token Routing - Top-2 of 8 Experts
Token
Router (linear)
softmax logits → top-2
E1
logit: 0.0
2.7%
E2
logit: 0.6
4.7%
E3
logit: 1.1
7.9%
E4
logit: 1.5
12.2%
E5
logit: 1.8
16.5%
E6
logit: 2.0
19.5%
SELECTED
E7
logit: 2.0
19.5%
SELECTED
E8
logit: 1.8
16.8%
Expert Load Distribution (across batch)
E1
36.8%
E2
18.4%
E3
12.3%
E4
9.2%
E5
7.4%
E6
6.1%
E7
5.3%
E8
4.6%
Yellow line = capacity (31.3%). Red bars = overflow → tokens dropped.
Auxiliary Load-Balancing Loss
Aux Loss
1.6542
Expected load/expert
25.0%
Load std dev
45.47%
The auxiliary loss penalizes unequal expert utilization. Without it, the router collapses - routing all tokens to the same few experts (expert collapse). With load balancing, experts are used more evenly.
Controls
Number of Experts
Experts8
464
Top-K
Options
MoE Routing: Each token is routed to only top-K experts out of N total. This gives MoE models more parameters than dense models while keeping compute per token constant. Expert collapse and load imbalance are the key failure modes.

MoE Router - Expert Selection Heatmap - Interactive Visualization

Mixture-of-Experts routing sends each token to only a small subset of experts (top-K out of N), enabling models with vastly more parameters than a dense model while keeping per-token compute constant. The router is a learned linear layer that produces logits, softmax probabilities, and selects top-K experts. Without load balancing, the router collapses to always routing to the same experts - the auxiliary loss penalizes this imbalance.

  • Router produces logits for each expert, softmax gives selection probabilities
  • Top-K selection: only K experts process each token, rest are unused
  • Expert collapse: router learns to always pick same experts without auxiliary loss
  • Capacity factor controls expert buffer size - tokens overflow if experts are overloaded
  • Load balancing auxiliary loss encourages uniform utilization across experts

Part of the EngineersOfAI Interactive 3D - free interactive visualizations covering every major concept in machine learning and AI engineering. Hover any element for a plain-English explanation. No code required.