Home Knowledge Base Mixture of Experts (MoE)

Mixture of Experts (MoE) is the neural architecture pattern that replaces dense feedforward layers with multiple specialized expert networks, activating only a sparse subset of experts per input token via learned routing — enabling models to scale to trillions of parameters while maintaining constant per-token compute cost, as demonstrated by Switch Transformer (1.6T parameters), GLaM (1.2T), and GPT-4's rumored MoE architecture that achieves GPT-3-level quality at 10-20× lower training cost.

MoE Architecture Components:

Routing Strategies and Variants:

Scaling and Efficiency:

Implementation and Deployment Challenges:

Mixture of Experts is the breakthrough architecture that decouples model capacity from computation cost — enabling the trillion-parameter models that define the current frontier of AI capabilities while remaining trainable and deployable within practical compute and memory budgets, fundamentally changing the economics of scaling language models.


AI Accelerator Architecture — Compute, Memory, and Interconnect. Modern AI chips are purpose-built for matrix multiplication: a systolic array or tensor core computes thousands of multiply-accumulate (MAC) operations per cycle, fed by a memory hierarchy (registers → SRAM → HBM) connected through a network-on-chip (NoC) that determines whether the compute units starve or stay busy. The single metric that captures this interaction is the roofline model: peak performance (TFLOPS) vs memory bandwidth (TB/s), where the arithmetic intensity of the workload (FLOPs/byte) determines which resource limits throughput.

AI Chip Roofline: Compute vs Memory Bound Arithmetic intensity (FLOPs/byte) determines whether you hit the compute ceiling or memory wall Arithmetic Intensity (FLOPs/byte) → Performance (TFLOPS) → 1 10 100 1000 1 10 100 1000 H100: 989 TFLOPS (FP16 Tensor) Ridge: 300 FLOPs/byte 3.35 TB/s HBM3 Attention (memory-bound) MatMul (compute-bound) KV cache decode A100: 312 TFLOPS (FP16) FlashAttention moves attention from memory-bound → compute-bound by fusing ops in SRAM KV cache + speculative decoding address the decode bottleneck (low arithmetic intensity)

Tensor Cores — The Matrix Multiply Unit. NVIDIA tensor cores perform 4$\times$4 matrix multiply-accumulate (D = A$\times$B + C) in a single clock cycle at mixed precision (FP16 inputs, FP32 accumulate). The H100 has 528 tensor cores across 132 SMs, delivering 989 TFLOPS at FP16 or 1,979 TFLOPS at FP8 — a 3$\times$ generational improvement over A100 (312 TFLOPS FP16). Programming tensor cores requires structuring data in tile-friendly layouts (16$\times$16 or 32$\times$8 fragments) via CUDA WMMA or MMA PTX instructions. Utilization typically reaches 60–80% in production training (compute-bound GEMM) but drops to 10–30% during inference decode (memory-bound, limited by KV cache reads). AMD CDNA3 Matrix Cores and Google TPU v5 MXUs provide equivalent functionality at comparable TFLOPS/W.

KV Cache and Inference Efficiency. During autoregressive LLM inference, each generated token requires reading the full key-value cache of all prior tokens — creating a memory-bandwidth bottleneck where arithmetic intensity drops to 1–5 FLOPs/byte (far left of the roofline). A 70B-parameter model at sequence length 4096 stores 40 GB of KV cache in HBM; generating each token reads 40 GB at 3.35 TB/s = 12 ms latency per token — regardless of compute capacity. Solutions: PagedAttention (vLLM) eliminates KV cache fragmentation; multi-query attention (MQA/GQA) reduces KV size by 8$\times$; speculative decoding verifies 4–8 draft tokens per forward pass, increasing effective throughput 2–4$\times$; continuous batching (Orca) amortizes KV reads across multiple sequences in flight.

Network-on-Chip (NoC) for AI Accelerators. The NoC connects hundreds of compute tiles (tensor cores, memory controllers, I/O ports) through a mesh, ring, or hierarchical topology — and its bisection bandwidth determines the maximum data rate for all-reduce operations during distributed training. An H100 has a 12$\times$11 crossbar connecting 132 SMs, 6 HBM3 stacks, and 18 NVLink ports. The total internal bandwidth exceeds 30 TB/s. For multi-chip training, NVLink 4.0 provides 900 GB/s chip-to-chip (18 links $\times$ 50 GB/s each) while PCIe 5.0 adds 128 GB/s for host communication. The NoC design determines whether the GPU can keep all tensor cores fed during a 2048-GPU training run where each iteration requires an all-reduce of 1–10 GB of gradients across the fabric.

Mixture of Experts (MoE) — Hardware Implications. MoE models (GPT-4, Mixtral, Switch Transformer) activate only 2–8 experts per token out of 64–256 total, reducing compute by 10–30$\times$ relative to a dense model of equivalent capacity — but at the cost of massive memory footprint (every expert's weights must reside in HBM) and irregular memory access patterns that stress the NoC and memory controller. A Mixtral 8$\times$7B model has 46.7B total parameters but only 12.9B active per token; the challenge is that expert routing is data-dependent and unpredictable, causing load imbalance across GPU SMs and across nodes in distributed inference. Hardware solutions include expert parallelism (each GPU holds a subset of experts), capacity factors limiting expert overload, and all-to-all communication patterns that require high bisection bandwidth.

mixture of experts moe architecturesparse moe modelsexpert routing mechanismmoe scaling efficiencyconditional computation moe

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.