可变宽度变形器
Variable-Width Transformers
摘要
在调整模型规模时,尤其是模型的深度和宽度方面,取得了显著的进展。不过,大多数架构都保持相同的宽度,无论不同层之间承担何种不同的计算任务,都会采用固定的参数配置和计算资源分配方式。在这项研究中,我们通过提出一种基于时间形状的架构结构,来探讨不同层次之间是否可以进行非均匀的参数分配问题。这种架构在早期和晚期层保持较宽的宽度,而中间层的宽度则逐渐减小,同时采用了无需额外参数的残差缩放机制。在从2亿参数到20亿参数(密集型)以及30亿参数的语言模型中,我们的架构在语言建模任务上的表现始终优于那些采用均匀参数配置的基线模型。通过降低平均层宽度,该架构还减少了整体的计算量(在拟合损失匹配的情况下,计算量减少了22%),同时降低了KV缓存内存和I/O成本(分别减少了15%)。分析结果表明,这种非均匀宽度分配方式能够使得语言模型的资源利用更加优化。
English Abstract
Scaling model size, specifically depth and width, has driven significant progress in transformer-based language models. However, most architectures maintain a constant width across all layers, allocating a fixed parameter and computation budget evenly despite different layers potentially playing distinct computational roles. In this work, we empirically investigate nonuniform capacity allocation across network depth by proposing a times-shaped > <former architecture. This design maintains wider early and late layers while narrowing the middle layers, utilizing a parameter-free residual resizing mechanism. Across decoder-only language models ranging from 200M to 2B parameters (dense) and 3B parameters (MoE), our > <former consistently outperforms parameter-matched uniform baselines on language modeling loss. By reducing the average layer width, this architecture also requires fewer overall FLOPs (22% reduction under fitted loss-matched scaling curves) and smaller KV cache memory and I/O cost (15% reduction). In analysis, we show that this bottleneck structure results in qualitatively different representations in residual streams. Overall, our results demonstrate that nonuniform width allocation can result in more resource-optimal scaling of language models.