arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2304.08767cs.CRcs.AI
收藏

基于掩码语言模型的文本对抗样本检测

Masked Language Model Based Textual Adversarial Example Detection

College of Computer and Information Science, Southwest University(西南大学计算机与信息科学学院);School of Information Technology, Deakin University(迪肯大学信息技术学院);School of Computer Science, University of Technology Sydney(悉尼科技大学计算机科学学院);School of Cyber Science and Engineering, Huazhong University of Science and Technology(华中科技大学网络空间安全学院);School of Information and Communication Technology, Griffith University(格里菲斯大学信息与通信技术学院)

Xiaomei Zhang, Zhaoxi Zhang, Qi Zhong, Xufei Zheng, Yanjun Zhang, Shengshan Hu, Leo Yu Zhang

AI总结:

针对文本对抗样本检测问题,提出即插即用的MLMD方法,利用预训练掩码语言模型捕捉流形变化,在多数据集上实现高检测准确率,性能优于或比肩现有SOTA防御方法。

摘要:

对抗攻击对机器学习模型在安全关键应用中的可靠部署构成严重威胁,它们可通过对输入稍作修改误导现有模型做出错误预测。近年来,大量研究表明对抗样本往往偏离正常样本的底层数据流形,而预训练掩码语言模型能够拟合正常自然语言处理(NLP)数据的流形。为探索如何将掩码语言模型应用于对抗检测,我们提出了一种新颖的文本对抗样本检测方法,即基于掩码语言模型的检测(Masked Language Model-based Detection,MLMD),该方法通过探究掩码语言模型引发的流形变化,能够在正常样本与对抗样本之间产生清晰可区分的信号。MLMD 具备即插即用的对抗防御特性(无需重新训练受害模型),且对分类任务、受害模型架构以及待防御的攻击方法均无依赖。我们在多个基准文本数据集、广泛研究的机器学习模型以及最先进(SOTA)的对抗攻击上对 MLMD 进行了评估,共计 3*4*4 = 48 种实验设置。实验结果表明,MLMD 可实现优异性能,在 AG-NEWS、IMDB 和 SST-2 数据集上的检测准确率分别高达 0.984、0.967 和 0.901。此外,MLMD 在检测准确率和 F1 分数上优于或至少与最先进的检测防御方法相当。在众多基于对抗样本离流形假设的防御方法中,本研究为捕捉流形变化提供了新的视角。本研究的代码可在 https://github.com/mlmddetection/MLMDdetection 公开获取。

英文摘要:

Adversarial attacks are a serious threat to the reliable deployment of machine learning models in safety-critical applications. They can misguide current models to predict incorrectly by slightly modifying the inputs. Recently, substantial work has shown that adversarial examples tend to deviate from the underlying data manifold of normal examples, whereas pre-trained masked language models can fit the manifold of normal NLP data. To explore how to use the masked language model in adversarial detection, we propose a novel textual adversarial example detection method, namely Masked Language Model-based Detection (MLMD), which can produce clearly distinguishable signals between normal examples and adversarial examples by exploring the changes in manifolds induced by the masked language model. MLMD features a plug and play usage (i.e., no need to retrain the victim model) for adversarial defense and it is agnostic to classification tasks, victim model's architectures, and to-be-defended attack methods. We evaluate MLMD on various benchmark textual datasets, widely studied machine learning models, and state-of-the-art (SOTA) adversarial attacks (in total $3*4*4 = 48$ settings). Experimental results show that MLMD can achieve strong performance, with detection accuracy up to 0.984, 0.967, and 0.901 on AG-NEWS, IMDB, and SST-2 datasets, respectively. Additionally, MLMD is superior, or at least comparable to, the SOTA detection defenses in detection accuracy and F1 score. Among many defenses based on the off-manifold assumption of adversarial examples, this work offers a new angle for capturing the manifold change. The code for this work is openly accessible at \url{https://github.com/mlmddetection/MLMDdetection}.

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

↑