1
00:00:00,120 --> 00:00:02,960
Welcome back to listeners to the
Neural Intel Podcast. 

2
00:00:03,360 --> 00:00:06,320
Let's dive into today's topic. 
As always, we'll focus on the 

3
00:00:06,320 --> 00:00:08,840
technical details and 
implications of the technology 

4
00:00:08,840 --> 00:00:10,040
we discuss. 
Right. 

5
00:00:10,040 --> 00:00:12,280
And we'll definitely keep the 
discussion engaging and 

6
00:00:12,280 --> 00:00:13,960
interesting. 
And let's focus on the technical

7
00:00:13,960 --> 00:00:15,120
aspects. 
Absolutely. 

8
00:00:15,760 --> 00:00:18,880
So if you checked the Artificial
Analysis Index this morning, 

9
00:00:18,920 --> 00:00:21,760
something just genuinely 
shocking has happened to the 

10
00:00:21,760 --> 00:00:23,720
frontier AI landscape. 
Oh yeah. 

11
00:00:24,120 --> 00:00:25,920
Right. 
It's wild, right? 

12
00:00:26,040 --> 00:00:29,680
Like 18 out of the top 20 open 
weights models are no longer 

13
00:00:29,680 --> 00:00:32,680
your standard dense models. 
We are talking about the 

14
00:00:32,680 --> 00:00:36,600
absolute bleeding edge releases 
from, you know, DeepSeek, GLM, 

15
00:00:36,600 --> 00:00:39,320
MIMO. 
They've completely abandoned the

16
00:00:39,320 --> 00:00:41,960
traditional underlying 
architecture, the exact 

17
00:00:41,960 --> 00:00:44,520
architecture that gave us the 
generative AI boom in the 1st 

18
00:00:44,520 --> 00:00:45,000
place. 
Really. 

19
00:00:45,200 --> 00:00:47,720
Yeah, and instead they've 
shifted to something called a 

20
00:00:47,760 --> 00:00:52,200
mixture of experts or MOEI Mean.
It really seems like the era of 

21
00:00:52,200 --> 00:00:55,760
the monolithic dense transformer
is just rapidly coming to an 

22
00:00:55,760 --> 00:00:58,440
end. 
It is, but it's a shift porn 

23
00:00:58,440 --> 00:01:01,480
entirely out of necessity. 
I mean, the underlying problem 

24
00:01:01,480 --> 00:01:05,000
with the standard dense 
transformer is that, well, every

25
00:01:05,000 --> 00:01:08,560
single parameter in the model is
activated for every single token

26
00:01:08,560 --> 00:01:10,880
that gets processed. 
And so if you type A10 word 

27
00:01:10,880 --> 00:01:14,880
sentence into a dense 100 
billion parameter model, it 

28
00:01:14,880 --> 00:01:18,560
literally has to compute all 100
billion parameters 10 times 

29
00:01:18,560 --> 00:01:19,520
over. 
Exactly. 

30
00:01:20,200 --> 00:01:22,160
And as these models scale 
towards like a trillion 

31
00:01:22,160 --> 00:01:24,960
parameters to gain more 
reasoning capabilities, 

32
00:01:25,560 --> 00:01:28,880
calculating every single weight 
for every single word just 

33
00:01:28,920 --> 00:01:30,520
becomes computationally 
impossible. 

34
00:01:30,600 --> 00:01:33,000
The energy draw is astronomical,
right? 

35
00:01:33,200 --> 00:01:35,920
Yeah, the merry bandwidth of the
hardware physically cannot keep 

36
00:01:35,920 --> 00:01:38,160
up. 
Which brings us to the solution 

37
00:01:38,160 --> 00:01:40,520
that's taking over the industry.
The mixture of experts, 

38
00:01:40,520 --> 00:01:43,160
architecture. 
So instead of 1 massive network 

39
00:01:43,160 --> 00:01:45,520
that processes everything, the 
model acts more like a 

40
00:01:45,520 --> 00:01:47,800
dispatcher. 
Yeah, it routes each incoming 

41
00:01:47,800 --> 00:01:51,360
token to a highly specialized 
subset of smaller networks, 

42
00:01:51,360 --> 00:01:54,560
which are the experts. 
So this allows the model to hold

43
00:01:54,560 --> 00:01:57,720
vastly more parameters in its 
memory, meaning much larger 

44
00:01:57,720 --> 00:02:01,080
capacity for knowledge, while 
drastically limiting the active 

45
00:02:01,080 --> 00:02:02,960
compute required for any given 
word. 

46
00:02:03,240 --> 00:02:06,240
You get the brain power of a 
trillion parameter model, but 

47
00:02:06,240 --> 00:02:09,320
you're only really paying the 
computational cost of a tiny 

48
00:02:09,320 --> 00:02:11,600
fraction of it. 
It sounds brilliant on paper, 

49
00:02:11,640 --> 00:02:15,560
yeah, but what happens in 
reality is that Moe introduces 

50
00:02:15,560 --> 00:02:19,080
this whole host of terrifying 
new engineering and networking 

51
00:02:19,080 --> 00:02:20,840
bottlenecks, doesn't it? 
Oh, absolutely. 

52
00:02:21,160 --> 00:02:24,280
Moving from a dense model to a 
sparse model completely breaks 

53
00:02:24,280 --> 00:02:27,600
the traditional rules of how we 
build, train, and run neural 

54
00:02:27,600 --> 00:02:29,920
networks. 
And to figure out how these labs

55
00:02:29,920 --> 00:02:32,640
are actually solving those 
bottlenecks, today's deep dive 

56
00:02:32,640 --> 00:02:36,000
is sourced entirely from this 
absolute masterpiece of a 

57
00:02:36,000 --> 00:02:38,920
technical document. 
Yeah, the ultimate Moe Training 

58
00:02:38,920 --> 00:02:39,920
Handbook. 
Exactly. 

59
00:02:40,040 --> 00:02:42,720
Published by the Hugging Face 
team, specifically authors 

60
00:02:43,080 --> 00:02:46,720
Noamane Tazi, Leandro von Vera, 
and Thomas Wolfe. 

61
00:02:46,920 --> 00:02:49,480
We really owe them immense 
credit for publishing what is 

62
00:02:49,480 --> 00:02:52,720
essentially the Holy Grail of 
distributed training 

63
00:02:52,720 --> 00:02:54,520
documentation. 
It really is a goldmine. 

64
00:02:54,840 --> 00:02:57,040
So our mission today is to 
deconstruct the technical 

65
00:02:57,040 --> 00:02:59,480
anatomy of an Moe model, layer 
by layer. 

66
00:02:59,960 --> 00:03:02,160
We'll look at exactly how a 
token navigates the 

67
00:03:02,160 --> 00:03:05,520
architecture, the absolute 
networking nightmares of moving 

68
00:03:05,520 --> 00:03:09,280
data across GPU's, and how to 
train and serve these massive 

69
00:03:09,280 --> 00:03:12,000
systems without them. 
Just, you know, collapsing into 

70
00:03:12,000 --> 00:03:14,080
a pile of digital rubble. 
Because they definitely want to 

71
00:03:14,080 --> 00:03:15,560
collapse. 
Oh, for sure. 

72
00:03:16,360 --> 00:03:17,960
And as always, we want to hear 
from you. 

73
00:03:18,400 --> 00:03:20,160
Drop your take in the comments 
below. 

74
00:03:20,160 --> 00:03:24,560
Visit ourblog@neuralintel.org to
stay updated on the latest in AI

75
00:03:24,560 --> 00:03:28,000
and ML, and make sure you check 
out the show on YouTube, Apple 

76
00:03:28,000 --> 00:03:31,280
Podcasts, and Spotify. 
So to even begin understanding 

77
00:03:31,280 --> 00:03:35,120
how an Moe functions, we have to
pull back from the code and look

78
00:03:35,120 --> 00:03:37,320
at the physical cables in 
silicon running it. 

79
00:03:37,760 --> 00:03:40,920
The actual hardware. 
Right, because the transition 

80
00:03:40,920 --> 00:03:44,600
from dense to Moe fundamentally 
alters how GPU's physically 

81
00:03:44,600 --> 00:03:45,960
communicate across a data 
center. 

82
00:03:46,520 --> 00:03:48,760
Let's establish the baseline 
hardware environment the 

83
00:03:48,760 --> 00:03:51,360
handbook uses. 
We are looking at a SLURM 

84
00:03:51,360 --> 00:03:55,680
cluster of eight GPU nodes. 
Think of like an AWSP 5 node. 

85
00:03:55,800 --> 00:03:59,120
Yeah, that's essentially a metal
box packed with eight NVIDIA 

86
00:03:59,120 --> 00:04:03,760
H100 GPU's, all connected 
internally by NV Link and then 

87
00:04:03,760 --> 00:04:06,720
connected to the outside world 
by Elastic Fabric Adapters, or 

88
00:04:06,840 --> 00:04:09,200
EFA. 
Now, in a traditional dense 

89
00:04:09,200 --> 00:04:12,320
model setup, these GPU's rely 
heavily on a mathematical 

90
00:04:12,320 --> 00:04:15,160
operation called Allreduce to 
synchronize their learning. 

91
00:04:15,400 --> 00:04:17,240
Right, let's breakdown 
Allreduce. 

92
00:04:17,680 --> 00:04:20,959
In a standard dense training 
run, you are using data 

93
00:04:20,959 --> 00:04:24,400
parallelism, so every GPU in 
your cluster has an identical 

94
00:04:24,400 --> 00:04:27,520
copy of the model. 
GPU one gets 1 batch of training

95
00:04:27,520 --> 00:04:30,120
data, GPU 2 gets a different 
batch and so on. 

96
00:04:30,120 --> 00:04:32,280
Exactly. 
They all do their forward 

97
00:04:32,280 --> 00:04:35,320
passes, calculate their errors, 
and do their backward passes to 

98
00:04:35,320 --> 00:04:36,800
figure out how the weights 
should change. 

99
00:04:37,000 --> 00:04:39,480
But before they actually update 
their weights, they have to 

100
00:04:39,480 --> 00:04:41,960
synchronize. 
They basically pause, 

101
00:04:42,040 --> 00:04:44,560
communicate their proposed 
changes across the network, 

102
00:04:44,960 --> 00:04:47,800
average out the gradients, and 
then all update their weights 

103
00:04:47,800 --> 00:04:50,080
identically. 
That sharing and averaging 

104
00:04:50,080 --> 00:04:52,200
process is the all reduce 
operation. 

105
00:04:52,640 --> 00:04:55,640
So in a dense model, the GPU's 
are essentially working 

106
00:04:55,640 --> 00:04:58,880
independently for a while and 
then having a quick sync 

107
00:04:58,880 --> 00:05:01,360
meeting. 
The data being passed across the

108
00:05:01,360 --> 00:05:03,560
cables is just the gradient 
updates. 

109
00:05:04,320 --> 00:05:07,640
But in a mixture of experts 
model, you aren't using data 

110
00:05:07,640 --> 00:05:11,520
parallelism in the same way you 
are using expert parallelism. 

111
00:05:11,880 --> 00:05:14,400
Right, the experts are 
physically spread out. 

112
00:05:14,880 --> 00:05:17,720
You might have an Moe layer with
64 experts. 

113
00:05:18,240 --> 00:05:22,440
Expert One might live in the 
VRAM of a GPU on Rack A, while 

114
00:05:22,440 --> 00:05:26,160
Expert 64 lives on a completely 
different GPU over on Rack Z. 

115
00:05:26,960 --> 00:05:30,360
So when a batch of tokens 
reaches this Moe layer, a router

116
00:05:30,360 --> 00:05:32,120
decides where each token needs 
to go. 

117
00:05:32,520 --> 00:05:36,680
And if a token on Rack A needs 
Expert 64, that token's entire 

118
00:05:36,680 --> 00:05:40,280
hidden state vector must 
physically leave Rack A, travel 

119
00:05:40,280 --> 00:05:44,080
across the data center's network
fabric to Rack Z, get processed,

120
00:05:44,440 --> 00:05:45,680
and then travel all the way 
back. 

121
00:05:45,920 --> 00:05:48,280
I mean, this sounds like a 
logistical nightmare if the 

122
00:05:48,320 --> 00:05:51,120
dense model is a company where 
everyone works from home and 

123
00:05:51,120 --> 00:05:53,000
occasionally syncs up on a big 
video call. 

124
00:05:53,520 --> 00:05:57,480
The Allreduce then the Moe model
is like a massive city. 

125
00:05:57,520 --> 00:05:59,760
Yeah, a very congested city. 
Right. 

126
00:05:59,760 --> 00:06:02,440
Millions of commuters are 
physically leaving their houses,

127
00:06:02,440 --> 00:06:05,800
taking a train to a highly 
specific office buildings, doing

128
00:06:05,800 --> 00:06:07,200
their work and taking the train 
back. 

129
00:06:07,600 --> 00:06:09,240
And this isn't happening once a 
day. 

130
00:06:09,280 --> 00:06:12,600
This is happening constantly. 
It happens at every single Moe 

131
00:06:12,640 --> 00:06:15,800
layer for every single token 
during both the forward pass and

132
00:06:15,800 --> 00:06:18,920
the backward pass. 
This operation is called an all 

133
00:06:18,920 --> 00:06:22,400
to all token exchange. 
The entire network has to just 

134
00:06:22,600 --> 00:06:24,840
throw data to everyone else 
simultaneously. 

135
00:06:24,840 --> 00:06:27,960
Exactly, and this completely 
changes the stress placed on 

136
00:06:27,960 --> 00:06:29,880
your network switches. 
Well, let's talk about that 

137
00:06:29,880 --> 00:06:32,800
stress, because the handbook 
reveals a terrifying hardware 

138
00:06:32,800 --> 00:06:35,200
reality here. 
If you run a standard cluster 

139
00:06:35,200 --> 00:06:38,920
diagnostic you might see blazing
fast speeds for an all reduce 

140
00:06:38,920 --> 00:06:41,600
operation. 
Yeah, the authors noted a 

141
00:06:41,600 --> 00:06:45,600
cluster hitting like 398.52 
gigabytes per second for all 

142
00:06:45,600 --> 00:06:46,920
reduce. 
Which is great. 

143
00:06:47,240 --> 00:06:49,480
A hardware engineer would look 
at that and say awesome, the 

144
00:06:49,480 --> 00:06:51,680
network is healthy, start the 
training run. 

145
00:06:51,880 --> 00:06:55,240
And that will be a multi 
$1,000,000 mistake because when 

