# Chapter 8: Dense versus Mixture of Experts

Part of the course “AI from Zero to Autonomous Agents” (https://llm.yoga/en). Page for humans: https://llm.yoga/en/08-dense-moe

*One router, many experts: why gpt-oss-120b can write faster than a dense 70B model and still doesn’t fit on your laptop.*

About 20 min to read · about 30 min hands-on exercise

**Start with the missions**

This chapter also comes as 3 short missions with a case, a decision and feedback, about 10 minutes each:

- [8.1 Isn’t 120B way too big?](https://llm.yoga/en/einsatz-8-1.md)
- [8.2 Why does the bigger model write faster?](https://llm.yoga/en/einsatz-8-2.md)
- [8.3 Are the experts specialists in law and medicine?](https://llm.yoga/en/einsatz-8-3.md)

For agents, this page is split into 3 parts so that each part can be fetched in full. Read the parts the question needs.

## Parts

### Part 1: https://llm.yoga/en/08-dense-moe-1.md

- **Getting started**: Picture two workshops.
- **Dense models: the same compute blocks for every token**: In a dense model, every token passes through every layer completely.
- **Mixture of Experts: one router and many experts**: An MoE model replaces the single feed-forward part of selected or all layers with many smaller ones, the experts.
- **Total parameters and active parameters**: So for MoE models there are two numbers.

### Part 2: https://llm.yoga/en/08-dense-moe-2.md

- **Memory follows total parameters, speed follows active ones**: Two rules follow from this design.
- **Why people build MoE models, and where the catch is**: The main reason is training.
- **A short history**: The idea of combining several subnetworks with a dispatcher is older than the transformer.
- **Exercise: MoE and dense compared**: Goal: you read the values for an MoE model from a config.json, work out memory and upper limit, and where possible compare with a measurement.

### Part 3: https://llm.yoga/en/08-dense-moe-3.md

- **Common misconceptions**: An MoE model only needs as much memory as its active parameters.
- **Review questions**: 1. An MoE model has 40 layers with 64 experts each, 8 of them active per token.
- **Go further**: Shazeer et al.: Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer (2017).
