目录
Introduction
VILLA (Vision-and-Language Large-scale Adversarial training)
- VILLA 是第一个将大规模 对抗训练 (adversarial training) 引入 vision-and-language (V+L) representation learning 来增强模型泛化能力的方法。它实际上是一个通用的框架,可以被运用在任何多模态预训练模型上来提高模型的泛化能力。它由两个步骤组成:(i) task-agnostic adversarial pre-training (APT); (ii) task-specific adversarial fine-tuning (AFT)。也就是说,VILLA 在 pre-training 和 fine-tuning 阶段都使用了对抗学习
- 作者在论文中将 VILLA 用在了当前的 SOTA 模型 UNITER 上,并在 6 个 V+L 任务上达到了 SOTA (Visual Question Answering (VQA), Visual Commonsense Reasoning (VCR), Referring Expression (RE) Compression, Visual Entailment, Image-Text Retrieval, and NLVR2)
Vision-and-Language Large-scale Adversarial Training
Adversarial Pre-training and Finetuning
- VILLA 在预训练和微调阶段都使用了对抗训练,根据作者的解释,在预训练阶段使用对抗训练能够增加模型的泛化性能,进而有利于模型在 finetuning 阶段的表现。而在 finetuning 阶段使用对抗学习则有利于进一步提升模型性能
Perturbations in the Embedding Space
- 由于 VILLA 的主要目的是增加模型的泛化性能而非帮助模型防御真实对抗样本的攻击,因此 VILLA 是直接在 embedding level 上增加扰动而不是在 pixel / token level 上增加扰动。对于文本数据而言,扰动直接加在 word embedding 上,对于图像数据而言,扰动直接加在 image-region features 上
- 同时,由于图像和文本的特征非常不同,VILLA 一次只在一个模态上增加扰动 (不过作者在论文的脚注里说了其实同时给两个模态增加扰动得到的模型性能也差不多)。设图像和文本的对抗扰动分别为 δ i m g \delta_{img} δimg 和 δ t x t \delta_{txt} δtxt,则增加扰动后模型的输出为 y ^ = f θ ( x i m g + δ i m g , x t x t ) \hat y=f_\theta(x_{img}+\delta_{img},x_{txt}) y^=fθ(ximg+δimg,xtxt) 或 y ~ = f θ ( x i m g , x t x t + δ t x t ) \tilde y=f_\theta(x_{img},x_{txt}+\delta_{txt}) y~=fθ(ximg,xtxt+δtxt)
“Free” Multimodal Adversarial Training
Training Objective
- 其中, L std ( θ ) = L ( f θ ( x i m g , x t x t ) , y ) \mathcal{L}_{\text {std }}(\theta)=L\left(f_{\theta}\left(x_{i m g}, x_{t x t}\right), y\right) Lstd (θ)=L(fθ(ximg,xtxt),y) 是由 clean data 计算的 cross-entropy loss; R a t ( θ ) \mathcal R_{at}(\theta) Rat(θ) 是 label-preserving AT loss (由于将对抗训练看作一种正则化方式,该 loss 项符号就写作 R \mathcal R R); R k l ( θ ) \mathcal R_{kl}(\theta) Rkl(θ) 为一个 finer-grained adversarial regularization term
label-preserving AT loss
finer-grained adversarial regularization term
- 其中, L k l ( p , q ) = K L ( p ∥ q ) + K L ( q ∥ p ) L_{k l}(p, q)=\mathrm{KL}(p \| q)+\mathrm{KL}(q \| p) Lkl(p,q)=KL(p∥q)+KL(q∥p), K L ( ⋅ ) \mathrm{KL}(\cdot) KL(⋅) 为 KL 散度
- 可以看出, R a t ( θ ) \mathcal R_{at}(\theta) Rat(θ) 只是要求模型在输入对抗样本时保持输出的 label 不变, R k l ( θ ) \mathcal R_{kl}(\theta) Rkl(θ) 则进一步要求预测的置信度也要尽量接近 (This promotes higher smoothness of the training objective and has empirically proven as important regularization effective for further performance boost.)
“Free” AT Strategy
- 因为 VILLA 在预训练阶段也使用了对抗训练,而对抗训练本身的开销是非常大的,为此 VILLA 使用了 FreeLB 作为对抗训练的算法来尽可能降低训练开销 (实际上感觉开销还是会相当大… FreeLB 的原作者也只是将 FreeLB 用在了 fine-tune 阶段)
下面给出 original FreeLB 算法以供参考:
Experiments
Experimental Setting
- 在 UNITER 的预训练阶段,VILLA 只被应用在了 Masked Language Modeling (MLM) 和 Image-Text Matching (ITM) 上。同时,由于对抗训练开销太大,VILLA 并没有在所有迭代步数中都采用对抗训练,在训练 UNITER BASE \text{UNITER}_{\text{BASE}} UNITERBASE 时 100k steps 为标准训练,100k steps 为对抗训练,训练 UNITER LARGE \text{UNITER}_{\text{LARGE}} UNITERLARGE时 425k steps 为标准训练,75k steps 为对抗训练,总的训练步数与原来的 UNITER 模型相同
- We typically select adversarial learning rate from {1e-2, 1e-3}, adversarial training steps to 3, and α α α from 1.0, 1.5, 2.0. (详细的参数说明可参加论文的附录部分)
Results and Ablation Analysis
Downstream Task Evaluation
Pre-training vs. Finetuning
- paper 用消融实验证明了在 Pre-training 和 Finetuning 阶段都应该使用对抗训练
Image vs. Text Modality
- paper 也用消融实验证明了在 image 和 text 两个模态都应该使用对抗训练
- 值得一提的是,在 CV 领域中,对抗训练在让模型增加泛化能力的同时,也会降低模型精度,但这里消融实验的结果表明,只在 image features 上增加扰动也可以显著提升模型的性能
Visualization of text-to-image attention