Recently it has been shown that state-of-the-art NLP models are vulnerable to adversarial attacks, where the predictions of a model can be drastically altered by slight modifications to the input (such as synonym substitutions). While several defense techniques have been proposed, and adapted, to the discrete nature of text adversarial attacks, the benefits of general-purpose regularization methods such as label smoothing for language models, have not been studied. In this paper, we study the adversarial robustness provided by various label smoothing strategies in foundational models for diverse NLP tasks in both in-domain and out-of-domain settings. Our experiments show that label smoothing significantly improves adversarial robustness in pre-trained models like BERT, against various popular attacks. We also analyze the relationship between prediction confidence and robustness, showing that label smoothing reduces over-confident errors on adversarial examples.
translated by 谷歌翻译
Machine learning algorithms are often vulnerable to adversarial examples that have imperceptible alterations from the original counterparts but can fool the state-of-the-art models. It is helpful to evaluate or even improve the robustness of these models by exposing the maliciously crafted adversarial examples. In this paper, we present TEXTFOOLER, a simple but strong baseline to generate adversarial text. By applying it to two fundamental natural language tasks, text classification and textual entailment, we successfully attacked three target models, including the powerful pre-trained BERT, and the widely used convolutional and recurrent neural networks. We demonstrate three advantages of this framework:(1) effective-it outperforms previous attacks by success rate and perturbation rate, (2) utility-preserving-it preserves semantic content, grammaticality, and correct types classified by humans, and (3) efficient-it generates adversarial text with computational complexity linear to the text length. 1
translated by 谷歌翻译
关于NLP模型的最先进攻击缺乏对成功攻击的共享定义。我们将思考从过去的工作蒸馏成统一的框架:一个成功的自然语言对抗性示例是欺骗模型并遵循一些语言限制的扰动。然后,我们分析了两个最先进的同义词替换攻击的产出。我们发现他们的扰动通常不会保留语义,38%引入语法错误。人类调查显示,为了成功保留语义,我们需要大大增加交换词语的嵌入和原始和扰动句子的句子编码之间的最小余弦相似之处。与更好的保留语义和语法性,攻击成功率下降超过70个百分点。
translated by 谷歌翻译
Robustness evaluation against adversarial examples has become increasingly important to unveil the trustworthiness of the prevailing deep models in natural language processing (NLP). However, in contrast to the computer vision domain where the first-order projected gradient descent (PGD) is used as the benchmark approach to generate adversarial examples for robustness evaluation, there lacks a principled first-order gradient-based robustness evaluation framework in NLP. The emerging optimization challenges lie in 1) the discrete nature of textual inputs together with the strong coupling between the perturbation location and the actual content, and 2) the additional constraint that the perturbed text should be fluent and achieve a low perplexity under a language model. These challenges make the development of PGD-like NLP attacks difficult. To bridge the gap, we propose TextGrad, a new attack generator using gradient-driven optimization, supporting high-accuracy and high-quality assessment of adversarial robustness in NLP. Specifically, we address the aforementioned challenges in a unified optimization framework. And we develop an effective convex relaxation method to co-optimize the continuously-relaxed site selection and perturbation variables and leverage an effective sampling method to establish an accurate mapping from the continuous optimization variables to the discrete textual perturbations. Moreover, as a first-order attack generation method, TextGrad can be baked into adversarial training to further improve the robustness of NLP models. Extensive experiments are provided to demonstrate the effectiveness of TextGrad not only in attack generation for robustness evaluation but also in adversarial defense.
translated by 谷歌翻译
尽管在许多机器学习任务方面取得了巨大成功,但深度神经网络仍然易于对抗对抗样本。虽然基于梯度的对抗攻击方法在计算机视野领域探索,但由于文本的离散性质,直接应用于自然语言处理中,这是不切实际的。为了弥合这一差距,我们提出了一般框架,以适应现有的基于梯度的方法来制作文本对抗性样本。在该框架中,将基于梯度的连续扰动添加到嵌入层中,并在前向传播过程中被放大。然后用掩模语言模型头解码最终的扰动潜在表示以获得潜在的对抗性样本。在本文中,我们将我们的框架与\ textbf {t} Extual \ TextBF {P} ROJECTED \ TextBF {G} Radient \ TextBF {D} excent(\ TextBF {TPGD})进行ronject \ textbf {p}。我们通过在三个基准数据集上执行转移黑匣子攻击来评估我们的框架来评估我们的框架。实验结果表明,与强基线方法相比,我们的方法达到了更好的性能,并产生更精细和语法的对抗性样本。所有代码和数据都将公开。
translated by 谷歌翻译
在过去几年中,已经提出了各种文字攻击方法来揭示自然语言处理中使用的深度神经网络的脆弱性。通常,这些方法涉及一个重要的优化步骤,以确定原始输入中的每个单词使用的替代。然而,从对问题理解和解决问题的角度来看,对这一步骤的目前的研究仍然是有限的。在本文中,我们通过揭示问题的理论属性并提出有效的本地搜索算法(LS)来解决这些问题来解决这些问题。我们建立了一个关于解决问题的第一个可提供的近似保证。涉及5个NLP任务,8个数据集和26个NLP模型的扩展实验表明,LS可能大大降低了Qualies数量,以实现高攻击成功率。进一步的实验表明,LS制造的对抗例通常具有更高的质量,表现出更好的可转移性,并且可以通过对抗培训为受害者模型带来更高的鲁棒性改善。
translated by 谷歌翻译
Adversarial attacks in NLP challenge the way we look at language models. The goal of this kind of adversarial attack is to modify the input text to fool a classifier while maintaining the original meaning of the text. Although most existing adversarial attacks claim to fulfill the constraint of semantics preservation, careful scrutiny shows otherwise. We show that the problem lies in the text encoders used to determine the similarity of adversarial examples, specifically in the way they are trained. Unsupervised training methods make these encoders more susceptible to problems with antonym recognition. To overcome this, we introduce a simple, fully supervised sentence embedding technique called Semantics-Preserving-Encoder (SPE). The results show that our solution minimizes the variation in the meaning of the adversarial examples generated. It also significantly improves the overall quality of adversarial examples, as confirmed by human evaluators. Furthermore, it can be used as a component in any existing attack to speed up its execution while maintaining similar attack success.
translated by 谷歌翻译
最近的自然语言处理(NLP)技术在基准数据集中实现了高性能,主要原因是由于深度学习性能的显着改善。研究界的进步导致了最先进的NLP任务的生产系统的巨大增强,例如虚拟助理,语音识别和情感分析。然而,随着对抗性攻击测试时,这种NLP系统仍然仍然失败。初始缺乏稳健性暴露于当前模型的语言理解能力中的令人不安的差距,当NLP系统部署在现实生活中时,会产生问题。在本文中,我们通过以各种维度的系统方式概述文献来展示了NLP稳健性研究的结构化概述。然后,我们深入了解稳健性的各种维度,跨技术,指标,嵌入和基准。最后,我们认为,鲁棒性应该是多维的,提供对当前研究的见解,确定文学中的差距,以建议值得追求这些差距的方向。
translated by 谷歌翻译
我们专注于在黑框设置中对模型的对抗性攻击的问题,攻击者旨在制作对受害者模型的查询访问有限的对抗性示例。现有的黑框攻击主要基于贪婪的算法,使用预先计算的关键位置来扰动,从而严重限制了搜索空间,并可能导致次优的解决方案。为此,我们提出了使用贝叶斯优化的查询有效的黑盒攻击,该贝叶斯优化使用自动相关性确定(ARD)分类内核动态计算重要位置。我们引入了块分解和历史次采样技术,以提高输入序列长时间时贝叶斯优化的可伸缩性。此外,我们开发了一种优化后算法,该算法找到了具有较小扰动大小的对抗示例。关于自然语言和蛋白质分类任务的实验表明,与先前的最新方法相比,我们的方法始终达到更高的攻击成功率,查询计数和修改率的显着降低。
translated by 谷歌翻译
Pre-trained programming language (PL) models (such as CodeT5, CodeBERT, GraphCodeBERT, etc.,) have the potential to automate software engineering tasks involving code understanding and code generation. However, these models operate in the natural channel of code, i.e., they are primarily concerned with the human understanding of the code. They are not robust to changes in the input and thus, are potentially susceptible to adversarial attacks in the natural channel. We propose, CodeAttack, a simple yet effective black-box attack model that uses code structure to generate effective, efficient, and imperceptible adversarial code samples and demonstrates the vulnerabilities of the state-of-the-art PL models to code-specific adversarial attacks. We evaluate the transferability of CodeAttack on several code-code (translation and repair) and code-NL (summarization) tasks across different programming languages. CodeAttack outperforms state-of-the-art adversarial NLP attack models to achieve the best overall drop in performance while being more efficient, imperceptible, consistent, and fluent. The code can be found at https://github.com/reddy-lab-code-research/CodeAttack.
translated by 谷歌翻译
Recent works on Lottery Ticket Hypothesis have shown that pre-trained language models (PLMs) contain smaller matching subnetworks(winning tickets) which are capable of reaching accuracy comparable to the original models. However, these tickets are proved to be notrobust to adversarial examples, and even worse than their PLM counterparts. To address this problem, we propose a novel method based on learning binary weight masks to identify robust tickets hidden in the original PLMs. Since the loss is not differentiable for the binary mask, we assign the hard concrete distribution to the masks and encourage their sparsity using a smoothing approximation of L0 regularization.Furthermore, we design an adversarial loss objective to guide the search for robust tickets and ensure that the tickets perform well bothin accuracy and robustness. Experimental results show the significant improvement of the proposed method over previous work on adversarial robustness evaluation.
translated by 谷歌翻译
神经网络缺乏对抗性鲁棒性,即,它们容易受到对抗的例子,通过对输入的小扰动导致错误的预测。此外,当模型给出错误的预测时,信任被破坏,即,预测的概率不是我们应该相信我们模型的良好指标。在本文中,我们研究了对抗性鲁棒性和校准之间的联系,发现模型对小扰动敏感的输入(很容易攻击)更有可能具有较差的预测。基于这种洞察力,我们通过解决这些对抗的缺陷输入来研究校准。为此,我们提出了基于对抗基于对抗的自适应标签平滑(AR-AD),其通过适应性软化标签,通过适应性软化标签来整合对抗性鲁棒性和校准到训练中的相关性,这是基于对敌人可以攻击的容易攻击。我们发现我们的方法,考虑了分销数据的对抗性稳健性,即使在分布班次下也能够更好地校准模型。此外,还可以应用于集合模型,以进一步提高模型校准。
translated by 谷歌翻译
extreme Multilabel文本分类(XMTC)是一个文本分类问题,其中(i)输出空间非常大,(ii)每个数据点可以具有多个正标签,并且(iii)数据遵循强不平衡的分布。通过在推荐系统中的应用和网络级文档的自动标记,对XMTC的研究一直专注于提高预测准确性并处理不平衡数据。然而,基于深度学习的XMTC模型对抗对抗示例的鲁棒性已经很大程度上是曝光率的。在本文中,我们调查了对抗攻击下XMTC模型的行为。为此,首先,我们定义了多标签文本分类问题中的对抗攻击。我们将攻击多书文本分类器分类为(a)正面目标,其中目标正标签应落在Top-K预测标签中,(b)负面目标,其中目标负面标签应该是预测的顶部K之间标签。然后,通过对APLC-XLNET和IppersionXML的实验,我们显示XMTC模型非常容易受到正面目标的攻击,但对负数目标的攻击更加强大。此外,我们的实验表明,积极靶向对抗攻击的成功率具有不平衡的分布。更精确地,尾部类易受对抗的攻击攻击,攻击者可以产生与实际数据点高相似性的对抗性样本。为了克服这个问题,我们探讨了XMTC中重新平衡损失函数的影响,不仅它们不仅增加了尾班的准确性,而且还可以提高这些课程对抗对抗攻击的鲁棒性。我们的实验的代码可以在https://github.com/xmc-aalto/adv-xmtc上获得
translated by 谷歌翻译
文本对抗攻击暴露了文本分类器的漏洞,可用于改善其稳健性。现有的上下文感知方法仅考虑黄金标签的概率,并在搜索攻击路径时使用贪婪的搜索,通常会限制攻击效率。为了解决这些问题,我们提出了PDB,这是一种使用概率差的引导光束搜索的上下文感知的文本对抗攻击模型。概率差异是所有类标签概率的总体考虑,PDB使用它来指导攻击路径的选择。此外,PDBS使用Beam搜索找到成功的攻击路径,从而避免搜索空间有限。广泛的实验和人类评估表明,PDB在一系列评估指标中的表现优于以前的最佳模型,尤其是提高 +19.5%的攻击成功率。消融研究和定性分析进一步证实了PDB的效率。
translated by 谷歌翻译
深度变压器神经网络模型在生物医学域中提高了智能文本处理系统的预测精度。他们在各种各样的生物医学和临床自然语言处理(NLP)基准上获得了最先进的性能分数。然而,到目前为止,这些模型的稳健性和可靠性较小。神经NLP模型可以很容易地被对抗动物样本所欺骗,即输入的次要变化,以保留文本的含义和可理解性,而是强制NLP系统做出错误的决策。这提出了对生物医学NLP系统的安全和信任的严重担忧,特别是当他们旨在部署在现实世界用例中时。我们调查了多种变压器神经语言模型的强大,即Biobert,Scibert,Biomed-Roberta和Bio-Clinicalbert,在各种生物医学和临床文本处理任务中。我们实施了各种对抗的攻击方法来测试不同攻击方案中的NLP系统。实验结果表明,生物医学NLP模型对对抗性样品敏感;它们的性能平均分别平均下降21%和18.9个字符级和字级对抗噪声的绝对百分比。进行广泛的对抗训练实验,我们在清洁样品和对抗性投入的混合物上进行了微调NLP模型。结果表明,对抗性训练是对抗对抗噪声的有效防御机制;模型的稳健性平均提高11.3绝对百分比。此外,清洁数据的模型性能平均增加2.4个绝对存在,表明对抗性训练可以提高生物医学NLP系统的概括能力。
translated by 谷歌翻译
深度神经网络在解决各种现实世界任务中具有广泛的应用,并在计算机视觉,图像分类和自然语言处理等域中实现了令人满意的结果。同时,神经网络的安全性和稳健性成为必要的,因为不同的研究表明了神经网络的脆弱方面。在点的情况下,在自然语言处理任务中,神经网络可以由秘密修改的文本欺骗,这与原始文本具有高相似性。根据以前的研究,大多数研究都集中在图像领域;与图像逆势攻击不同,文本以离散序列表示,传统的图像攻击方法不适用于NLP字段。在本文中,我们提出了一个单词级NLP情绪分类器攻击模型,包括一种基于自我关注机制的词选择方法和用于Word替换的贪婪搜索算法。我们通过在IMDB数据集中攻击GRU和1D-CNN受害者模型进行攻击模型进行实验。实验结果表明,我们的模型达到了更高的攻击成功率,并且比以前的方法更有效,因为由于有效的单词选择算法,并且最小化了单词替代数。此外,我们的模型可转换,可用于具有多种修改的图像域。
translated by 谷歌翻译
在过去的几年中,保护NLP模型免受拼写错误的障碍是研究兴趣的对象。现有的补救措施通常会损害准确性,或者需要对每个新的攻击类别进行完整的模型重新训练。我们提出了一种新颖的方法,可以向基于变压器的NLP模型中的拼写错误增加弹性。可以实现这种鲁棒性,而无需重新训练原始的NLP模型,并且只有最小的语言丧失理解在没有拼写错误的输入上的性能。此外,我们提出了一种新的有效近似方法来产生对抗性拼写错误,这大大降低了评估模型对对抗性攻击的弹性所需的成本。
translated by 谷歌翻译
最近,已经表明,自然语言处理(NLP)模型容易受到一种称为后门攻击的安全威胁,它利用“后门触发器”范例误导模型。最威胁的后门攻击是隐身的后门,它将触发器定义为文本样式或句法。虽然他们已经取得了令人难以置信的高攻击成功率(ASR),但我们发现为ASR的主要因素贡献不是“后门触发”范式。因此,当作为后门攻击分类时,这些隐身后门攻击的能力大得多。因此,为了评估后门攻击的真正攻击力,我们提出了一种称为攻击成功率差异(ASRD)的新度量,从而测量干净状态和毒药状态模型之间的ASR差异。此外,由于对抗隐蔽的后门攻击的防御,我们提出了触发破坏者,包括两个太简单的技巧,可以有效地防御隐秘的后门攻击。关于文本分类任务的实验表明,我们的方法比对隐身后门攻击的最先进的防御方法实现了更好的性能。
translated by 谷歌翻译
现有的研究表明,对抗性示例可以直接归因于具有高度预测性的非稳态特征的存在,但很容易被对手对愚弄NLP模型进行操纵。在这项研究中,我们探讨了捕获特定于任务的鲁棒特征的可行性,同时使用信息瓶颈理论消除了非舒适的特征。通过广泛的实验,我们表明,通过我们的信息基于瓶颈的方法训练的模型能够在稳健的精度上取得显着提高,超过了所有先前报道的防御方法的性能,而在SST-2上几乎没有遭受清洁准确性的表现下降,Agnews和IMDB数据集。
translated by 谷歌翻译
最近的作品表明了解释性和鲁棒性是值得信赖和可靠的文本分类的两个关键成分。然而,以前的作品通常是解决了两个方面的一个:i)如何提取准确的理由,以便在有利于预测的同时解释; ii)如何使预测模型对不同类型的对抗性攻击稳健。直观地,一种产生有用的解释的模型应该对对抗性攻击更加强大,因为我们无法信任输出解释的模型,而是在小扰动下改变其预测。为此,我们提出了一个名为-BMC的联合分类和理由提取模型。它包括两个关键机制:混合的对手训练(AT)旨在在离散和嵌入空间中使用各种扰动,以改善模型的鲁棒性,边界匹配约束(BMC)有助于利用边界信息的引导来定位理由。基准数据集的性能表明,所提出的AT-BMC优于分类和基本原子的基础,由大边距提取。鲁棒性分析表明,建议的AT-BMC将攻击成功率降低了高达69%。经验结果表明,强大的模型与更好的解释之间存在连接。
translated by 谷歌翻译