Follow
Subscribe via Email!

Enter your email address to subscribe to this platform and receive notifications of new posts by email.

Mixture of Experts Architecture and How Sparse Routing Works

The mixture of experts architecture divides neural networks into specialized subnetworks, routing individual tokens to select experts to scale parameter counts without multiplying computational costs.
An abstract geometric pattern composed of dark red, crimson, and orange square tiles.

The mixture of experts architecture divides deep neural networks into specialized sub-networks, routing each input token to only a small fraction of available parameters. Conventional dense networks activate every weight for every token, but sparse models select specific experts based on routing scores. This selective execution expands total model capacity without forcing a proportional jump in compute workload. Systems can scale to tens or hundreds of billions of parameters, and they keep the runtime latency of much smaller models [10].

Mathematical Core of the Ensemble

Gating directs incoming data. This modular framework traces its roots to ensemble learning, where separate units divide a complex problem space into smaller regions, pairing multiple sub-networks with a gating function instead of forcing a monolithic network to master every pattern [8].

Formally, an input vector $x$ feeds into $n$ separate expert functions, labeled $f_1$ through $f_n$, together with a weighting mechanism that computes routing coefficients $w(x)$ to produce a weighted sum output. The overall system calculates its output as $f(x) = \sum_{i=1}^n w(x)_i f_i(x)$, scaling each expert contribution by its assigned weight. In classical models, both the gating function and expert weights are optimized together using gradient descent or maximum likelihood estimation. Softmax activations generate a probability distribution over the ensemble. This creates a soft partition of the input domain, and each expert tunes its weights to a specific subset of training inputs. Variants also substitute Gaussian distributions with Student’s t-distributions to handle noisy data with heavy tails [7, 8].

Conditional computation separates modern models from older ensembles. In a dense layer, every matrix multiplication runs for every token, consuming energy regardless of sample difficulty. By contrast, conditional routing passes tokens only to selected sub-networks, forming a dynamic computational graph during inference that decouples total parameter capacity from per-token floating-point arithmetic [10]. Sparsity keeps runtime budgets constant. Large models retain broad knowledge without slowing generation speeds.

Architectural overview diagram illustrating the mixture of experts architecture in the OLMoE repository.
Architecture overview from the OLMoE project illustrating token routing across expert feedforward blocks. (Credit: Allen Institute for AI)

Origins in Committee Machines

Early modular systems emerged in the late twentieth century as teams tested committee machines for speech classification tasks. Hampshire and Waibel built the meta-pi network to classify Japanese phonemes spoken by six speakers, consisting of two women and four men. Their model used six time-delayed neural network experts. Five experts focused on five speakers, while the voice of the sixth male speaker was classified through a linear combination of the three other male experts, showing how data-driven gating can discover focused sub-tasks on its own [8]. This division set an early precedent for automated task partitioning. Neural networks could distribute acoustic features across separate modules without human intervention.

Adaptive mixtures of local experts connected gating functions to Gaussian mixture models, using a linear-softmax gate that selected local learners to model patches of data with maximum likelihood estimation while expectation-maximization algorithms optimized assignments during training [8, 9]. Learners managed separate regions.

Deep learning teams adapted these statistical ideas to multi-layer networks in 2013. In an arXiv preprint that has not passed peer review, Eigen, Ranzato, and Sutskever stacked multiple gating and expert layers to build a deep mixture of experts system. When evaluated on shifted handwritten digits from the MNIST benchmark, the network showed that first-layer experts tracked spatial positions while second-layer units focused on digit categories. The authors also applied their network to speech monophones, finding that all combinations of experts were actively utilized. Hierarchical mixtures could extract rich features in stacked neural architectures without manual feature engineering, confirming that layered gating scales well to deep representations [6].

Gating Network Design

Routers evaluate each incoming token. Parallel expert layers replace standard dense feedforward blocks in transformers, where a router computes dot products against learnable vectors and converts raw scores into probabilities to select appropriate sub-networks for each token [8].

Google Brain researchers introduced the sparsely-gated MoE layer in January 2017, combining a top-k selection function with Gaussian noise to route tokens well. Tunable noise in routing logits prevents the gate from picking the same experts during early training steps. Shortly after, developers combined this sparse gating layer with the transformer to build the multimodal MultiModel system [8]. Inactive pathways consume no computing cycles. For a deeper breakdown of how token dispatching operates across distributed clusters, readers can review how sparse AI models route tokens in production environments. Selective dispatching ensures that each parameter block receives tokens matching its learned features, preventing compute waste on inactive weights.

Performance comparison chart for Mixtral 8x7B against dense models.
Performance benchmarks comparing Mixtral 8x7B against Llama 2 models on standard reasoning evaluations. (Credit: Mistral AI)

Hyperparameter $k$ controls routing granularity. Setting $k=1$ maximizes hardware throughput, whereas choosing $k=2$ allows a token to blend information from two complementary experts through an additive weighted sum. Researchers at Nvidia built LatentMoE, used in Nvidia Nemotron and Kimi K3, projecting input tokens into a latent space before routing to conserve memory bandwidth [8].

Why Sparse Mixture of Experts Cuts Compute Costs

