arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2202.10054cs.LGcs.CV
收藏

微调可能会扭曲预训练的特征并使分布外的性能不佳

Fine-Tuning can Distort Pretrained Features and Underperform Out-of-Distribution

Stanford University(斯坦福大学)

Ananya Kumar, Aditi Raghunathan, Robbie Jones, Tengyu Ma, Percy Liang

摘要:

当将预训练模型转移到下游任务时,两种流行的方法是完全微调(更新所有模型参数)和线性探测(仅更新最后一个线性层-“头部”)。众所周知,微调导致更好的精度分布(ID)。然而,在本文中,我们发现,当预训练的特征很好并且分布偏移很大时,微调可以达到比线性探测分布外(OOD)更差的准确性。在10个分布偏移数据集(Breeds-Living 17,Breeds-Brachty 30,DomainNet,CIFAR $\to$ STL,CIFAR10.1,FMoW,ImageNet V2,ImageNet-R,ImageNet-A,ImageNet-Sketch)上,与线性探测相比,微调平均获得了2%的高精度ID,但7%的低精度OOD。我们从理论上证明,即使在一个简单的设置中,ID和OOD精度之间的这种权衡也会出现:微调过参数化的双层线性网络。我们证明,当我们初始化一个固定的或随机的头部时,微调的OOD误差很高-这是因为当微调学习头部时,神经网络的下层同时改变并扭曲预训练的特征。我们的分析表明,线性探测然后完全微调(LP-FT)的简单两步策略,有时用作微调启发式,结合了微调和线性探测的优点。从经验上讲,LP-FT在上述数据集上的表现优于微调和线性探测(比完全微调好1%的ID,好10%的OOD)。

英文摘要:

When transferring a pretrained model to a downstream task, two popular methods are full fine-tuning (updating all the model parameters) and linear probing (updating only the last linear layer -- the "head"). It is well known that fine-tuning leads to better accuracy in-distribution (ID). However, in this paper, we find that fine-tuning can achieve worse accuracy than linear probing out-of-distribution (OOD) when the pretrained features are good and the distribution shift is large. On 10 distribution shift datasets (Breeds-Living17, Breeds-Entity30, DomainNet, CIFAR $\to$ STL, CIFAR10.1, FMoW, ImageNetV2, ImageNet-R, ImageNet-A, ImageNet-Sketch), fine-tuning obtains on average 2% higher accuracy ID but 7% lower accuracy OOD than linear probing. We show theoretically that this tradeoff between ID and OOD accuracy arises even in a simple setting: fine-tuning overparameterized two-layer linear networks. We prove that the OOD error of fine-tuning is high when we initialize with a fixed or random head -- this is because while fine-tuning learns the head, the lower layers of the neural network change simultaneously and distort the pretrained features. Our analysis suggests that the easy two-step strategy of linear probing then full fine-tuning (LP-FT), sometimes used as a fine-tuning heuristic, combines the benefits of both fine-tuning and linear probing. Empirically, LP-FT outperforms both fine-tuning and linear probing on the above datasets (1% better ID, 10% better OOD than full fine-tuning).

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

↑