ElemedexA pocket encyclopedia of AI architectures
No. 044

Mixture of experts (Mixtral)

Sparse mixture of experts (SMoE) · Mixtral 8x7B

Sparse Committee

Inside there are eight specialists, but each word is seen by only two, the ones a doorman picks at the entrance. It carries 47 billion parameters and works with 13 billion. Nobody quite knows what each expert is an expert in; neither do the experts.

Height
32 layers
Weight
≈ 93 GB (bf16)
Parameters
46.7 B total · 12.9 B active per token
Context
32,768 tokens
Training data
Multilingual data; size and composition undisclosed
Year
2023
Generation
6 · Assistants, reasoning, and agents
Creators
Jiang, Sablayrolles, Roux, Mensch et al. (Mistral AI), after Shazeer et al. (Google Brain, 2017)
Kind
Architecture

Base stats

Total
393

Approximate, ordinal scales meant for comparing species with each other; the hard numbers are in the data sheet.

Weaknesses

  • All 47 B must sit in memory, even though each token uses 13 B.
  • Load balancing: left alone, the router tends to keep favoring the same experts.
  • Spreading experts across GPUs means shipping tokens from one card to another.
  • The “experts” are not topic specialists: the name promises more than there is.

Habitat

It was trained on multilingual data, in a much larger proportion than its predecessor, Mistral 7B. Its weights circulate under the Apache 2.0 license; its lineage, the sparse mixture, now lives inside many frontier models, such as DeepSeek-V3.

Moves

Abilities

Conditional computation
Each token activates only part of the network: total parameters grow with the number of experts, compute only with the chosen ones.
Router
A linear layer scores the eight experts; the top two are kept and their outputs are summed, weighted by a softmax.
Shared attention
Only the feedforward networks are multiplied; attention (with grouped queries) and embeddings are shared, which is why “8x7B” does not add up to 56 B.

Anatomy

At every layer, the router scores the eight experts (SwiGLU feedforward networks) and picks two for this token (here E2 and E6, in color); the output is their sum weighted by a softmax over their scores. The next token, or the next layer, may pick another two. Attention and embeddings are shared by all.

Evolution chain

  • many feedforward “experts”; a router picks two per token032 GPT-3
044 Mixture of experts (Mixtral)
  • multi-head latent attention, FP8 training, 37 B active of 671 B048 DeepSeek-V3

A mixture of experts is a way of making a network larger without making the computation larger: instead of a single feedforward network per layer there are several (“experts”), and a small router network decides which of them process each token. Mixtral 8x7B, by Mistral AI (weights released in December 2023, paper in January 2024), is the specimen that popularized the technique among open weights models: each layer has 8 experts and the router picks 2 per token, so the model has 47 billion parameters but uses about 13 billion per token (Jiang et al., 2024).

How it works

The expert layer replaces the feedforward block of each transformer block. For a token's vector x, the router computes scores x·W_g, keeps the two highest, applies a softmax to them, and the output is the weighted sum of the two chosen experts: y = Σᵢ softmax(Top2(x·W_g))ᵢ · SwiGLUᵢ(x) (Jiang et al., 2024, sec. 2.1). The rest is Mistral 7B's architecture: 32 layers, 4,096-dimensional vectors and grouped-query attention (GQA), in which several heads share keys and values (Jiang et al., 2024, sec. 2; Alammar & Grootendorst, 2024, pp. 98–100). Since attention and embeddings are not multiplied, “8x7B” does not add up to 56 billion.

The key distinction is between total parameters, which grow with the number of experts, and active parameters, which grow with how many are chosen per token (Jiang et al., 2024, sec. 2.1). Memory must hold all 47 billion (about 93 GB in bf16), but the compute per token is that of a 13-billion model.

Where it comes from

The idea is old: Jacobs et al. (1991) proposed “adaptive mixtures of local experts.” Shazeer et al. (2017) turned it into a sparse layer for deep networks: thousands of experts between LSTM layers, up to 137 billion parameters, and a gating network that picks a few per example, which they called conditional computation. They already noticed the central problem: the gating network tends to keep favoring the same experts, which therefore train faster and get chosen even more; they fixed it with an extra loss that rewards balance (Shazeer et al., 2017, sec. 4).

Compared with GPT-3, which is dense (it uses all 175 billion parameters for every token), Mixtral matches or beats Llama 2 70B and GPT-3.5 on most benchmarks, with clear advantages in math, code, and French, German, Spanish and Italian (Jiang et al., 2024, secs. 3–3.1). Its Instruct version was tuned with SFT and DPO. Since then, the sparse mixture has become standard at the frontier: DeepSeek-V3, the base of R1, has 671 billion total parameters and 37 billion active per token.

Limits

Everything must fit in memory, and spreading experts across several GPUs means shipping tokens from one to another and making sure none is overloaded (Jiang et al., 2024, sec. 2.1). The name, moreover, is misleading: Mixtral's routing analysis found no topic experts (see the professor's note). Mistral did not publish the size or composition of the data or the training compute: the data and compute base stats of this entry are estimates, not published figures.

Sources

  • Alammar, J., & Grootendorst, M. (2024). Hands-on large language models: Language understanding and generation. O’Reilly Media. §
  • Buckner, C. J. (2024). From deep learning to rational machines: What the history of philosophy can teach us about the future of artificial intelligence. Oxford University Press. https://doi.org/10.1093/oso/9780197653302.001.0001 §
  • Fodor, J. A. (1983). The modularity of mind: An essay on faculty psychology. MIT Press. https://doi.org/10.7551/mitpress/4737.001.0001 §
  • 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 §