[论文解读] Towards Improving Adversarial Training of NLP Models
本文提出 A2T,一种计算高效的 NLP 模型对抗训练方法,通过基于梯度的词重要性排序和反向拟合词嵌入,生成廉价且有效的对抗样本。A2T 提升了模型对多样化攻击的鲁棒性,增强了标准准确率和跨领域泛化能力,并提高了可解释性,且无需昂贵的搜索或复杂架构。
Adversarial training, a method for learning robust deep neural networks, constructs adversarial examples during training. However, recent methods for generating NLP adversarial examples involve combinatorial search and expensive sentence encoders for constraining the generated instances. As a result, it remains challenging to use vanilla adversarial training to improve NLP models' performance, and the benefits are mainly uninvestigated. This paper proposes a simple and improved vanilla adversarial training process for NLP models, which we name Attacking to Training (A2T). The core part of A2T is a new and cheaper word substitution attack optimized for vanilla adversarial training. We use A2T to train BERT and RoBERTa models on IMDB, Rotten Tomatoes, Yelp, and SNLI datasets. Our results empirically show that it is possible to train robust NLP models using a much cheaper adversary. We demonstrate that vanilla adversarial training with A2T can improve an NLP model's robustness to the attack it was originally trained with and also defend the model against other types of word substitution attacks. Furthermore, we show that A2T can improve NLP models' standard accuracy, cross-domain generalization, and interpretability. Code is available at https://github.com/QData/Textattack-A2T .
研究动机与目标
- 为解决原始对抗训练在 NLP 中计算成本过高的问题,该问题限制了其实际应用。
- 探究是否一种更廉价、基于梯度的对抗攻击仍能提升模型的鲁棒性和泛化能力。
- 评估对抗训练对标准准确率、跨领域泛化能力以及模型可解释性的影响。
- 比较在对抗训练中使用反向拟合词嵌入与掩码语言模型进行词替换的有效性。
- 证明使用 A2T 的对抗训练可提升对训练期间未使用攻击的鲁棒性。
提出的方法
- A2T 通过基于梯度的词重要性排序,迭代地进行词替换以生成对抗样本。
- 它使用反向拟合词嵌入模型中的同义词替换词语,以保持流畅性和语义一致性。
- 该攻击方法针对速度进行了优化,避免使用昂贵的句子级编码器或组合搜索。
- A2T-MLM 是一种变体,使用掩码语言模型进行词替换,而非同义词查找。
- 通过在原始数据和 A2T 生成的对抗样本上进行数据增强,执行对抗训练。
- 该方法在 BERT 和 RoBERTa 模型上,基于 IMDB、Rotten Tomatoes、Yelp 和 SNLI 数据集,使用标准准确率、鲁棒性和可解释性指标进行了评估。
实验结果
研究问题
- RQ1一种更廉价、基于梯度的对抗攻击是否能在 NLP 中实现与昂贵搜索方法相当的鲁棒性提升?
- RQ2使用 A2T 的对抗训练是否能提升模型在分布外数据上的泛化能力?
- RQ3与自然训练相比,A2T 对标准准确率和模型可解释性有何影响?
- RQ4A2T 是否能提升对训练期间未使用攻击的鲁棒性?
- RQ5不同的词替换策略(反向拟合词嵌入 vs. 掩码语言模型)对模型性能有何影响?
主要发现
- A2T 在多种攻击下均提升了对抗鲁棒性,包括训练期间未使用的攻击,表明防御具有泛化能力。
- 使用 A2T 训练的模型在标准准确率和跨领域泛化能力方面优于自然训练,尤其在 IMDB 和 Yelp 数据集上表现更优。
- A2T 提升了模型可解释性,AOPC 测量结果显示 BERT 模型的 AOPC 分数高于 RoBERTa。
- A2T-MLM 降低了标准准确率和跨领域泛化能力,可能是因为生成了具有语义漂移的假阳性对抗样本。
- 对抗训练的最优 γ 值为 0.2,表明更高的攻击率不会提升鲁棒性,甚至可能降低性能。
- 使用 A2T 的对抗训练降低了原始输入与对抗输入的 [CLS] 嵌入表示之间的 ℓ₂ 距离,表明在表征空间中鲁棒性得到提升。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。