146
00:06:55,240 --> 00:06:58,240
they tested the all to all 
operation on that exact same 

147
00:06:58,240 --> 00:07:02,520
hardware, the bandwidth 
plummeted to 39.84 gigabytes per

148
00:07:02,520 --> 00:07:03,320
second. 
Wait. 

149
00:07:03,760 --> 00:07:08,480
A 90% drop in efficiency, why 
does it drop so drastically? 

150
00:07:08,480 --> 00:07:11,720
I mean if the cables are the 
same and the GPU's are the same,

151
00:07:12,000 --> 00:07:16,040
why does an all to all gridlock 
the system while an all reduce 

152
00:07:16,040 --> 00:07:18,080
just flies? 
Because of the communication 

153
00:07:18,080 --> 00:07:20,760
pattern OK, all reduce is highly
structured. 

154
00:07:21,040 --> 00:07:24,840
GPU's can pass data in a ring or
a tree structure, accumulating 

155
00:07:24,840 --> 00:07:29,520
data cleanly as it moves. 
All to all is just pure chaos by

156
00:07:29,520 --> 00:07:31,840
comparison. 
Every single GPU is trying to 

157
00:07:31,840 --> 00:07:35,880
send distinct non overlapping 
chunks of data to every other 

158
00:07:35,880 --> 00:07:39,000
GPU simultaneously. 
Right, it completely floods the 

159
00:07:39,000 --> 00:07:41,360
network interface cards and the 
network switches. 

160
00:07:41,920 --> 00:07:44,320
It exposes routing 
inefficiencies and congestion 

161
00:07:44,320 --> 00:07:48,560
control issues that a structured
all reduce civilly bypasses. 

162
00:07:48,960 --> 00:07:52,280
OK, neural signal check. 
Here's why this development 

163
00:07:52,280 --> 00:07:53,840
actually matters at a technical 
level. 

164
00:07:54,600 --> 00:07:58,040
If your hardware diagnostic only
checks standard matrix math or 

165
00:07:58,040 --> 00:08:01,480
all reduced speeds, you will be 
completely blind to the all to 

166
00:08:01,480 --> 00:08:04,160
all bottleneck that will 
absolutely strangle your Moe 

167
00:08:04,240 --> 00:08:07,360
during training. 
You have to benchmark the exact 

168
00:08:07,360 --> 00:08:09,360
communication pattern your model
uses. 

169
00:08:09,440 --> 00:08:13,000
Which brings us to the actual 
networking protocols, the NCCL 

170
00:08:13,000 --> 00:08:15,480
and the EFA. 
Right, the NVIDIA Collective 

171
00:08:15,480 --> 00:08:18,680
Communication Library. 
It is the underlying software 

172
00:08:18,680 --> 00:08:21,600
logic that dictates how NVIDIA 
GPU's talk to each other. 

173
00:08:22,000 --> 00:08:26,760
So when a tensor needs to move 
from GPUA to GPUB, NCCL decides 

174
00:08:26,760 --> 00:08:29,240
the fastest route. 
If they are in the same physical

175
00:08:29,240 --> 00:08:31,880
box, uses the Hyperfast and V 
link. 

176
00:08:32,320 --> 00:08:34,679
If they're on different nodes, 
it has to use the network cards 

177
00:08:34,840 --> 00:08:38,720
like AWS EFA. 
And setting these up perfectly 

178
00:08:38,720 --> 00:08:41,720
seems incredibly fragile, 
specifically because of 

179
00:08:41,720 --> 00:08:43,960
something called a silent 
failure. 

180
00:08:44,760 --> 00:08:47,760
Silent failures are just the 
bane of distributed systems. 

181
00:08:48,080 --> 00:08:52,640
Ideally across nodes, NCCL 
should use RDMA Remote Direct 

182
00:08:52,640 --> 00:08:55,760
Memory access. 
Which allows a GPU on node one 

183
00:08:55,760 --> 00:08:59,800
to write data directly into the 
VRAM of a GPU on node 2, right? 

184
00:08:59,800 --> 00:09:02,360
Completely bypassing the 
operating system, CPU and 

185
00:09:02,360 --> 00:09:03,560
kernel. 
Exactly. 

186
00:09:03,600 --> 00:09:08,040
It's incredibly fast, but to do 
this on AWS, NCCL needs a 

187
00:09:08,040 --> 00:09:11,640
specific plugin called the OFI 
plugin to talk to the EFA. 

188
00:09:12,120 --> 00:09:16,200
What happens if that plug in is 
misconfigured or if the you know

189
00:09:16,240 --> 00:09:18,680
the environment variables aren't
perfectly aligned in your docker

190
00:09:18,680 --> 00:09:20,520
container? 
The training doesn't crash, 

191
00:09:20,920 --> 00:09:24,680
that's why it's a silent failure
and CCL looks for the RDMA path,

192
00:09:24,680 --> 00:09:28,400
fails to find it and quietly 
falls back to using standard TCP

193
00:09:28,400 --> 00:09:29,920
sockets. 
Wait, what? 

194
00:09:29,920 --> 00:09:33,560
It falls back to TCP as in the 
standard Internet Protocol that 

195
00:09:33,560 --> 00:09:35,200
sends emails and loads web 
pages. 

196
00:09:35,240 --> 00:09:39,600
Yeah, it routes the massive 
tensor data through the CPU down

197
00:09:39,600 --> 00:09:43,040
through the OS networking stack,
chops it into standard TCP 

198
00:09:43,040 --> 00:09:46,000
packets, sends it across the 
wire, and reconstructs it on the

199
00:09:46,000 --> 00:09:48,040
other side. 
Oh my God. 

200
00:09:48,560 --> 00:09:51,440
The handbook explicitly 
documents the catastrophic cost 

201
00:09:51,440 --> 00:09:54,000
of this. 
A multi node training run that 

202
00:09:54,000 --> 00:09:58,120
was supposed to hit 42 point O 
teraflops per second suddenly 

203
00:09:58,120 --> 00:10:00,560
dropped to 1.7 teraflops per 
second. 

204
00:10:00,760 --> 00:10:04,280
That is a 25X slowdown. 
You could burn through your 

205
00:10:04,280 --> 00:10:08,000
entire compute budget in a month
and accomplish 2 days worth of 

206
00:10:08,000 --> 00:10:11,240
training, all because a 
configuration flag was missing. 

207
00:10:11,720 --> 00:10:14,440
And because it's a silent 
failure, the loss curves might 

208
00:10:14,520 --> 00:10:17,200
still go down. 
The model is mathematically 

209
00:10:17,200 --> 00:10:20,240
learning, it's just doing it at 
an absolute crawl. 

210
00:10:21,240 --> 00:10:24,640
So you really have to look for 
the phrase using network Lib 

211
00:10:24,640 --> 00:10:28,440
fabric in the logs. 
If it says using network socket,

212
00:10:28,720 --> 00:10:30,640
you have to stop the run 
immediately and fix it. 

213
00:10:31,640 --> 00:10:33,640
OK, let's assume we've passed 
that hurdle. 

214
00:10:33,880 --> 00:10:36,960
We've verified the RDMA is 
working, the all to all 

215
00:10:36,960 --> 00:10:39,960
bandwidth is optimized and our 
network is pristine. 

216
00:10:40,840 --> 00:10:43,240
Now we have to look at how the 
model actually uses that 

217
00:10:43,240 --> 00:10:44,800
network. 
Right, the routing. 

218
00:10:44,840 --> 00:10:47,760
Yeah, a token has arrived at an 
Moe layer. 

219
00:10:47,960 --> 00:10:50,760
How does it know which experts 
building to take the train to? 

220
00:10:51,320 --> 00:10:54,120
We have to look inside the 
router and specifically how 

221
00:10:54,120 --> 00:10:56,480
logits become weights. 
Well, the router is actually one

222
00:10:56,480 --> 00:10:58,560
of the smallest components in 
the entire network. 

223
00:10:58,880 --> 00:11:01,000
It's typically just a single 
linear layer. 

224
00:11:01,760 --> 00:11:04,280
So when a token arrives, it's 
high dimensional hidden state 

225
00:11:04,280 --> 00:11:08,000
vector is multiplied by a 
routing weight matrix and this 

226
00:11:08,000 --> 00:11:10,200
outputs a set of scores which we
call logits. 

227
00:11:10,440 --> 00:11:12,720
You get 1 logit for every 
available expert. 

228
00:11:13,080 --> 00:11:17,360
If your Moe layer has 64 
experts, the router generates 64

229
00:11:17,360 --> 00:11:20,160
logits for that token. 
And the router just picks the 

230
00:11:20,160 --> 00:11:24,080
experts with the highest logits.
So if we are doing a top 2 

231
00:11:24,080 --> 00:11:27,160
routing scheme, it just looks 
for the two highest numbers and 

232
00:11:27,160 --> 00:11:28,680
sends the token to those 
experts. 

233
00:11:29,240 --> 00:11:32,200
It does, but selecting the 
experts is only half the job. 

234
00:11:32,640 --> 00:11:35,440
The router also has to assign a 
mathematical weight to each 

235
00:11:35,440 --> 00:11:37,720
chosen expert. 
Right, because when the token 

236
00:11:37,720 --> 00:11:40,880
comes back from expert A and 
expert B, the model doesn't just

237
00:11:41,200 --> 00:11:42,920
add their outputs together. 
No. 

238
00:11:43,360 --> 00:11:47,560
It multiplies expert A's output 
by a weight and expert B's 

239
00:11:47,560 --> 00:11:49,760
output by a weight, and then 
sums them. 

240
00:11:50,560 --> 00:11:53,880
This is how the model determines
how much to listen to each 

241
00:11:53,880 --> 00:11:56,000
expert. 
Which brings in the gating 

242
00:11:56,000 --> 00:11:58,880
functions. 
The logits have to be 

243
00:11:58,880 --> 00:12:01,920
transformed into these weights, 
and the traditional way to do 

244
00:12:01,920 --> 00:12:05,000
this in neural networks is using
a softmax function. 

245
00:12:05,160 --> 00:12:08,520
Yeah, softmax takes any set of 
numbers and turns them into a 

246
00:12:08,520 --> 00:12:11,360
probability distribution that 
always sums to 1.0. 

247
00:12:11,680 --> 00:12:15,840
It is great for classification. 
But softmax has an exponential 

248
00:12:15,840 --> 00:12:18,000
nature, right? 
As the router learns and becomes

249
00:12:18,000 --> 00:12:21,320
more confident, the gap between 
the top logit and the second 

250
00:12:21,320 --> 00:12:24,360
logit grows. 
Because the exponential math in 

251
00:12:24,360 --> 00:12:28,000
softmax, a slightly higher logit
gets pushed towards a 

252
00:12:28,000 --> 00:12:31,040
probability of 1.0 and 
everything else gets crushed 

253
00:12:31,040 --> 00:12:34,360
towards 0. 
That seems like a massive waste 

254
00:12:34,360 --> 00:12:36,720
of compute. 
If my token routes to two 

255
00:12:36,720 --> 00:12:41,680
experts and softmax gives expert
A a weight of .99 and expert BA 

256
00:12:41,680 --> 00:12:46,560
weight of .01, core expert B is 
doing all this massive matrix 

257
00:12:46,560 --> 00:12:49,600
multiplication across the 
network just for its final 

258
00:12:49,600 --> 00:12:53,560
answer to be multiplied by .01 
and essentially ignored. 

259
00:12:53,840 --> 00:12:57,080
It is a total waste. 
The top expert dominates and the

260
00:12:57,080 --> 00:12:59,840
secondary experts failed to 
contribute meaningfully. 

261
00:13:00,280 --> 00:13:02,960
This is exactly why Frontier 
models are moving away from 

262
00:13:02,960 --> 00:13:05,880
softmax for routing. 
OK, So what are they using? 

263
00:13:06,440 --> 00:13:08,760
Sigmoid. 
A popular alternative is a 

264
00:13:08,760 --> 00:13:11,720
sigmoid function, yeah. 
How does sigmoid differ here? 

265
00:13:11,920 --> 00:13:14,320
Doesn't it also output values 
between zero and one? 

266
00:13:14,560 --> 00:13:18,240
It does, but sigmoid evaluates 
each logit completely 

267
00:13:18,240 --> 00:13:20,400
independently. 
It doesn't force them to sum to 

268
00:13:20,400 --> 00:13:22,200
one. 
If the router generates very 

269
00:13:22,200 --> 00:13:26,200
high logits for both expert A 
and expert B, the sigmoid 

270
00:13:26,200 --> 00:13:28,960
function will output a weight 
near one point O for both of 

271
00:13:28,960 --> 00:13:31,760
them. 
So if it's confident in both, 

272
00:13:31,840 --> 00:13:33,600
they both get an equal say. 
Exactly. 

273
00:13:34,040 --> 00:13:36,960
Confident experts end up with 
roughly equal weights, so they 

274
00:13:36,960 --> 00:13:39,760
all contribute their full 
computational value to the final

275
00:13:39,760 --> 00:13:42,280
output. 
And the handbook also mentions 

276
00:13:42,280 --> 00:13:46,120
1/3 option that DeepSeek V4 
switch to which is the square 

277
00:13:46,120 --> 00:13:49,840
root of the soft plus function. 
Yeah, that is getting deep into 

278
00:13:49,840 --> 00:13:52,520
the math weeds. 
What makes that function 

279
00:13:52,520 --> 00:13:55,600
special? 
It acts as a mathematical middle

280
00:13:55,600 --> 00:13:58,040
ground. 
Sigmoid can sometimes saturate 

281
00:13:58,040 --> 00:14:01,800
too quickly, meaning it hits one
point O and stops passing useful

282
00:14:01,800 --> 00:14:03,400
gradients back during training, 
right? 

283
00:14:04,120 --> 00:14:07,600
The square root of soft plus 
scales gracefully for positive 

284
00:14:07,600 --> 00:14:10,360
log it's. 
It completely avoids the winner 

285
00:14:10,360 --> 00:14:13,320
takes all crushing effect of 
softmax, but it provides A 

286
00:14:13,320 --> 00:14:16,360
smoother gradient for the 
optimizer to learn from than a 

287
00:14:16,360 --> 00:14:19,960
raw sigmoid. 
But wait, if we use sigmoid or 

288
00:14:19,960 --> 00:14:23,600
the square root of soft plus, we
lose the main property of 

289
00:14:23,600 --> 00:14:26,840
softmax. 
The weights no longer sum to one

