ElemedexA pocket encyclopedia of AI architectures

Glossary (TM) › Architectural parts

TM096

Mixture of experts

Also: MoE, sparse mixture of experts

In Spanish: Mezcla de expertos

A layer made of many subnetworks ("experts") and a router that picks a few for each token: the model has many parameters but uses only a fraction per token.

In an ordinary transformer, all parameters work on every token. In a mixture of experts, the feedforward (MLP) block block is replaced by n parallel blocks (the experts) and a small gating network, the router, which scores the experts for each token and picks the top k. The output is the sum of those few experts, weighted by the router (Jiang et al., 2024, sec. 2.1):

y = Σᵢ G(x)ᵢ · Eᵢ(x), G(x) = softmax(TopK(x · W_g))

Experts not chosen are not computed: this is sparse activation.

Why. It decouples the size of a model from the cost of running it. Shazeer et al. (2017) inserted between recurrent layers a layer with thousands of experts and up to 137 billion parameters, multiplying capacity with only minor losses in efficiency. In Mixtral 8x7B (Mixture of experts (Mixtral)), each layer has 8 experts and the router picks 2 per token: 47 billion parameters in total, 13 billion active (Jiang et al., 2024). The idea is much older than transformers (Jacobs et al., 1991) and now appears in large open models such as DeepSeek-V3: 671 billion parameters, 37 billion active per token (DeepSeek-AI, 2024).

Costs. All experts must sit in memory even though each token uses few, and the router must be kept from sending everything to the same experts.

A misleading name. "Expert" suggests topic specialists: one for biology, another for philosophy. Mixtral's authors tested this and found no split by topic: the experts chosen for ArXiv papers, biology and philosophy were distributed very similarly. What they did find was syntactic regularity: in Python code, the word self or indentation tokens tend to go to the same expert (Jiang et al., 2024, sec. 5). It is a useful reminder for anyone thinking about Fodor-style modularity of mind: that an architecture has modules does not mean they divide the work the way a human org chart would.

Sources

  • Alammar, J., & Grootendorst, M. (2024). Hands-on large language models: Language understanding and generation. O’Reilly Media. §
  • DeepSeek-AI. (2024). DeepSeek-V3 technical report (arXiv:2412.19437). arXiv. https://doi.org/10.48550/arXiv.2412.19437 §
  • Jacobs, R. A., Jordan, M. I., Nowlan, S. J., & Hinton, G. E. (1991). Adaptive mixtures of local experts. Neural Computation, 3(1), 79–87. https://doi.org/10.1162/neco.1991.3.1.79 §
  • Jiang, A. Q., Sablayrolles, A., Roux, A., Mensch, A., Savary, B., Bamford, C., Chaplot, D. S., de Las Casas, D., Bou Hanna, E., Bressand, F., Lengyel, G., Bour, G., Lample, G., Renard Lavaud, L., Saulnier, L., Lachaux, M.-A., Stock, P., Subramanian, S., Yang, S., . . . El Sayed, W. (2024). Mixtral of experts (arXiv:2401.04088). arXiv. https://doi.org/10.48550/arXiv.2401.04088 §
  • Shazeer, N., Mirhoseini, A., Maziarz, K., Davis, A., Le, Q., Hinton, G., & Dean, J. (2017). Outrageously large neural networks: The sparsely-gated mixture-of-experts layer. In 5th International Conference on Learning Representations (ICLR 2017). https://openreview.net/forum?id=B1ckMDqlg §