MoE Token Routing Explained: How Mixture of Experts Works (with Code)

From the creator

This video dives deep into Token Routing, the core algorithm of Mixture of Experts (MoE) models. Slides: https://huggingface.co/ariG23498/moe-routing-algorithm/blob/main/MoE_routing_algorithm.pdf Colab Notebook: https://huggingface.co/ariG23498/moe-routing-algorithm/blob/main/routing_mechanism.ipynb Chapter Timestamp: Introduction: 00:00 Laying the Foundation for Mixture of Experts (MoE): 00:09 Focus on Token Routing: 00:50 What is a Mixture of Experts Layer?: 02:36 Problem Statement and Configurations: 04:48 Compute Router Logits: 08:31 Sparsity and Selecting Top K Experts: 10:54 Normalizing Logits to Router Probabilities: 12:43 Slot Selection: 14:39 Dropping Oversubscribed Tokens: 16:51 Updated Normalized Token Weights: 20:36 Updated Slot Selection and Token Slots: 21:34 Final Weight Matrix Construction: 24:35 Conclusion: 32:41 Correction: As @denisflavius5365 rightly suggested the router matrix in the slides should be of the shape 3x4 and not 4x4.

Stop watching · start building
Matched to Neural Networks

Makers residency 4th edition

Your idea can be anything. At our last workshops, people built plant-based nutrition businesses, a way to measure planetary resilience, crochet headwear and a way to connect lonely people living in the same building. An asset manager went on to raise an additional £25M on their fund within nine months. The fourth workshop is a full day at KOKO with Nick Sarafa, learning to build with Claude Code. Bring the thing you keep meaning to start. We’ll bring the pizza.

◆ Fri 13 Nov 2026 ◆ KOKO, London
Makers residency 4th edition
Live event
Makers residency 4th edition
Fri 13 Nov 2026

More like this

Running one yourself?

List your AI event,
wherever it is.

A meetup, a workshop, a hackathon, a conference. Any city, or online. Tell us about it and it lands in front of people already learning this stuff.