Sparse routing breaks this link. Dense language models face steep hardware bottlenecks as parameter counts rise because every token must pass through every weight matrix, meaning that a seventy-billion-parameter dense model requires seventy billion operations to generate a single token [10].

The release of Mixtral 8x7B by Mistral AI in December 2023 offered a clear demonstration of this efficiency in open-weight models [11]. In an unreviewed research preprint, Jiang and co-authors documented that Mixtral replaced standard feedforward layers with eight expert blocks, selecting two experts per token. Although the model houses 46.7 billion total parameters, each token touches only 12.9 billion active weights during inference. The system generates text at the speed and compute budget of a 12.9 billion parameter dense network, and it matches or outperforms Llama 2 70B and GPT-3.5 on reasoning benchmarks [3, 11]. On the MT-Bench evaluation suite, the instruction-tuned version scored 8.30. This score set a competitive benchmark for open models under the Apache 2.0 license [11].

Fedus, Zoph, and Shazeer introduced the Switch Transformer in a 2021 preprint that has not passed peer review, scaling sparse models up to a trillion parameters on the Colossal Clean Crawled Corpus. By adopting top-1 routing, their design simplified communication between processing nodes and cut memory transfers between accelerators. The authors reported up to a sevenfold increase in pre-training speed compared to compute-equivalent dense T5 models. They also showed that sparse models could be trained stably in lower-precision bfloat16 formats, proving that sparse scaling functions well in 101 languages [5].

Scaling graph tracking performance versus active compute budget.
Quality versus inference budget tradeoff demonstrating scaling characteristics of sparse architectures. (Credit: Mistral AI)

Expert Load Balance

A central challenge in training sparse networks is the risk of representation collapse, where the routing network develops an early preference for a few experts and starves the rest. When an expert receives more tokens, it receives more gradient updates and improves faster, creating a self-reinforcing loop that leaves neglected experts untrained. In severe cases, an eight-expert model might collapse into functioning as a single over-burdened dense sub-network. If certain experts sit idle while others exceed processing limits, the model loses representational diversity, causing generation latency to spike whenever token traffic bottlenecks on a single overloaded accelerator [8].

To counter imbalance, the Switch Transformer introduced an auxiliary loss function that penalizes uneven token assignments between batches. Formulated as $\text{loss} = n \sum_{i=1}^n f_i P_i$, it measures the product of token assignment fractions and routing scores. The loss reaches its minimum when every expert handles an equal share of the batch [5, 8].

Standard load balancing can force experts to duplicate basic knowledge, such as common syntax and punctuation, rather than acquiring unique skills. In an unreviewed 2024 preprint detailing DeepSeekMoE, Dai and co-authors proposed isolating shared experts to capture core knowledge while leaving routed experts free to acquire focused skills. They also developed an auxiliary-loss-free balancing strategy using dynamic expert bias terms. If an expert is neglected during training, its bias value increases to attract subsequent tokens. This keeps routing balanced on hardware nodes without adding auxiliary penalties to the main loss function [4, 8].

Detailed benchmark results across mathematics and code generation tasks.
Comparative scores across mathematics, code generation, and multi-turn conversational benchmarks. (Credit: Mistral AI)

Expert Choice in MoE Architecture

Traditional routing in a mixture of experts architecture lets tokens choose their preferred top-k experts, but this setup produces uneven workload distributions. Informational density varies in sentences, and allocating identical expert counts to every token wastes energy on trivial filler words while starving complex semantic concepts that need deeper reasoning from multiple expert parameters [1].

Zhou and co-authors presented an alternative method called expert choice routing at the 2022 Advances in Neural Information Processing Systems conference. Instead of tokens selecting experts, their architecture allows experts to select the top-k tokens from a global batch, ensuring balanced workloads across processors without auxiliary loss terms. Each expert operates with a predetermined capacity buffer. Meanwhile, tokens can be assigned to variable numbers of experts based on their semantic relevance in various layers. Highly informative tokens receive attention from multiple experts, whereas simpler tokens pass through fewer pathways, scaling computation with actual contextual demand [1].

Benchmarks confirmed that expert choice routing achieved more than a two-fold speedup in training convergence compared to Switch Transformer top-1 and GShard top-2 gating baselines. When fine-tuned on eleven tasks from the GLUE and SuperGLUE benchmarks, the framework outperformed dense T5 models in seven of eleven tasks with lower activation cost. Fixed expert buffer sizes eliminated token dropping, proving that reversing routing direction stabilizes distributed multi-expert systems [1].

Open Weight Language Models

Open-source releases accelerated the practical adoption of sparse models through fully reproducible research artifacts. In 2024, Muennighoff and twenty-four collaborators released OLMoE-1B-7B, a sparse model built with 6.9 billion total parameters that activates only 1.3 billion parameters per token, outperforming Llama 2 13B Chat across multiple benchmarks. In an arXiv preprint that has not passed peer review, the authors noted that OLMoE was trained on five trillion tokens from the Dolma dataset. Their team published complete weights, code, and logs [2, 12]. Public checkpoints enabled researchers to study routing evolution through billions of training steps without relying on proprietary black-box APIs.

