arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2602.06471cs.CLcs.AIcs.LG
收藏

重新审视变换器语言模型的形状约定

Revisiting the Shape Convention of Transformer Language Models

National Taiwan University(国立台湾大学)

Feng-Ting Liao, Guan-Ting Yi, Tzu-Quan Lin, Meng-Hsi Chen, Da-shan Shiu

AI总结:

本文重新审视变换器语言模型的MLP形状约定,提出更深层但更轻的hourglass FFN作为传统FFN的竞争替代品,并通过实验证明其在不同模型规模下的优越性能。

摘要:

密集型变换器语言模型在很大程度上遵循一种一致的架构形状:每个层由一个注意力模块后接一个具有窄-宽-窄MLP的前馈网络(FFN)组成,MLP在扩展比在2到4之间时分配大部分参数。受最近结果的启发,即残差宽-窄-宽(hourglass)MLP在函数近似能力方面表现更优,我们重新审视变换器中长期存在的MLP形状约定,挑战窄-宽-窄设计的必要性。为了研究这一问题,我们开发了一种变换器变体,用更深层的hourglass形状FFN替代传统FFN,该FFN由一系列通过残差路径连接的hourglass子MLP堆叠而成。我们提出,更深层但更轻的hourglass FFN可以作为传统FFN的竞争替代品,并且使用更轻的hourglass FFN节省的参数可以更有效地利用,例如在固定预算下扩大模型隐藏维度。我们通过跨模型规模的实证验证确认了这些发现:hourglass FFN在400M规模以下优于传统FFN,并在更大规模(1B参数)时表现相当;具有减少FFN和增加注意力参数的hourglass FFN变体在匹配预算下表现出一致的改进。这些发现为最近的工作提供了新的视角,并促使对窄-宽-窄MLP约定以及注意力与FFN之间的平衡重新思考,以实现高效且表达能力强的现代语言模型。

英文摘要:

The architectural shape of dense Transformers has remained remarkably stable: narrow-wide-narrow feed-forward networks (FFNs) consume most non-embedding parameters. Motivated by theoretical and empirical evidences that residual wide-narrow-wide (hourglass) MLPs remain expressive despite bottlenecks, we revisit whether this architectural convention is necessary for dense language models. We study Hourglass Transformers, which replace the conventional FFN with residual stacks of hourglass sub-MLPs and use hourglass attention to decouple residual-stream width from attention width. This exposes a practical depth-width trade-off: compressing the FFN intermediate dimension allows wider hidden states and fewer layers at matched parameter budgets. Across model scales from 113M to 8B parameters, Hourglass Transformers achieve language-modeling and downstream performance comparable to conventional Transformers, while improving training compute efficiency by $8.7\%$ at matched average downstream accuracy across the 906M, 3B, and 8B scales. After long-context extension, the 8B Hourglass model also outperforms its matched conventional baseline across 4k-64k context lengths. At 64k context, the reduced attention layer count lowers both computation and KV-cache requirements, yielding up to $1.93\times$ faster token decoding and $50\%$ lower KV-cache memory at the 1B scale. These results identify hourglass structures as a practical architecture-efficiency alternative for compute- and latency-conscious Transformer design.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