Mixture-of-Experts (MoE) Architecture: Sparse Routing and Compute Scaling
In a traditional dense Transformer, every single generated token multiplies through 100% of the model’s parameters—tying world-knowledge capacity directly to inference latency and training FLOPs. Sparse Mixture-of-Experts (MoE) architectures break that coupling by replacing monolithic feed-forward MLP blocks with dozens or hundreds of specialized expert subnetworks controlled by a lightweight learned router that activates only the top-k experts (typically 2 to 8) for each token.
Key Highlights
- An MoE model with 400B total parameters and 32B active parameters stores the broad factual capacity of a giant model while executing per-token matrix FLOPs comparable to a 32B dense model.
- Modern fine-grained MoE designs combine always-active "shared experts" (capturing universal syntax and grammar) with dozens of routed fine-grained experts.
- Without load-balancing mechanisms (auxiliary losses or loss-free dynamic router biases), routers suffer routing collapse—sending every token to the same two popular experts while leaving others untrained.
- MoE accelerates FLOP-bound training and large-batch prefill dramatically, but still requires enough total GPU HBM memory to hold all inactive experts simultaneously.
Deploying and Fine-Tuning Sparse MoE Models in Production
Understanding memory versus bandwidth explains exactly when MoE wins. On a laptop with 24 GB of unified memory, a 32B dense INT4 model fits comfortably whereas a 120B-total / 15B-active MoE spills onto slow SSD swap. Conversely, on an enterprise node with sufficient HBM to hold all experts in memory, single-stream and moderate-batch token generation screams ahead because the GPU reads only the active subset of expert weights per generated token.
- When LoRA fine-tuning an MoE on small domain datasets, keep router gating weights frozen initially or apply light router regularization to prevent destabilizing expert routing.
- At very large batch sizes, nearly every expert gets touched by at least one token in the batch—use token-grouped GEMM kernels (MegaBlocks / vLLM fused MoE) for peak throughput.
- Quantize cold/routed experts to FP8 or INT4 while keeping tiny router linear gates in FP16/BF16 precision.
References & Sources
- Shazeer, Noam et al. (2017) — Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer, ICLR.
- Fedus, William; Zoph, Barret; Shazeer, Noam (2022) — Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity, JMLR.
- Dai, Damai et al. (2024) — DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Models, ACL.