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

Transformer作为Learngene的线性扩展

Transformer as Linear Expansion of Learngene

Southeast University(东南大学)

Shiyu Xia, Miaosen Zhang, Xu Yang, Ruiming Chen, Haokun Chen, Xin Geng

AI总结:

本文提出TLEG方法,通过线性扩展共享learngene模块生成并初始化不同深度的Transformer,在ImageNet-1K及多个下游数据集上取得优于或媲美独立训练模型的性能,并大幅降低训练与存储成本。

摘要:

我们提出扩展共享Transformer模块,以生成并初始化不同深度的Transformer,从而适应多样的资源约束。借鉴遗传可扩展性的类比,我们将此类模块称为learngene。为识别扩展机制,我们深入探究了层位置与其对应权重值之间的关系,并发现线性函数能较好地近似这种关系。基于这一洞察,我们提出了Transformer作为Learngene的线性扩展(TLEG),这是一种灵活生成并初始化不同深度Transformer的新方法。具体而言,为学习learngene,我们首先构建一个从learngene线性扩展的辅助Transformer,然后通过软蒸馏对其进行训练。随后,我们可通过线性扩展训练良好的learngene来生成并初始化不同深度的Transformer,从而支持多样的下游场景。在ImageNet-1K上的大量实验表明,与许多从零训练的独立模型相比,TLEG取得了相当或更好的性能,同时减少了约2倍的训练成本。在迁移到多个下游分类数据集时,TLEG大幅超越了现有初始化方法(例如,在iNat 2019上+6.87%,在CIFAR-100上+7.66%)。在需要生成适应不同资源约束的不同深度模型的情况下,与预训练和微调方法相比,TLEG在取得相当结果的同时,减少了约19倍用于初始化这些模型的存储参数和约5倍的预训练成本。当使用固定参数集初始化不同模型时,与预训练方法相比,TLEG展现出更好的灵活性和有竞争力的性能,同时减少了约2.9倍用于初始化的存储参数。

英文摘要:

We propose expanding the shared Transformer module to produce and initialize Transformers of varying depths, enabling adaptation to diverse resource constraints. Drawing an analogy to genetic expansibility, we term such module as learngene. To identify the expansion mechanism, we delve into the relationship between the layer's position and its corresponding weight value, and find that linear function appropriately approximates this relationship. Building on this insight, we present Transformer as Linear Expansion of learnGene (TLEG), a novel approach for flexibly producing and initializing Transformers of diverse depths. Specifically, to learn learngene, we firstly construct an auxiliary Transformer linearly expanded from learngene, after which we train it through employing soft distillation. Subsequently, we can produce and initialize Transformers of varying depths via linearly expanding the well-trained learngene, thereby supporting diverse downstream scenarios. Extensive experiments on ImageNet-1K demonstrate that TLEG achieves comparable or better performance in contrast to many individual models trained from scratch, while reducing around 2x training cost. When transferring to several downstream classification datasets, TLEG surpasses existing initialization methods by a large margin (e.g., +6.87% on iNat 2019 and +7.66% on CIFAR-100). Under the situation where we need to produce models of varying depths adapting for different resource constraints, TLEG achieves comparable results while reducing around 19x parameters stored to initialize these models and around 5x pre-training costs, in contrast to the pre-training and fine-tuning approach. When transferring a fixed set of parameters to initialize different models, TLEG presents better flexibility and competitive performance while reducing around 2.9x parameters stored to initialize, compared to the pre-training approach.

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

↑