[论文解读] TextDefense: Adversarial Text Detection based on Word Importance Entropy
TextDefense 是一种新颖的、与攻击方式无关的对抗性文本检测框架,通过分析目标模型预测结果中的词重要性熵来检测对抗性样本。通过分析词重要性分布的变化,它在多种模型、数据集和攻击类型下均实现了高性能检测(AUC > 0.95),优于当前最先进方法,且无需事先了解攻击方式或引入显著的计算开销。
Currently, natural language processing (NLP) models are wildly used in various scenarios. However, NLP models, like all deep models, are vulnerable to adversarially generated text. Numerous works have been working on mitigating the vulnerability from adversarial attacks. Nevertheless, there is no comprehensive defense in existing works where each work targets a specific attack category or suffers from the limitation of computation overhead, irresistible to adaptive attack, etc. In this paper, we exhaustively investigate the adversarial attack algorithms in NLP, and our empirical studies have discovered that the attack algorithms mainly disrupt the importance distribution of words in a text. A well-trained model can distinguish subtle importance distribution differences between clean and adversarial texts. Based on this intuition, we propose TextDefense, a new adversarial example detection framework that utilizes the target model's capability to defend against adversarial attacks while requiring no prior knowledge. TextDefense differs from previous approaches, where it utilizes the target model for detection and thus is attack type agnostic. Our extensive experiments show that TextDefense can be applied to different architectures, datasets, and attack methods and outperforms existing methods. We also discover that the leading factor influencing the performance of TextDefense is the target model's generalizability. By analyzing the property of the target model and the property of the adversarial example, we provide our insights into the adversarial attacks in NLP and the principles of our defense method.
研究动机与目标
- 解决自然语言处理中对抗性文本缺乏通用、与攻击方式无关的防御机制的问题。
- 识别一种通用信号——词重要性分布的破坏——以区分对抗性文本与干净文本。
- 开发一种检测框架,利用目标模型自身的行为进行检测,无需事先了解攻击方式或重新训练模型。
- 评估该方法在多种架构、数据集和攻击类型(包括未见过或自适应攻击)下的鲁棒性。
- 理解模型泛化能力在对抗性检测性能中的作用。
提出的方法
- TextDefense 基于词对模型预测置信度的影响,计算输入文本中每个词的重要性得分。
- 通过测量词重要性分布的熵作为检测对抗性扰动的信号。
- 通过替换输入文本中的词为同义词或随机词,并在多次前向传播中观察重要性熵的变化来实现扰动。
- 利用熵变化量的阈值将样本分类为对抗性或干净文本,依赖于模型内部的一致性。
- 该框架设计为与攻击类型无关,仅依赖于目标模型的预测行为。
- 支持迁移性:当原始模型较大时,可使用小型替代模型来降低推理成本。
实验结果
研究问题
- RQ1词重要性熵是否可作为跨多种攻击类型的通用信号,用于检测对抗性文本?
- RQ2TextDefense 的性能在多大程度上依赖于目标模型的泛化能力?
- RQ3TextDefense 是否可在不了解攻击方法的前提下,检测已知和未知的对抗性攻击?
- RQ4在 AUC 和鲁棒性方面,TextDefense 与当前最先进检测方法及对抗性训练方法相比表现如何?
- RQ5TextDefense 在检测具有标签反转模式的对抗性样本时存在哪些局限性?
主要发现
- TextDefense 在五个数据集和多种攻击方法上实现了平均 AUC 0.954,显著优于当前最先进检测和对抗性训练基线方法。
- 即使在黑盒、查询高效且语义保持的攻击(如 TextFooler 和 PWWS)下,该方法仍保持高检测性能(AUC > 0.95)。
- 当目标模型的置信度降至 0.02 时,TextDefense 仍可实现 AUC 0.6449,表明其在强攻击下仍具备部分有效性。
- TextDefense 的性能与目标模型的泛化能力密切相关,泛化能力越强的模型,检测准确率越高。
- 误检主要出现在标签反转攻击中(例如,用非毒性词替换毒性词),此时模型置信度的变化方式与干净文本相似。
- TextDefense 对迁移攻击具有鲁棒性,即使使用替代模型进行推理,也能有效检测对抗性样本,从而降低计算成本。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。