290
00:14:26,840 --> 00:14:28,040
point O. 
True. 

291
00:14:28,680 --> 00:14:32,600
So if a token comes out of the 
Moe layer and its values are 

292
00:14:32,600 --> 00:14:35,480
being multiplied by two 
different weights that are both 

293
00:14:35,480 --> 00:14:38,360
sitting at one point O, the 
output vector is going to be 

294
00:14:38,360 --> 00:14:40,240
massive. 
The scale of the numbers will 

295
00:14:40,240 --> 00:14:42,520
explode. 
You've hit on the exact reason 

296
00:14:42,520 --> 00:14:46,120
we need renormalization and an 
output scale. 

297
00:14:46,800 --> 00:14:49,760
If you just let those weights 
ride, the activation norms of 

298
00:14:49,760 --> 00:14:53,320
your neural network will 
fluctuate wildly depending on 

299
00:14:53,520 --> 00:14:56,760
how confident the router is. 
The model will just become 

300
00:14:56,800 --> 00:14:58,600
numerically unstable and 
diverge. 

301
00:14:58,840 --> 00:15:02,440
So even if you use sigmoid to 
get the weights, you still take 

302
00:15:02,440 --> 00:15:04,920
the final chosen weights and 
renormalize them. 

303
00:15:05,360 --> 00:15:08,240
You divide each weight by the 
sum of the chosen weights so 

304
00:15:08,240 --> 00:15:11,120
that they add up to 1. 
Wait, I see a math problem 

305
00:15:11,120 --> 00:15:13,800
there. 
If we force them to sum to one 

306
00:15:13,800 --> 00:15:17,600
point O and they are both 
equally confident, they both get

307
00:15:17,600 --> 00:15:22,120
a weight of 0.5. 
The outputs of the experts are 

308
00:15:22,120 --> 00:15:25,000
being halved. 
It gets worse the more experts 

309
00:15:25,000 --> 00:15:28,240
you pick. 
If you route to 8 experts and 

310
00:15:28,240 --> 00:15:31,200
they all get an equal slice, 
each experts output is 

311
00:15:31,200 --> 00:15:36,240
multiplied by 0.125. 
When you average the outputs of 

312
00:15:36,240 --> 00:15:39,320
multiple independent experts 
like that, the variance of the 

313
00:15:39,320 --> 00:15:41,120
combined output drops 
significantly. 

314
00:15:41,560 --> 00:15:45,120
The token signal loses energy. 
So how do you fix a signal 

315
00:15:45,120 --> 00:15:47,240
that's shrinking as it passes 
through the network? 

316
00:15:47,880 --> 00:15:50,600
You'll apply a mathematical 
scaling factor to restore the 

317
00:15:50,640 --> 00:15:53,320
root mean, square, or RMS of the
output. 

318
00:15:53,960 --> 00:15:57,840
Oh, so after you sum the 
renormalized expert outputs, you

319
00:15:57,840 --> 00:16:02,000
might multiply the entire vector
by a constant like 2.5, or 

320
00:16:02,200 --> 00:16:05,440
dynamically by the square root 
of K, the number of experts you 

321
00:16:05,440 --> 00:16:06,800
routed to. 
Exactly. 

322
00:16:07,440 --> 00:16:10,960
This restores the energy of the 
token signal so it maintains A 

323
00:16:10,960 --> 00:16:13,600
consistent magnitude as it 
travels deeper into the 

324
00:16:13,600 --> 00:16:16,280
transformer layers. 
OK, here is where the handbook 

325
00:16:16,280 --> 00:16:19,240
dives into something that 
completely fascinated me. 

326
00:16:19,600 --> 00:16:22,120
The precision of the router. 
This is a huge one. 

327
00:16:22,640 --> 00:16:26,200
In modern AI, the whole goal is 
to use lower precision formats 

328
00:16:26,200 --> 00:16:31,360
like FP16 or BF16. 
You use 16 bits instead of 32 

329
00:16:31,360 --> 00:16:34,240
bits to store a number, which 
halves your memory footprint and

330
00:16:34,240 --> 00:16:37,200
allows the tensor cores to chew 
through matrix math twice as 

331
00:16:37,200 --> 00:16:39,560
fast. 
But the authors highlight that 

332
00:16:39,560 --> 00:16:42,400
doing this to the router is a 
fatal mistake. 

333
00:16:42,840 --> 00:16:46,040
It is one of the most critical 
yet subtle bugs you can 

334
00:16:46,040 --> 00:16:50,640
introduce into an Moe code base.
The massive FFN experts can run 

335
00:16:50,640 --> 00:16:53,760
in low precision, but the tiny 
little router calculation 

336
00:16:53,960 --> 00:16:58,080
absolutely must be done in high 
definition FP 32 precision. 

337
00:16:58,520 --> 00:17:01,960
Right, because if you calculate 
the router logits in BF16, the 

338
00:17:01,960 --> 00:17:04,680
model will often 
catastrophically fail to learn. 

339
00:17:05,000 --> 00:17:07,760
Google explicitly documented 
this failure mode in their 

340
00:17:07,760 --> 00:17:09,839
switch Transformers research. 
Yeah, they did. 

341
00:17:10,200 --> 00:17:12,319
I really need to understand the 
physics of this. 

342
00:17:12,520 --> 00:17:15,640
We are doing billions of 
parameter matrix multiplications

343
00:17:15,640 --> 00:17:19,560
in low precision to save memory,
but this one tiny routing 

344
00:17:19,560 --> 00:17:23,160
calculation has to be in high 
def FP 32. 

345
00:17:23,280 --> 00:17:25,760
It does. 
It's like using a blurry, worn 

346
00:17:25,760 --> 00:17:29,000
out tape measure to construct 
the steel beams of a skyscraper,

347
00:17:29,200 --> 00:17:32,400
but demanding a laser micrometer
just to sort the mail in the 

348
00:17:32,400 --> 00:17:35,000
lobby. 
Why is the router so incredibly 

349
00:17:35,000 --> 00:17:37,640
fragile? 
To understand why the laser 

350
00:17:37,640 --> 00:17:41,200
micrometer is necessary, you 
have to understand how BF16 

351
00:17:41,200 --> 00:17:43,640
represents numbers compared to 
FP32. 

352
00:17:44,600 --> 00:17:47,040
Floating point numbers are 
stored in scientific notation. 

353
00:17:47,160 --> 00:17:50,480
They have a sign bit, an 
exponent which tells you how big

354
00:17:50,480 --> 00:17:54,440
the number is, and a mantissa 
which tells you the precise 

355
00:17:54,440 --> 00:17:56,240
decimal value. 
Exactly. 

356
00:17:56,720 --> 00:18:00,400
FP 32 has 8 bits for the 
exponent and 23 bits for the 

357
00:18:00,400 --> 00:18:02,720
mantissa. 
It's highly precise. 

358
00:18:03,120 --> 00:18:06,640
And BF 16. 
BF16 was invented by Google 

359
00:18:06,640 --> 00:18:08,240
specifically for machine 
learning. 

360
00:18:08,560 --> 00:18:11,720
It keeps the 8 bit exponent, 
meaning it can represent numbers

361
00:18:11,720 --> 00:18:14,960
just as massively large as FB32 
without overflowing. 

362
00:18:15,360 --> 00:18:20,120
But to save space, it chops the 
mantissa down to just 7 bits. 

363
00:18:20,400 --> 00:18:23,720
So it sacrifices precision to 
maintain scale. 

364
00:18:24,200 --> 00:18:27,200
It can store a massive number, 
but it can't tell you the exact 

365
00:18:27,200 --> 00:18:29,240
decimal points of that massive 
number. 

366
00:18:29,360 --> 00:18:31,600
Exactly. 
Now think about the ruler 

367
00:18:31,600 --> 00:18:34,800
analogy you brought up earlier. 
In floating point math, the tick

368
00:18:34,800 --> 00:18:37,960
marks on the ruler represent the
numbers the computer can 

369
00:18:37,960 --> 00:18:41,320
actually understand. 
When numbers are close to 0, the

370
00:18:41,320 --> 00:18:44,640
tick marks are microscopic. 
You have incredible precision. 

371
00:18:45,200 --> 00:18:48,600
But as numbers get larger and 
larger, the absolute physical 

372
00:18:48,600 --> 00:18:52,000
distance between the tick marks 
gets wider because the exponent 

373
00:18:52,000 --> 00:18:54,120
has stepped up. 
So the limited bits of the 

374
00:18:54,120 --> 00:18:57,800
mantissa are representing larger
and larger chunks of distance. 

375
00:18:58,000 --> 00:19:01,280
Right, and here is where it 
collides with Moe training. 

376
00:19:01,640 --> 00:19:05,440
As the model trains the router's
weights update and the logits it

377
00:19:05,440 --> 00:19:08,400
outputs have a natural tendency 
to drift upwards, they get 

378
00:19:08,400 --> 00:19:10,480
larger. 
Because standard loss functions 

379
00:19:10,480 --> 00:19:12,880
don't care how big the logits 
are, they only care about the 

380
00:19:12,880 --> 00:19:14,640
relative difference between 
them, right? 

381
00:19:14,800 --> 00:19:18,680
Yeah, the router realizes that 
making the logits larger makes 

382
00:19:18,680 --> 00:19:23,600
the softmax output sharper, so 
it pushes the logits from 5 up 

383
00:19:23,600 --> 00:19:27,920
to 20 up to 100 and. 
What happens to our BF 16 tick 

384
00:19:27,920 --> 00:19:30,120
marks when the logits drift up 
to 100? 

385
00:19:30,720 --> 00:19:33,720
The tick marks spread out at a 
value of 100. 

386
00:19:33,720 --> 00:19:38,360
The BF16 format might only have 
a tick mark at 100.0, and the 

387
00:19:38,360 --> 00:19:41,800
next possible representable 
number is 100.5. 

388
00:19:41,880 --> 00:19:44,600
It physically cannot store 
anything in between. 

389
00:19:45,960 --> 00:19:48,440
Oh, I see the collision. 
The sharpness of the routing 

390
00:19:48,440 --> 00:19:51,040
decision lives in the 
microscopic gaps between the 

391
00:19:51,040 --> 00:19:53,680
logits. 
Precisely if expert A is 

392
00:19:53,680 --> 00:19:57,080
genuinely better, it's true. 
Mathematical logit might be 

393
00:19:57,240 --> 00:20:03,840
100.1 while expert B is 100.2. 
NFP 32 router has enough 

394
00:20:03,840 --> 00:20:06,560
manticipates to see that expert 
B is better. 

395
00:20:07,160 --> 00:20:10,680
But ABF 16 router will round 
them both to the exact same tick

396
00:20:10,680 --> 00:20:12,680
mark 100.0. 
They tie. 

397
00:20:12,960 --> 00:20:15,920
They tie, and when experts tie, 
the selection mechanism 

398
00:20:15,920 --> 00:20:18,720
essentially becomes random. 
Yeah, tokens start randomly 

399
00:20:18,720 --> 00:20:22,040
flipping between experts from 
step to step, The gradients 

400
00:20:22,040 --> 00:20:25,600
become chaotic noise, the 
optimizer gets confused, and the

401
00:20:25,600 --> 00:20:28,800
model diverges. 
That is mind blowing. 

402
00:20:29,040 --> 00:20:32,880
The entire trillion parameter 
model collapses because a 7 bit 

403
00:20:32,880 --> 00:20:35,440
mantissa rounded 2 numbers to 
the same integer. 

404
00:20:35,920 --> 00:20:39,680
So the fix is just forcing the 
router to stay in FP32. 

405
00:20:39,840 --> 00:20:43,840
That is Part 1 of the fix. 
You compute the router in FP32, 

406
00:20:44,080 --> 00:20:47,120
but remember even FP 32 has a 
limit. 

407
00:20:47,600 --> 00:20:52,720
If the logits drift to 10,000 or
100,000, even FP32 tick marks 

408
00:20:52,720 --> 00:20:54,880
will spread out and cause 
rounding ties. 

409
00:20:55,480 --> 00:20:58,360
So you have to stop the logits 
from drifting upward in the 1st 

410
00:20:58,360 --> 00:21:00,560
place. 
You have to keep them near 0, 

411
00:21:00,560 --> 00:21:03,120
where the floating point tick 
marks are infinitely dense. 

412
00:21:03,120 --> 00:21:05,600
Exactly. 
And how do you force a neural 

413
00:21:05,600 --> 00:21:08,200
network to keep its numbers 
small while it's trying to 

414
00:21:08,200 --> 00:21:10,800
learn? 
You apply an auxiliary penalty 

415
00:21:10,800 --> 00:21:15,200
called AZ Loss. 
You add this Z loss term to the 

416
00:21:15,200 --> 00:21:17,840
overall training loss. 
Specifically, the Z loss 

417
00:21:18,160 --> 00:21:21,120
penalizes the log sum X of the 
router logits. 

418
00:21:21,520 --> 00:21:24,400
Let's unpack that. 
It stands for the logarithm of 

419
00:21:24,400 --> 00:21:27,560
the sum of the exponentials. 
Without getting bogged down in 

420
00:21:27,560 --> 00:21:31,840
the equation, think of log sum X
as a smooth approximation of the

421
00:21:31,840 --> 00:21:36,000
maximum logit value. 
By penalizing the log sum X you 

422
00:21:36,000 --> 00:21:39,120
are basically adding a 
mathematical rubber band to the 

423
00:21:39,120 --> 00:21:41,400
logits. 
So as the logits try to drift 

424
00:21:41,400 --> 00:21:43,640
higher, the Z loss pulls them 
back towards 0. 

425
00:21:43,640 --> 00:21:46,400
Exactly. 
It applies A gentle downward 

426
00:21:46,400 --> 00:21:48,880
pressure on the overall 
magnitude of the logits. 

427
00:21:49,440 --> 00:21:53,000
This keeps the logits anchored 
in the sweet spot of the 

428
00:21:53,000 --> 00:21:56,240
floating point representation 
right around 0, ensuring that 

429
00:21:56,240 --> 00:21:59,400
the microscopic decimal 
differences between them are 

430
00:21:59,400 --> 00:22:03,840
preserved perfectly forever. 
That is a phenomenal piece of 

431
00:22:03,840 --> 00:22:06,760
engineering. 
So we've got our FP32 laser 

432
00:22:06,760 --> 00:22:11,760
micrometer sorting the mail, and
we've added AZ loss rubber band 

