自然语言处理(Natural Language Processing,NLP)模型易受后门攻击的攻击,这是NLP模型面临的一个新的威胁。现有的NLP模型在线后门防御方法只关注输入或输出层面的异常,仍然存在易受自适应攻击和计算代价高的问题。在这项工作中,我们采取的第一步,在中间特征水平上研究文本中毒样本的去隐藏,并提出了一种基于特征的有效的在线防御方法。通过对现有攻击方法的大量实验,我们发现中毒样本在中毒NLP模型的中间特征空间中远离干净样本。出于这一观察,我们设计了一个基于距离的异常分数(DAN)区分中毒的样本从干净的样本在功能级别。在情感分析和攻击检测任务上的实验证明了DAN的优越性,因为它在防御性能方面大大超过现有的在线防御方法,并且具有较低的推理成本。此外,我们还证明了DAN也能抵抗基于特征级正则化的自适应攻击。我们的代码可在https://github.com/lancopku/DAN上获得。
英文摘要:
Natural language processing (NLP) models are known to be vulnerable to backdoor attacks, which poses a newly arisen threat to NLP models. Prior online backdoor defense methods for NLP models only focus on the anomalies at either the input or output level, still suffering from fragility to adaptive attacks and high computational cost. In this work, we take the first step to investigate the unconcealment of textual poisoned samples at the intermediate-feature level and propose a feature-based efficient online defense method. Through extensive experiments on existing attacking methods, we find that the poisoned samples are far away from clean samples in the intermediate feature space of a poisoned NLP model. Motivated by this observation, we devise a distance-based anomaly score (DAN) to distinguish poisoned samples from clean samples at the feature level. Experiments on sentiment analysis and offense detection tasks demonstrate the superiority of DAN, as it substantially surpasses existing online defense methods in terms of defending performance and enjoys lower inference costs. Moreover, we show that DAN is also resistant to adaptive attacks based on feature-level regularization. Our code is available at https://github.com/lancopku/DAN.
Merging Triggers, Breaking Backdoors: Defensive Poisoning for Instruction-Tuned Language Models
Graduate School of Artificial Intelligence, POSTECH, Republic of Korea(POSTECH人工智能研究生院,韩国);Department of Computer Science and Engineering, POSTECH, Republic of Korea(POSTECH计算机科学与工程系,韩国)
ONION: A Simple and Effective Defense Against Textual Backdoor Attacks
Tsinghua University(清华大学);Beijing National Research Center for Information Science and Technology(北京信息科学与技术国家研究中心);Huazhong University of Science and Technology(华中科技大学);Beihang University(北京航空航天大学)
Test-time Backdoor Mitigation for Black-Box Large Language Models with Defensive Demonstrations
University of Southern California(南加州大学);Harvard University(哈佛大学);University of California, Davis(加州大学戴维斯分校);University of Wisconsin-Madison(威斯康星大学麦迪逊分校)