模型雕刻:训练可优化自身拓扑结构的Transformer
Model Carving: Training Transformers That Optimize Their Own Topology
AI总结:
该研究提出Model Carving方法,可在训练Transformer时同步优化其拓扑结构,生成的模型在相同计算量下验证损失更低、性能优于剪枝或蒸馏模型,且推理更高效。
摘要:
机器学习在很大程度上一直将架构选择与训练过程分离开来。例如,经典Transformer在每一层都会以相同顺序训练固定数量的注意力机制和MLP子层,并优化其中的权重。这种均匀性是一种惯例,而非有原则的设计选择,很可能并非最优:针对特定任务的最佳架构可能更小、更高效,且远非均匀。我们认为,理想情况下,训练过程本身应塑造模型的拓扑结构。为此,我们提出了Model Carving(模型雕刻),它可在单次运行中同时学习Transformer的权重及其架构。通过为每个子层应用可学习的标量门,我们允许训练损失在训练过程中移除模型自身的组件,从而在内部生成一个更小的异构网络。我们通过预训练参数规模从1.4亿到27亿的标准Transformer,以及参数规模从1.4亿到13亿的循环Transformer来评估Model Carving。在相同的训练计算量下,雕刻后的模型达到的验证损失比使用多达1.7倍计算量训练的密集模型更低。此外,雕刻后的模型在性能上也优于通过剪枝或蒸馏得到的规模匹配模型,这表明为边缘设备获取小型模型的最佳方式是在训练过程中雕刻它们,而非事后压缩大型模型。这种优势随规模增大而提升,且可迁移到少样本评估和生成等下游任务。由于被移除的子层不再运行,雕刻后的模型每token的FLOPs最多可减少34%,解码速度最多可提升1.6倍,且不会损失质量。我们的结果表明,架构与权重一样,应被学习而非预先固定,每个大型Transformer内部都有一个更小、更快、更强的模型等待被雕刻出来。
英文摘要:
Machine learning has largely kept separate the choice of architecture and the process of training. A classic Transformer, for instance, trains a fixed set of attention and MLP sublayers at every layer, in the same order, and optimizes the weights within. This uniformity is a convention rather than a principled design choice, and it is likely suboptimal: the best architecture for a given task may be smaller, more efficient, and far from uniform. We believe that, ideally, training itself should shape the model's topology. To this end, we introduce Model Carving, which learns both a Transformer's weights and its architecture in a single run. By applying learnable, scalar gates to each sublayer, we allow the training loss to remove the model's own components during training -- freeing a smaller heterogeneous network inside. We evaluate Model Carving by pre-training standard Transformers from 140M to 2.7B parameters and looped Transformers from 140M to 1.3B. At equal training compute, carved models reach a lower validation loss than dense models trained with up to 1.7 times more compute. Furthermore, carved models also outperform size-matched models produced by pruning or distillation, suggesting that the best way to obtain small models for edge devices is to carve them during training, not to compress a large one afterwards. This advantage both grows with scale and carries over to downstream tasks such as few-shot evaluation and generation. Because the removed sublayers no longer run, carved models also cost up to 34% fewer FLOPs per token and decode up to 1.6 times faster without cost in quality. Our results show that architecture, like weights, should be learned and not fixed in advance, and that inside every large transformer is a smaller, faster, stronger one waiting to be carved out.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。