Mixture of experts (MoE) interview questions
Mixture of experts interview questions for inference: routing and top-k, total vs active parameters, how many experts a batch touches, why MoE decodes fast but needs big GPUs, expert parallelism and load imbalance.
Most frontier open-weight models are now mixtures of experts, so MoE questions have moved from niche to standard. The key idea interviewers probe is the split between active parameters, which set compute and decode bytes per token, and total parameters, which set memory, and what batching does to that split.
Question 1
What is a mixture-of-experts layer and how does routing work?
Model answer
In an MoE transformer the dense MLP in each block (or in most blocks) is replaced by parallel MLPs called experts plus a small router. For each token the router computes a score per expert (a linear layer followed by a softmax or sigmoid), picks the top experts, runs the token through only those, and combines their outputs weighted by the router scores. Attention layers stay dense and shared.
Examples:
- Mixtral 8x7B: 8 experts, top 2, about 47B total and 13B active parameters.
- DeepSeek-V3: 256 routed experts plus 1 shared expert per MoE layer, top 8, about 671B total and 37B active.
The point is that model capacity grows with the number of experts while the compute per token grows only with . During training an auxiliary loss or, in DeepSeek-V3, a per-expert bias adjustment keeps tokens spread across experts so no expert is starved or overloaded.
Likely follow-up questions
- Why are attention layers usually not split into experts?
- What is a shared expert, and why add one?
- What happens to quality and speed if you change at inference time?
Question 2
What are total and active parameters, and which matters for what?
Model answer
- Total parameters: all weights in the model, including every expert. They must all be stored somewhere, so they set memory requirements. DeepSeek-V3 at 671B needs about 671 GB in FP8 before any KV cache.
- Active parameters: the weights one token actually uses (attention, shared parts and its experts). They set FLOPs per token, about active parameters, and, at batch size 1, the bytes read per decode step.
So an MoE model decodes like a model its active size but needs the memory of a model its total size. A 47B-total, 13B-active model can generate at roughly the speed of a 13B dense model on hardware that holds all 47B, which is why MoE models run well on large-memory machines with modest bandwidth, like unified-memory desktops, or with experts offloaded to CPU RAM.
Likely follow-up questions
- Estimate the batch-1 decode speed of a 30B-total, 3B-active model in 4-bit on a machine with 250 GB/s of bandwidth.
- Why is an MoE model's quality usually between a dense model of its active size and one of its total size?
- Which parts would you keep on the GPU when offloading an MoE model to CPU RAM?
Question 3
How many experts does a batch touch, and why does batching erase the sparse advantage?
Model answer
Each token reads only of experts, but different tokens pick different experts. With tokens in a decode step and roughly uniform routing, the expected number of distinct experts touched per layer is
For Mixtral (, ) a batch of 8 tokens already touches about of 8 experts. For DeepSeek-V3 (, ) a batch of 64 touches about of 256.
So at batch size 1 an MoE reads only its active weights per step, but at serving batch sizes it reads nearly all of them, and decode becomes as memory-heavy per step as a dense model of the total size. The win at high batch is compute: each expert still does work only for the tokens routed to it, so FLOPs per token stay at the active size, and once you batch enough tokens per expert the experts become compute-efficient.
Likely follow-up questions
- How does real, non-uniform routing change the formula's prediction?
- At what batch size does each expert see enough tokens to be compute-bound on an H100?
- Why does this make MoE models good for high-throughput serving but tricky for low-latency single-user serving at scale?
Question 4
How do you serve a large MoE across GPUs? Explain expert parallelism.
Model answer
Large MoE models do not fit on one GPU, and splitting each expert with tensor parallelism makes the per-expert matmuls tiny. Expert parallelism (EP) instead places whole experts on different GPUs:
- Each GPU runs attention for its tokens (often with data parallelism for attention, which also splits the KV cache by request).
- The router picks experts for each token, and an all-to-all dispatch sends each token's hidden state to the GPUs holding its experts.
- Experts run their batched tokens, and a second all-to-all combines the results back to each token's home GPU.
Design concerns:
- The two all-to-alls per MoE layer need high-bandwidth, low-latency links; within an NVLink domain they are cheap, across InfiniBand they need careful overlap with computation. Libraries such as DeepEP provide optimised kernels for this.
- Expert weights spread across many GPUs free memory for KV cache, enabling large batches.
- Prefill and decode often use different EP and DP layouts, which is one reason large MoE deployments use disaggregated serving.
Likely follow-up questions
- Why is data parallelism for attention a natural pairing with expert parallelism?
- Estimate the dispatch traffic per layer for a batch of tokens with hidden size 7,168 in FP8 and .
- How does EP change the failure blast radius compared with independent replicas?
Question 5
What is expert load imbalance and how do you deal with it at inference time?
Model answer
Training balances experts on average, but real traffic is lumpier: some experts are much more popular for particular languages, domains or batches. With expert parallelism a step finishes only when the busiest GPU finishes, so one hot expert slows everyone, and the GPUs holding cold experts sit idle.
Mitigations:
- Redundant experts: replicate hot experts on extra GPUs and split their tokens between copies. DeepSeek's deployment uses an expert-parallel load balancer that periodically rebalances which experts are replicated based on observed load.
- Placement: group experts so each GPU's expected load is similar, and keep experts that are often co-selected on the same node to reduce cross-node traffic.
- Capacity limits: cap tokens per expert per step. Training often drops overflow tokens, but in inference dropping changes outputs, so engines generally avoid it and rely on balancing instead.
- Monitoring: track per-expert token counts and per-GPU MoE kernel time to see imbalance directly.
Likely follow-up questions
- Why is load imbalance worse at small batch sizes?
- How would you choose how many redundant expert slots to provision?
- What trade-off does replicating experts make against KV cache memory?
Question 6
How do quantisation and offloading apply to MoE models?
Model answer
Because total parameters drive memory and most of them are expert weights, MoE models benefit a lot from weight quantisation of the experts: FP8 or 4-bit experts shrink the memory footprint and, at small batch, the bytes read per step. Attention and the router are often kept at higher precision because they are a small share of the weights and more sensitive. Some models are released with experts natively in low precision, such as MXFP4.
For local or small deployments, offloading places attention, embeddings and shared experts on the GPU and the routed experts in CPU RAM. Each token needs only experts, so the CPU reads a small fraction of the expert weights per token, and engines like llama.cpp can run experts on the CPU next to the GPU work. Speed is then set by CPU memory bandwidth for the active expert bytes. This works well at batch size 1 and poorly at large batch, where the touched experts approach all of them.
Validate quality per task after quantising experts, since rarely used experts get little calibration data and can degrade more than average.
Likely follow-up questions
- Why might calibration-based quantisation struggle with rarely selected experts?
- Estimate the tokens per second when routed experts for a 3B-active model sit in 80 GB/s DDR5 memory.
- When would you rather pay for more GPUs than offload experts?
The lesson behind these answers · 14 min · free
Mixture of experts: routing, memory and why MoE decodes fast but needs big GPUs
Worked numbers, step-through diagrams and a quiz, so you can derive the answer in the interview instead of reciting it.
Read the lesson →- Placing a model across GPUs, CPU and RAM: MoE offload and multi-GPU splits · Performance Tuning14 min · Pro
- Model parallelism: tensor, pipeline, expert and data parallel inference · Performance Techniques15 min · Pro
- Case study: serving a trillion-parameter hybrid MoE (Kimi K3) · Performance Techniques20 min · Pro
- Multi-GPU interconnects: PCIe, NVLink, NVSwitch and InfiniBand · Bottlenecks and Hardware20 min · Pro
Articles on this topic
- How many GPUs do you need to serve an LLM? A worked capacity plan (9 min read)
- Mixture of experts inference: cheap to compute, expensive to hold (7 min read)
- Tensor vs pipeline vs data vs expert parallelism for LLM inference (7 min read)
- Can you run a 70B model at home? What hardware works (7 min read)
Related interview questions
- Multi-GPU LLM serving interview questions (5 questions)
- Roofline model interview questions for LLM inference (5 questions)
- Batching and continuous batching interview questions (5 questions)
- LLM quantization interview questions (5 questions)