Revisiting the Shape Convention of Transformer Language Models
Feng-Ting Liao, Meng-Hsi Chen, Guan-Ting Yi, Da-shan Shiu
TL;DR
The paper challenges the long-standing narrow-wide-narrow FFN convention in dense Transformer language models and proposes an hourglass FFN with $K$ sub-blocks and bottleneck size $d_h < d_{\text{model}}$. By integrating this hourglass FFN into a standard Transformer backbone, the authors demonstrate that hourglass configurations can outperform conventional FFNs at smaller scales (up to around $4\times 10^{8}$ parameters) and remain competitive at larger scales near $1\times 10^{9}$ parameters, often rebalancing parameters toward the attention module. Key findings include a robust width-depth trade-off with an optimal $d_{\text{model}}/L$ around 100–250 and a typical $d_h/d_{\text{model}}$ around 0.4–0.6, with deeper hourglass structures (larger $K$) yielding consistent gains. These results suggest that deeper bottlenecked FFNs combined with increased attention capacity can yield more efficient and expressive language models, potentially reshaping architectural choices for scalable transformers.
Abstract
Dense Transformer language models have largely adhered to one consistent architectural shape: each layer consists of an attention module followed by a feed-forward network (FFN) with a narrow-wide-narrow MLP, allocating most parameters to the MLP at expansion ratios between 2 and 4. Motivated by recent results that residual wide-narrow-wide (hourglass) MLPs offer superior function approximation capabilities, we revisit the long-standing MLP shape convention in Transformer, challenging the necessity of the narrow-wide-narrow design. To study this, we develop a Transformer variant that replaces the conventional FFN with a deeper hourglass-shaped FFN, comprising a stack of hourglass sub-MLPs connected by residual pathways. We posit that a deeper but lighter hourglass FFN can serve as a competitive alternative to the conventional FFN, and that parameters saved by using a lighter hourglass FFN can be more effectively utilized, such as by enlarging model hidden dimensions under fixed budgets. We confirm these through empirical validations across model scales: hourglass FFNs outperform conventional FFNs up to 400M and achieve comparable performance at larger scales to 1B parameters; hourglass FFN variants with reduced FFN and increased attention parameters show consistent improvements over conventional configurations at matched budgets. Together, these findings shed new light on recent work and prompt a rethinking of the narrow-wide-narrow MLP convention and the balance between attention and FFN towards efficient and expressive modern language models.