Parameters ranged up to 34 billion. Xue and co-authors published routing analyses across the OpenMoE series, showing that routing decisions depend largely on token IDs rather than broader context and take shape early in pre-training [8, 10].

Multilingual benchmark evaluation scores for sparse language models.
Evaluation results across multiple European languages showing multilingual capabilities of sparse routing. (Credit: Mistral AI)

Sparse models need fast runtime software capable of handling dynamic memory routing without kernel launch latency. The OLMoE and Mixtral releases integrated directly into high-throughput inference runtimes, including vLLM, SGLang, and llama.cpp. By incorporating MegaBlocks CUDA kernels, these deployment frameworks manage sparse matrix multiplications on accelerators without padding wasted memory buffers, lowering latency for production applications [2, 11, 12].

Memory Demands in MoE Architecture

Sparse systems deliver substantial compute efficiency during training and inference, but they introduce distinct hardware tradeoffs. The foremost challenge involves total memory footprint: even though a model activates only a fraction of its weights per token, all parameters must still reside in accelerator memory to serve real-time requests [8, 10].

Communication overhead poses another hurdle when scaling sparse models on multi-GPU clusters. Because different experts often reside on separate chips, routing tokens requires all-to-all transfers that can saturate interconnect bandwidth, meaning that network latency can quickly erode the compute savings achieved through sparsity. For edge deployments, researchers often pair sparse routing with compact foundation layers, as seen in on-device AI models with hybrid architectures that balance memory limits with task adaptability. Teams map experts on compute nodes to maintain high processor utilization.

Teams continue expanding sparse systems into new modalities and architectures. Frameworks like MoE-LLaVA and Uni-MoE extend sparse expert routing into vision-language tasks. Decoupled weight training stabilizes these cross-modal representations. As routing algorithms shift from simple heuristics toward dynamic, loss-free mechanisms, the mixture of experts architecture remains a practical foundation for scaling artificial intelligence without unsustainable computational overhead [10].

Sources
  1. CONFERENCE PAPER Zhou, Y., Lei, T., Liu, H., Du, N., Huang, Y., Zhao, V., Dai, A. M., Chen, Z., Le, Q. V., & Laudon, J. (2022). Mixture-Of-Experts with Expert Choice Routing. Advances in Neural Information Processing Systems, 35, 7103-7114. [Article Link]
  2. PREPRINT Muennighoff, N., Soldaini, L., Groeneveld, D., Lo, K., Morrison, J., Min, S., Shi, W., Walsh, P., Tafjord, O., Lambert, N., Gu, Y., Arora, S., Bhagia, A., Schwenk, D., Wadden, D., Wettig, A., Hui, B., Dettmers, T., Kiela, D.,. Hajishirzi, H. (2024). OLMoE: Open Mixture-of-Experts Language Models. arXiv. [Article Link]
  3. PREPRINT Jiang, A. Q., Sablayrolles, A., Roux, A., Mensch, A., Savary, B., Bamford, C., Chaplot, D. S., Casas, D. d. l., Hanna, E. B., Bressand, F., Lengyel, G., Bour, G., Lample, G., Lavaud, L. R., Saulnier, L., Lachaux, M., Stock, P., Subramanian, S., Yang, S.,. Lacroix, T. (2024). Mixtral of Experts. arXiv. [Article Link]
  4. PREPRINT Dai, D., Deng, C., Zhao, C., Xu, R. X., Gao, H., Chen, D., Li, J., Zeng, W., Yu, X., Wu, Y., Xie, Z., Li, Y. K., Huang, P., Luo, F., Ruan, C., Sui, Z., & Liang, W. (2024). DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Models. arXiv. [Article Link]
  5. PREPRINT Fedus, W., Zoph, B., & Shazeer, N. (2021). Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity. arXiv. [Article Link]
  6. PREPRINT Eigen, D., Ranzato, M., & Sutskever, I. (2013). Learning Factored Representations in a Deep Mixture of Experts. arXiv. [Article Link]
  7. PREPRINT Chamroukhi, F. (2016). Robust mixture of experts modeling using the t distribution. arXiv. [Article Link]
  8. WEBSITE Wikipedia contributors. (2024). Mixture of experts. Wikipedia, The Free Encyclopedia. [Article Link]
  9. ACADEMIC JOURNAL Yüksel, S. E., Wilson, J. N., & Gader, P. (2012). Twenty Years of Mixture of Experts. IEEE Transactions on Neural Networks and Learning Systems, 23(8), 1177-1193. [Article Link]
  10. ACADEMIC JOURNAL Cai, W., Jiang, J., Wang, F., Tang, J., Kim, S., & Huang, J. (2025). A Survey on Mixture of Experts in Large Language Models. IEEE Transactions on Knowledge and Data Engineering, 1-20. [Article Link]
  11. PRESS RELEASE Mistral AI. (2023). Mixtral of experts. Mistral AI. [Article Link]
  12. WEBSITE Allen Institute for AI. (2024). OLMoE: Open Mixture-of-Experts Language Models. GitHub. [Article Link]
Leave a Comment

Related Posts
Total
0
Share