Skip to main content
QUICK REVIEW

[论文解读] How to prepare your task head for finetuning

Yi Ren, Shangmin Guo|arXiv (Cornell University)|Feb 11, 2023
Domain Adaptation and Few-Shot LearningComputer Science被引用 3
一句话总结

本文提出了一种系统性方法,通过分析任务头在初始训练动态中(特别是其“能量”)对特征适应的影响,来提升微调性能。通过将学习过程分解为能量与方向两个分量,作者表明,结合标签平滑和架构修改的早期停止头探测,可通过受控的特征适应实现更优的下游性能。

ABSTRACT

In deep learning, transferring information from a pretrained network to a downstream task by finetuning has many benefits. The choice of task head plays an important role in fine-tuning, as the pretrained and downstream tasks are usually different. Although there exist many different designs for finetuning, a full understanding of when and why these algorithms work has been elusive. We analyze how the choice of task head controls feature adaptation and hence influences the downstream performance. By decomposing the learning dynamics of adaptation, we find that the key aspect is the training accuracy and loss at the beginning of finetuning, which determines the "energy" available for the feature's adaptation. We identify a significant trend in the effect of changes in this initial energy on the resulting features after fine-tuning. Specifically, as the energy increases, the Euclidean and cosine distances between the resulting and original features increase, while their dot products (and the resulting features' norm) first increase and then decrease. Inspired by this, we give several practical principles that lead to better downstream performance. We analytically prove this trend in an overparamterized linear setting and verify its applicability to different experimental settings.

研究动机与目标

  • 理解任务头的选择及其初始训练动态如何影响微调过程中的特征适应。
  • 挑战微调过程中预训练特征保持不变的假设,表明即使微小的适应也会显著影响性能。
  • 开发实用且基于理论的指导原则,用于设计超越标准全网络微调或线性探测的更优微调流程。
  • 将研究从线性头推广至非线性头探测(HP)及其对表征学习的影响。
  • 通过能量与方向分解构建控制特征适应的框架,从而提升下游准确率。

提出的方法

  • 将特征适应的学习动态分解为‘能量’(梯度更新的幅度)与‘方向’(特征向量方向的变化)。
  • 将任务头的初始能量形式化为微调开始时的训练准确率与损失,以确定可用的适应容量。
  • 分析初始能量对三个关键指标的影响:原始特征与适配后特征之间的欧氏距离、余弦相似度与点积。
  • 使用过参数化的线性模型,严格证明增加初始能量会导致特征范数与距离呈现非单调行为。
  • 引入实用技术:在头探测过程中实施早期停止、在探测期间使用标签平滑,以及重新初始化与任务头相连的后续主干层。
  • 在包括视觉与自然语言处理基准在内的多样化实验设置中,验证理论趋势。
Figure 1: Left: a general example of pretraining (PT), head probing (HP) and finetuning (FT) procedure (DS is short for downstream). Right: an example showing that neither probing the head to converge nor no probing is the optimum (pretrained on ImageNet-1K and finetuned on STL10).
Figure 1: Left: a general example of pretraining (PT), head probing (HP) and finetuning (FT) procedure (DS is short for downstream). Right: an example showing that neither probing the head to converge nor no probing is the optimum (pretrained on ImageNet-1K and finetuned on STL10).

实验结果

研究问题

  • RQ1任务头的初始训练状态(即其‘能量’)如何影响微调过程中的特征适应?
  • RQ2为何头探测的早期停止在下游性能上优于完全收敛?
  • RQ3任务头的初始能量与最终特征距离、范数及余弦相似度之间存在何种关系?
  • RQ4与线性探测相比,非线性任务头如何影响特征适应?
  • RQ5通过能量操控控制特征适应,是否能在不同架构与数据集上实现一致的性能提升?

主要发现

  • 增加任务头的初始能量,会导致原始特征与适配后特征之间的欧氏距离和余弦距离单调增加。
  • 适配后特征的点积与范数随初始能量上升先增加后减少,表明存在非单调的适应模式。
  • 特征范数达到峰值的临界点出现在初始能量的中等水平,提示存在一个最优的适应窗口。
  • 先前研究中假设的‘特征不变’在微调过程中极少成立,可能导致次优性能。
  • 在头探测未完全收敛前即停止(即早期停止),可获得比完全收敛更优的下游准确率,原因在于实现了最优的能量控制。
  • 在头探测期间使用标签平滑,以及通过合并与重新初始化后续主干层等架构修改,可进一步提升性能,通过稳定适应动态。
(a) Influence of $\tau$ on energy.
(a) Influence of $\tau$ on energy.

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。