DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Models
TL;DR. DeepSeekMoE makes experts smaller and more numerous (fine-grained segmentation), so each token can mix many specialists. It also keeps a few experts always on (shared experts) to hold common knowledge. At the same parameters and compute, this beats GShard-style top-2 MoE. The 16B model matches 7B dense models with about 40% of the compute.
Why it matters now. This is the MoE layer inside DeepSeek-V2 and DeepSeek-V3, and the fine-grained-plus-shared pattern is now common in open frontier models. If you fine-tune one of these as an embedding model, reranker or RL-trained search agent, you are working with 64 or more small experts, a shared path that sees every token, and balance losses that small fine-tuning sets can easily disturb.
Key idea
Section titled “Key idea”Fine-grained segmentation. Split each of experts into smaller experts with of the FFN width, and activate of the . Parameters and FLOPs per token stay the same, but the number of possible expert combinations explodes. For token input , with the router vector of expert :
Shared-expert isolation. Make experts always active and route only of the remaining . Total active compute is unchanged.
Two balance losses. With routed experts and routed choices:
A device-level loss does the same per GPU group. Here is the mean of over the experts on device and is their sum. The paper sets small (only to prevent collapse) and larger (for throughput).
Key results
Section titled “Key results”- 2B validation (Table 1, 100B tokens, 0.3B active). Pile loss: Dense 2.060, Hash Layer 1.932, Switch 1.881, GShard 1.867, DeepSeekMoE 1.808. TriviaQA rises from 10.2 (GShard) to 16.6, and NQ from 3.2 to 5.7.
- Same quality as a bigger GShard (§4.3). DeepSeekMoE 2B roughly matches GShard 2.9B, which has 1.5× the expert parameters and compute.
- 16B model (§5). 28 layers, 2 shared + 64 routed quarter-size experts, top-6, 16.4B total and 2.8B active, trained on 2T tokens. It is comparable to DeepSeek 7B and LLaMA2 7B with about 40% of their compute.
- 145B preview (§7). Comparable to DeepSeek 67B with 28.5% of its compute (“maybe even 18.2%”, per the authors).
- Weak spot. MMLU is 45.0 against DeepSeek 7B’s 48.2. The authors attribute this to only about 0.5B attention parameters, against 2.5B in the dense 7B.
Limitations & open questions
Section titled “Limitations & open questions”- Granularity has hardware costs (small matmuls, more routing traffic) that the paper does not fully price in.
- Specialisation evidence is indirect (loss changes when experts are removed). What each expert actually stores is not characterised.
- Balance still relies on auxiliary losses that trade off against quality. Aux-loss-free balancing later removes the expert-level loss.
- The attention budget seems to cap multiple-choice performance. MLA in DeepSeek-V2 revisits attention.
Connections
Section titled “Connections”- Before: Switch Transformers (balance loss, capacity) and Mixtral (top-2 of 8 large experts).
- After: MLA / DeepSeek-V2 (DeepSeekMoE plus latent attention), aux-loss-free balancing, and DeepSeek-V3.
- Also uses this pattern: the NSA experiments run on a DeepSeekMoE backbone.
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
Start from a layer with 16 experts and top-2 routing. (a) Split each expert into 4 (FFN width divided by 4) and activate 8. Show that parameters and FLOPs per token do not change, and compute the number of expert combinations before and after. (b) Now make 1 of the 64 small experts shared and route 7 of the other 63. How many combinations remain? (c) DeepSeekMoE 16B uses 2 shared and 64 routed experts, each a quarter of a standard FFN, with top-6 routing. How many standard-FFN equivalents are active per token, and how many are stored?
What a strong answer covers
- (a) Total expert parameters: 16 × P = 64 × P/4. Active: 2 × P = 8 × P/4. Both unchanged. Combinations: C(16,2) = 120 before and C(64,8) = 4,426,165,368 after.
- (b) The shared expert is not chosen, so only C(63,7) = 553,270,671 combinations remain. That is still millions of times more than 120, so the flexibility gain mostly survives.
- (c) Active: (2 shared + 6 routed) × 0.25 = 2 standard FFNs, the same compute as a top-2 MoE of full-size experts. Stored: 66 × 0.25 = 16.5 FFN equivalents per MoE layer.
- Caveat: more, smaller experts mean more router outputs, more scatter and gather work, and smaller matmuls, so wall-clock cost is not exactly constant.
- Mechanism
Explain why isolating a shared expert should make routed experts more specialised. Then interpret the paper's test in which the shared expert is disabled and one extra routed expert is activated in its place, which raises Pile loss from 1.808 to 2.414.
What a strong answer covers
- Without a shared expert, common knowledge (frequent syntax and function words) must be learned by whichever routed experts receive it. That knowledge is duplicated across many experts, which is redundancy.
- A shared expert sees every token, so it can absorb what all tokens need. Routed experts are then free to store narrower knowledge.
- The test keeps active compute fixed and swaps the shared expert for a routed one. Loss jumps from 1.808 to 2.414, so the shared expert holds knowledge that the routed experts do not duplicate. It is not interchangeable with them.
- This is the specialisation claim in one number: the experts have taken on different roles, not redundant copies.
- What if…
Use the paper's ablations to argue which of the two ideas, fine-grained segmentation or shared-expert isolation, matters more, and how many shared experts to use. Draw on the 2B validation runs (Figure 3, the shared-count study, and the redundancy test that disables top routed experts).
What a strong answer covers
- Adding a shared expert to a GShard-style baseline improves results. Splitting further, to 32 experts (1 shared + 31 routed) and then 64 (1 + 63), keeps improving. Both ideas help, and the gains stack.
- The number of shared experts barely matters: 1, 2 and 4 give Pile loss 1.808, 1.806 and 1.811. The authors keep a ratio of about 1 shared to 3 activated routed experts when scaling.
- Redundancy test: disabling the top routed experts hurts DeepSeekMoE more than a GShard model with 1.5× the expert parameters. This is evidence of less redundancy among experts.
- Efficiency: activating only 4 routed experts already matches GShard, and a half-activated model trained from scratch still beats GShard.
- Design
You are pretraining a 2B-total, roughly 0.3B-active fine-grained MoE on one 8-GPU node with experts sharded across GPUs, for later use as an embedding and reranking backbone. Choose the expert count, top-k and shared count, and set the two balance losses. Say what you would monitor during training.
What a strong answer covers
- A reasonable start mirrors the paper's 2B setup: 64 small experts, 1 shared + 7 routed active, and a dense first layer if balance converges slowly there (the 16B model did this).
- Expert-level loss: α₁ · Σ fᵢPᵢ with fᵢ scaled by N'/(K'T), where N' and K' count only routed experts. Keep α₁ small, because a large value hurts quality.
- Device-level loss: group experts by GPU and penalise the product of the mean f and the summed P per device. Use a larger α₂, because only cross-device imbalance hurts throughput.
- Monitor per-expert and per-device token counts, the max-to-mean load ratio, router entropy, and loss spikes.
- For the IR use: check whether fine-tuning on small retrieval sets collapses routing, and consider freezing the router during fine-tuning.
- Critique
DeepSeekMoE 16B beats or matches DeepSeek 7B on most tasks with about 40% of the compute, but trails it on MMLU (45.0 versus 48.2). The authors blame the small attention budget (about 0.5B attention parameters versus 2.5B). Critique this explanation and design an experiment that could falsify it.
What a strong answer covers
- The explanation fits their earlier finding that an MQA variant of DeepSeek 7B also struggled on MMLU-style tasks. But in the comparison, attention size is confounded with total FFN capacity, depth and width.
- Alternative causes: the multiple-choice format (comparing option letters) may need different circuits, or routing may hurt exactly on short, format-heavy prompts.
- Falsifying experiment: train MoE variants that differ only in attention parameters (more heads or wider attention), at matched FFN and data. If MMLU tracks attention size while Pile and TriviaQA do not, the claim holds. If not, it fails.
- Also compare cloze-style and letter-choice scoring of MMLU, to separate knowledge from format handling.
- Research idea
Fine-grained segmentation keeps helping from 16 to 64 experts at the 2B scale. Propose a study to find where granularity stops paying off, accounting for both model quality and hardware efficiency.
What a strong answer covers
- Sweep the split factor m (for example 1, 2, 4, 8, 16, 32) at fixed total and active parameters, with the shared ratio fixed.
- Measure loss and downstream accuracy, and also tokens per second, all-to-all bytes, and matmul efficiency, since tiny experts give small, inefficient GEMMs.
- Hypothesis: quality saturates as the number of combinations grows past what the data can use, while efficiency keeps falling. The optimum moves with batch size and interconnect.
- Add a specialisation metric (for example per-expert domain or token-type mutual information) to test whether gains come from specialisation or just from more routing flexibility.