What does the router inside a Mixture-of-Experts block actually do, per token?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
The router is a tiny linear layer projecting from the model width to N expert scores per token, picking the top-k (usually 1 or 2) and weighting their FFN outputs by softmaxed scores.
Imagine a busy hospital where every patient walks in and a single receptionist instantly decides which one or two specialists they need to see, out of a hundred specialists in the building. The receptionist is the router: tiny compared to a specialist (one quick form, not a full exam), but their decision controls all the heavy work. If the receptionist always sent everyone to the same two specialists, the other ninety-eight would sit idle, so the hospital trains the receptionist to spread the load evenly. In an MoE transformer, the router does exactly this for every token in every block.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 min: name the linear-layer shape, walk one token through top-k selection and softmax weighting, mention load-balancing loss.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating the router as expensive or stateful. It is a single tiny linear layer with no recurrence and no awareness of other tokens; the whole point is that routing decisions are cheap and local.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.