arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2303.07320cs.CLcs.LG
收藏

通过提示进行模型调优使 NLP 模型具备对抗鲁棒性

Model-tuning Via Prompts Makes NLP Models Adversarially Robust

Carnegie Mellon University(卡内基梅隆大学);Indian Institute of Science (IISc)(印度科学学院)

Mrigank Raman, Pratyush Maini, J. Zico Kolter, Zachary C. Lipton, Danish Pruthi

AI总结:

本文提出通过提示模板进行下游适配的 MVP 方法,在多数据集、攻击和模型上显著提升 NLP 对抗鲁棒性,并揭示 MLP-FT 脆弱源于任务错配与随机初始化参数。

摘要:

近年来,NLP 从业者已趋于采用如下做法:(i) 引入现成的预训练(掩码)语言模型;(ii) 在 CLS token 的隐藏表示之上附加一个多层感知机(权重随机初始化);以及 (iii) 在下游任务上微调整个模型(MLP-FT)。这一流程在标准 NLP 基准上带来了巨大提升,但这些模型仍然脆弱,即使面对轻微的对抗扰动也是如此。在本工作中,我们展示了 Model-tuning Via Prompts(MVP,通过提示进行模型调优)所获得的令人惊讶的对抗鲁棒性提升,这是一种适应下游任务的替代方法。MVP 并不附加 MLP 头来进行输出预测,而是向输入附加提示模板,并通过文本填充/补全进行预测。在 5 个 NLP 数据集、4 种对抗攻击和 3 种不同模型上,相比标准方法,MVP 将对抗替换下的性能平均提升 8%,甚至比基于对抗训练的最先进防御方法还高出 3.5%。通过将 MVP 与对抗训练相结合,我们在保持未扰动样本性能的同时,进一步提升了对抗鲁棒性。最后,我们进行消融实验以研究这些提升背后的机制。值得注意的是,我们发现 MLP-FT 脆弱性的主要原因可归因于预训练任务与微调任务之间的错配,以及随机初始化的 MLP 参数。

英文摘要:

In recent years, NLP practitioners have converged on the following practice: (i) import an off-the-shelf pretrained (masked) language model; (ii) append a multilayer perceptron atop the CLS token's hidden representation (with randomly initialized weights); and (iii) fine-tune the entire model on a downstream task (MLP-FT). This procedure has produced massive gains on standard NLP benchmarks, but these models remain brittle, even to mild adversarial perturbations. In this work, we demonstrate surprising gains in adversarial robustness enjoyed by Model-tuning Via Prompts (MVP), an alternative method of adapting to downstream tasks. Rather than appending an MLP head to make output prediction, MVP appends a prompt template to the input, and makes prediction via text infilling/completion. Across 5 NLP datasets, 4 adversarial attacks, and 3 different models, MVP improves performance against adversarial substitutions by an average of 8% over standard methods and even outperforms adversarial training-based state-of-art defenses by 3.5%. By combining MVP with adversarial training, we achieve further improvements in adversarial robustness while maintaining performance on unperturbed examples. Finally, we conduct ablations to investigate the mechanism underlying these gains. Notably, we find that the main causes of vulnerability of MLP-FT can be attributed to the misalignment between pre-training and fine-tuning tasks, and the randomly initialized MLP parameters.

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

↑