Skip to content
ML to LLMs
Labs / Transformer Lab

Mixture-of-experts routing

Route tokens to experts with a learned gate; change top-k and capacity and watch load balance, dropped tokens, and active parameters.

Theory and worked examples: Mixture of experts

Mixture-of-experts routing

12 synthetic tokens, a seeded synthetic router. Each token picks its top-k experts; each expert has a fixed number of slots.

tokenE0E1E2E3E4E5E6E7
the0.080.030.700.300.100.070.090.04
cat0.640.180.040.030.360.100.040.06
sat0.150.090.050.570.040.430.030.03
on0.100.050.100.390.020.610.100.13
a0.580.420.080.190.140.010.020.03
warm0.410.020.030.190.060.070.080.59
mat✕0.130.040.050.020.020.360.04
and0.100.120.050.020.140.570.090.43
then✕0.160.010.050.070.150.430.13
it✕0.220.480.060.140.010.060.03
slept✕0.060.11✕0.060.130.040.08
.✕0.070.040.030.010.020.360.17

Blue cells are chosen experts with their renormalized gate weight; grey numbers are router probabilities of unchosen experts; ✕ means the expert was full.

Expert load vs capacity

E08E11E22E34E41E53E63E72
processed dropped (over capacity) capacity
6 token-expert slots overflowed and were dropped; those tokens skip that expert and keep only the residual. Turn on balancing or raise the capacity factor.