What a mixture of experts is
In a dense transformer every token goes through the same MLP in every block, so adding parameters adds computation for every token. A mixture of experts (MoE) replaces that MLP with many smaller MLPs, the experts, and a router that sends each token to a few of them. The model can hold many more parameters than any one token uses.
This page records Granite 3.1 1B-A400M, which has 1,334,625,280 parameters of which about 400M are active for each token. Each of its 24 blocks has 32 experts and routes every token to 8. The trace covers three prompts, The capital of France is, a two-line Python function and a small sum, at every layer: 696 token–layer pairs and 5,568 expert evaluations. On the first prompt the most likely next token is Par, the start of Paris, at 34.3 %.
The router
The router is a linear map from the normalised hidden state (1024 dimensions) to one logit per expert. Granite keeps the 8 largest logits and applies a softmax to those 8 only, so the weights of the chosen experts sum to 1:
The choice depends on the token and the layer: every token in the Mixture of Experts block has its own eight experts, and the arrows step through them. Expert numbers are local to a layer, so expert 5 in block 1 has nothing to do with expert 5 in block 2. In the default view, the last token is in block 1, the eight weights run from 25.5 % down to 5.9 %, so no single expert dominates.
One expert
Each expert is a small SwiGLU MLP without biases. Two projections take the 1024-dimensional input to 512 dimensions; the SiLU of one gates the other, and a third projection returns to 1024:
The expert card draws these steps as the Wup, Wgate, SiLU, ⊙ and Wdown boxes, 1024 → 512 → 1024, and its pager steps through the token's 8 experts.
Weighted sum and residual
The Σ step adds the eight experts' full 1024-dimensional outputs, each multiplied by its router weight, and the block adds the result to the residual stream after scaling it by 0.22:
Only 8 of the 32 experts run, so the MoE layer costs about as much as one MLP a quarter of its total size. In return the router must spread tokens sensibly: in training, MoE models add a load-balancing loss so that a few experts do not take every token.
Attention and Granite's multipliers
Attention uses 16 query heads of 64 dimensions and 8 key and value heads, each shared by two query heads (grouped-query attention). There is no position vector. The RoPE step rotates each query and key in pairs of coordinates by angles set by the token's position, , so that depends only on how far apart the two tokens are.
Granite also scales four places with fixed multipliers, which the page shows where they act: the token embedding is multiplied by 12 (Embedding Scale); attention scores are divided by 64, the head size, rather than by ; every attention and MoE output is multiplied by 0.22 before it joins the residual stream; and the logits are divided by 6 before the softmax. Multipliers like these come from the maximal-update parametrisation (μP), which prescribes the attention scale and lets hyper-parameters tuned on a small model carry over to a large one. The Granite 3.0 report describes training with μP and IBM's Power scheduler.
Where mixtures of experts came from
Jacobs, Jordan, Nowlan and Hinton (1991) trained several networks together with a gating network that learned which one should handle each input. Shazeer et al. (2017) made the gate sparse, choosing a few of thousands of experts per token inside an LSTM language model, so that parameters grew far faster than computation. GShard (2020) put top-2 experts into the transformer, Switch Transformers (2021) routed each token to a single expert, and Mixtral (2024) brought top-2 of 8 experts to open models.
The MLA tab shows DeepSeek's variant, with two always-on shared experts and top-6 weights that are not renormalised, and the SF tab shows gpt-oss's top-4 of 32 experts stored in 4 bits. The Dense tab shows the single MLP that experts replace.
Papers
- Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer The sparsely gated MoE layer: a trainable router picks the top-k of many experts for each token.
- Granite 3.0 Language Models The Granite family this page records, including its mixture-of-experts models, trained with μP and the Power scheduler.
- Adaptive Mixtures of Local Experts The original mixture of experts: a gating network learns to assign each input to one of several expert networks.
- GShard: Scaling Giant Models with Conditional Computation and Automatic Sharding Mixture-of-experts layers with top-2 routing inside the transformer, trained across thousands of accelerators.
- Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity Routing each token to a single expert, with a simple load-balancing loss.
- Mixtral of Experts An open-weight model that routes each token to 2 of 8 SwiGLU experts in every layer.
- GLU Variants Improve Transformer Gated MLPs, among them SwiGLU, the form of every Granite expert.
- Tensor Programs V: Tuning Large Neural Networks via Zero-Shot Hyperparameter Transfer The maximal-update parametrisation (μP): multipliers and a 1/d attention scale that let hyper-parameters transfer across model sizes.