Pidoku

MoE Research

Module 24 Lesson 24.f 50 min Difficulty 4/5

Prerequisites 14.e, 14.g, 14.h, 24.a


Before you start: words you need#

WordPlain meaning
MoE (mixture of experts)A model whose feed-forward layers are split into many “experts”; a small router sends each token to only a few of them (14.g).
Total vs active parametersTotal: every weight you must store. Active: the weights one token actually uses. A 1.6T model with 49B active stores 1.6T and computes with 49B per token.
Top-k routingEach token picks the k experts with the highest router scores.
Expert parallelism (EP)Spreading the experts across GPUs, so tokens travel to the GPU that holds their expert and back (14.e).
All-to-allThe communication step where every GPU sends tokens to every other GPU for expert processing, and gets results back.
Load imbalanceSome experts get far more tokens than others, so their GPU becomes the slowest and everyone waits.
Shared expertAn expert every token uses, alongside its routed ones.
AFD (attention–FFN disaggregation)Running attention layers and expert layers on separate GPU pools that pass activations to each other.

1. What is it?#

MoE research asks how to build sparse models that are both good and cheap to serve: how many experts, how to route, how to balance, and how to place experts on hardware.

TopicStatus, November 2026
Top-k routing, stable MoE training at scaleESTABLISHED
Fine-grained experts (hundreds of small experts) plus shared expertsESTABLISHED (DeepSeek, Kimi, Qwen, MiniMax)
Load balancing without an auxiliary lossESTABLISHED (DeepSeek-V3 lineage)
Wide expert parallelism over a whole NVL72 rackESTABLISHED at large providers
Elastic EP (grow or shrink the expert pool live)EMERGING: in vLLM and SGLang, new in 2026
Latent MoE (route and compute experts in a smaller dimension)EMERGING (NVIDIA Nemotron 3, Kimi K3)
Attention–FFN disaggregationEMERGING: experimental plugin, mixed results
Expert offloading to CPUESTABLISHED for local, low-batch use; not for busy servers
Predicting experts ahead of time for prefetchSPECULATIVE

Facts checked on 12 November 2026.


2. Why does it matter?#

The question this lesson used to ask, “will frontier models stay MoE?”, is answered. Every major open frontier model of 2026 is a large, sparse MoE:

ModelTotal / active parametersExperts
DeepSeek-V4-Pro (April 2026)1.6T / 49Bfine-grained, shared expert
DeepSeek-V4-Flash284B / 13Bfine-grained
Kimi K3 (July 2026)2.8T / not stated in vLLM’s post16 of 896 per token, LatentMoE
Qwen3.8 (August 2026)2.4T / 95BMoE (expert count not checked here)
MiniMax-M3 (June 2026)428B / about 22–23B (sources differ)4 of 128

Small MoEs are common too (gpt-oss-20b, Qwen3-30B-A3B, Nemotron 3 Nano 30B-A3B), which settles another old question: MoE is useful well below 10B active parameters.

So serving MoE well is no longer a niche skill. It is most of large-model serving.


3. Simple analogy#

A hospital with 896 specialists. Each patient (token) sees 16 of them. With one patient a day, most specialists sit idle, yet you still pay to house them all (memory). With 500 patients a day, nearly every specialist is busy (high batch), and the hard problems become the corridors between departments (all-to-all) and the queue outside the most popular specialist (load imbalance).


4. Tiny example: how many experts does a step touch?#

If each of B tokens picks k of E experts at random, the expected number of distinct experts touched is E × (1 − (1 − k/E)^B). For DeepSeek-V3’s 256 experts with top-8, a single token touches 3% of the expert weights, but 128 tokens touch 98%. Decode reads every touched expert’s weights from memory, so at high batch MoE reads almost as many bytes as a dense model of its total size, per step, spread over more tokens. Section 6 prints the table for three designs.


5. Technical explanation#

Architecture findings that matter for serving#

  • Fine-grained experts (many small experts, larger k) give more combinations and better quality per FLOP. For serving: more all-to-all destinations, finer load-balance granularity, and the “experts touched” curve rises more slowly, so the memory advantage lasts to larger batches.
  • Shared experts are read by every token: a fixed cost, but routing errors hurt less.
  • Auxiliary-loss-free balancing (DeepSeek-V3) adjusts per-expert bias terms during training instead of adding a loss that fights the main objective. Better balance at training time means better balance at serving time.
  • Node-limited routing (DeepSeek) caps how many machines one token’s experts may span. It is a training-time rule that bounds serving traffic: co-design in its clearest form.
  • Latent MoE (Nemotron 3 Super and Ultra; Kimi K3’s “Stable LatentMoE”) projects tokens into a smaller dimension for routing and expert computation. Less data moves in all-to-all and expert weights shrink. EMERGING: two families, no independent serving comparisons yet.
  • Native FP4 expert weights (DeepSeek-V4, Kimi K3) halve expert bytes again (24.d).

