挑战传统Transformer的窄宽窄结构,用更轻量的沙漏型网络提升模型效率。
Revisiting the Shape Convention of Transformer Language Models
- 用堆叠残差沙漏结构替代传统窄宽窄前馈网络
- 400M模型下性能超越传统结构,1B模型相当且参数分配更优
- 适合追求高效表达力的模型设计者与资源受限场景
密集型Transformer语言模型长期遵循固定架构:每层由注意力模块后接前馈网络(FFN)构成,采用窄-宽-窄的MLP结构,将大部分参数分配给扩张率2至4的MLP。受近期研究启发,残差式宽-窄-宽(沙漏)结构在函数逼近能力上表现更优,本文重新审视这一长期沿用的MLP设计范式。为此,提出一种新型Transformer变体,以更深但更轻的沙漏型FFN替代传统结构,由多个沙漏子模块通过残差路径连接而成。我们假设,更深层但更轻的沙漏型FFN可作为有效替代方案,节省的参数可用于扩大隐藏维度等更关键部分。实验验证表明,在不同规模模型上,沙漏型FFN在400M模型中优于传统结构,并在1B模型中达到相当水平;在相同参数预算下,减少FFN、增加注意力参数的沙漏型配置持续优于传统设计。这些发现为现代语言模型的高效与表达力平衡提供了新视角。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。