chapter 03
SwiGLU
The Day 1 MLP widened the vector, bent it with GELU, and narrowed it back.
Two MLPs
vanilla: Wdown · GELU(Wup x) SwiGLU: Wdown · ( SiLU(Wgate x) ⊙ Wup x )
Vanilla MLP vs SwiGLU MLP
ReLU, GELU, SiLU
SiLU(x) = x · σ(x) = x / (1 + e−x)
The gate in action
Gating, element by element
The gate surface
Sizing the hidden layer
From 4d to 8d/3, then rounded
h = multiple_of · ⌈ ffn_mult · ⌊8d/3⌋ / multiple_of ⌉