Why is the feed-forward hidden dimension conventionally expanded to four times the model dimension?
Last updated
It is an empirical convention from the original Transformer (d_model 512, d_ff 2048), not a derived optimum.
The FFN does most per-token transformation and knowledge storage. Expanding before the nonlinearity gives it capacity, and 4x puts about two-thirds of block parameters there (8d² vs 4d² for attention).
The ratio isn't sacred: SwiGLU uses about 8/3, and scaling studies show quality is fairly insensitive to the exact ratio.