无需模型访问,仅用两次查询即可检测文本对抗攻击
RTD-Guard: A Black-Box Textual Adversarial Detection Framework via Replacement Token Detection
- 利用预训练的替换词检测器定位可疑词语
- 通过前后预测置信度变化判断是否为对抗样本
- 适合资源受限或隐私敏感场景部署
文本对抗攻击通过引入人眼难以察觉的扰动,严重威胁自然语言处理系统的安全性。尽管对抗样本检测可作为鲁棒训练的轻量级替代方案,但现有方法通常依赖攻击先验知识、白盒模型访问或大量查询,严重限制了实际应用。本文提出RTD-Guard,一种新型黑盒文本对抗样本检测框架。核心思想是:对抗攻击中的词替换扰动与预训练的替换词检测(RTD)判别器所识别的“被替换词”高度相似。基于此,RTD-Guard直接使用现成的、未经微调的RTD判别器,定位可疑词,掩码后观察目标模型预测置信度的变化,从而检测对抗样本。整个过程无需对抗数据、模型调优或内部模型访问,仅需两次黑盒查询。在多个基准数据集上的全面实验表明,RTD-Guard能有效检测多种先进攻击生成的对抗文本,在多项指标上优于现有基线,提供高效、实用且资源消耗极低的防御机制,尤其适用于资源受限或隐私敏感的实际场景。
原文摘要 · Abstract (English)
Textual adversarial attacks pose a serious security threat to Natural Language Processing (NLP) systems by introducing imperceptible perturbations that mislead deep learning models. While adversarial example detection offers a lightweight alternative to robust training, existing methods typically rely on prior knowledge of attacks, white-box access to the victim model, or numerous queries, which severely limits their practical deployment. This paper introduces RTD-Guard, a novel black-box framework for detecting textual adversarial examples. Our key insight is that word-substitution perturbations in adversarial attacks closely resemble the "replaced tokens" that a Replaced Token Detection (RTD) discriminator is pre-trained to identify. Leveraging this, RTD-Guard employs an off-the-shelf RTD discriminator-without fine-tuning-to localize suspicious tokens, masks them, and detects adversarial examples by observing the prediction confidence shift of the victim model before and after intervention. The entire process requires no adversarial data, model tuning, or internal model access, and uses only two black-box queries. Comprehensive experiments on multiple benchmark datasets demonstrate that RTD-Guard effectively detects adversarial texts generated by diverse state-of-the-art attack methods. It surpasses existing detection baselines across multiple metrics, offering a highly efficient, practical, and resource-light defense mechanism-particularly suited for real-world deployment in resource-constrained or privacy-sensitive environments.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。