Mixture of Experts (MoE)
- title
- Mixture of Experts (MoE)
- type
- concept
- summary
- Architecture where a router activates a small subset of "expert" subnetworks per token โ splits total params from compute params and changes the local-inference economics
- tags
- llm, local-models, architecture
- sources
- habr-local-llm-16gb-vram-gemma-qwen, ikp-incompressible-knowledge-probes, habr-local-llm-quantization-deep-dive
- created
- 2026-05-13
- updated
- 2026-05-13
Mixture-of-Experts is an LLM architecture where each layer contains many parallel subnetworks ("experts") and a small router selects which few to use for each token. Total parameter count and active parameter count are different numbers. A 35B-A3B model has 35 billion weights total but only ~3 billion participate in any single forward pass.
This split matters because it decouples model capacity from compute cost. The router and the active experts have to be in fast memory to keep generation responsive. The inactive experts can sit anywhere โ system RAM, SSD, even network โ as long as they reach the GPU before they're needed. Dense models can't do this; every weight participates in every token.
Why the headline number lies
Comparing MoE models by total parameters is misleading. Three models from Vyacheslav's tests:
| Model | Total | Active | Pattern |
|---|---|---|---|
| Gemma 4 | 26B | ~4B | 26B-A4B |
| Qwen 3.6 | 35B | ~3B | 35B-A3B |
| Qwen3-Coder | 30B | ~3B | 30B-A3B |
Gemma 4 has the smallest total but the largest active count. In Vyacheslav's coding tests it also produced the best results, which suggests architecture and active-param budget matter more than total weights.
What MoE buys local inference
Two things, both critical for consumer hardware:
- Lower compute per token โ only the active experts run, so a 30B model generates at speeds closer to a 3B dense model.
- Selective offload โ inactive experts can live in slow memory without blocking generation. This is what makes
llama.cpp --n-cpu-moework; see moe-cpu-offload.
The cost is that all expert weights still have to be loaded somewhere. A 30B MoE doesn't fit in 16 GB VRAM at Q4 any more easily than a 30B dense model would โ it just gives you a working way to spill the cold parts.
What MoE doesn't buy
- The router is not "smart" in a human sense. It learns which experts to activate during training; you don't get to pick or interpret them.
- Some MoE architectures interact badly with quantization formats. Unsloth's Dynamic 2.0 quants degrade more on Qwen MoE than on dense models because aggressive 4-bit compression collides with the router's sensitivity to small weight perturbations. See llm-quantization.
- Long sequences and large file edits stress MoE more than dense models because expert routing can shift unpredictably as context grows โ one observed cause of Qwen's poor long-session behavior in local-llm-16gb-vram-tests.
Total params predict knowledge, not active params
Bojie Li's IKP paper (April 2026) regresses factual capacity against MoE parameter counts across 37 MoE models. Total parameters predict knowledge capacity (Rยฒ = 0.79); active parameters do not (Rยฒ = 0.51). Factual knowledge is stored across all expert weights, not only the ones routed to per token. This validates a piece of folk knowledge that hadn't had a clean empirical anchor: when you see "DeepSeek-V3 is a 671B model, 37B active," the 671B is the right number to compare against a 671B dense model for knowledge, even though the 37B is the right comparison for inference compute.
The corollary: REAP-pruning experts (reap-expert-pruning) trades knowledge capacity for size at a measurable rate. Cutting 20% of experts reduces both compute and the model's effective stored facts.
Notable MoE models in this wiki
- Gemma 4 26B-A4B โ Google's MoE; the surprise winner of local-llm-16gb-vram-tests.
- Qwen 3.6 35B-A3B โ Alibaba's reasoning generation.
- Qwen3-Coder 30B-A3B โ code-specialized sibling.
- DeepSeek V3 / R1 / V4 โ the line that proved MoE could be cost-effective at scale; see deepseek.
- CrofAI
- llama.cpp
- BF16 vs FP16
- Factual Capacity Scaling
- Local LLMs Deep Dive โ Quants, MoE Offload, REAP, ik_llama, Speculative Decoding
- Incompressible Knowledge Probes (IKP)
- KV Cache Sizing
- little-coder โ Scaffold-Model Fit on Aider Polyglot
- LLM Quantization Formats
- Coding-Agent Tests of Local LLMs on 16 GB VRAM
- MoE CPU Offload (`--n-cpu-moe`)
- Pine AI
- Random-Rotation Quantization
- REAP โ Router-weighted Expert Activation Pruning
- Unsloth