Prompt-based learning has been proved to be an effective way in pre-trained language models (PLMs), especially in low-resource scenarios like few-shot settings. However, the trustworthiness of PLMs is of paramount significance and potential vulnerabilities have been shown in prompt-based templates that could mislead the predictions of language models, causing serious security concerns. In this paper, we will shed light on some vulnerabilities of PLMs, by proposing a prompt-based adversarial attack on manual templates in black box scenarios. First of all, we design character-level and word-level heuristic approaches to break manual templates separately. Then we present a greedy algorithm for the attack based on the above heuristic destructive approaches. Finally, we evaluate our approach with the classification tasks on three variants of BERT series models and eight datasets. And comprehensive experimental results justify the effectiveness of our approach in terms of attack success rate and attack speed. Further experimental studies indicate that our proposed method also displays good capabilities in scenarios with varying shot counts, template lengths and query counts, exhibiting good generalizability.
翻译:基于提示的学习已被证明是预训练语言模型(PLMs)中的有效方法,尤其在少样本等低资源场景下。然而,PLMs的可信性至关重要,且已有研究表明提示模板存在潜在漏洞,可能误导语言模型的预测,引发严重的安全问题。本文通过提出一种针对黑盒场景下手动模板的基于提示的对抗攻击方法,揭示PLMs的某些脆弱性。首先,我们分别设计字符级和词级启发式方法以破坏手动模板;其次,基于上述启发式破坏方法,提出一种贪婪攻击算法;最后,我们在三种BERT系列模型变体及八个数据集上通过分类任务评估该方法。全面的实验结果验证了本方法在攻击成功率和攻击速度方面的有效性。进一步的实验研究表明,所提方法在不同样本数量、模板长度及查询次数场景下均表现良好,显示出较强的泛化能力。