433
00:22:11,760 --> 00:22:13,600
to make sure the mail doesn't 
pile up to the ceiling. 

434
00:22:14,240 --> 00:22:17,080
But that router logic brings up 
a massive physical problem. 

435
00:22:17,280 --> 00:22:20,120
If the router is working 
perfectly, and it identifies 

436
00:22:20,120 --> 00:22:22,600
that expert one is 
mathematically the smartest 

437
00:22:22,600 --> 00:22:26,080
expert for grammar, it's going 
to send every single grammar 

438
00:22:26,080 --> 00:22:29,000
token to expert one. 
How does the hardware not 

439
00:22:29,000 --> 00:22:31,800
meltdown from the traffic jam? 
We have to talk about load 

440
00:22:31,800 --> 00:22:34,480
balancing. 
This is arguably the most 

441
00:22:34,480 --> 00:22:37,760
difficult aspect of training in 
Moe because the router is 

442
00:22:37,760 --> 00:22:40,960
fundamentally selfish. 
It only cares about minimizing 

443
00:22:40,960 --> 00:22:43,360
the immediate loss for the 
current token it is holding. 

444
00:22:43,400 --> 00:22:47,840
Yeah, if it calculates that 
expert one is even 0.1% better 

445
00:22:47,840 --> 00:22:51,720
at processing a comma than 
expert two, it will ruthlessly 

446
00:22:51,720 --> 00:22:54,840
route every single comma token 
to expert one. 

447
00:22:55,400 --> 00:22:57,640
And since language is absolutely
flooded with commas and 

448
00:22:57,640 --> 00:23:01,240
punctuation, Expert one gets 
slammed with millions of tokens,

449
00:23:01,240 --> 00:23:04,720
while Expert 2, which might be 
slightly worse at commas but 

450
00:23:04,720 --> 00:23:08,080
amazing at French verbs, sits 
completely idle waiting for 

451
00:23:08,080 --> 00:23:10,160
French text. 
This brings us to the core 

452
00:23:10,160 --> 00:23:13,720
routing paradigms. 
Token choice versus expert 

453
00:23:13,720 --> 00:23:16,440
choice. 
What you just described is token

454
00:23:16,440 --> 00:23:18,440
choice. 
The tokens look at the experts 

455
00:23:18,560 --> 00:23:21,240
and pick their favorites. 
And because real world data is 

456
00:23:21,240 --> 00:23:24,160
heavily skewed towards certain 
topics and grammar structures, 

457
00:23:24,520 --> 00:23:28,480
token choice naturally leads to 
catastrophic load imbalances. 

458
00:23:29,120 --> 00:23:31,120
What is the alternative expert 
choice? 

459
00:23:31,400 --> 00:23:34,720
How does that flip the dynamic? 
In expert choice, you invert the

460
00:23:34,720 --> 00:23:37,160
selection process. 
Instead of tokens picking 

461
00:23:37,160 --> 00:23:40,480
experts, the experts look at all
the tokens in the batch. 

462
00:23:41,040 --> 00:23:44,280
Each expert evaluates the batch 
and selects its top K favorite 

463
00:23:44,280 --> 00:23:47,400
tokens until its physical 
capacity buffer is full. 

464
00:23:47,960 --> 00:23:50,400
Mathematically, that sounds like
a perfect solution. 

465
00:23:50,480 --> 00:23:54,480
If every expert picks exactly 
1000 tokens, you have guaranteed

466
00:23:54,480 --> 00:23:59,120
100% perfect load balancing. 
No GPU sits idle, no hardware is

467
00:23:59,120 --> 00:24:01,360
wasted. 
Why doesn't everyone just use 

468
00:24:01,360 --> 00:24:04,520
expert choice? 
Because of a fatal flock called 

469
00:24:04,600 --> 00:24:08,720
Future Token leakage. 
Expert choice works beautifully 

470
00:24:08,720 --> 00:24:11,760
during training because the 
expert is looking at a massive 

471
00:24:11,760 --> 00:24:14,480
static batch of text. 
You can look at the beginning of

472
00:24:14,480 --> 00:24:17,360
a paragraph and the end of a 
paragraph simultaneously to pick

473
00:24:17,360 --> 00:24:20,040
the best tokens. 
But think about inference. 

474
00:24:20,240 --> 00:24:22,520
When a user is actually chatting
with the model. 

475
00:24:22,960 --> 00:24:26,320
Inference is auto regressive. 
It generates text one single 

476
00:24:26,320 --> 00:24:28,200
token at a time. 
Exactly. 

477
00:24:28,320 --> 00:24:31,320
During inference, the expert 
cannot look into the future. 

478
00:24:31,480 --> 00:24:34,360
It doesn't have a batch of 
tokens to pick from, It only has

479
00:24:34,360 --> 00:24:36,320
the single token that was just 
generated. 

480
00:24:36,920 --> 00:24:39,400
And can't decide if it wants to 
process the current token or 

481
00:24:39,400 --> 00:24:42,280
wait for a better one three 
words later because the future 

482
00:24:42,280 --> 00:24:44,080
words haven't been generated 
yet, right? 

483
00:24:45,040 --> 00:24:47,640
Because the routing mechanism 
during inference fundamentally 

484
00:24:47,640 --> 00:24:51,400
breaks from how it was trained, 
Expert choice models suffer 

485
00:24:51,400 --> 00:24:54,280
severe performance degradation 
when actually deployed. 

486
00:24:54,880 --> 00:24:58,120
So we are essentially forced to 
stick with token choice for auto

487
00:24:58,120 --> 00:25:00,400
regressive language models, 
which means we are stuck 

488
00:25:00,400 --> 00:25:03,760
fighting the traffic jams. 
How do we measure how bad the 

489
00:25:03,760 --> 00:25:06,200
jam is? 
The handbook mentions a metric 

490
00:25:06,200 --> 00:25:10,160
called Maxvio. 
Maxvio stands for Maximal 

491
00:25:10,160 --> 00:25:13,280
Violation OK. 
It is a vital metric for your 

492
00:25:13,280 --> 00:25:16,000
dashboard. 
It measures how far the busiest 

493
00:25:16,000 --> 00:25:20,480
experts load sits above the mean
or average load of the layer. 

494
00:25:21,520 --> 00:25:24,480
Let's say you have 64 experts. 
OK, if you divide the tokens 

495
00:25:24,480 --> 00:25:27,600
evenly, the average load is 1000
tokens per expert. 

496
00:25:27,960 --> 00:25:31,600
If your busiest expert is 
receiving 2000 tokens, it is 

497
00:25:31,600 --> 00:25:35,560
100% over the mean. 
Your Max bio is 1.0. 

498
00:25:36,040 --> 00:25:39,320
And a Max bio of 0.0 means 
perfect balance. 

499
00:25:39,960 --> 00:25:42,440
Neural signal check. 
Here's why this development 

500
00:25:42,440 --> 00:25:44,120
actually matters at a technical 
level. 

501
00:25:44,440 --> 00:25:47,920
Imbalance isn't just an abstract
mathematical penalty on a loss 

502
00:25:47,920 --> 00:25:50,520
curve, it is a physical hardware
Rodelbach. 

503
00:25:50,640 --> 00:25:52,560
Absolutely. 
Because of the all to all 

504
00:25:52,560 --> 00:25:57,000
network barrier we discussed 
earlier, a cluster of 1024 GPU's

505
00:25:57,000 --> 00:26:00,680
will literally sit completely 
idle waiting for the single GPU 

506
00:26:00,680 --> 00:26:03,520
holding that overloaded Max 
patch expert to finish its math.

507
00:26:04,120 --> 00:26:07,080
The network cannot proceed to 
the next layer until all tokens 

508
00:26:07,080 --> 00:26:10,320
are returned. 
One overloaded expert halts $100

509
00:26:10,320 --> 00:26:13,200
million supercomputer. 
Which is why we introduced 

510
00:26:13,200 --> 00:26:16,200
balancing strategies to force 
the router to behave. 

511
00:26:16,960 --> 00:26:19,920
The most blunt instrument is the
auxiliary loss. 

512
00:26:20,120 --> 00:26:22,680
How does that work? 
You add another term to the main

513
00:26:22,680 --> 00:26:25,360
loss function. 
This term mathematically 

514
00:26:25,360 --> 00:26:27,920
increases if the routing 
distribution becomes uneven. 

515
00:26:28,840 --> 00:26:31,440
When the optimizer does 
backpropagation, it penalizes 

516
00:26:31,440 --> 00:26:34,400
the router's weights for sending
too many tokens to one expert. 

517
00:26:34,840 --> 00:26:37,400
The router learns that sending 
everything to expert One causes 

518
00:26:37,400 --> 00:26:40,080
a spike in the loss, so it 
starts spreading them out. 

519
00:26:40,680 --> 00:26:42,520
But doesn't that create a 
terrible tension? 

520
00:26:42,680 --> 00:26:45,040
It does. 
The router wants to send the 

521
00:26:45,040 --> 00:26:48,120
token to the best expert to get 
a good language modeling score, 

522
00:26:48,400 --> 00:26:51,400
but the auxiliary loss slaps its
wrist and says no, send it to 

523
00:26:51,400 --> 00:26:53,520
the dumb expert because it needs
work. 

524
00:26:53,920 --> 00:26:56,760
Aren't we forcing the model to 
make suboptimal intelligence 

525
00:26:56,760 --> 00:26:58,520
choices just to keep the 
hardware happy? 

526
00:26:58,640 --> 00:27:02,200
Yes, the auxiliary loss actively
competes with the main language 

527
00:27:02,200 --> 00:27:03,800
modeling loss. 
It's a tug of war. 

528
00:27:03,880 --> 00:27:06,960
If you set the aux loss 
coefficient too high, the model 

529
00:27:06,960 --> 00:27:10,480
routes tokens almost randomly 
just to achieve perfect balance 

530
00:27:10,840 --> 00:27:13,600
and the model becomes stupid. 
And if you set it too low, the 

531
00:27:13,600 --> 00:27:16,120
router ignores it, the balance 
fails, and the hardware 

532
00:27:16,120 --> 00:27:18,440
gridlocks. 
It is incredibly difficult to 

533
00:27:18,440 --> 00:27:20,040
tune. 
Are there other ways? 

534
00:27:20,040 --> 00:27:22,960
Ways that don't corrupt the 
actual learning gradients. 

535
00:27:23,360 --> 00:27:26,920
Yes, Frontier models are 
shifting toward loss free expert

536
00:27:26,920 --> 00:27:28,760
bias. 
Instead of messing with a loss 

537
00:27:28,760 --> 00:27:32,360
function and confusing the 
gradients, you inject A dynamic 

538
00:27:32,360 --> 00:27:35,720
bias directly into the router's 
logits, but purely for the 

539
00:27:35,720 --> 00:27:39,200
selection phase. 
How does a bias work in this 

540
00:27:39,200 --> 00:27:41,680
context? 
It's an additive scaler. 

541
00:27:42,320 --> 00:27:45,360
If the system detects that 
expert one is getting too full, 

542
00:27:45,720 --> 00:27:48,720
it artificially subtracts a 
value from expert one's logit 

543
00:27:48,960 --> 00:27:50,960
before the top case selection 
happens. 

544
00:27:51,160 --> 00:27:54,440
If Expert 2 is starving for 
tokens, it artificially adds a 

545
00:27:54,440 --> 00:27:58,040
value to Expert 2's logit. 
This steers the tokens toward 

546
00:27:58,040 --> 00:28:00,840
underutilized experts without 
changing the underlying 

547
00:28:00,840 --> 00:28:03,480
mathematical logits that the 
router uses to learn. 

548
00:28:03,480 --> 00:28:05,840
Exactly. 
OK, let's use an analogy here. 

549
00:28:06,440 --> 00:28:09,840
This sounds like a restaurant 
where the grill chef is slammed 

550
00:28:09,840 --> 00:28:13,120
with 50 burger orders, and the 
salad chef is just standing 

551
00:28:13,120 --> 00:28:16,200
there wiping the counter. 
The customer, the training 

552
00:28:16,200 --> 00:28:19,200
batch, doesn't get their food 
until both chefs are done, 

553
00:28:19,280 --> 00:28:21,600
right? 
Using an auxiliary loss is like 

554
00:28:21,600 --> 00:28:23,960
yelling at the waiter for 
writing down too many burger 

555
00:28:23,960 --> 00:28:26,200
orders. 
The waiter panics and, to avoid 

556
00:28:26,200 --> 00:28:28,520
getting yelled at, starts 
bringing salads to people who 

557
00:28:28,520 --> 00:28:31,120
ordered burgers. 
The balance is fixed, but the 

558
00:28:31,120 --> 00:28:33,800
customers are furious. 
The model loses intelligence. 

559
00:28:34,120 --> 00:28:37,080
And how does the loss free bias 
fit into the restaurant? 

560
00:28:37,800 --> 00:28:40,920
The loss free bias is like the 
kitchen manager quietly taking 

561
00:28:40,920 --> 00:28:44,240
some of the burger prep, like 
toasting the buns or slicing the

562
00:28:44,240 --> 00:28:47,680
tomatoes and routing it over to 
the salad chef station to help 

563
00:28:47,680 --> 00:28:49,920
out. 
The waiter still orders burgers.

564
00:28:50,200 --> 00:28:52,640
The customer still gets a 
burger, but the physical 

565
00:28:52,640 --> 00:28:55,240
workload in the kitchen is 
dynamically shifted to keep 

566
00:28:55,240 --> 00:28:57,520
everyone moving. 
That is an excellent way to 

567
00:28:57,520 --> 00:28:59,800
conceptualize it. 
But to make the salad chef 

568
00:28:59,800 --> 00:29:03,320
actually useful at toasting 
buns, the router has to learn 

569
00:29:03,320 --> 00:29:07,080
which tokens the underutilized 
expert can adequately handle, 

570
00:29:07,600 --> 00:29:10,160
right? 
If you shift the bias wildly 

571
00:29:10,160 --> 00:29:13,040
from microsecond to microsecond,
the router never learns. 

572
00:29:13,560 --> 00:29:16,800
This is why the handbook 
discusses quantile balancing. 

573
00:29:17,240 --> 00:29:19,280
Smooth out the steering. 
Exactly. 

574
00:29:19,520 --> 00:29:23,440
Quantile balancing uses an 
exponential moving average, or 

575
00:29:23,440 --> 00:29:26,360
EMA. 
Instead of wildly changing the 

576
00:29:26,360 --> 00:29:29,480
biases based on the immediate 
panic of a single batch of 

