From the source
Cerebras published a step-by-step guide to training a small Mixture-of-Experts model and debugging its router, built on the modded-nanogpt codebase and its 124M GPT-2-like baseline trained on FineWeb.
- The guide argues that MoE is not only about scale, since the technique can be scaled down to observe the same benefits, and says readers need only a laptop or a small acceleration node rather than a datacenter.
- It walks through replacing a single feedforward network with multiple expert networks, each a copy of GPT-2's FFN, and then through learned routing, which it says has two objectives: picking the best expert per token through learnable weights and keeping all experts used through load balancing.
- The auxiliary loss is summed across layers and added to the cross-entropy loss with a weight of 0.01.
- The resulting MoE beats the dense GPT-2 baseline, but the guide notes it captures only about half of the roughly 2% improvement promised for learned routing at 4 experts in the earlier part of the series.
- The post includes a video walkthrough and points readers to train_gpt_moe.py for the complete implementation or train_gpt.py to code along.