Visual walkthrough — Mixture-of-Experts (MoE) architecture
Step 1 — A token is just an arrow of numbers
WHAT. The thing flowing through the network is a token embedding, written . It is a vector: a fixed-length list of numbers. Think " numbers" for pictures; real models use in the thousands.
WHY. Everything downstream — scoring, routing, blending — is arithmetic on these numbers. Before we can route a token we must agree on what a token is: a point in space, equivalently an arrow from the origin to that point.
PICTURE. The blue arrow is our token . Its two shown coordinates are just the numbers that place its tip. (Real tokens live in dimensions; we draw 2 so your eyes can follow.)

Step 2 — Each expert has a "preference arrow"; the dot product measures how well matches it
WHAT. We have experts. The router stores one preference vector per expert, stacked as rows of a matrix of shape ( rows, columns). Row , call it , is expert 's favourite direction. We score the match between token and expert with the dot product.
WHY THIS TOOL — why a dot product and not, say, a difference? We want one number saying "how aligned is with what expert likes." The dot product is large and positive when the two arrows point the same way, zero when perpendicular, negative when opposed. That is exactly "alignment," and it is a single number — perfect for scoring.
PICTURE. Two red expert-preference arrows. The token (blue) is nearly parallel to expert (big projection → big score) and nearly perpendicular to expert (tiny projection → small score). The dashed line is 's shadow onto — its length is the dot product.

Step 3 — Turn the raw scores into probabilities with softmax
WHAT. After Step 2 we have raw scores . Some may be negative, none sum to anything nice. We convert them into probabilities that are all positive and sum to , using softmax.
WHY THIS TOOL — why exponentiate, why not just divide by the sum? Three demands: (1) every weight must be positive (a negative blend weight is meaningless), (2) they must sum to 1 (so the output is a proper average), (3) the map must be smooth so the router can learn by gradients. Plain division fails demand (1) with negative scores. The exponential is always positive and grows monotonically — bigger score, bigger share — and it is smooth everywhere.
PICTURE. Left bars: the raw logits (some negative). Middle: after everything is positive and the tall ones stretch taller. Right: after dividing by the total, the bars become a probability distribution summing to .

Step 4 — Keep only the Top- experts (this is where the savings live)
WHAT. We do not run all experts. We pick the experts with the largest (usually or ). Call that set of chosen indices . Everyone outside is set to gate .
WHY. An expert with gate contributes — so we never compute at all. That is the whole reason MoE is cheap: compute scales with , not (see Sparse vs Dense Models and Conditional Computation). You store experts (knowledge) but fire only (cost).
PICTURE. The four probability bars from Step 3. A yellow "keep line" sits under the top-2; the top-2 bars glow, the bottom-2 are crossed out (gate , greyed). Only the glowing experts will do arithmetic.

Step 5 — Re-normalize the survivors so their weights sum to 1
WHAT. After deleting the losers, the surviving probabilities no longer sum to (we threw some mass away). We divide each survivor by the survivors' total, giving the final gates .
WHY. The layer output will be a weighted average of expert outputs. For it to be a proper average — a convex blend, no accidental scaling up or down — the weights must sum to . Re-normalizing over just restores that.
PICTURE. Left: the two survivors, e.g. and , summing to only (a gap). Right: after dividing by they become and , refilling the bar to a full .

Step 6 — Blend the chosen experts' outputs into the answer
WHAT. Now, and only now, we actually run each chosen expert on the token: . Each is an ordinary feed-forward network. We combine their outputs, each scaled by its gate.
WHY. The gate says "how much to trust expert for this token." A gate-weighted sum lets the two specialists co-author the answer, weighted by relevance. The result is the MoE layer's output — same shape as , so it slots into the network like any other layer.
PICTURE. Two glowing experts each emit an output arrow. Expert 's arrow is scaled by (long), expert 's by (short); tip-to-tail addition gives the final green output arrow .

Step 7 — Edge case: the "rich get richer" collapse, and the balancing nudge
WHAT. Steps 1–6 describe one token. Over a whole batch, a nasty degenerate case appears: the router keeps sending most tokens to a handful of experts, and the rest go dead. This is routing collapse.
WHY IT HAPPENS. A slightly-better expert gets more tokens → trains faster → gets even better → gets even more tokens. A runaway feedback loop. The result wastes almost all your stored parameters — the entire MoE bet is lost. We counter it with an auxiliary load-balancing loss (see Load Balancing and Auxiliary Losses).
PICTURE. Left board: "no aux loss" — one giant bar (an overloaded expert), the rest flat on the floor (dead). Right board: "with aux loss" — bars pushed toward the even dashed line .

Step 8 — Edge case: capacity overflow and token dropping
WHAT. Even with balancing, each expert has a hard seat limit per batch, the capacity . Tokens beyond for an over-subscribed expert are dropped — they skip the experts and pass straight through the residual connection unchanged.
WHY. Real hardware allocates fixed-size buffers per expert (see Model Parallelism & Expert Parallelism). If more tokens arrive than seats exist, the extras cannot fit. The capacity factor tunes how many spare seats you buy: bigger = fewer drops but more memory/compute.
PICTURE. An expert "bus" with seats. Tokens board up to the line; the overflow tokens (pink) fall off and take the residual "bypass road" around the experts.

The one-picture summary
One token flows left-to-right: arrow → dot products → softmax → keep top- → re-normalize → weighted blend → , with the two guardrails (balance, capacity) hanging underneath.

Recall Feynman: the whole walkthrough in plain words
A token arrives as an arrow of numbers. Each expert keeps a "favourite direction," and we measure how well the token points that way with a dot product — one number per expert (Step 2). Those numbers are messy, so softmax squashes them into clean positive percentages that add up to (Step 3). We keep only the two biggest and throw the rest to zero, because a zeroed expert does no work — that's the whole reason MoE is cheap (Step 4). The two survivors' percentages no longer add to , so we rescale them (Step 5), then run just those two experts and mix their answers by those percentages to get the output (Step 6). Two safety rails watch the batch: a balancing nudge stops one expert from hogging everyone (Step 7), and a seat limit drops overflow tokens onto a bypass road when an expert is full (Step 8).
Recall Quick self-check
Why does compute scale with and not ? ::: Because non-chosen experts get gate , so is never computed for them; only the chosen experts run. Why softmax and not plain division of the logits? ::: Logits can be negative; softmax's exponential makes every weight positive, keeps them summing to 1, and stays smooth so the router can learn by gradients. What breaks if we skip the load-balancing loss? ::: Routing collapses onto a few experts (rich-get-richer), leaving most parameters dead and wasting the model's capacity.