577
00:29:29,480 --> 00:29:33,800
tokens, the EMA slowly adjusts 
the bias over global batches. 

578
00:29:34,160 --> 00:29:36,320
It takes a longer term view of 
the traffic patterns. 

579
00:29:36,840 --> 00:29:40,440
It slowly nudges the router over
millions of tokens, giving the 

580
00:29:40,440 --> 00:29:43,760
experts time to adapt to the new
data they are receiving. 

581
00:29:44,160 --> 00:29:46,680
Which brings up the critical 
concept of scope. 

582
00:29:47,240 --> 00:29:50,960
Do you calculate this balance 
per micro batch, per sequence, 

583
00:29:51,200 --> 00:29:53,240
or over the massive global 
batch? 

584
00:29:53,600 --> 00:29:56,600
Why does the scope of the 
balancing fundamentally change 

585
00:29:56,600 --> 00:29:59,360
the models intelligence? 
Scope changes everything about 

586
00:29:59,360 --> 00:30:02,800
how the experts specialize. 
To understand this, let's say 

587
00:30:02,800 --> 00:30:06,480
your training data happens to 
have a micro batch that consists

588
00:30:06,480 --> 00:30:10,640
entirely of Python code. 
OK, thousands of Python tokens 

589
00:30:10,800 --> 00:30:13,920
hitting the router at once. 
If you enforce load balancing 

590
00:30:13,920 --> 00:30:17,400
strictly per micro batch, the 
router looks at those Python 

591
00:30:17,400 --> 00:30:20,240
tokens and is mathematically 
forced to distribute them 

592
00:30:20,240 --> 00:30:22,840
perfectly evenly across all 64 
experts. 

593
00:30:22,920 --> 00:30:26,160
Which means every single expert 
receives a tiny slice of Python 

594
00:30:26,160 --> 00:30:29,120
code. 
Exactly, and because of that you

595
00:30:29,120 --> 00:30:32,480
destroy specialization. 
No single expert can become the 

596
00:30:32,800 --> 00:30:35,960
master of Python because the 
strict micro batch balancing 

597
00:30:35,960 --> 00:30:38,880
forbids any single expert from 
taking all the Python tokens. 

598
00:30:39,360 --> 00:30:42,520
Every expert is forced to learn 
a little bit of Python, a little

599
00:30:42,520 --> 00:30:44,360
bit of French, a little bit of 
history. 

600
00:30:44,600 --> 00:30:46,400
They all become mediocre 
generalists. 

601
00:30:46,600 --> 00:30:49,720
So the obvious solution is to 
balance over the global batch. 

602
00:30:50,520 --> 00:30:53,520
A global batch contains a 
massive mixture of Python, 

603
00:30:53,880 --> 00:30:56,480
French literature, math 
equations, and Wikipedia 

604
00:30:56,480 --> 00:30:58,920
articles. 
That way expert A can grab all 

605
00:30:58,920 --> 00:31:02,320
the Python, expert B grabs all 
the French, and as long as they 

606
00:31:02,320 --> 00:31:05,320
all get an equal amount of total
work across the massive global 

607
00:31:05,320 --> 00:31:08,120
batch, everyone is happy and 
hyper specialized. 

608
00:31:08,160 --> 00:31:12,120
In theory, yes, global balancing
creates beautifully specialized 

609
00:31:12,120 --> 00:31:14,640
experts. 
But here is the brutal hardware 

610
00:31:14,640 --> 00:31:16,200
trap. 
Let's say you have that 

611
00:31:16,200 --> 00:31:20,000
perfectly mixed global batch. 
It's too big to process at once,

612
00:31:20,240 --> 00:31:23,800
so it's fed to the GPU's 
sequentially in smaller micro 

613
00:31:23,800 --> 00:31:25,760
batches. 
Chunk by chunk. 

614
00:31:26,280 --> 00:31:29,480
Micro batch 1 happens to be the 
chunk of Python data. 

615
00:31:30,080 --> 00:31:34,400
Because Expert A has specialized
in Python, 100% of the tokens in

616
00:31:34,400 --> 00:31:36,600
micro batch one are routed to 
Expert A. 

617
00:31:36,960 --> 00:31:39,600
Oh no. 
Yes, during the processing of 

618
00:31:39,600 --> 00:31:43,600
that specific micro batch, the 
single GPU holding expert A does

619
00:31:43,600 --> 00:31:47,920
100% of the work. 
The other 63 GPU sit completely 

620
00:31:47,920 --> 00:31:50,000
idle, waiting for expert A to 
finish. 

621
00:31:50,280 --> 00:31:53,160
So even though the global batch 
will be perfectly balanced by 

622
00:31:53,160 --> 00:31:56,480
the end of the day, at a 
microsecond to microsecond 

623
00:31:56,480 --> 00:31:59,360
hardware level you have 
catastrophic imbalance. 

624
00:31:59,400 --> 00:32:02,960
The cluster grinds to a halt. 
You're literally trapped. 

625
00:32:03,320 --> 00:32:05,760
You either ruin the models 
intelligence by forcing micro 

626
00:32:05,760 --> 00:32:09,280
batch balance or you ruin the 
hardware efficiency by allowing 

627
00:32:09,280 --> 00:32:13,200
global batch specialization. 
And This is why training MO ES 

628
00:32:13,200 --> 00:32:17,840
is considered a dark art. 
You are constantly tuning the 

629
00:32:17,840 --> 00:32:21,480
EMA, the bias scalers, the 
routing algorithms, trying to 

630
00:32:21,480 --> 00:32:25,800
find the exact scope that allows
just enough specialization to 

631
00:32:25,800 --> 00:32:29,840
make the model brilliant, but 
just enough micro level balance 

632
00:32:29,840 --> 00:32:32,040
to keep the massive GPU cluster 
fed. 

633
00:32:32,720 --> 00:32:35,640
OK. 
We've routed our tokens, we've 

634
00:32:35,640 --> 00:32:38,080
balanced the traffic so the data
center doesn't melt. 

635
00:32:38,080 --> 00:32:41,680
But what exactly are these 
tokens being routed to? 

636
00:32:42,160 --> 00:32:44,560
We need to look at the physical 
architecture of the experts 

637
00:32:44,560 --> 00:32:47,400
themselves. 
The granularity, the latent 

638
00:32:47,400 --> 00:32:51,000
projections, and the wiring. 
When we talk about an expert in 

639
00:32:51,000 --> 00:32:53,720
these architectures, we are 
almost always talking about a 

640
00:32:53,720 --> 00:32:57,880
feed forward network or FFN. 
In a dense transformer, the 

641
00:32:57,880 --> 00:33:01,080
attention layer mixes 
information between tokens, and 

642
00:33:01,080 --> 00:33:05,560
then the FFN is a massive wide 
layer that processes each token 

643
00:33:05,560 --> 00:33:07,280
individually to extract 
features. 

644
00:33:07,960 --> 00:33:11,920
In an Moe, we take the compute 
budget of that massive, dense 

645
00:33:11,920 --> 00:33:13,960
FFN and slice it up into 
experts. 

646
00:33:14,160 --> 00:33:16,640
This brings us to the concept of
granularity. 

647
00:33:17,040 --> 00:33:19,360
Right. 
If I have a compute budget for a

648
00:33:19,360 --> 00:33:21,520
massive dense layer, I have 
choices. 

649
00:33:22,080 --> 00:33:25,800
I could replace it with eight 
massive experts and route each 

650
00:33:25,800 --> 00:33:29,200
token to two of them, or I could
slice it much finer. 

651
00:33:29,680 --> 00:33:33,400
You could create 64 smaller 
experts and route tokens to 8 of

652
00:33:33,400 --> 00:33:35,320
them. 
Mathematically, the total number

653
00:33:35,320 --> 00:33:38,320
of active parameters and the 
compute flops per token stays 

654
00:33:38,320 --> 00:33:41,160
absolutely identical. 
The authors note that finer 

655
00:33:41,160 --> 00:33:44,840
granularity, more smaller 
experts actually leads to better

656
00:33:44,840 --> 00:33:48,880
learning and lower perplexity. 
So why not just make 1000 tiny 

657
00:33:48,880 --> 00:33:51,160
experts? 
Because of the strict physics of

658
00:33:51,160 --> 00:33:54,680
how a GPU operates, GPU's 
achieve their incredible speeds 

659
00:33:54,680 --> 00:33:58,880
by doing massive block matrix 
multiplications known as gems. 

660
00:33:59,360 --> 00:34:02,760
They use specialized hardware 
called tensor cores to do this. 

661
00:34:03,160 --> 00:34:06,880
Tensor cores require matrices to
be as a certain minimum size to 

662
00:34:06,880 --> 00:34:08,600
fully saturate their compute 
pipelines. 

663
00:34:08,920 --> 00:34:12,520
If you slice your experts too 
small, the matrices become tiny.

664
00:34:13,000 --> 00:34:16,320
The GPU waste cycle spinning up 
the operation processes the tiny

665
00:34:16,320 --> 00:34:19,600
math instantly and spins down. 
You lose compute efficiency. 

666
00:34:19,800 --> 00:34:22,440
It's like using a massive 
freight train to deliver a 

667
00:34:22,440 --> 00:34:24,639
single pizza. 
The overhead of starting the 

668
00:34:24,639 --> 00:34:26,960
train ruins the efficiency of 
the delivery. 

669
00:34:27,199 --> 00:34:28,960
Exactly. 
And the second problem with 

670
00:34:28,960 --> 00:34:31,440
extreme granularity is the 
network overhead. 

671
00:34:31,880 --> 00:34:34,199
If a token routes to two 
experts, you are sending 2 

672
00:34:34,199 --> 00:34:37,159
copies of that token's massive 
hidden state vector across the 

673
00:34:37,159 --> 00:34:40,760
network fabric. 
If you route to 16 tiny experts,

674
00:34:41,159 --> 00:34:45,239
you are duplicating and sending 
16 copies of that massive vector

675
00:34:45,520 --> 00:34:48,520
over the all to all network. 
The bandwidth requirement 

676
00:34:48,520 --> 00:34:50,639
absolutely explodes and chokes 
the system. 

677
00:34:51,120 --> 00:34:53,440
But the handbook mentions a 
brilliant architectural fix to 

678
00:34:53,440 --> 00:34:55,440
this network overhead called 
Latent Moe. 

679
00:34:56,000 --> 00:34:57,760
How does compressing the token 
fix this? 

680
00:34:58,000 --> 00:35:01,640
Latent Moe is a very clever 
mathematical trick. 

681
00:35:02,720 --> 00:35:05,760
A standard tokens hidden state 
vector is huge. 

682
00:35:06,640 --> 00:35:11,120
Let's call it dimension D, which
might be 4096 numbers long. 

683
00:35:12,160 --> 00:35:15,960
Sending that full 4096 dimension
vector across the network 8 

684
00:35:15,960 --> 00:35:18,240
times is terrible. 
Right. 

685
00:35:19,080 --> 00:35:22,680
In latent Moe, before the token 
is dispatched over the network, 

686
00:35:23,000 --> 00:35:26,400
it is multiplied by a projection
matrix that compresses it down 

687
00:35:26,400 --> 00:35:30,480
to a tiny latent size. 
Let's call it dimension L, maybe

688
00:35:30,480 --> 00:35:33,800
just 256 numbers long. 
So you drastically shrink the 

689
00:35:33,800 --> 00:35:35,320
data footprint. 
Exactly. 

690
00:35:35,880 --> 00:35:38,480
You send that tiny compressed 
vector across the network. 

691
00:35:39,800 --> 00:35:42,360
The expert, which is also 
proportionally smaller, 

692
00:35:42,520 --> 00:35:45,160
processes it. 
The expert sends the tiny vector

693
00:35:45,160 --> 00:35:48,000
back across the network, and 
then another projection matrix 

694
00:35:48,120 --> 00:35:51,680
scales it back up to the full 
dimension D so it can continue 

695
00:35:51,680 --> 00:35:54,080
through the model. 
It's literally like zipping a 

696
00:35:54,080 --> 00:35:58,040
massive file before you e-mail 
it, the expert unzips it, edits 

697
00:35:58,040 --> 00:36:01,480
the file, rezips it, emails it 
back, and you unzip it locally. 

698
00:36:01,680 --> 00:36:04,160
You drastically reduce the 
bandwidth required on the 

699
00:36:04,160 --> 00:36:06,080
cables. 
That compression allows you to 

700
00:36:06,080 --> 00:36:09,760
use a much higher granularity, 
more experts, better routing 

701
00:36:10,240 --> 00:36:12,640
without hitting the all to all 
network bottleneck. 

702
00:36:12,880 --> 00:36:15,360
Now here is a concept that broke
my brain a little bit when 

703
00:36:15,360 --> 00:36:19,600
reading the handbook. 
Shared experts DeepSeek-V3 and 

704
00:36:19,600 --> 00:36:23,760
Kimi K3 use this architecture. 
The idea is that one expert sits

705
00:36:24,040 --> 00:36:27,120
outside the router and it 
processes every single token 

706
00:36:27,120 --> 00:36:28,760
regardless of what the router 
says. 

707
00:36:28,800 --> 00:36:33,120
Yes, the shared expert acts as a
foundational knowledge base. 

708
00:36:33,600 --> 00:36:37,040
It learns the common grammar, 
the basic syntax, the structural

709
00:36:37,040 --> 00:36:39,880
connective tissue of the 
language that every single token

710
00:36:39,880 --> 00:36:42,120
needs. 
But hold on, if we introduce a 

711
00:36:42,120 --> 00:36:45,520
shared expert that processes 
every single token, haven't we 

712
00:36:45,520 --> 00:36:49,280
just reinvented the dense model?
Aren't we undoing the entire 

713
00:36:49,280 --> 00:36:52,800
point of the Moe which was to 
achieve sparsity and not compute

714
00:36:52,800 --> 00:36:56,040
every parameter for every token?
It's a great observation, but 

715
00:36:56,040 --> 00:36:58,480
you have to look at how they 
allocate the compute budget. 

716
00:36:59,160 --> 00:37:02,040
The shared expert is not the 
size of the whole original dense

717
00:37:02,040 --> 00:37:04,200
model. 
It is relatively small. 

718
00:37:04,360 --> 00:37:06,240
OK, how does that work in 
practice? 

719
00:37:06,960 --> 00:37:08,360
Think of it like a medical 
hospital. 

720
00:37:08,800 --> 00:37:11,600
You have a team of highly 
specialized doctors, a brain 

