ffn-dimensions-follow-fixed-ratios-across-architectures

IN derived (depth 1)

Created 2026-06-21T13:06:41+00:00 · Reviewed 2026-06-21T14:41:08+00:00

The transformer's feed-forward layers contain the majority of model parameters. A common dimensioning convention sets FFN size to 4x the hidden size (as seen in GPT-2 and BERT), and BERT specifically uses a fixed ratio of H/64 for attention heads — though these ratios are architectural conventions of specific models rather than universal structural constants across all architectures.

Summary

In many popular transformer designs like GPT-2 and BERT, the feed-forward layers are set to about four times the hidden width, and BERT further ties its number of attention heads to that same width by a fixed fraction. These are deliberate design choices made by those specific model families, not universal laws of transformer construction, so they cannot be assumed to hold in every architecture you encounter.

Justifications

SL — Three independent architectural observations combine into a single structural invariant across transformer families

Antecedents (all must be IN):