arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2405.16747cs.LG
收藏

从NTK视角理解线性探测后微调语言模型

Understanding Linear Probing then Fine-tuning Language Models from NTK Perspective

The University of Tokyo(东京大学)

Akiyoshi Tomihari, Issei Sato

AI总结:

本文从神经正切核视角分析线性探测后微调(LP-FT)的训练动态,揭示线性头范数在特征保持与模型校准中的作用,并将分析扩展到LoRA,验证了LP-FT微调语言模型的有效性。

摘要:

两阶段微调方法,即先线性探测再微调(LP-FT),优于单独的线性探测和微调。这一结论对于分布内(ID)和分布外(OOD)数据都成立。其成功的一个关键原因是通过在LP阶段获得接近最优的线性头来保留预训练特征。然而,尽管大语言模型被广泛使用,但对Transformer等更复杂架构的探索仍然有限。在本文中,我们基于神经正切核(NTK)理论分析了LP-FT在分类任务中的训练动态。我们的分析将NTK矩阵分解为两个分量。这一分解凸显了线性头范数以及FT阶段开始时的预测精度的重要性。我们还观察到在LP阶段线性头范数显著增加,这源于使用交叉熵(CE)损失进行训练。线性头范数的增加有效减少了已学习特征的变化。此外,我们发现这种增大的范数会对模型校准产生不利影响,而这一问题可以通过温度缩放来纠正。另外,我们将基于NTK的分析扩展到低秩适应(LoRA)方法,并验证了其有效性。我们使用基于Transformer的模型在多个自然语言处理数据集上的实验证实了我们的理论分析。我们的研究表明LP-FT在微调语言模型方面是有效的。代码可在https://github.com/tom4649/lp-ft_ntk获取。

英文摘要:

The two-stage fine-tuning (FT) method, linear probing (LP) then fine-tuning (LP-FT), outperforms linear probing and FT alone. This holds true for both in-distribution (ID) and out-of-distribution (OOD) data. One key reason for its success is the preservation of pre-trained features, achieved by obtaining a near-optimal linear head during LP. However, despite the widespread use of large language models, there has been limited exploration of more complex architectures such as Transformers. In this paper, we analyze the training dynamics of LP-FT for classification tasks on the basis of the neural tangent kernel (NTK) theory. Our analysis decomposes the NTK matrix into two components. This decomposition highlights the importance of the linear head norm alongside the prediction accuracy at the start of the FT stage. We also observe a significant increase in the linear head norm during LP, which stems from training with the cross-entropy (CE) loss. This increase in the linear head norm effectively reduces changes in learned features. Furthermore, we find that this increased norm can adversely affect model calibration, which can be corrected using temperature scaling. Additionally, we extend our analysis with the NTK to the low-rank adaptation (LoRA) method and validate its effectiveness. Our experiments using a Transformer-based model on multiple natural language processing datasets confirm our theoretical analysis. Our study demonstrates the effectiveness of LP-FT for fine-tuning language models. Code is available at https://github.com/tom4649/lp-ft_ntk.

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

↑