721
00:37:11,600 --> 00:37:14,080
surgeon, a cardiologist and 
oncologist. 

722
00:37:14,800 --> 00:37:18,080
These are your routed experts. 
You don't want the world class 

723
00:37:18,080 --> 00:37:21,040
brain surgeon wasting their 
brain power and time taking a 

724
00:37:21,040 --> 00:37:24,280
patient's blood pressure, asking
for their basic medical history,

725
00:37:24,280 --> 00:37:25,520
or checking their height and 
weight. 

726
00:37:25,800 --> 00:37:27,200
Right. 
You have a General practitioner 

727
00:37:27,200 --> 00:37:29,520
or a triage nurse. 
Do that for every single patient

728
00:37:29,520 --> 00:37:31,000
first. 
Exactly. 

729
00:37:31,560 --> 00:37:34,640
The shared expert is the triage 
nurse because it handles the 

730
00:37:34,640 --> 00:37:36,840
basic syntax and common 
knowledge for every single 

731
00:37:36,840 --> 00:37:39,120
token. 
The routed experts are 

732
00:37:39,120 --> 00:37:41,880
completely freed up from having 
to relearn basic grammar. 

733
00:37:42,280 --> 00:37:44,560
They don't have to waste their 
parameter capacity learning what

734
00:37:44,560 --> 00:37:46,920
a period is or how a noun 
connects to a verb. 

735
00:37:47,240 --> 00:37:50,200
They can dedicate 100% of the 
parameters to becoming hyper 

736
00:37:50,200 --> 00:37:53,840
specialized in quantum physics 
or Python coding or complex 

737
00:37:53,840 --> 00:37:55,960
logic. 
By adding a small dense 

738
00:37:55,960 --> 00:37:59,040
component, you make the sparse 
components vastly more 

739
00:37:59,040 --> 00:38:00,720
efficient. 
That makes total sense. 

740
00:38:01,000 --> 00:38:03,600
Now what about the layout of 
these blocks? 

741
00:38:03,720 --> 00:38:08,240
Does every single layer in a 100
layer transformer need to be an 

742
00:38:08,240 --> 00:38:10,360
Moe layer? 
Not necessarily. 

743
00:38:10,920 --> 00:38:14,480
Every Moe layer introduces an 
all to all network bottleneck. 

744
00:38:15,000 --> 00:38:18,640
To mitigate this, some models 
like Llama 4 Maverick alternate 

745
00:38:18,640 --> 00:38:20,600
their layers. 
They put a standard dense 

746
00:38:20,600 --> 00:38:24,480
attention and dense FFM block, 
followed by an Moe block, 

747
00:38:24,560 --> 00:38:26,160
followed by a dense block and so
on. 

748
00:38:26,760 --> 00:38:30,200
By doing that, you literally cut
the all to all network traffic 

749
00:38:30,200 --> 00:38:33,440
of the entire model in half 
while still maintaining massive 

750
00:38:33,440 --> 00:38:36,240
sparse capacity. 
Yes, and the handbook also 

751
00:38:36,240 --> 00:38:39,000
highlights an optimization from 
Megatron called Shortcut 

752
00:38:39,000 --> 00:38:41,320
Connections. 
This is a pure systems 

753
00:38:41,320 --> 00:38:42,600
engineering trick. 
What does that do? 

754
00:38:43,080 --> 00:38:46,200
In a standard layer, the model 
does the attention math, 

755
00:38:46,440 --> 00:38:49,840
finishes it, and then sends the 
tokens to the Moe. 

756
00:38:50,400 --> 00:38:53,040
Megatron overlaps them. 
While the attention head is 

757
00:38:53,040 --> 00:38:56,040
crunching the massive matrix 
math on the GPU's tensor cores, 

758
00:38:56,440 --> 00:38:58,600
the networking card is 
simultaneously sending the 

759
00:38:58,600 --> 00:39:01,680
tokens out to the experts. 
You hide the latency of the 

760
00:39:01,680 --> 00:39:04,360
network transfer behind the 
latency of the mathematical 

761
00:39:04,360 --> 00:39:06,480
computation. 
Which is brilliant because the 

762
00:39:06,480 --> 00:39:09,640
network card and the tensor 
cores are different physical 

763
00:39:09,760 --> 00:39:12,440
pieces of silicon on the board. 
You keep them both busy at the 

764
00:39:12,440 --> 00:39:15,160
same time. 
OK, we have the architecture 

765
00:39:15,160 --> 00:39:17,360
built. 
The network is wired, the router

766
00:39:17,360 --> 00:39:20,280
is Z loss stabilized. 
Now we hit run. 

767
00:39:20,920 --> 00:39:23,400
And this is where training 
introduces terrifying new ways 

768
00:39:23,400 --> 00:39:26,480
for a model to crash. 
Yeah, training an Moe from 

769
00:39:26,480 --> 00:39:29,360
scratch from random 
initialization is notoriously 

770
00:39:29,360 --> 00:39:32,760
difficult, but the handbook 
details a massive shortcut that 

771
00:39:32,760 --> 00:39:34,520
the industry uses called 
upcycling. 

772
00:39:34,640 --> 00:39:38,120
Right, you don't actually have 
to start from random noise. 

773
00:39:38,440 --> 00:39:41,600
You can take an already trained,
highly intelligent dense model 

774
00:39:41,600 --> 00:39:46,400
like a Llama 3 or a Mistral and 
physically transform it into an 

775
00:39:46,400 --> 00:39:49,360
Moe. 
How do you slice a dense model 

776
00:39:49,360 --> 00:39:51,920
into experts? 
Let's say your dense model has a

777
00:39:51,920 --> 00:39:56,080
massive FFN that is 8192 neurons
wide. 

778
00:39:56,680 --> 00:39:59,960
You mathematically slice that 
weight matrix into 8 smaller 

779
00:39:59,960 --> 00:40:05,720
slices, each 1024 neurons wide. 
Then you literally copy and 

780
00:40:05,720 --> 00:40:10,440
paste those 8 slices 8 times 
over, giving you 64 total 

781
00:40:10,440 --> 00:40:13,720
experts. 
But if I just copy them, don't I

782
00:40:13,720 --> 00:40:16,160
just have 64 completely 
identical experts? 

783
00:40:16,760 --> 00:40:20,360
If a token routes to expert A or
expert B, it gets the exact same

784
00:40:20,360 --> 00:40:22,800
mathematical answer. 
It's step zero. 

785
00:40:22,960 --> 00:40:27,600
Yes, every expert is a clone, 
but you add a tiny bit of random

786
00:40:27,600 --> 00:40:30,760
noise to the router's weights. 
It's training begins. 

787
00:40:30,920 --> 00:40:33,960
This noise causes slightly 
different tokens to go to 

788
00:40:33,960 --> 00:40:36,280
slightly different copies of the
experts. 

789
00:40:36,840 --> 00:40:40,040
Because the data they see starts
to diverge, the gradients they 

790
00:40:40,040 --> 00:40:42,400
receive during back propagation 
start to diverge. 

791
00:40:43,040 --> 00:40:46,280
Over thousands of training 
steps, those identical clones 

792
00:40:46,280 --> 00:40:49,120
slowly drift apart. 
They adjust their weights to 

793
00:40:49,120 --> 00:40:51,480
better serve the specific tokens
they are receiving. 

794
00:40:52,200 --> 00:40:55,840
The Moe starts out smart, 
inheriting all the dense 

795
00:40:55,840 --> 00:40:58,920
knowledge, and then seamlessly 
drifts into hyper 

796
00:40:58,920 --> 00:41:01,640
specialization. 
It's like cloning a brilliant 

797
00:41:01,640 --> 00:41:05,160
scientist 64 times, locking them
all in different specialized 

798
00:41:05,160 --> 00:41:09,080
libraries, and a year later one 
has become an expert in biology 

799
00:41:09,080 --> 00:41:11,320
and the other in astrophysics. 
Exactly. 

800
00:41:11,720 --> 00:41:14,720
But as they drift, you have to 
be very careful about how you 

801
00:41:14,720 --> 00:41:17,520
update their weights. 
This brings us to the choice of 

802
00:41:17,520 --> 00:41:21,880
optimizer Adam West versus Muon.
Adam West is the industry 

803
00:41:21,880 --> 00:41:25,840
standard optimizer for almost 
every neural network, but it is 

804
00:41:25,840 --> 00:41:28,680
incredibly dangerous for MO ES. 
Why? 

805
00:41:28,960 --> 00:41:31,160
How does Adam West actually 
update a weight? 

806
00:41:31,640 --> 00:41:34,200
Adam West scales its weight 
updates based on a moving 

807
00:41:34,200 --> 00:41:37,600
average of the gradient history.
It acts like a teacher looking 

808
00:41:37,600 --> 00:41:41,120
at a student's past grades. 
If a parameter consistently gets

809
00:41:41,120 --> 00:41:45,000
steep useful gradients, Adam W 
increases the learning rate for 

810
00:41:45,000 --> 00:41:47,680
that parameter. 
But in an Moe, the routing is 

811
00:41:47,680 --> 00:41:49,520
dynamic. 
If the router decides it doesn't

812
00:41:49,520 --> 00:41:52,520
like a particular expert, that 
expert might go hundreds of 

813
00:41:52,520 --> 00:41:54,840
training steps receiving almost 
0 tokens. 

814
00:41:55,120 --> 00:41:57,560
So it's gradients basically 
dropped to 0 for a long time. 

815
00:41:57,960 --> 00:42:01,280
Yes, and because Adam W relies 
on that historical moving 

816
00:42:01,280 --> 00:42:04,280
average, the optimizer 
essentially puts that expert to 

817
00:42:04,280 --> 00:42:06,760
sleep. 
It looks at the history, sees 0 

818
00:42:06,760 --> 00:42:09,840
gradients and shrinks the update
size to microscopic noise. 

819
00:42:10,240 --> 00:42:12,520
Even if the router leader 
accidentally sends a batch of 

820
00:42:12,520 --> 00:42:15,640
tokens to that expert, the 
optimizer won't move the weights

821
00:42:15,640 --> 00:42:19,240
enough to learn anything useful.
The expert effectively dies and 

822
00:42:19,240 --> 00:42:22,400
becomes dead weight on the GPU. 
Neural signal check. 

823
00:42:22,880 --> 00:42:25,320
Here's why this development 
actually matters at a technical 

824
00:42:25,320 --> 00:42:27,960
level. 
This is exactly why Frontier 

825
00:42:27,960 --> 00:42:31,240
Labs are experimenting with 
newer optimizers like Muon for 

826
00:42:31,240 --> 00:42:34,400
the expert layers. 
Yeah, Muon fundamentally changes

827
00:42:34,400 --> 00:42:37,440
the mathematics of the update. 
Instead of looking at a 

828
00:42:37,440 --> 00:42:40,600
historical average, Muon 
orthogonalizes the update 

829
00:42:40,600 --> 00:42:42,840
matrix. 
It scales the update based 

830
00:42:42,840 --> 00:42:45,400
purely on the physical shape of 
the matrix itself. 

831
00:42:45,400 --> 00:42:48,640
It completely ignores how big or
small the historical gradient 

832
00:42:48,640 --> 00:42:51,600
is. 
By doing this, it artificially 

833
00:42:51,600 --> 00:42:55,520
performs CPR on dying experts. 
Even if an expert hasn't 

834
00:42:55,520 --> 00:42:59,640
received a token in 1000 steps, 
the moment it gets 1 Muon 

835
00:42:59,640 --> 00:43:02,920
mathematically forces the 
weights to update significantly.

836
00:43:03,600 --> 00:43:05,960
It decouples the learning rate 
from the router's popularity 

837
00:43:05,960 --> 00:43:09,000
contest, ensuring all the 
expensive silicon on the GPU is 

838
00:43:09,000 --> 00:43:11,400
actually learning. 
Are there other stability 

839
00:43:11,400 --> 00:43:13,680
guards? 
What happens if an expert just 

840
00:43:13,680 --> 00:43:16,560
goes rogue during training? 
The handbook details what they 

841
00:43:16,560 --> 00:43:20,440
call catastrophic failures. 
Sometimes a single expert will 

842
00:43:20,440 --> 00:43:23,120
encounter a weird batch of data 
and its weights will spike. 

843
00:43:23,320 --> 00:43:26,360
It starts producing massive 
exploding output values, while 

844
00:43:26,360 --> 00:43:28,040
the rest of the model looks 
perfectly fine. 

845
00:43:28,320 --> 00:43:31,120
Because of the residual 
connections, that exploding 

846
00:43:31,120 --> 00:43:34,400
value infects the entire forward
pass and corrupts the model. 

847
00:43:35,440 --> 00:43:37,760
To prevent this you have to 
implement step by step 

848
00:43:37,760 --> 00:43:39,400
mitigations. 
Like what? 

849
00:43:39,960 --> 00:43:44,160
You rigorously cap the gradient 
norms so no single update can be

850
00:43:44,160 --> 00:43:47,600
too large. 
You physically clamp the Swiglu 

851
00:43:47,600 --> 00:43:50,920
activation functions inside the 
experts so their mathematical 

852
00:43:50,920 --> 00:43:53,320
outputs literally cannot exceed 
a certain bound. 

853
00:43:53,640 --> 00:43:56,600
And as we mentioned with the 
router, you aggressively keep 

854
00:43:56,600 --> 00:44:00,640
the critical attention outputs 
in FP32 precision to prevent 

855
00:44:00,640 --> 00:44:02,080
compounding floating point 
errors. 

856
00:44:02,480 --> 00:44:05,400
It sounds like you are wrapping 
the entire multi $1,000,000 

857
00:44:05,400 --> 00:44:08,320
model in mathematical bubble 
wrap just to keep it from 

858
00:44:08,320 --> 00:44:10,720
tearing itself apart. 
That is exactly what you were 

859
00:44:10,720 --> 00:44:12,840
doing. 
MO E training is an exercise in 

860
00:44:12,840 --> 00:44:15,680
writing a razor's edge between 
chaos and gridlock. 

861
00:44:16,360 --> 00:44:19,520
Which leads us to the system's 
efficiency of the cluster 

862
00:44:19,520 --> 00:44:22,320
hardware. 
Even if the math is perfectly 

863
00:44:22,320 --> 00:44:26,040
stable and wrapped in bubble 
wrap, the sheer physics of 

864
00:44:26,040 --> 00:44:29,720
moving terabytes of data across 
a cluster requires strict 

