A Closer Look at How Fine-tuning Changes BERT
Yichu Zhou School of Computing University of Utah、Vivek Srikumar School of Computing University of Utah
Abstract
Given the prevalence of pre-trained contextualized representations in today’s NLP, there have been many efforts to understand what information they contain, and why they seem to be universally successful. The most common approach to use these representations involves fine-tuning them for an end task. Yet, how fine-tuning changes the underlying embedding space is less studied. In this work, we study the English BERT family and use two probing techniques to analyze how fine-tuning changes the space. We hypothesize that fine-tuning affects classification performance by increasing the distances between examples associated with different labels. We confirm this hypothesis with carefully designed experiments on five different NLP tasks. Via these experiments, we also discover an exception to the prevailing wisdom that “fine-tuning always improves performance”. Finally, by comparing the representations before and after fine-tuning, we discover that fine-tuning does not introduce arbitrary changes to representations; instead, it adjusts the representations to downstream tasks while largely preserving the original spatial structure of the data points.
中文速览
预训练语言模型(如BERT)在各类NLP任务上效果出众,研究者普遍认为微调(fine-tuning)是提升性能的法宝,但微调究竟如何改变模型内部的表示空间,此前鲜有深入分析。本文针对英文BERT系列模型,结合分类器探针和几何探针(DirectProbe)两种方法,在词性标注、依存关系、介词语义消歧和文本分类等五项任务上系统考察了微调前后表示空间的变化。研究发现,微调的核心机制在于拉大不同标签对应样本簇之间的距离——对于原本线性不可分的表示,微调会把同标签的点聚拢成更少的簇;对于原本已可线性分离的表示,微调则进一步推开不同标签的簇群,从而让分类边界更宽、泛化更容易。此外,研究还揭示了一个反常识的发现:微调并非总能提升性能,在训练集与测试集分布差异因微调而被显著放大的情况下,微调反而会损害表现;同时,微调并不会随意扰乱原有空间结构,而是在基本保留各簇相对位置的前提下对空间进行有针对性的调整。这些发现为理解"为什么微调有效"提供了清晰的几何直觉,也对何时使用微调给出了更为审慎的参考。
原文 arXiv:2106.14282;中英对照 + 大白话阅读 https://aha.fim.ai/paper/2106.14282v3