Defend the 4x FFN expansion ratio, then explain why SwiGLU breaks the simple rule
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Vaswani 2017 set the FFN hidden dimension to 4x d_model and that ratio held for years. Modern SwiGLU-based models often use ~2.67x instead. Defend the original 4x choice, then explain what specifically changed with SwiGLU.
4x is the historical FFN expansion ratio from Vaswani 2017, picked empirically as the sweet spot for capacity vs compute and the source of the two thirds of block params rule.
Imagine the FFN is a small room where each word goes in, gets handed off across the room, and comes back out. The 2017 design had two big doors: one expanding the word into a wider workspace, one shrinking it back. The 'wide' part was 4 times wider than the input, because that was the size where adding more space stopped helping. SwiGLU added a third door: a gate that decides which parts of the wide workspace actually count. Three doors cost more lumber than two doors at the same width, so the designers made the room narrower (2.67x instead of 4x) to keep the total wood the same. The new room has three doors and is narrower; the old room had two doors and was wider. Both rooms cost about the same to build.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
5 min: where the 4x rule came from, the two-thirds parameter heuristic, SwiGLU's three-matrix structure, the 8/3 parameter-parity arithmetic, why some models pick 3x or 3.5x instead, the empirical quality win.
| Property | ReLU FFN (Vaswani 2017) | SwiGLU FFN (modern) |
|---|---|---|
| Weight matrices per FFN | 2 (up, down) | 3 (gate, up, down) |
| Hidden ratio (d_ff / d_model) | 4x | ~2.67x (or 3-3.5x) |
| Parameter cost per FFN | 8 * d_model^2 | ~8 * d_model^2 (parity by design) |
| FLOPs per FFN forward pass | 2 matmuls + 1 activation | 3 matmuls + 1 activation + 1 elementwise multiply |
| Block parameter share | ~2/3 in FFN | ~2/3 in FFN (preserved) |
| Quality vs ReLU baseline | Baseline | ~1-2% perplexity reduction |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Citing 'SwiGLU is just better' as the explanation for the smaller hidden ratio. The ratio dropped specifically to keep parameter counts comparable; the quality improvement is a separate effect that emerges from the gating mechanism itself.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.