865
00:44:29,840 --> 00:44:32,560
traffic control. 
Let's talk about group limited 

866
00:44:32,560 --> 00:44:35,160
routing. 
As we discussed, a single token 

867
00:44:35,160 --> 00:44:38,280
might want to pick eight 
different experts in a massive 

868
00:44:38,280 --> 00:44:42,280
cluster of 1024 GPU's. 
Those 8 experts might physically

869
00:44:42,280 --> 00:44:44,840
live on 8 completely different 
physical nodes. 

870
00:44:45,280 --> 00:44:47,960
That means one token has to be 
copied and blasted out to 8 

871
00:44:47,960 --> 00:44:51,400
different locations across the 
highest latency part of the 

872
00:44:51,400 --> 00:44:55,600
network, the Internode fabric. 
The dreaded cross rack traffic. 

873
00:44:55,840 --> 00:44:58,160
Exactly. 
DeepSeek-V3 came up with a 

874
00:44:58,160 --> 00:45:01,920
brilliant, albeit restrictive, 
rule called Group Limited 

875
00:45:01,920 --> 00:45:04,360
Routing. 
They mathematically force the 

876
00:45:04,360 --> 00:45:07,680
router's decision making process
so that a token is only allowed 

877
00:45:07,680 --> 00:45:11,360
to select experts that live on a
maximum of four physical nodes. 

878
00:45:11,600 --> 00:45:14,880
So even if the absolute best 
expert for a token lives on node

879
00:45:14,880 --> 00:45:18,520
5, the router evaluates its 
current path and says, sorry, 

880
00:45:18,600 --> 00:45:20,800
you've already visited experts 
on 4 nodes. 

881
00:45:21,080 --> 00:45:23,840
You have to pick a suboptimal 
expert that happens to live on 

882
00:45:23,840 --> 00:45:25,640
one of the nodes you are already
going to. 

883
00:45:25,800 --> 00:45:28,880
Yes, it is topological aware 
routing. 

884
00:45:29,280 --> 00:45:32,120
It trades a tiny bit of 
theoretical model intelligence 

885
00:45:32,600 --> 00:45:35,440
for a massive reduction in cross
node network traffic. 

886
00:45:35,960 --> 00:45:39,240
It mathematically caps the fan 
out of the tokens, preventing 

887
00:45:39,240 --> 00:45:41,000
the network switches from being 
overwhelmed. 

888
00:45:41,600 --> 00:45:45,440
That brings up another crazy 
hardware limit, capacity factors

889
00:45:45,440 --> 00:45:48,000
and token dropping. 
What happens when an expert 

890
00:45:48,000 --> 00:45:50,760
physically runs out of memory 
buffer on the GPU? 

891
00:45:51,040 --> 00:45:53,880
Let's say a massive spike of 
tokens all route to the same GPU

892
00:45:53,880 --> 00:45:56,040
despite our best load balancing 
efforts. 

893
00:45:56,240 --> 00:45:59,160
When a buffer fills up, you 
basically have three engineering

894
00:45:59,160 --> 00:46:00,760
choices. 
Choice one. 

895
00:46:01,240 --> 00:46:03,800
You let the GPU try to 
dynamically allocate more 

896
00:46:03,800 --> 00:46:07,480
memory, it runs out of VRAM and 
the entire cluster crashes with 

897
00:46:07,480 --> 00:46:10,520
an OOM and out of memory error. 
That's a bad choice. 

898
00:46:11,040 --> 00:46:14,640
Choice two, You use a dropless 
architecture. 

899
00:46:15,000 --> 00:46:18,520
You dynamically pause the other 
GPU's, resize the buffers across

900
00:46:18,520 --> 00:46:21,760
the network, and wait for the 
overloaded GPU to chew through 

901
00:46:21,760 --> 00:46:25,400
the massive queue of tokens. 
This prevents crashes, but it 

902
00:46:25,400 --> 00:46:28,280
destroys your throughput. 
Your expensive cluster is 

903
00:46:28,280 --> 00:46:29,720
spending most of its time 
paused. 

904
00:46:30,360 --> 00:46:34,040
And choice 3. 
Choice 3 is you literally set a 

905
00:46:34,040 --> 00:46:36,920
hard capacity factor. 
You define a rule. 

906
00:46:37,200 --> 00:46:41,200
This experts buffer is 1.5 times
the average expected load. 

907
00:46:41,680 --> 00:46:44,280
If tokens keep pouring in and 
the buffer fills up, you just 

908
00:46:44,360 --> 00:46:46,640
drop the tokens. 
Wait, drop them. 

909
00:46:46,920 --> 00:46:49,720
You delete them from the Moy 
layer's computation entirely. 

910
00:46:50,360 --> 00:46:53,640
Real world models use this. 
Huawei's Pangu model, for 

911
00:46:53,640 --> 00:46:57,800
example, was observed dropping 6
to 8% of its tokens during heavy

912
00:46:57,800 --> 00:47:00,240
traffic. 
OK, I have to push back here. 

913
00:47:00,440 --> 00:47:02,760
Dropping token sounds absolutely
insane. 

914
00:47:02,960 --> 00:47:07,080
If I ask the AIA highly specific
coding question and the Python 

915
00:47:07,080 --> 00:47:09,920
expert happens to be full 
because of a queue, does the 

916
00:47:09,920 --> 00:47:13,360
model just randomly delete my 
semi colon or my bracket from 

917
00:47:13,360 --> 00:47:15,240
its brain? 
How can it possibly generate 

918
00:47:15,240 --> 00:47:18,400
working code if it's just 
throwing away 8% of my prompt? 

919
00:47:18,720 --> 00:47:22,480
I know it is a shocking concept,
but to understand why it works 

920
00:47:22,600 --> 00:47:24,840
you have to remember the 
fundamental architecture of a 

921
00:47:24,840 --> 00:47:28,080
transformer. 
The Moe layer replaces the feed 

922
00:47:28,080 --> 00:47:32,960
forward network, but running 
parallel to the Moe layer is the

923
00:47:32,960 --> 00:47:35,160
residual stream. 
The skip connections. 

924
00:47:35,520 --> 00:47:39,920
Exactly, the residual stream is 
like a massive multi lane 

925
00:47:39,920 --> 00:47:42,720
highway running straight through
the center of the model from the

926
00:47:42,720 --> 00:47:44,800
first layer all the way to the 
last. 

927
00:47:45,360 --> 00:47:47,680
The Moe block is just an off 
ramp. 

928
00:47:48,440 --> 00:47:51,080
The token leaves the highway, 
gets processed by the expert, 

929
00:47:51,080 --> 00:47:54,120
and merges back onto the 
highway, adding its new insights

930
00:47:54,120 --> 00:47:56,080
to the stream. 
Oh I see. 

931
00:47:56,560 --> 00:47:59,240
If the off ramp to the expert is
closed because the buffer is 

932
00:47:59,240 --> 00:48:02,680
full, the token doesn't 
disappear into the void, it just

933
00:48:02,880 --> 00:48:05,920
stays on the highway. 
Precisely, it's mathematical 

934
00:48:05,920 --> 00:48:09,280
vector representation is passed 
completely unchanged to the next

935
00:48:09,280 --> 00:48:11,240
layer. 
Furthermore, the attention 

936
00:48:11,240 --> 00:48:14,320
mechanism, which mixes 
information and contacts between

937
00:48:14,360 --> 00:48:17,840
all the tokens in the sequence, 
still processes every single 

938
00:48:17,840 --> 00:48:20,880
token perfectly. 
So the sequence context is 

939
00:48:20,880 --> 00:48:24,480
preserved even if the specific 
Moe reasoning step is skipped 

940
00:48:24,480 --> 00:48:27,600
for that one specific token at 
that one specific layer. 

941
00:48:28,080 --> 00:48:31,640
That is incredibly resilient. 
The token survives, it just 

942
00:48:31,640 --> 00:48:35,080
didn't get that specific layers 
expert opinion added to its 

943
00:48:35,080 --> 00:48:37,240
vector. 
It is Transformers are 

944
00:48:37,240 --> 00:48:41,640
remarkably robust to noisy or 
dropped internal features and to

945
00:48:41,640 --> 00:48:44,640
further optimize this hardware 
efficiency, while we 

946
00:48:44,640 --> 00:48:48,400
meticulously keep the router in 
FP32 to avoid precision 

947
00:48:48,400 --> 00:48:52,920
collapse, the actual expert GEM 
calculations, the massive 

948
00:48:52,920 --> 00:48:55,960
matrices doing the heavy 
reasoning are aggressively 

949
00:48:55,960 --> 00:48:59,720
pushed down to FP8 precision. 
Taking advantage of the Hopper 

950
00:48:59,720 --> 00:49:01,720
and Blackwell tensor cores. 
Exactly. 

951
00:49:02,400 --> 00:49:06,080
Moving from BF16 to FP8 halves 
the memory footprint of the mass

952
00:49:06,080 --> 00:49:08,680
of experts, and it double s the 
mathematical throughput on 

953
00:49:08,680 --> 00:49:11,520
modern tensor cores. 
Because the experts are just 

954
00:49:11,520 --> 00:49:13,880
doing dense feature 
transformations, they are 

955
00:49:13,880 --> 00:49:17,440
surprisingly resilient to the 
lower precision, provided your 

956
00:49:17,440 --> 00:49:20,120
router remains accurate enough 
to send the tokens to the right 

957
00:49:20,120 --> 00:49:22,120
place. 
It's all about putting the high 

958
00:49:22,120 --> 00:49:25,400
precision exactly where the math
is fragile, and ruthlessly 

959
00:49:25,400 --> 00:49:27,560
cutting the precision where the 
math is robust. 

960
00:49:28,000 --> 00:49:32,000
OK, we have trained this beast. 
The loss curves look beautiful, 

961
00:49:32,000 --> 00:49:35,320
but training is temporary, 
serving is forever. 

962
00:49:35,520 --> 00:49:38,000
This brings us to the post 
training reality. 

963
00:49:38,840 --> 00:49:42,200
How we run this model for 
millions of active users changes

964
00:49:42,200 --> 00:49:43,880
the rules of the architecture 
entirely. 

965
00:49:44,000 --> 00:49:46,800
When you move to serving, your 
main goal is minimizing latency 

966
00:49:46,800 --> 00:49:49,040
and cost. 
The first thing engineers try to

967
00:49:49,040 --> 00:49:52,080
do to save compute is serve a 
different K. 

968
00:49:52,520 --> 00:49:54,720
Right. 
So if I train the model to pick 

969
00:49:54,720 --> 00:49:58,840
the top 8 experts for every 
token, maybe during inference to

970
00:49:58,840 --> 00:50:01,560
save money on my cloud bill, I 
tell the router to only evaluate

971
00:50:01,560 --> 00:50:05,640
the top six experts. 
That's immediately 25% less 

972
00:50:05,640 --> 00:50:08,040
compute. 
It is, but if you remember from 

973
00:50:08,040 --> 00:50:10,880
our earlier discussion, we 
applied renormalization to the 

974
00:50:10,880 --> 00:50:13,640
weights. 
If you train a model at top 8, 

975
00:50:13,880 --> 00:50:17,080
the router learns to divide the 
probability mass among eight 

976
00:50:17,080 --> 00:50:20,120
different experts. 
If you suddenly only serve 6 

977
00:50:20,120 --> 00:50:24,520
experts, and you renormalize 
those six to some to one point O

978
00:50:25,120 --> 00:50:27,760
the remaining 6 experts suddenly
have mathematically larger 

979
00:50:27,760 --> 00:50:29,640
weights than they ever 
experienced during training. 

980
00:50:29,920 --> 00:50:32,840
Because the denominator of the 
renormalization equation got 

981
00:50:32,840 --> 00:50:36,240
smaller, the six experts are 
absorbing the probability mass 

982
00:50:36,240 --> 00:50:38,440
that used to belong to experts 7
and 8. 

983
00:50:38,560 --> 00:50:40,400
Exactly. 
And because the weights are 

984
00:50:40,400 --> 00:50:44,360
artificially larger, the output 
vector of the Moe layer becomes 

985
00:50:44,360 --> 00:50:46,760
larger. 
This causes a massive 

986
00:50:46,760 --> 00:50:48,800
distribution shift in the 
activation values. 

987
00:50:49,200 --> 00:50:52,360
The handbook notes that when 
engineers tried this on a QNMOE 

988
00:50:52,360 --> 00:50:55,240
model without careful 
mathematical adjustments, the 

989
00:50:55,240 --> 00:50:58,480
perplexity, which is a measure 
of how confused the model is, 

990
00:50:58,920 --> 00:51:03,520
exploded by 356%. 
It completely broke the model's 

991
00:51:03,520 --> 00:51:05,480
ability to generate coherent 
text. 

992
00:51:05,720 --> 00:51:09,440
So you can't just casually drop 
experts at serving without 

993
00:51:09,760 --> 00:51:12,920
recalibrating the scales? 
What about the parallelism 

994
00:51:12,920 --> 00:51:14,640
itself? 
In training? 

995
00:51:14,920 --> 00:51:18,680
We are doing massive batches of 
documents, but it's serving a 

996
00:51:18,680 --> 00:51:20,920
user is chatting with it in real
time. 

997
00:51:21,240 --> 00:51:24,640
Serving as two distinct 
computational phases, prefill 

998
00:51:24,760 --> 00:51:27,240
and decoding. 
Prefill is when the model reads 

999
00:51:27,240 --> 00:51:30,360
your initial prompt. 
If you paste 1000 Word document 

1000
00:51:30,360 --> 00:51:32,960
into the chat, the model reads 
all 1000 words at once. 

1001
00:51:33,360 --> 00:51:36,320
This behaves a lot like training
because it processes a large 

1002
00:51:36,320 --> 00:51:40,400
batch of tokens simultaneously. 
It requires low expert 

1003
00:51:40,400 --> 00:51:44,800
parallelism because a single GPU
has plenty of tokens to keep all

1004
00:51:44,800 --> 00:51:48,480
of its experts completely busy. 
But decoding is different. 

1005
00:51:48,480 --> 00:51:51,600
Fundamentally different decoding
is the phase where the model 

1006
00:51:51,600 --> 00:51:55,120
generates its response one 
single token at a time. 

1007
00:51:55,800 --> 00:51:59,360
If you only have one token and 
it routes to one expert, the 

1008
00:51:59,360 --> 00:52:01,640
rest of the massive GPU is 
basically sitting idle. 

1009
00:52:02,080 --> 00:52:04,720
To get efficiency during 
decoding, you need massive 