Serving-side research#

  • Wide EP on a rack. With 72 GPUs on one NVLink domain, a whole MoE layer’s experts spread over the rack and all-to-all stays on NVLink (7.d, 14.h). Public 2026 results for DeepSeek, Qwen and Kimi models on GB200 and GB300 NVL72 use this.
  • Elastic EP. vLLM (May 2026) and SGLang with NIXL let you add or remove GPUs from a running EP group. vLLM’s October 2026 numbers on GB200 with DeepSeek-V4-Pro: scaling 16 → 20 GPUs paused serving for 0.82 s instead of 99.6 s for a restart. This turns MoE capacity into something autoscaling can manage (23.d).
  • Expert placement and replication. Measure expert popularity, replicate hot experts, rebalance as traffic shifts. Straightforward and effective; the research question is how often to move.
  • All-to-all cost. Still the dominant MoE serving overhead. Overlapping it with compute (dual micro-batches), better kernels (DeepEP and its successors), and bigger scale-up domains attack it.
  • Attention–FFN disaggregation. Run attention (which owns the KV cache) on one pool and experts on another, sized independently. vLLM’s AFD plugin (July 2026) reported +9–11% per chip on DeepSeek-V3.2 decode on Ascend with one ratio, and −5% to −10% with another; prefill time to first token fell 47% in a reduced 10-layer test. Honest status: EMERGING, ratio-sensitive, not a general win yet. NVIDIA describes the same split for Groq 3 LPX next to Rubin (7.k).
  • Expert offloading. Keep cold experts in CPU memory. Practical for one local user (llama.cpp’s --n-cpu-moe keeps some layers’ experts on the CPU). Not viable on a busy server, because at high batch you touch nearly every expert every step anyway (section 6).

Is MoE a serving-efficient architecture?#

Partly. Compute per token is that of the active parameters, which helps prefill and high-batch decode. Memory capacity is that of the total parameters, which sets the minimum hardware. Memory traffic per step falls between the two and rises with batch. All-to-all and imbalance add cost a dense model does not have. MoE won because quality per training FLOP is much better, and serving systems caught up. The 2026 answer is: on a rack-scale system at high batch, yes; on one small GPU with tight latency, often no.


6. Under the hood: experts touched per step#

Go
// experts.go — how many distinct experts a decode step touches as the batch grows.
// Each token picks k of E experts; expected distinct experts = E × (1 − (1 − k/E)^B).
package main

import (
	"fmt"
	"math"
)

func main() {
	models := []struct {
		name string
		e, k float64
	}{
		{"8 experts, top-2 (Mixtral-style)", 8, 2},
		{"256 experts, top-8 (DeepSeek-V3)", 256, 8},
		{"896 experts, top-16 (Kimi K3)", 896, 16},
	}
	batches := []float64{1, 8, 32, 128, 512}
	fmt.Printf("%-34s", "tokens in the step →")
	for _, b := range batches {
		fmt.Printf("%7.0f", b)
	}
	fmt.Println()
	for _, m := range models {
		fmt.Printf("%-34s", m.name)
		for _, b := range batches {
			touched := m.e * (1 - math.Pow(1-m.k/m.e, b))
			fmt.Printf("%6.0f%%", 100*touched/m.e)
		}
		fmt.Println()
	}
}

Output:

tokens in the step →                    1      8     32    128    512
8 experts, top-2 (Mixtral-style)      25%    90%   100%   100%   100%
256 experts, top-8 (DeepSeek-V3)       3%    22%    64%    98%   100%
896 experts, top-16 (Kimi K3)          2%    13%    44%    90%   100%

How to read it:

  • With 8 large experts, the memory saving is gone by 32 tokens per step. With fine-grained designs it lasts longer: at 32 tokens, Kimi K3 touches under half its experts.
  • Real routing is not uniform. Popular experts make the real curve flatter (fewer distinct experts) and the load more uneven.
  • Under expert parallelism, read each row per GPU: each GPU holds a slice of the experts and sees the tokens routed to it.

7. Performance implications#

  • Low batch: MoE is memory-capacity bound; you pay for all the weights and use a few percent.
  • High batch: nearly every expert is read each step; compute per token stays low; all-to-all and imbalance set the speed.
  • Bigger scale-up domains (NVL72 and larger) are what make trillion-parameter MoE serving fast.
  • FP4 experts and latent MoE cut bytes per expert, which helps both capacity and traffic.

8. Production implications#

  • Size hardware from total parameters plus KV, not from active parameters.
  • Watch per-expert load in production; static replication is enough only if popularity is stable.
  • Plan capacity changes around elastic EP if your engine supports it; otherwise MoE scaling means restarts.
  • Treat AFD as an experiment: measure with your model, ratio and traffic.
  • For local or single-user serving, CPU expert offload is a valid way to fit a large MoE.

9. Common mistakes#

  1. Quoting active parameters as if they were serving cost.
  2. Assuming the MoE memory saving holds at production batch sizes.
  3. Ignoring all-to-all time in profiles.
  4. Evaluating expert offloading only at batch 1.
  5. Assuming one Attention:FFN ratio that worked in a blog post will work for you.
  6. Forgetting that expert load shifts with traffic mix (code-heavy hours versus chat-heavy hours).

10. Hands-on exercise#

  1. Run experts.go. Add MiniMax-M3 (128 experts, top-4). At what batch does it touch 90%?
  2. Instrument the router of an MoE model you can run. Measure distinct experts touched at batch 1, 8, 32 and 128 and compare with the formula. How far off is uniform routing?
  3. Log expert load per hour over a day of real traffic. Would static replication work?
  4. Profile one MoE layer at high batch. What fraction is all-to-all, and how much is overlapped?
  5. Compare cost per million tokens for an MoE and a dense model of similar quality at batch 8 and batch 256 (23.c).

11. Interview questions#

  1. Is the serving cost of an MoE model set by active or total parameters? Be precise about which cost.
  2. Why do fine-grained experts keep the memory-traffic advantage to larger batches?
  3. What is node-limited routing and which serving problem does it solve?
  4. What does elastic EP change for autoscaling MoE deployments?
  5. What does attention–FFN disaggregation separate, and why are its results mixed?
  6. When is expert offloading to CPU a good idea?

12. Further reading#

Checked on 12 November 2026.

↑↓ navigate↵ openesc close

100% drag to pan · scroll or pinch to zoom · double-click to zoom in