Skip to main content
QUICK REVIEW

[论文解读] A Prompting-based Approach for Adversarial Example Generation and Robustness Enhancement

Yuting Yang, Pei Huang|arXiv (Cornell University)|Mar 21, 2022
Adversarial Robustness in Machine Learning被引用 4
一句话总结

本文提出了一种基于提示的对抗性攻击(PAT),通过设计恶意提示并利用预训练语言模型(PLMs)填充掩码标记,生成自然、流畅且多样化的对抗性样本,无需查询受害模型即可实现高攻击成功率。此外,本文还提出了一种基于提示的对抗性训练方法,在准确率下降最小的情况下提升了模型的鲁棒性,与传统方法相比,鲁棒性准确率最高可提升10%。

ABSTRACT

Recent years have seen the wide application of NLP models in crucial areas such as finance, medical treatment, and news media, raising concerns of the model robustness and vulnerabilities. In this paper, we propose a novel prompt-based adversarial attack to compromise NLP models and robustness enhancement technique. We first construct malicious prompts for each instance and generate adversarial examples via mask-and-filling under the effect of a malicious purpose. Our attack technique targets the inherent vulnerabilities of NLP models, allowing us to generate samples even without interacting with the victim NLP model, as long as it is based on pre-trained language models (PLMs). Furthermore, we design a prompt-based adversarial training method to improve the robustness of PLMs. As our training method does not actually generate adversarial samples, it can be applied to large-scale training sets efficiently. The experimental results show that our attack method can achieve a high attack success rate with more diverse, fluent and natural adversarial examples. In addition, our robustness enhancement method can significantly improve the robustness of models to resist adversarial attacks. Our work indicates that prompting paradigm has great potential in probing some fundamental flaws of PLMs and fine-tuning them for downstream tasks.

研究动机与目标

  • 探究恶意设计的提示是否能够暴露预训练语言模型(PLMs)中固有的鲁棒性缺陷。
  • 开发一种无需与受害模型进行迭代交互的查询高效型对抗性攻击方法。
  • 与传统的基于搜索的方法相比,生成更具自然性、流畅性和多样性的对抗性样本。
  • 设计一种基于提示的对抗性训练技术,以提升模型鲁棒性,同时避免依赖耗时的对抗样本生成过程。
  • 证明提示机制可作为一种强大范式,用于探测并缓解PLMs中的根本性漏洞。

提出的方法

  • 构建一个包含掩码输入和恶意触发词文本的提示模板,以传达特定的对抗性意图。
  • 使用预训练语言模型填充提示中的掩码位置,生成包含恶意意图的改写文本。
  • 移除触发词文本,获得外观自然但会误导下游分类器的对抗性样本,同时保持语义连贯性。
  • 利用少量已知的对抗性样本微调基于提示的攻击,以提升攻击性能,模拟模型从示例中学习的过程。
  • 设计一种基于提示的对抗性训练方法,在微调过程中注入对抗性提示,避免显式生成对抗性样本。
  • 将基于提示的训练方法应用于下游模型,提升鲁棒性,同时在测试集上保持高干净准确率。

实验结果

研究问题

  • RQ1恶意构造的提示是否能有效利用预训练语言模型中的固有漏洞,生成对抗性样本?
  • RQ2基于提示的方法是否能生成比基于搜索的方法更具自然性、流畅性和多样性的对抗性样本?
  • RQ3在不查询受害模型的情况下,基于提示的攻击能取得多大程度的成功?
  • RQ4基于提示的对抗性训练是否能显著提升模型鲁棒性,同时不损害干净准确率?
  • RQ5提示机制是否可作为探测和提升NLP模型鲁棒性的可扩展且高效范式?

主要发现

  • 所提出的PAT攻击在MR数据集上实现了43.02%的高攻击成功率,在IMDB数据集上达到36.87%,且相比基于搜索的基线方法,流畅性和多样性显著提升。
  • 在SNLI数据集上,PAT实现了44.50%的鲁棒性准确率,优于基线BERT模型(29.50%)和对抗性训练方法(22.00%)在相同攻击下的表现。
  • 与传统对抗性训练相比,基于提示的对抗性训练方法将鲁棒性准确率提高了约10%,同时干净准确率下降不足2%。
  • 该方法在显著提升鲁棒性的同时,保持了高干净准确率(如MR数据集上为89.50%,IMDB数据集上为92.20%),表明准确率与鲁棒性之间具有有利的权衡。
  • 实验表明,基于提示的训练方法具有可扩展性和高效性,因为它避免了训练过程中生成对抗性样本的高成本过程。
  • 结果表明,精心设计的提示能够有效探测并利用PLMs中的鲁棒性缺陷,提示提示机制是鲁棒性分析与增强的有前景范式。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。