1010
00:52:04,720 --> 00:52:07,440
expert parallelism. 
You have to spread the experts 

1011
00:52:07,440 --> 00:52:11,040
across many GPU's, and you have 
to batch thousands of different 

1012
00:52:11,040 --> 00:52:14,560
users decoding steps together to
create enough traffic to keep 

1013
00:52:14,560 --> 00:52:16,840
the hardware fed. 
The traffic patterns are so 

1014
00:52:16,840 --> 00:52:20,680
different that DeepSeek actually
provisions completely separate 

1015
00:52:20,680 --> 00:52:24,760
physical pools of GPU's. 
One pool is optimized and 

1016
00:52:24,760 --> 00:52:28,200
configured purely for prefill 
and another pool is optimized 

1017
00:52:28,360 --> 00:52:31,400
purely for decode. 
You are physically routing user 

1018
00:52:31,400 --> 00:52:34,360
traffic to different server 
racks depending on whether they 

1019
00:52:34,360 --> 00:52:37,880
are sending a prompt or waiting 
for a reply, and this leads into

1020
00:52:37,880 --> 00:52:40,840
the most extreme architectural 
shift mentioned in the handbook,

1021
00:52:41,240 --> 00:52:45,000
disaggregation. 
To segregation is the logical 

1022
00:52:45,000 --> 00:52:47,400
extreme of optimizing Moe 
serving. 

1023
00:52:48,080 --> 00:52:50,920
In a standard transformer, every
layer is interleaved. 

1024
00:52:51,240 --> 00:52:53,880
You have an attention block, 
then an FFN block, then 

1025
00:52:53,880 --> 00:52:56,920
attention, then FFN. 
But these two blocks have 

1026
00:52:56,920 --> 00:52:59,040
completely opposing hardware 
needs. 

1027
00:52:59,480 --> 00:53:02,800
Attention requires massive 
amounts of VRAM memory to store 

1028
00:53:02,800 --> 00:53:04,320
the KV cache. 
Right. 

1029
00:53:04,440 --> 00:53:08,320
The KV cache stores the key and 
value tensors for all the past 

1030
00:53:08,320 --> 00:53:11,160
tokens in the conversation, so 
the model remembers what was 

1031
00:53:11,160 --> 00:53:12,920
said. 
It's incredibly memory 

1032
00:53:12,920 --> 00:53:15,880
intensive, but requires very 
little actual math compute. 

1033
00:53:16,280 --> 00:53:18,880
And the MO we experts are the 
exact opposite. 

1034
00:53:19,200 --> 00:53:22,240
They require massive compute 
tensor cores to do their matrix 

1035
00:53:22,240 --> 00:53:25,120
math, but they hold zero 
conversation states, so they 

1036
00:53:25,120 --> 00:53:28,640
don't need a KV cache at all. 
They are compute bound while 

1037
00:53:28,640 --> 00:53:31,760
attention is memory bound. 
So if you put them on the same 

1038
00:53:31,760 --> 00:53:33,680
GPU, you are always 
compromising. 

1039
00:53:33,800 --> 00:53:37,040
Either you run out of memory for
the attention cache, or you 

1040
00:53:37,040 --> 00:53:38,880
waste compute cycles on the 
experts. 

1041
00:53:39,200 --> 00:53:42,120
Exactly. 
So modern serving frameworks 

1042
00:53:42,160 --> 00:53:45,840
like Mega Scale Infer literally 
disaggregate the architecture. 

1043
00:53:46,040 --> 00:53:48,800
They tear the model apart. 
They put the attention 

1044
00:53:48,800 --> 00:53:52,880
mechanisms on one set of servers
equipped with GPU's packed with 

1045
00:53:53,040 --> 00:53:56,440
high bandwidth memory, and they 
put the FFN experts on a 

1046
00:53:56,440 --> 00:53:59,560
completely separate set of 
servers equipped with GPU's 

1047
00:53:59,560 --> 00:54:01,680
packed with massive compute 
tensor cores. 

1048
00:54:02,000 --> 00:54:05,240
Wait, I need to visualize this. 
The physical layers of the model

1049
00:54:05,240 --> 00:54:08,640
are separated by network cables.
The attention server calculates 

1050
00:54:08,640 --> 00:54:12,240
the tokens context, then blasts 
the massive vector over the data

1051
00:54:12,240 --> 00:54:14,120
center network to the expert 
server. 

1052
00:54:14,640 --> 00:54:17,920
The expert server does the 
reasoning and blasts it back 

1053
00:54:17,920 --> 00:54:20,120
over the network to the 
attention server for the next. 

1054
00:54:20,120 --> 00:54:20,640
Layer. 
Yes. 

1055
00:54:21,360 --> 00:54:24,320
They pass micro batches of 
tokens back and forth across the

1056
00:54:24,320 --> 00:54:27,000
network fabric millions of times
a second. 

1057
00:54:27,320 --> 00:54:30,520
It allows you to tailor the 
physical hardware exactly to the

1058
00:54:30,520 --> 00:54:32,160
specific bottleneck of the 
algorithm. 

1059
00:54:32,160 --> 00:54:36,120
It is an engineering marvel. 
That is absolutely wild. 

1060
00:54:37,240 --> 00:54:40,880
Finally, the handbook touches on
a post training phase called RL 

1061
00:54:40,880 --> 00:54:43,280
Routing. 
This is reinforcement learning, 

1062
00:54:43,280 --> 00:54:47,880
specifically RLHF, which is how 
models are fine-tuned to stop 

1063
00:54:47,880 --> 00:54:51,320
acting like document predictors 
and start acting like helpful 

1064
00:54:51,320 --> 00:54:53,680
chat bots. 
But applying RL to an Moe 

1065
00:54:53,680 --> 00:54:55,880
introduces a bizarre ghost in 
the machine. 

1066
00:54:56,120 --> 00:54:59,600
In RLHF you typically have two 
systems running simultaneously. 

1067
00:55:00,080 --> 00:55:02,800
A rolled out engine that 
generates text based on a 

1068
00:55:02,800 --> 00:55:06,840
prompt, and a trainer that 
evaluates that generated text 

1069
00:55:07,120 --> 00:55:09,360
and calculates gradients to 
improve the model. 

1070
00:55:09,760 --> 00:55:12,680
In a large asynchronous system, 
the rollout engine might be 

1071
00:55:12,680 --> 00:55:15,600
using weights that are slightly 
older than the trainer's 

1072
00:55:15,600 --> 00:55:17,360
weights. 
Because the trainer is 

1073
00:55:17,600 --> 00:55:21,200
constantly calculating updates, 
but it takes time to sync those 

1074
00:55:21,200 --> 00:55:24,280
massive gigabytes of updates 
over to the generation servers. 

1075
00:55:24,400 --> 00:55:26,920
Exactly. 
Now in a dense model, this 

1076
00:55:26,920 --> 00:55:29,680
slight lag just means the 
probability distributions are 

1077
00:55:29,680 --> 00:55:31,800
slightly off. 
It's noisy, but it learns. 

1078
00:55:32,120 --> 00:55:35,360
But in an Moe it causes a 
physical divergent in the 

1079
00:55:35,360 --> 00:55:38,360
routing path. 
The rollout engine, using older 

1080
00:55:38,360 --> 00:55:41,680
weights might evaluate A token 
and it's router sends it to 

1081
00:55:41,680 --> 00:55:44,000
expert A. 
It generates a sentence. 

1082
00:55:44,560 --> 00:55:47,920
The trainer looks at that 
sentence, but using its slightly

1083
00:55:47,920 --> 00:55:51,160
newer weights, it's router 
calculates that the token should

1084
00:55:51,160 --> 00:55:52,840
have gone to expert B. 
Oh. 

1085
00:55:53,720 --> 00:55:56,400
So the trainer ends up 
calculating back propagation 

1086
00:55:56,400 --> 00:55:59,960
gradients for a physical path 
expert B that the token never 

1087
00:55:59,960 --> 00:56:01,480
actually took during the 
generation. 

1088
00:56:01,480 --> 00:56:05,120
Yes, the trainer is optimizing 
the wrong experts based on a 

1089
00:56:05,400 --> 00:56:08,720
hallucinated trajectory. 
It sounds like trying to steer a

1090
00:56:08,720 --> 00:56:11,480
race car while looking at a 
photograph of the road taken 

1091
00:56:11,480 --> 00:56:13,840
from 5 seconds ago. 
You are going to crash. 

1092
00:56:14,360 --> 00:56:16,400
How do they fix the RL routing 
drift? 

1093
00:56:16,960 --> 00:56:19,440
It's a severe problem that will 
cause RL training to 

1094
00:56:19,440 --> 00:56:22,360
mathematically collapse. 
The fixes detailed by the 

1095
00:56:22,360 --> 00:56:25,080
authors involve strictly 
enforcing consistency between 

1096
00:56:25,080 --> 00:56:27,280
the two systems. 
You have two choices. 

1097
00:56:28,160 --> 00:56:30,400
Choice one. 
You freeze the router matrix 

1098
00:56:30,400 --> 00:56:32,600
entirely During the async RL 
phase. 

1099
00:56:32,960 --> 00:56:36,120
The router weights cannot 
update, so the routing decisions

1100
00:56:36,120 --> 00:56:38,080
never diverge between the 
rollout and the trainer. 

1101
00:56:38,640 --> 00:56:41,120
But then the router can't learn 
from the reinforcement learning.

1102
00:56:41,920 --> 00:56:44,720
What's choice 2? 
Choice 2 is you force the 

1103
00:56:44,720 --> 00:56:48,120
trainer to physically replay the
exact routing decisions logged 

1104
00:56:48,120 --> 00:56:51,240
by the rollout engine. 
You pass a log file of the 

1105
00:56:51,240 --> 00:56:54,360
routing choices, and you 
explicitly override what the 

1106
00:56:54,360 --> 00:56:57,560
trainer's own router suggests, 
forcing it to calculate 

1107
00:56:57,560 --> 00:57:00,360
gradients for the exact path the
token actually took. 

1108
00:57:01,000 --> 00:57:03,400
You literally have to force the 
trainer to walk in the exact 

1109
00:57:03,400 --> 00:57:05,000
footsteps of the generator. 
Wow. 

1110
00:57:06,400 --> 00:57:08,720
We have covered an immense 
amount of ground today. 

1111
00:57:09,480 --> 00:57:12,360
We've traced the incredible 
chaotic journey of a token 

1112
00:57:12,720 --> 00:57:14,480
through a mixture of experts 
architecture. 

1113
00:57:14,760 --> 00:57:18,840
We watched it get mathematically
steered by an FP32 router using 

1114
00:57:18,840 --> 00:57:21,240
AZ loss to prevent precision 
collapse. 

1115
00:57:21,720 --> 00:57:25,440
We saw it fly across EFA network
fabric, avoiding the TCP socket 

1116
00:57:25,440 --> 00:57:27,120
trap. 
We saw it arrive at a 

1117
00:57:27,120 --> 00:57:30,240
dynamically balanced expert 
surviving group, limited caps 

1118
00:57:30,240 --> 00:57:35,080
and capacity drops by riding the
residual stream highway, and 

1119
00:57:35,080 --> 00:57:37,800
ultimately we saw it being 
served to users by a massive 

1120
00:57:37,960 --> 00:57:41,480
disaggregated GPU clusters 
passing micro batches over the 

1121
00:57:41,480 --> 00:57:43,320
wire. 
It is a testament to the 

1122
00:57:43,320 --> 00:57:46,360
incredible engineering happening
at the frontier of AI right now.

1123
00:57:46,840 --> 00:57:49,720
The mathematical theory of 
sparsity is elegant, but the 

1124
00:57:49,720 --> 00:57:52,560
sheer systems engineering 
required to make it a physical 

1125
00:57:52,560 --> 00:57:55,320
reality in a data center is 
staggering. 

1126
00:57:55,360 --> 00:57:58,400
We are pushing the absolute 
limits of silicon and light. 

1127
00:57:58,800 --> 00:58:01,320
Which brings me to a final 
provocative thought for everyone

1128
00:58:01,320 --> 00:58:04,360
listening, think about that 
disaggregation we just talked 

1129
00:58:04,360 --> 00:58:06,600
about. 
If our serving systems are 

1130
00:58:06,600 --> 00:58:10,240
literally forcing us to 
physically RIP the model apart, 

1131
00:58:10,560 --> 00:58:13,160
putting attention memory 
mechanisms on one set of 

1132
00:58:13,160 --> 00:58:16,520
servers, and expert reasoning on
a completely different set of 

1133
00:58:16,520 --> 00:58:19,760
servers, are we witnessing the 
end of the traditional 

1134
00:58:19,760 --> 00:58:23,280
interleaved transformer block? 
For the last seven years, every 

1135
00:58:23,280 --> 00:58:27,440
model has been attention FFN, 
Attention FFN. 

1136
00:58:27,960 --> 00:58:32,480
Will future AI models abandoned 
the concept of layers entirely? 

1137
00:58:32,800 --> 00:58:35,680
Could we be moving toward a 
future where a model is just one

1138
00:58:35,680 --> 00:58:39,040
giant global memory pool 
interacting over a network with 

1139
00:58:39,040 --> 00:58:43,120
one giant global reasoning pool?
It's something to deeply Mull 

1140
00:58:43,120 --> 00:58:45,680
over as this Moe architecture 
takes over the world. 

1141
00:58:46,720 --> 00:58:49,440
The physical constraints of the 
hardware are fundamentally 

1142
00:58:49,440 --> 00:58:52,320
reshaping the algorithmic 
architecture. 

1143
00:58:53,000 --> 00:58:56,760
It's a fascinating evolution, 
and I suspect we are only seeing

1144
00:58:56,760 --> 00:59:00,080
the beginning of it. 
A huge thank you to the Hugging 

1145
00:59:00,080 --> 00:59:03,320
Face team for the incredible 
source material in the Ultimate 

1146
00:59:03,320 --> 00:59:06,520
MOA Training Handbook. 
As a reminder to our listeners, 

1147
00:59:06,520 --> 00:59:09,240
please leave your thoughts and 
theories in the comments below. 

1148
00:59:09,640 --> 00:59:13,720
Visit neuralintel.org for the 
latest deep dives in AI and ML, 

1149
00:59:14,040 --> 00:59:16,880
and make sure you check out the 
show on YouTube, Apple Podcast, 

1150
00:59:16,880 --> 00:59:18,760
and Spotify. 
Until next time.

