近年来,随着Transformer的出现,NLP领域的重心逐渐向迁移学习转变,也出现了BERT、GPT2等基于非监督学习的大型模型,有很多文章关注如何对其进行有效的预训练,但如何针对下游任务进行微调也是很值得研究的问题。本文介绍一篇2019年底的文章,《SMART: Robust and Efficient Fine-Tuning for Pre-trained Natural Language Models through Principled Regularized Optimization》。
文章针对现有微调方法中存在的在下游任务中过拟合以及遗忘预训练知识的问题,提出了两种微调方法:
- SMoothness-inducing Adversarial Regularization
- Bregman proximal poinT optimization
Smoothness-inducing Adversarial Regularization
这里用到的思想很简单,就是加入一个正则化项嘛,只不过这个正则化项是由对抗训练引出的。
min θ F ( θ ) = L ( θ ) + λ s R s ( θ ) , \min \limits_{\theta}F(\theta)=L(\theta)+\lambda_sR_s(\theta), θminF(θ)=L(θ)+λsRs(θ),其中 L ( θ ) L(\theta) L(θ)是损失函数(对于分类模型来说通常为KL散度或者交叉熵,对于回归模型通常为均方误差), R s ( θ ) R_s(\theta) Rs(θ)有两种形式:
- [ A ] : R s ( θ ) = 1 n ∑ i = 1 n max ∥ x i − x ~ i ∥ p ≤ ϵ l s ( f ( x i ; θ ) , f ( x ~ i ; θ ) ) \mathrm{[A]}: R_s(\theta)=\frac{1}{n}\sum \limits_{i=1}^n\max\limits_{\Vert x_i-\tilde{x}_i \Vert_p\leq \epsilon}l_s(f(x_i;\theta),f(\tilde{x}_i;\theta)) [A]:Rs(θ)=n1