Certified Adversarial Robustness via Randomized Smoothing | AGIDaily
AGI Daily
资讯日报词条论文人物新创
返回论文列表
1. 引言2. 相关工作3. 随机平滑3.1. 鲁棒性保证3.2. 实用算法3.3. 训练基分类器4. 实验5. 结论6. 致谢
返回论文列表
目录

Certified Adversarial Robustness via Randomized Smoothing

收录于 ICML 2019 会议论文被引 2,576 次
打开论文来源

Certified Adversarial Robustness via Randomized Smoothing

Jeremy Cohen(^1) Elan Rosenfeld(^1) J. Zico Kolter(^{1\ 2})

(^1)Carnegie Mellon University (^2)Bosch Center for AI. Correspondence to: Jeremy Cohen jeremycohen@cmu.edu.

Proceedings of the 36th International Conference on Machine Learning, Long Beach, California, PMLR 97, 2019. Copyright 2019 by the author(s).

Abstract

摘要

We show how to turn any classifier that classifies well under Gaussian noise into a new classifier that is certifiably robust to adversarial perturbations under the (\ell_2) norm. While this “randomized smoothing” technique has been proposed before in the literature, we are the first to provide a tight analysis, which establishes a close connection between (\ell_2) robustness and Gaussian noise. We use the technique to train an ImageNet classifier with e.g. a certified top-1 accuracy of 49% under adversarial perturbations with (\ell_2) norm less than 0.5 (=127/255). Smoothing is the only approach to certifiably robust classification which has been shown feasible on full-resolution ImageNet. On smaller-scale datasets where competing approaches to certified (\ell_2) robustness are viable, smoothing delivers higher certified accuracies. The empirical success of the approach suggests that provable methods based on randomization at prediction time are a promising direction for future research into adversarially robust classification. Code and models are available at http://github.com/locuslab/smoothing.

我们说明如何把任意一个在高斯噪声下分类得好的分类器,转成对 (\ell_2) 范数下的对抗扰动具有可认证鲁棒性的新分类器。虽然文献中已经提出过这种“随机平滑”技术,我们是最先给出紧密分析的,从而在 (\ell_2) 鲁棒性与高斯噪声之间建立起密切联系。我们用这一技术训练了一个 ImageNet 分类器,例如在 (\ell_2) 范数小于 0.5(=127/255)的对抗扰动下,可认证的 top-1 准确率为 49%。平滑是当时唯一被证明能在全分辨率 ImageNet 上可行的可认证鲁棒分类方法。在相互竞争的认证 (\ell_2) 鲁棒方法也行得通的较小规模数据集上,平滑给出了更高的认证准确率。这一方法在经验上的成功表明,基于预测时随机化的可证明方法,是未来对抗鲁棒分类研究的一个有前途的方向。代码与模型见 http://github.com/locuslab/smoothing。

Evaluating the smoothed classifier at an input with class regions and class probabilities

Figure 1. Evaluating the smoothed classifier at an input (x). Left: the decision regions of the base classifier (f) are drawn in different colors. The dotted lines are the level sets of the distribution (\mathcal{N}(x, \sigma^2 I)). Right: the distribution (f(\mathcal{N}(x, \sigma^2 I))). As discussed below, (\underline{p_A}) is a lower bound on the probability of the top class and (\overline{p_B}) is an upper bound on the probability of each other class. Here, (g(x)) is “blue.”

图 1. 在输入 (x) 处评估平滑分类器。左:基分类器 (f) 的决策区域用不同颜色画出。虚线是分布 (\mathcal{N}(x, \sigma^2 I)) 的等值线。右:分布 (f(\mathcal{N}(x, \sigma^2 I)))。如下文所述,(\underline{p_A}) 是最高类概率的下界,(\overline{p_B}) 是其余每一类概率的上界。这里 (g(x)) 为“蓝色”。

1. Introduction

1. 引言

Modern image classifiers achieve high accuracy on i.i.d. test sets but are not robust to small, adversarially-chosen perturbations of their inputs (Szegedy et al., 2014; Biggio et al., 2013). Given an image (x) correctly classified by, say, a neural network, an adversary can usually engineer an adversarial perturbation (\delta) so small that (x + \delta) looks just like (x) to the human eye, yet the network classifies (x + \delta) as a different, incorrect class. Many works have proposed heuristic methods for training classifiers intended to be robust to adversarial perturbations. However, most of these heuristics have been subsequently shown to fail against suitably powerful adversaries (Carlini & Wagner, 2017; Athalye et al., 2018; Uesato et al., 2018). In response, a line of work on certifiable robustness studies classifiers whose prediction at any point (x) is verifiably constant within some set around (x) (e.g. Wong & Kolter, 2018; Raghunathan et al., 2018a). In most of these works, the robust classifier takes the form of a neural network. Unfortunately, all existing approaches for certifying the robustness of neural networks have trouble scaling to networks that are large and expressive enough to solve problems like ImageNet.

现代图像分类器在独立同分布测试集上能达到很高的准确率,但对输入上很小的、由对手选定的扰动并不鲁棒(Szegedy et al., 2014; Biggio et al., 2013)。给定一幅例如被神经网络正确分类的图像 (x),对手通常可以构造一个小到使人眼看起来 (x+\delta) 仍与 (x) 一样的对抗扰动 (\delta),网络却把 (x+\delta) 分成另一个错误的类。许多工作提出了启发式方法,试图训练对对抗扰动鲁棒的分类器。然而,这些启发式后来大多被证明无法抵御足够强的对手(Carlini & Wagner, 2017; Athalye et al., 2018; Uesato et al., 2018)。作为回应,认证鲁棒性这条研究线关注这样的分类器:在任意点 (x) 处,可以验证其预测在 (x) 周围的某个集合内保持不变(例如 Wong & Kolter, 2018; Raghunathan et al., 2018a)。这些工作中,鲁棒分类器大多仍采用神经网络的形式。不幸的是,当时所有认证神经网络鲁棒性的方法,都难以扩展到大且有足够表达能力、能够解决 ImageNet 这类问题的网络。

One workaround is to look for robust classifiers that are not neural networks. In this paper, we analyze an operation we call randomized smoothing(^1) which transforms any arbitrary base classifier (f) into a new “smoothed classifier” (g) that is certifiably robust in (\ell_2) norm. Let (f) be an arbitrary classifier which maps inputs (\mathbb{R}^d) to classes (\mathcal{Y}). For any input (x), the smoothed classifier's prediction (g(x)) is defined to be the class which (f) is most likely to classify the random variable (\mathcal{N}(x, \sigma^2 I)) as. That is, (g(x)) returns the most probable prediction by (f) of random Gaussian corruptions of (x).

一种变通办法是寻找并非神经网络的鲁棒分类器。本文分析一种我们称为随机平滑(randomized smoothing)(^1) 的操作,它把任意基分类器 (f) 变成一个在 (\ell_2) 范数下具有可认证鲁棒性的新“平滑分类器” (g)。设 (f) 是任意一个把输入 (\mathbb{R}^d) 映射到类别 (\mathcal{Y}) 的分类器。对任意输入 (x),平滑分类器的预测 (g(x)) 定义为:(f) 最可能把随机变量 (\mathcal{N}(x, \sigma^2 I)) 分成的那个类。也就是说,(g(x)) 返回的是 (f) 对 (x) 的随机高斯腐蚀所作出的最可能预测。

(^1)We adopt this term because it has been used to describe a similar technique in a different context (Duchi et al., 2012).

(^1)我们采用这一术语,是因为它曾在不同语境下被用来描述一种类似的技术(Duchi et al., 2012)。

If the base classifier (f) is most likely to classify (\mathcal{N}(x, \sigma^2 I)) as (x)'s correct class, then the smoothed classifier (g) will be correct at (x). But the smoothed classifier (g) will also possess a desirable property that the base classifier may lack: one can verify that (g)'s prediction is constant within an (\ell_2) ball around any input (x), simply by estimating the probabilities with which (f) classifies (\mathcal{N}(x, \sigma^2 I)) as each class. The higher the probability with which (f) classifies (\mathcal{N}(x, \sigma^2 I)) as the most probable class, the larger the (\ell_2) radius around (x) in which (g) provably returns that class.

如果基分类器 (f) 最可能把 (\mathcal{N}(x, \sigma^2 I)) 分成 (x) 的正确类,那么平滑分类器 (g) 在 (x) 处就会判对。但 (g) 还会具有基分类器可能没有的理想性质:只需估计 (f) 把 (\mathcal{N}(x, \sigma^2 I)) 分到各类的概率,就可以验证 (g) 的预测在任意输入 (x) 周围的一个 (\ell_2) 球内保持不变。(f) 把 (\mathcal{N}(x, \sigma^2 I)) 分成最高类的概率越高,(g) 在 (x) 周围可证明返回该类的 (\ell_2) 半径就越大。

Lecuyer et al. (2019) proposed randomized smoothing as a provable adversarial defense, and used it to train the first certifiably robust classifier for ImageNet. Subsequently, Li et al. (2018) proved a stronger robustness guarantee. However, both of these guarantees are loose, in the sense that the smoothed classifier (g) is provably always more robust than the guarantee indicates. In this paper, we prove the first tight robustness guarantee for randomized smoothing. Our analysis reveals that smoothing with Gaussian noise naturally induces certifiable robustness under the (\ell_2) norm. We suspect that other, as-yet-unknown noise distributions might induce robustness to other perturbation sets such as general (\ell_p) norm balls.

Lecuyer et al. (2019) 把随机平滑作为可证明的对抗防御提出,并用它训练了第一个面向 ImageNet 的可认证鲁棒分类器。随后,Li et al. (2018) 证明了更强的鲁棒性保证。不过,这两项保证都是松的,意思是:可以证明平滑分类器 (g) 总是比保证所说的更鲁棒。本文为随机平滑证明了第一项紧密的鲁棒性保证。我们的分析表明,用高斯噪声做平滑会自然地诱导出 (\ell_2) 范数下的可认证鲁棒性。我们猜想,其他尚未为人所知的噪声分布,也许会对一般 (\ell_p) 范数球等扰动集合诱导出鲁棒性。

Randomized smoothing has one major drawback. If (f) is a neural network, it is not possible to exactly compute the probabilities with which (f) classifies (\mathcal{N}(x, \sigma^2 I)) as each class. Therefore, it is not possible to exactly evaluate the smoothed classifier (g) or to exactly compute the radius in which (g) is robust. Instead, we present Monte Carlo algorithms for both tasks that are guaranteed to succeed with arbitrarily high probability.

随机平滑有一个主要缺点。如果 (f) 是神经网络,就无法精确计算 (f) 把 (\mathcal{N}(x, \sigma^2 I)) 分到各类的概率。因此,既无法精确计算平滑分类器 (g),也无法精确求出 (g) 鲁棒的半径。我们转而为这两项任务给出蒙特卡洛算法,并保证它们能以任意高的概率成功。

Despite this drawback, randomized smoothing enjoys several compelling advantages over other certifiably robust classifiers proposed in the literature: it makes no assumptions about the base classifier's architecture, it is simple to implement and understand, and, most importantly, it permits the use of arbitrarily large neural networks as the base classifier. In contrast, other certified defenses do not currently scale to large networks. Indeed, smoothing is the only certified adversarial defense which has been shown feasible on the full-resolution ImageNet classification task.

尽管有这一缺点,随机平滑相对文献中提出的其他可认证鲁棒分类器仍有几项引人注目的优点:它对基分类器的架构不做任何假定,实现和理解都很简单,而且最重要的是,它允许使用任意大的神经网络作为基分类器。相比之下,其他认证防御当时还不能扩展到大网络。事实上,平滑是当时唯一被证明能在全分辨率 ImageNet 分类任务上可行的认证对抗防御。

A clean panda image and a Gaussian-corrupted version used by the smoothed classifier

Figure 2. The smoothed classifier's prediction at an input (x) (left) is defined as the most likely prediction by the base classifier on random Gaussian corruptions of (x) (right; (\sigma = 0.5)). Note that this Gaussian noise is much larger in magnitude than the adversarial perturbations to which (g) is provably robust. One interpretation of randomized smoothing in high dimension is that these large random perturbations “drown out” small adversarial perturbations.

图 2. 平滑分类器在输入 (x) 处的预测(左)定义为基分类器对 (x) 的随机高斯腐蚀所作出的最可能预测(右;(\sigma = 0.5))。注意,这种高斯噪声在幅度上远大于 (g) 可被证明鲁棒应对的那些对抗扰动。在高维中,对随机平滑的一种理解是:这些大的随机扰动把小的对抗扰动“淹没”了。

We use randomized smoothing to train state-of-the-art certifiably (\ell_2)-robust ImageNet classifiers; for example, one of them achieves 49% provable top-1 accuracy under adversarial perturbations with (\ell_2) norm less than 127/255 (Table 1). We also demonstrate that on smaller-scale datasets like CIFAR-10 and SHVN, where competing approaches to certified (\ell_2) robustness are feasible, randomized smoothing can deliver better certified accuracies, both because it enables the use of larger networks and because it does not constrain the expressivity of the base classifier.

我们用随机平滑训练了当时最好的、具有可认证 (\ell_2) 鲁棒性的 ImageNet 分类器;例如,其中之一在 (\ell_2) 范数小于 127/255 的对抗扰动下,达到了 49% 的可证明 top-1 准确率(表 1)。我们还表明,在 CIFAR-10 和 SHVN 这类较小规模、相互竞争的认证 (\ell_2) 鲁棒方法也行得通的数据集上,随机平滑能够给出更好的认证准确率,既因为它可以使用更大的网络,也因为它并不限制基分类器的表达能力。

Table 1. Approximate certified accuracy on ImageNet. Each row shows a radius (r), the best hyperparameter (\sigma) for that radius, the approximate certified accuracy at radius (r) of the corresponding smoothed classifier, and the standard accuracy of the corresponding smoothed classifier. To give a sense of scale, a perturbation with (\ell_2) radius 1.0 could change one pixel by 255, ten pixels by 80, 100 pixels by 25, or 1000 pixels by 8. Random guessing on ImageNet would attain 0.1% accuracy.

(\ell_2) RADIUS BEST (\sigma) CERT. ACC (%) STD. ACC (%)
0.5 0.25 49 67
1.0 0.50 37 57
2.0 0.50 19 57
3.0 1.00 12 44

表 1. ImageNet 上的近似认证准确率。每一行给出一个半径 (r)、该半径下最好的超参数 (\sigma)、相应平滑分类器在半径 (r) 处的近似认证准确率,以及相应平滑分类器的标准准确率。为了给出尺度感,(\ell_2) 半径为 1.0 的扰动可以把一个像素改 255、十个像素改 80、100 个像素改 25,或 1000 个像素改 8。在 ImageNet 上随机猜测将得到 0.1% 的准确率。

(\ell_2) 半径 最佳 (\sigma) 认证准确率(%) 标准准确率(%)
0.5 0.25 49 67
1.0 0.50 37 57
2.0 0.50 19 57
3.0 1.00 12 44

2. Related Work

2. 相关工作

Many works have proposed classifiers intended to be robust to adversarial perturbations. These approaches can be broadly divided into empirical defenses, which empirically seem robust to known adversarial attacks, and certified defenses, which are provably robust to certain kinds of adversarial perturbations.

许多工作提出了意在对对抗扰动鲁棒的分类器。这些方法大体可分为经验防御和认证防御:前者在经验上看起来对已知对抗攻击鲁棒,后者则对某些种类的对抗扰动具有可证明的鲁棒性。

Empirical defenses. The most successful empirical defense to date is adversarial training (Goodfellow et al., 2015; Kurakin et al., 2017; Madry et al., 2018), in which adversarial examples are found during training (often using projected gradient descent) and added to the training set. Unfortunately, it is typically impossible to tell whether a prediction by an empirically robust classifier is truly robust to adversarial perturbations; the most that can be said is that a specific attack was unable to find any. In fact, many heuristic defenses proposed in the literature were later “broken” by stronger adversaries (Carlini & Wagner, 2017; Athalye et al., 2018; Uesato et al., 2018; Athalye & Carlini, 2018).

经验防御。 迄今最成功的经验防御是对抗训练(Goodfellow et al., 2015; Kurakin et al., 2017; Madry et al., 2018):在训练过程中找到对抗例子(常用投影梯度下降),并把它们加入训练集。不幸的是,通常无法判断一个经验上鲁棒的分类器所给出的预测,是否真正对对抗扰动鲁棒;最多只能说某一次特定攻击没能找到这样的扰动。事实上,文献中提出的许多启发式防御后来都被更强的对手“打破”(Carlini & Wagner, 2017; Athalye et al., 2018; Uesato et al., 2018; Athalye & Carlini, 2018)。

Aiming to escape this cat-and-mouse game, a growing body of work has focused on defenses with formal guarantees.

为了摆脱这种猫鼠游戏,越来越多的工作把重点放在具有形式保证的防御上。

Certified defenses. A classifier is said to be certifiably robust if for any input (x), one can easily obtain a guarantee that the classifier's prediction is constant within some set around (x), often an (\ell_2) or (\ell_\infty) ball. In most work in this area, the certifiably robust classifier is a neural network. Some works propose algorithms for certifying the robustness of generically trained networks, while others (Wong & Kolter, 2018; Raghunathan et al., 2018a) propose both a robust training method and a complementary certification mechanism.

认证防御。 如果对任意输入 (x),都能容易地得到保证:分类器的预测在 (x) 周围的某个集合(常常是 (\ell_2) 或 (\ell_\infty) 球)内保持不变,就称该分类器具有可认证鲁棒性。这一领域的大多数工作中,可认证鲁棒分类器是神经网络。有些工作提出认证通用训练网络鲁棒性的算法,另一些工作(Wong & Kolter, 2018; Raghunathan et al., 2018a)则同时提出鲁棒训练方法和配套的认证机制。

Certification methods are either exact (a.k.a “complete”) or conservative (a.k.a “sound but incomplete”). In the context of (\ell_p) norm-bounded perturbations, exact methods take a classifier (g), input (x), and radius (r), and report whether or not there exists a perturbation (\delta) within (|\delta| \le r) for which (g(x) \ne g(x+\delta)). In contrast, conservative methods either certify that no such perturbation exists or decline to make a certification; they may decline even when it is true that no such perturbation exists. Exact methods are usually based on Satisfiability Modulo Theories (Katz et al., 2017; Carlini et al., 2017; Ehlers, 2017; Huang et al., 2017) or mixed integer linear programming (Cheng et al., 2017; Lomuscio & Maganti, 2017; Dutta et al., 2017; Fischetti & Jo, 2018; Bunel et al., 2018). Unfortunately, no exact methods have been shown to scale beyond moderate-sized (100,000 activations) networks (Tjeng et al., 2019), and networks of that size can only be verified when they are trained in a manner that impairs their expressivity.

认证方法要么是精确的(又称“完全的”),要么是保守的(又称“可靠但不完全的”)。在 (\ell_p) 范数有界扰动的设定下,精确方法给定分类器 (g)、输入 (x) 和半径 (r),报告是否存在满足 (|\delta| \le r) 且 (g(x) \ne g(x+\delta)) 的扰动 (\delta)。相比之下,保守方法要么认证不存在这样的扰动,要么拒绝作出认证;即便实际上并不存在这样的扰动,它们也可能拒绝。精确方法通常基于可满足性模理论(Katz et al., 2017; Carlini et al., 2017; Ehlers, 2017; Huang et al., 2017)或混合整数线性规划(Cheng et al., 2017; Lomuscio & Maganti, 2017; Dutta et al., 2017; Fischetti & Jo, 2018; Bunel et al., 2018)。不幸的是,还没有精确方法被证明能扩展到中等规模(10 万个激活)以上的网络(Tjeng et al., 2019),而且那种规模的网络只有在以损害表达能力的方式训练后才能被验证。

Conservative certification is more scalable. Some conservative methods bound the global Lipschitz constant of the neural network (Gouk et al., 2018; Tsuzuku et al., 2018; Anil et al., 2019; Cisse et al., 2017), but these approaches tend to be very loose on expressive networks. Others measure the local smoothness of the network in the vicinity of a particular input (x). In theory, one could obtain a robustness guarantee via an upper bound on the local Lipschitz constant of the network (Hein & Andriushchenko, 2017), but computing this quantity is intractable for general neural networks. Instead, a panoply of practical solutions have been proposed in the literature (Wong & Kolter, 2018; Wang et al., 2018a;b; Raghunathan et al., 2018a;b; Wong et al., 2018; Dvijotham et al., 2018b;a; Croce et al., 2019; Gehr et al., 2018; Mirman et al., 2018; Singh et al., 2018; Gowal et al., 2018; Weng et al., 2018a; Zhang et al., 2018). Two themes stand out. Some approaches cast verification as an optimization problem and import tools such as relaxation and duality from the optimization literature to provide conservative guarantees (Wong & Kolter, 2018; Wong et al., 2018; Raghunathan et al., 2018a;b; Dvijotham et al., 2018b;a). Others step through the network layer by layer, maintaining at each layer an outer approximation of the set of activations reachable by a perturbed input (Mirman et al., 2018; Singh et al., 2018; Gowal et al., 2018; Weng et al., 2018a; Zhang et al., 2018). None of these local certification methods have been shown to be feasible on networks that are large and expressive enough to solve modern machine learning problems like the ImageNet classification task. Also, all method either assume specific network architectures (e.g. ReLU activations or a layered feedforward structure) or require extensive customization for new network architectures.

保守认证更具可扩展性。有些保守方法对神经网络的全局 Lipschitz 常数给出上界(Gouk et al., 2018; Tsuzuku et al., 2018; Anil et al., 2019; Cisse et al., 2017),但这些做法在表达能力强的网络上往往非常松。另一些方法度量网络在某一特定输入 (x) 附近的局部平滑性。理论上,可以通过网络局部 Lipschitz 常数的上界得到鲁棒性保证(Hein & Andriushchenko, 2017),但这一量对一般神经网络是难计算的。取而代之,文献中提出了大量实用方案(Wong & Kolter, 2018; Wang et al., 2018a;b; Raghunathan et al., 2018a;b; Wong et al., 2018; Dvijotham et al., 2018b;a; Croce et al., 2019; Gehr et al., 2018; Mirman et al., 2018; Singh et al., 2018; Gowal et al., 2018; Weng et al., 2018a; Zhang et al., 2018)。其中有两条主线。一类把验证写成优化问题,并从优化文献中引入松弛和对偶等工具,以给出保守保证(Wong & Kolter, 2018; Wong et al., 2018; Raghunathan et al., 2018a;b; Dvijotham et al., 2018b;a)。另一类逐层穿过网络,在每一层维持一个外近似,用来包住受扰动输入所能到达的激活集合(Mirman et al., 2018; Singh et al., 2018; Gowal et al., 2018; Weng et al., 2018a; Zhang et al., 2018)。这些局部认证方法都还没有被证明能在大且有足够表达能力、能够解决 ImageNet 分类这类现代机器学习问题的网络上可行。此外,所有方法要么假定特定的网络架构(例如 ReLU 激活或分层前馈结构),要么需要对新的网络架构做大量定制。

Related work involving noise. Prior works have proposed using a network's robustness to Gaussian noise as a proxy for its robustness to adversarial perturbations (Weng et al., 2018b; Ford et al., 2019), and have suggested that Gaussian data augmentation could supplement or replace adversarial training (Zantedeschi et al., 2017; Kannan et al., 2018). Smilkov et al. (2017) observed that averaging a classifier's input gradients over Gaussian corruptions of an image yields very interpretable saliency maps. The robustness of neural networks to random noise has been analyzed both theoretically (Fawzi et al., 2016; Franceschi et al., 2018) and empirically (Dodge & Karam, 2017). Finally, Webb et al. (2019) proposed a statistical technique for estimating the noise robustness of a classifier more efficiently than naive Monte Carlo simulation; we did not use this technique since it appears to lack formal high-probability guarantees. While these works hypothesized relationships between a neural network's robustness to random noise and the same network's robustness to adversarial perturbations, randomized smoothing instead uses a classifier's robustness to random noise to create a new classifier robust to adversarial perturbations.

与噪声有关的相关工作。 已有工作提议把网络对高斯噪声的鲁棒性作为它对对抗扰动鲁棒性的代理(Weng et al., 2018b; Ford et al., 2019),并建议用高斯数据增广来补充或替代对抗训练(Zantedeschi et al., 2017; Kannan et al., 2018)。Smilkov et al. (2017) 观察到,把分类器的输入梯度在图像的高斯腐蚀上取平均,会得到非常可解释的显著性图。神经网络对随机噪声的鲁棒性既有理论分析(Fawzi et al., 2016; Franceschi et al., 2018),也有经验分析(Dodge & Karam, 2017)。最后,Webb et al. (2019) 提出一种统计技术,用于比朴素蒙特卡洛模拟更高效地估计分类器的噪声鲁棒性;我们没有使用这一技术,因为它似乎缺少形式上的高概率保证。这些工作假定的是同一网络对随机噪声的鲁棒性与对对抗扰动的鲁棒性之间的关系,而随机平滑则是利用分类器对随机噪声的鲁棒性,来构造一个对新的对抗扰动鲁棒的分类器。

Randomized smoothing. Randomized smoothing has been studied previously for adversarial robustness. Several works (Liu et al., 2018; Cao & Gong, 2017) proposed similar techniques as heuristic defenses, but did not prove any guarantees. Lecuyer et al. (2019) used inequalities from the differential privacy literature to prove an (\ell_2) and (\ell_1) robustness guarantee for smoothing with Gaussian and Laplace noise, respectively. Subsequently, Li et al. (2018) used tools from information theory to prove a stronger (\ell_2) robustness guarantee for Gaussian noise. However, all of these robustness guarantees are loose. In contrast, we prove a tight robustness guarantee in (\ell_2) norm for randomized smoothing with Gaussian noise.

随机平滑。 随机平滑此前已在对抗鲁棒性中被研究过。有几项工作(Liu et al., 2018; Cao & Gong, 2017)把类似技术作为启发式防御提出,但没有证明任何保证。Lecuyer et al. (2019) 利用差分隐私文献中的不等式,分别为采用高斯噪声和拉普拉斯噪声的平滑证明了 (\ell_2) 和 (\ell_1) 鲁棒性保证。随后,Li et al. (2018) 利用信息论工具,为高斯噪声证明了更强的 (\ell_2) 鲁棒性保证。不过,这些鲁棒性保证都是松的。相比之下,我们为采用高斯噪声的随机平滑证明了 (\ell_2) 范数下的紧密鲁棒性保证。

3. Randomized smoothing

3. 随机平滑

Consider a classification problem from (\mathbb{R}^d) to classes (\mathcal{Y}). As discussed above, randomized smoothing is a method for constructing a new, “smoothed” classifier (g) from an arbitrary base classifier (f). When queried at (x), the smoothed classifier (g) returns whichever class the base classifier (f) is most likely to return when (x) is perturbed by isotropic Gaussian noise:

考虑从 (\mathbb{R}^d) 到类别 (\mathcal{Y}) 的分类问题。如上所述,随机平滑是一种由任意基分类器 (f) 构造新的“平滑”分类器 (g) 的方法。在 (x) 处被查询时,平滑分类器 (g) 返回的是:当 (x) 被各向同性高斯噪声扰动时,基分类器 (f) 最可能返回的那个类:

[
g(x) = \arg\max_{c \in \mathcal{Y}} \mathbb{P}(f(x+\varepsilon)=c)
\quad \text{where} \quad \varepsilon \sim \mathcal{N}(0,\sigma^2 I)
\tag{1}
]

An equivalent definition is that (g(x)) returns the class (c) whose pre-image ({x' \in \mathbb{R}^d : f(x') = c}) has the largest probability measure under the distribution (\mathcal{N}(x, \sigma^2 I)). The noise level (\sigma) is a hyperparameter of the smoothed classifier (g) which controls a robustness/accuracy tradeoff; it does not change with the input (x). We leave undefined the behavior of (g) when the argmax is not unique.

一个等价定义是:(g(x)) 返回其原像 ({x' \in \mathbb{R}^d : f(x') = c}) 在分布 (\mathcal{N}(x, \sigma^2 I)) 下具有最大概率测度的那个类 (c)。噪声水平 (\sigma) 是平滑分类器 (g) 的一个超参数,用来控制鲁棒性与准确率的权衡;它不随输入 (x) 改变。当 argmax 不唯一时,我们不对 (g) 的行为作定义。

We will first present our robustness guarantee for the smoothed classifier (g). Then, since it is not possible to exactly evaluate the prediction of (g) at (x) or to certify the robustness of (g) around (x), we will give Monte Carlo algorithms for both tasks that succeed with arbitrarily high probability.

我们将首先给出平滑分类器 (g) 的鲁棒性保证。然后,由于无法精确计算 (g) 在 (x) 处的预测,也无法精确认证 (g) 在 (x) 附近的鲁棒性,我们将为这两项任务给出能以任意高概率成功的蒙特卡洛算法。

3.1. Robustness guarantee

3.1. 鲁棒性保证

Suppose that when the base classifier (f) classifies (\mathcal{N}(x, \sigma^2 I)), the most probable class (c_A) is returned with probability (p_A), and the “runner-up” class is returned with probability (p_B). Our main result is that smoothed classifier (g) is robust around (x) within the (\ell_2) radius (R = \frac{\sigma}{2} \bigl(\Phi^{-1}(p_A) - \Phi^{-1}(p_B)\bigr)), where (\Phi^{-1}) is the inverse of the standard Gaussian CDF. This result also holds if we replace (p_A) with a lower bound (\underline{p_A}) and we replace (p_B) with an upper bound (\overline{p_B}).

假设当基分类器 (f) 对 (\mathcal{N}(x, \sigma^2 I)) 分类时,最可能的类 (c_A) 以概率 (p_A) 被返回,“第二名”类以概率 (p_B) 被返回。我们的主要结果是:平滑分类器 (g) 在 (x) 周围、(\ell_2) 半径 (R = \frac{\sigma}{2} \bigl(\Phi^{-1}(p_A) - \Phi^{-1}(p_B)\bigr)) 内是鲁棒的,其中 (\Phi^{-1}) 是标准高斯分布函数的反函数。如果我们把 (p_A) 换成下界 (\underline{p_A}),把 (p_B) 换成上界 (\overline{p_B}),这一结果同样成立。

Theorem 1. Let (f: \mathbb{R}^d \to \mathcal{Y}) be any deterministic or random function, and let (\varepsilon \sim \mathcal{N}(0, \sigma^2 I)). Let (g) be defined as in (1). Suppose (c_A \in \mathcal{Y}) and (\underline{p_A}, \overline{p_B} \in [0,1]) satisfy:
[
\mathbb{P}(f(x+\varepsilon)=c_A) \ge \underline{p_A} \ge \overline{p_B} \ge \max_{c \ne c_A} \mathbb{P}(f(x+\varepsilon)=c)
\tag{2}
]
Then (g(x+\delta)=c_A) for all (|\delta|_2 < R), where
[
R = \frac{\sigma}{2} \bigl(\Phi^{-1}(\underline{p_A}) - \Phi^{-1}(\overline{p_B})\bigr)
\tag{3}
]

定理 1. 设 (f: \mathbb{R}^d \to \mathcal{Y}) 是任意确定性或随机函数,并设 (\varepsilon \sim \mathcal{N}(0, \sigma^2 I))。设 (g) 如 (1) 中所定义。假设 (c_A \in \mathcal{Y}) 且 (\underline{p_A}, \overline{p_B} \in [0,1]) 满足:
[
\mathbb{P}(f(x+\varepsilon)=c_A) \ge \underline{p_A} \ge \overline{p_B} \ge \max_{c \ne c_A} \mathbb{P}(f(x+\varepsilon)=c)
\tag{2}
]
则对所有 (|\delta|_2 < R) 都有 (g(x+\delta)=c_A),其中
[
R = \frac{\sigma}{2} \bigl(\Phi^{-1}(\underline{p_A}) - \Phi^{-1}(\overline{p_B})\bigr)
\tag{3}
]

We now make several observations about Theorem 1:

关于定理 1,我们现作几点说明:

  • Theorem 1 assumes nothing about (f). This is crucial since it is unclear which well-behavedness assumptions, if any, are satisfied by modern deep architectures.
  • 定理 1 对 (f) 不做任何假定。这一点很关键,因为现代深度架构究竟满足哪些(如果有的话)良性假定,并不清楚。
  • The certified radius (R) is large when: (1) the noise level (\sigma) is high, (2) the probability of the top class (c_A) is high, and (3) the probability of each other class is low.
  • 认证半径 (R) 在以下情形较大:(1)噪声水平 (\sigma) 高,(2)最高类 (c_A) 的概率高,(3)其余每一类的概率低。
  • The certified radius (R) goes to (\infty) as (\underline{p_A} \to 1) and (\overline{p_B} \to 0). This should sound reasonable: the Gaussian distribution is supported on all of (\mathbb{R}^d), so the only way that (f(x+\varepsilon)=c_A) with probability 1 is if (f=c_A) almost everywhere.
  • 当 (\underline{p_A} \to 1) 且 (\overline{p_B} \to 0) 时,认证半径 (R) 趋向于 (\infty)。这应当听起来合理:高斯分布的支撑是整个 (\mathbb{R}^d),因此 (f(x+\varepsilon)=c_A) 以概率 1 成立的唯一方式,是 (f=c_A) 几乎处处成立。

Both Lecuyer et al. (2019) and Li et al. (2018) proved (\ell_2) robustness guarantees for the same setting as Theorem 1, but with different, smaller expressions for the certified radius. However, our (\ell_2) robustness guarantee is tight: if (2) is all that is known about (f), then it is impossible to certify an (\ell_2) ball with radius larger than (R). In fact, it is impossible to certify any superset of the (\ell_2) ball with radius (R):

Lecuyer et al. (2019) 和 Li et al. (2018) 都为与定理 1 相同的设定证明了 (\ell_2) 鲁棒性保证,但认证半径的表达式不同、也更小。然而,我们的 (\ell_2) 鲁棒性保证是紧的:如果关于 (f) 所知道的仅有 (2),就不可能认证一个半径大于 (R) 的 (\ell_2) 球。事实上,也不可能认证半径为 (R) 的 (\ell_2) 球的任何超集:

Theorem 2. Assume (\underline{p_A} + \overline{p_B} \le 1). For any perturbation (\delta) with (|\delta|_2 > R), there exists a base classifier (f) consistent with the class probabilities (2) for which (g(x+\delta) \ne c_A).

定理 2. 假设 (\underline{p_A} + \overline{p_B} \le 1)。对任意满足 (|\delta|_2 > R) 的扰动 (\delta),都存在一个与类概率 (2) 相符的基分类器 (f),使得 (g(x+\delta) \ne c_A)。

Theorem 2 shows that Gaussian smoothing naturally induces (\ell_2) robustness: if we make no assumptions on the base classifier beyond the class probabilities (2), then the set of perturbations to which a Gaussian-smoothed classifier is provably robust is exactly an (\ell_2) ball.

定理 2 表明,高斯平滑自然地诱导出 (\ell_2) 鲁棒性:如果对基分类器除类概率 (2) 之外不做任何假定,那么高斯平滑分类器可被证明鲁棒应对的扰动集合,恰好是一个 (\ell_2) 球。

The complete proofs of Theorems 1 and 2 are in Appendix A. We now sketch the proofs in the special case when there are only two classes.

定理 1 和定理 2 的完整证明见 Appendix A。我们现在在只有两类的特殊情形下概述这些证明。

Theorem 1 (binary case). Suppose (p_A \in \bigl(\tfrac{1}{2}, 1\bigr]) satisfies (\mathbb{P}(f(x+\varepsilon)=c_A) \ge p_A). Then (g(x+\delta)=c_A) for all (|\delta|_2 < \sigma \Phi^{-1}(p_A)).

定理 1(二元情形)。 假设 (p_A \in \bigl(\tfrac{1}{2}, 1\bigr]) 满足 (\mathbb{P}(f(x+\varepsilon)=c_A) \ge p_A)。则对所有 (|\delta|_2 < \sigma \Phi^{-1}(p_A)) 都有 (g(x+\delta)=c_A)。

Proof sketch. Fix a perturbation (\delta \in \mathbb{R}^d). To guarantee that (g(x+\delta)=c_A), we need to show that (f) classifies the translated Gaussian (\mathcal{N}(x+\delta, \sigma^2 I)) as (c_A) with probability (> \tfrac{1}{2}). However, all we know about (f) is that (f) classifies (\mathcal{N}(x, \sigma^2 I)) as (c_A) with probability (\ge p_A). This raises the question: out of all possible base classifiers (f) which classify (\mathcal{N}(x, \sigma^2 I)) as (c_A) with probability (\ge p_A), which one (f^) classifies (\mathcal{N}(x+\delta, \sigma^2 I)) as (c_A) with the smallest probability? One can show using an argument similar to the Neyman-Pearson lemma (Neyman & Pearson, 1933) that this “worst-case” (f^) is a linear classifier whose decision boundary is normal to the perturbation (\delta) (Figure 3):

证明概要。 固定一个扰动 (\delta \in \mathbb{R}^d)。要保证 (g(x+\delta)=c_A),需要证明 (f) 把平移后的高斯 (\mathcal{N}(x+\delta, \sigma^2 I)) 分成 (c_A) 的概率大于 (\tfrac{1}{2})。然而,关于 (f) 我们只知道:它把 (\mathcal{N}(x, \sigma^2 I)) 分成 (c_A) 的概率至少为 (p_A)。这就提出一个问题:在所有把 (\mathcal{N}(x, \sigma^2 I)) 以至少 (p_A) 的概率分成 (c_A) 的基分类器 (f) 中,哪一个 (f^) 把 (\mathcal{N}(x+\delta, \sigma^2 I)) 分成 (c_A) 的概率最小?利用与 Neyman-Pearson 引理(Neyman & Pearson, 1933)类似的论证可以证明,这个“最坏情形”的 (f^) 是一个决策边界垂直于扰动 (\delta) 的线性分类器(图 3):

[
f^*(x') =
\begin{cases}
c_A & \text{if } \delta^{\top}(x'-x) \le \sigma |\delta|_2 \Phi^{-1}(p_A) \
c_B & \text{otherwise}
\end{cases}
\tag{4}
]

This “worst-case” (f^) classifies (\mathcal{N}(x+\delta, \sigma^2 I)) as (c_A) with probability (\Phi\bigl(\Phi^{-1}(p_A) - \tfrac{|\delta|_2}{\sigma}\bigr)). Therefore, to ensure that even the “worst-case” (f^) classifies (\mathcal{N}(x+\delta, \sigma^2 I)) as (c_A) with probability (> \tfrac{1}{2}), we solve for those (\delta) for which
[
\Phi\Bigl(\Phi^{-1}(p_A) - \tfrac{|\delta|_2}{\sigma}\Bigr) > \tfrac{1}{2}
]
which is equivalent to the condition (|\delta|_2 < \sigma \Phi^{-1}(p_A)).

这个“最坏情形”的 (f^) 把 (\mathcal{N}(x+\delta, \sigma^2 I)) 分成 (c_A) 的概率为 (\Phi\bigl(\Phi^{-1}(p_A) - \tfrac{|\delta|_2}{\sigma}\bigr))。因此,为确保即便是“最坏情形”的 (f^) 也以大于 (\tfrac{1}{2}) 的概率把 (\mathcal{N}(x+\delta, \sigma^2 I)) 分成 (c_A),我们求解那些满足
[
\Phi\Bigl(\Phi^{-1}(p_A) - \tfrac{|\delta|_2}{\sigma}\Bigr) > \tfrac{1}{2}
]
的 (\delta),而这等价于条件 (|\delta|_2 < \sigma \Phi^{-1}(p_A))。

Theorem 2 is a simple consequence: for any (\delta) with (|\delta|_2 > R), the base classifier (f^) defined in (4) is consistent with (2); yet if (f^) is the base classifier, then (g(x+\delta)=c_B).

定理 2 是一个简单推论:对任意满足 (|\delta|_2 > R) 的 (\delta),(4) 中定义的基分类器 (f^) 与 (2) 相符;但如果基分类器就是 (f^),则 (g(x+\delta)=c_B)。

Two-dimensional illustration of the worst-case linear base classifier f-star

Figure 3. Illustration of (f^) in two dimensions. The concentric circles are the density contours of (\mathcal{N}(x, \sigma^2 I)) and (\mathcal{N}(x+\delta, \sigma^2 I)). Out of all base classifiers (f) which classify (\mathcal{N}(x, \sigma^2 I)) as (c_A) (blue) with probability (\ge p_A), such as both classifiers depicted above, the “worst-case” (f^), which classifies (\mathcal{N}(x+\delta, \sigma^2 I)) as (c_A) with minimal probability, is the classifier depicted on the right: a linear classifier with decision boundary normal to the perturbation (\delta).

图 3. 二维中 (f^) 的示意。同心圆是 (\mathcal{N}(x, \sigma^2 I)) 和 (\mathcal{N}(x+\delta, \sigma^2 I)) 的密度等值线。在所有以至少 (p_A) 的概率把 (\mathcal{N}(x, \sigma^2 I)) 分成 (c_A)(蓝色)的基分类器 (f) 中,例如上面画出的两个分类器,把 (\mathcal{N}(x+\delta, \sigma^2 I)) 分成 (c_A) 的概率最小的“最坏情形” (f^),就是右侧画出的那个分类器:决策边界垂直于扰动 (\delta) 的线性分类器。

Figure 5 (left) plots our (\ell_2) robustness guarantee against the guarantees derived in prior work. Observe that our (R) is much larger than that of Lecuyer et al. (2019) and moderately larger than that of Li et al. (2018). Appendix I derives the other two guarantees using this paper's notation.

图 5(左)把我们的 (\ell_2) 鲁棒性保证与先前工作中导出的保证画在一起。可以看到,我们的 (R) 比 Lecuyer et al. (2019) 的大得多,也比 Li et al. (2018) 的适度更大。Appendix I 用本文的记号导出了另外两项保证。

Linear base classifier. A two-class linear classifier (f(x)=\mathrm{sign}(w^{\top}x+b)) is already certifiable: the distance from any input (x) to the decision boundary is (|w^{\top}x+b|/\ |w|), and no perturbation (\delta) with (\ell_2) norm less than this distance can possibly change (f)'s prediction. In Appendix B we show that if (f) is linear, then the smoothed classifier (g) is identical to the base classifier (f). Moreover, we show that our bound (3) will certify the true robust radius (|w^{\top}x+b|/\ |w|), rather than a smaller, overconservative radius. Therefore, when (f) is linear, there always exists a perturbation (\delta) just beyond the certified radius which changes (g)'s prediction.

线性基分类器。 两类线性分类器 (f(x)=\mathrm{sign}(w^{\top}x+b)) 本身就已经可认证:任意输入 (x) 到决策边界的距离是 (|w^{\top}x+b|/\ |w|),任何 (\ell_2) 范数小于该距离的扰动 (\delta) 都不可能改变 (f) 的预测。在 Appendix B 中我们证明,如果 (f) 是线性的,则平滑分类器 (g) 与基分类器 (f) 相同。此外我们还证明,我们的界 (3) 认证的就是真实鲁棒半径 (|w^{\top}x+b|/\ |w|),而不是一个更小、过于保守的半径。因此,当 (f) 为线性时,总存在一个刚好超出认证半径、能够改变 (g) 预测的扰动 (\delta)。

Noise level can scale with image resolution. Since our expression (3) for the certified radius does not depend explicitly on the data dimension (d), one might worry that randomized smoothing is less effective for images of higher resolution — certifying a fixed (\ell_2) radius is “less impressive” for, say, a (224 \times 224) image than for a (56 \times 56) image. However, as illustrated by Figure 4, images in higher resolution can tolerate higher levels (\sigma) of isotropic Gaussian noise before their class-distinguishing content gets destroyed. As a consequence, in high resolution, smoothing can be performed with a larger (\sigma), leading to larger certified radii. See Appendix G for a more rigorous version of this argument.

噪声水平可以随图像分辨率缩放。 由于认证半径的表达式 (3) 并不显式依赖于数据维数 (d),人们可能会担心随机平滑对更高分辨率的图像效果较差——认证一个固定的 (\ell_2) 半径,对于例如 (224 \times 224) 的图像,不如对 (56 \times 56) 的图像那么“好看”。然而,如图 4 所示,更高分辨率的图像能够承受更高水平 (\sigma) 的各向同性高斯噪声,而不至于毁掉其区分类别的内容。因此,在高分辨率下可以用更大的 (\sigma) 做平滑,从而得到更大的认证半径。这一论证更严格的表述见 Appendix G。

Clean and noisy hummingbird images at 56 and 224 resolution with the same noise level

Figure 4. Left to right: clean (56 \times 56) image, clean (224 \times 224) image, noisy (56 \times 56) image ((\sigma = 0.5)), noisy (224 \times 224) image ((\sigma = 0.5)).

图 4. 从左到右:干净的 (56 \times 56) 图像,干净的 (224 \times 224) 图像,带噪的 (56 \times 56) 图像((\sigma = 0.5)),带噪的 (224 \times 224) 图像((\sigma = 0.5))。

3.2. Practical algorithms

3.2. 实用算法

We now present practical Monte Carlo algorithms for evaluating (g(x)) and certifying the robustness of (g) around (x). More details can be found in Appendix C.

我们现在给出用于计算 (g(x))、以及认证 (g) 在 (x) 附近鲁棒性的实用蒙特卡洛算法。更多细节见 Appendix C。

3.2.1. PREDICTION

3.2.1. 预测

Evaluating the smoothed classifier's prediction (g(x)) requires identifying the class (c_A) with maximal weight in the categorical distribution (f(x+\varepsilon)). The procedure described in pseudocode as PREDICT draws (n) samples of (f(x+\varepsilon)) by running (n) noise-corrupted copies of (x) through the base classifier. Let (\hat{c}_A) be the class which appeared the largest number of times. If (\hat{c}_A) appeared much more often than any other class, then PREDICT returns (\hat{c}_A). Otherwise, it abstains from making a prediction. We use the hypothesis test from Hung & Fithian (2019) to calibrate the abstention threshold so as to bound by (\alpha) the probability of returning an incorrect answer. PREDICT satisfies the following guarantee:

要计算平滑分类器的预测 (g(x)),需要找出分类分布 (f(x+\varepsilon)) 中权重最大的类 (c_A)。伪代码中记为 PREDICT 的步骤,通过把 (x) 的 (n) 个加噪副本送入基分类器,抽取 (f(x+\varepsilon)) 的 (n) 个样本。设 (\hat{c}_A) 是出现次数最多的类。如果 (\hat{c}_A) 出现得比任何其他类都多得多,则 PREDICT 返回 (\hat{c}_A);否则弃权、不作预测。我们使用 Hung & Fithian (2019) 的假设检验来标定弃权阈值,从而把返回错误答案的概率限制在 (\alpha) 以内。PREDICT 满足如下保证:

Proposition 1. With probability at least (1-\alpha) over the randomness in PREDICT, PREDICT will either abstain or return (g(x)). (Equivalently: the probability that PREDICT returns a class other than (g(x)) is at most (\alpha).)

命题 1. 对于 PREDICT 中的随机性,该步骤将以至少 (1-\alpha) 的概率或者弃权,或者返回 (g(x))。(等价地说:PREDICT 返回不是 (g(x)) 的类的概率至多为 (\alpha)。)

The function SAMPLEUNDERNOISE((f, x, \mathrm{num}, \sigma)) in the pseudocode draws (\mathrm{num}) samples of noise, (\varepsilon_1 \ldots \varepsilon_{\mathrm{num}} \sim \mathcal{N}(0, \sigma^2 I)), runs each (x+\varepsilon_i) through the base classifier (f), and returns a vector of class counts. BINOMPVALUE((n_A), (n_A+n_B), (p)) returns the (p)-value of the two-sided hypothesis test that (n_A \sim \mathrm{Binomial}(n_A+n_B, p)).

伪代码中的函数 SAMPLEUNDERNOISE((f, x, \mathrm{num}, \sigma)) 抽取 (\mathrm{num}) 个噪声样本 (\varepsilon_1 \ldots \varepsilon_{\mathrm{num}} \sim \mathcal{N}(0, \sigma^2 I)),把每个 (x+\varepsilon_i) 送入基分类器 (f),并返回各类计数构成的向量。BINOMPVALUE((n_A), (n_A+n_B), (p)) 返回双侧假设检验 (n_A \sim \mathrm{Binomial}(n_A+n_B, p)) 的 (p) 值。

Even if the true smoothed classifier (g) is robust at radius (R), PREDICT will be vulnerable in a certain sense to adversarial perturbations with (\ell_2) norm slightly less than (R). By engineering a perturbation (\delta) for which (f(x+\delta+\varepsilon)) puts mass just over (\tfrac{1}{2}) on class (c_A) and mass just under (\tfrac{1}{2}) on class (c_B), an adversary can force PREDICT to abstain at a high rate. If this scenario is of concern, a variant of Theorem 1 could be proved to certify a radius in which (\mathbb{P}(f(x+\delta+\varepsilon)=c_A)) is larger by some margin than (\max_{c \ne c_A} \mathbb{P}(f(x+\delta+\varepsilon)=c)).

即便真正的平滑分类器 (g) 在半径 (R) 处是鲁棒的,PREDICT 在某种意义上仍会受到 (\ell_2) 范数略小于 (R) 的对抗扰动的影响。通过构造一个扰动 (\delta),使得 (f(x+\delta+\varepsilon)) 在类 (c_A) 上的质量刚好超过 (\tfrac{1}{2})、在类 (c_B) 上的质量刚好低于 (\tfrac{1}{2}),对手可以迫使 PREDICT 以很高的频率弃权。如果担心这种情况,可以证明定理 1 的一个变体,用来认证这样一个半径:在其中 (\mathbb{P}(f(x+\delta+\varepsilon)=c_A)) 比 (\max_{c \ne c_A} \mathbb{P}(f(x+\delta+\varepsilon)=c)) 高出某个间隔。

3.2.2. CERTIFICATION

3.2.2. 认证

Evaluating and certifying the robustness of (g) around an input (x) requires not only identifying the class (c_A) with maximal weight in (f(x+\varepsilon)), but also estimating a lower bound (\underline{p_A}) on the probability that (f(x+\varepsilon)=c_A) and an upper bound (\overline{p_B}) on the probability that (f(x+\varepsilon)) equals any other class. Doing all three of these at the same time in a statistically correct manner requires some care. One simple solution is presented in pseudocode as CERTIFY: first, use a small number of samples from (f(x+\varepsilon)) to take a guess at (c_A); then use a larger number of samples to estimate (\underline{p_A}); then simply take (\overline{p_B} = 1 - \underline{p_A}).

要计算并认证 (g) 在输入 (x) 附近的鲁棒性,不仅需要找出 (f(x+\varepsilon)) 中权重最大的类 (c_A),还需要估计 (f(x+\varepsilon)=c_A) 的概率下界 (\underline{p_A}),以及 (f(x+\varepsilon)) 等于任何其他类的概率上界 (\overline{p_B})。要在统计上正确地同时完成这三件事,需要一些小心。一种简单做法在伪代码中记为 CERTIFY:先用来自 (f(x+\varepsilon)) 的少量样本对 (c_A) 作一个猜测;再用更多样本估计 (\underline{p_A});然后直接取 (\overline{p_B} = 1 - \underline{p_A})。

Pseudocode for certification and prediction

# evaluate g at x
function PREDICT(f, σ, x, n, α)
    counts ← SAMPLEUNDERNOISE(f, x, n, σ)
    ĉ_A, ĉ_B ← top two indices in counts
    n_A, n_B ← counts[ĉ_A], counts[ĉ_B]
    if BINOMPVALUE(n_A, n_A + n_B, 0.5) ≤ α return ĉ_A
    else return ABSTAIN

# certify the robustness of g around x
function CERTIFY(f, σ, x, n0, n, α)
    counts0 ← SAMPLEUNDERNOISE(f, x, n0, σ)
    ĉ_A ← top index in counts0
    counts ← SAMPLEUNDERNOISE(f, x, n, σ²)
    p̲_A ← LOWERCONFBOUND(counts[ĉ_A], n, 1 − α)
    if p̲_A > 1/2 return prediction ĉ_A and radius σ Φ^{-1}(p̲_A)
    else return ABSTAIN

认证与预测的伪代码

# 在 x 处计算 g
function PREDICT(f, σ, x, n, α)
    counts ← SAMPLEUNDERNOISE(f, x, n, σ)
    ĉ_A, ĉ_B ← counts 中频数最高的两个下标
    n_A, n_B ← counts[ĉ_A], counts[ĉ_B]
    if BINOMPVALUE(n_A, n_A + n_B, 0.5) ≤ α return ĉ_A
    else return ABSTAIN

# 认证 g 在 x 附近的鲁棒性
function CERTIFY(f, σ, x, n0, n, α)
    counts0 ← SAMPLEUNDERNOISE(f, x, n0, σ)
    ĉ_A ← counts0 中频数最高的下标
    counts ← SAMPLEUNDERNOISE(f, x, n, σ²)
    p̲_A ← LOWERCONFBOUND(counts[ĉ_A], n, 1 − α)
    if p̲_A > 1/2 return 预测 ĉ_A 以及半径 σ Φ^{-1}(p̲_A)
    else return ABSTAIN

Proposition 2. With probability at least (1-\alpha) over the randomness in CERTIFY, if CERTIFY returns a class (\hat{c}_A) and a radius (R) (i.e. does not abstain), then (g) predicts (\hat{c}_A) within radius (R) around (x): (g(x+\delta)=\hat{c}_A\ \forall |\delta|_2 < R).

命题 2. 对于 CERTIFY 中的随机性,若该步骤返回一个类 (\hat{c}_A) 和一个半径 (R)(即没有弃权),则以至少 (1-\alpha) 的概率,(g) 在 (x) 周围半径 (R) 内预测为 (\hat{c}_A):(g(x+\delta)=\hat{c}_A\ \forall |\delta|_2 < R)。

The function LOWERCONFBOUND((k, n, 1-\alpha)) in the pseudocode returns a one-sided ((1-\alpha)) lower confidence interval for the Binomial parameter (p) given a sample (k \sim \mathrm{Binomial}(n, p)).

伪代码中的函数 LOWERCONFBOUND((k, n, 1-\alpha)) 在给定样本 (k \sim \mathrm{Binomial}(n, p)) 时,返回二项分布参数 (p) 的单侧 ((1-\alpha)) 下置信区间。

Certifying large radii requires many samples. Recall from Theorem 1 that (R) approaches (\infty) as (\underline{p_A}) approaches 1. Unfortunately, it turns out that (\underline{p_A}) approaches 1 so slowly with (n) that (R) also approaches (\infty) very slowly with (n). Consider the most favorable situation: (f(x)=c_A) everywhere. This means that (g) is robust at radius (\infty). But after observing (n) samples of (f(x+\varepsilon)) which all equal (c_A), the tightest (to our knowledge) lower bound would say that with probability at least (1-\alpha), (\underline{p_A} \ge \alpha^{1/n}). Plugging (\underline{p_A}=\alpha^{1/n}) and (\overline{p_B}=1-\underline{p_A}) into (3) yields an expression for the certified radius as a function of (n): (R=\sigma\Phi^{-1}(\alpha^{1/n})). Figure 5 (right) plots this function for (\alpha=0.001), (\sigma=1). Observe that certifying a radius of (4\sigma) with 99.9% confidence would require (\approx 10^5) samples.

认证较大的半径需要很多样本。 由定理 1 可知,当 (\underline{p_A}) 趋向 1 时,(R) 趋向 (\infty)。不幸的是,(\underline{p_A}) 随 (n) 趋向 1 的速度很慢,因而 (R) 随 (n) 趋向 (\infty) 也很慢。考虑最有利的情形:(f(x)=c_A) 处处成立。这意味着 (g) 在半径 (\infty) 处是鲁棒的。但在观测到 (f(x+\varepsilon)) 的 (n) 个全部等于 (c_A) 的样本之后,就我们所知最紧的下界只会说:以至少 (1-\alpha) 的概率,(\underline{p_A} \ge \alpha^{1/n})。把 (\underline{p_A}=\alpha^{1/n}) 和 (\overline{p_B}=1-\underline{p_A}) 代入 (3),就得到认证半径作为 (n) 的函数:(R=\sigma\Phi^{-1}(\alpha^{1/n}))。图 5(右)画出了 (\alpha=0.001)、(\sigma=1) 时的这个函数。可以看到,要以 99.9% 的把握认证 (4\sigma) 的半径,大约需要 (10^5) 个样本。

Certified radius versus class probability and versus number of samples

Figure 5. Left: Certified radius (R) as a function of (p_A) (with (p_B = 1-p_A) and (\sigma=1)) under all three randomized smoothing bounds. Right: A plot of (R=\sigma\Phi^{-1}(\alpha^{1/n})) for (\alpha=0.001) and (\sigma=1). The radius we can certify with high probability grows slowly with the number of samples, even in the best case where (f(x)=c_A) everywhere.

图 5. 左:在全部三项随机平滑界下,认证半径 (R) 作为 (p_A) 的函数(其中 (p_B=1-p_A),(\sigma=1))。右:(\alpha=0.001)、(\sigma=1) 时 (R=\sigma\Phi^{-1}(\alpha^{1/n})) 的曲线。即便在 (f(x)=c_A) 处处成立的最好情形下,我们能以高概率认证的半径随样本数增长也很慢。

3.3. Training the base classifier

3.3. 训练基分类器

Theorem 1 holds regardless of how the base classifier (f) is trained. However, in order for (g) to classify the labeled example ((x, c)) correctly and robustly, (f) needs to consistently classify (\mathcal{N}(x, \sigma^2 I)) as (c). In high dimension, the Gaussian distribution (\mathcal{N}(x, \sigma^2 I)) places almost no mass near its mode (x). As a consequence, when (\sigma) is moderately high, the distribution of natural images has virtually disjoint support from the distribution of natural images corrupted by (\mathcal{N}(0, \sigma^2 I)); see Figure 2 for a visual demonstration. Therefore, if the base classifier (f) is trained via standard supervised learning on the data distribution, it will see no noisy images during training, and hence will not necessarily learn to classify (\mathcal{N}(x, \sigma^2 I)) with (x)'s true label. Indeed, we observed empirically that when neural network base classifiers are trained on noiseless data, they cannot recognize noisy images.

无论基分类器 (f) 如何训练,定理 1 都成立。但是,为了让 (g) 在带标签的例子 ((x, c)) 上既判对又鲁棒,(f) 需要稳定地把 (\mathcal{N}(x, \sigma^2 I)) 分成 (c)。在高维中,高斯分布 (\mathcal{N}(x, \sigma^2 I)) 在其众数 (x) 附近几乎不放质量。因此,当 (\sigma) 适度偏高时,自然图像的分布与被 (\mathcal{N}(0, \sigma^2 I)) 腐蚀后的自然图像分布,其支撑实际上几乎不相交;直观展示见图 2。于是,如果基分类器 (f) 只是在数据分布上按标准有监督学习来训练,它在训练中就看不到带噪图像,因而不一定能学会用 (x) 的真实标签去分类 (\mathcal{N}(x, \sigma^2 I))。我们在经验上也观察到:当神经网络基分类器在无噪声数据上训练时,它们认不出带噪图像。

Therefore, in this paper we follow Lecuyer et al. (2019) and train the base classifier with Gaussian data augmentation at variance (\sigma^2). A justification for this procedure is provided in Appendix F. However, we suspect that there may be room to improve upon this training scheme, perhaps by training the base classifier so as to maximize the smoothed classifier's certified accuracy at some tunable radius (r).

因此,本文跟随 Lecuyer et al. (2019),用方差为 (\sigma^2) 的高斯数据增广来训练基分类器。这一做法的论证见 Appendix F。不过我们猜想,这一训练方案可能还有改进余地,或许可以通过训练基分类器,使平滑分类器在某个可调半径 (r) 处的认证准确率达到最大。

4. Experiments

4. 实验

In adversarially robust classification, one metric of interest is the certified test set accuracy at radius (r), defined as the fraction of the test set which (g) classifies correctly with a prediction that is certifiably robust within an (\ell_2) ball of radius (r). However, if (g) is a randomized smoothing classifier, computing this quantity exactly is not possible, so we instead report the approximate certified test set accuracy, defined as the fraction of the test set which CERTIFY classifies correctly (without abstaining) and certifies robust with a radius (R \ge r). Appendix D shows how to convert the approximate certified accuracy into a lower bound on the true certified accuracy that holds with high probability over the randomness in CERTIFY. However Appendix H.2 demonstrates that when (\alpha) is small, the difference between these two quantities is negligible. Therefore, in our experiments we omit the step for simplicity and report approximate certified accuracies.

在对抗鲁棒分类中,一个受关注的指标是半径 (r) 处的认证测试集准确率,定义为测试集中被 (g) 正确分类、并且其预测在半径为 (r) 的 (\ell_2) 球内可认证鲁棒的比例。然而,如果 (g) 是随机平滑分类器,就无法精确计算这一量,因此我们改为报告近似认证测试集准确率,定义为测试集中被 CERTIFY 正确分类(并且没有弃权)、且被认证为在半径 (R \ge r) 内鲁棒的比例。Appendix D 说明如何把近似认证准确率转换成对真实认证准确率的下界,该下界对 CERTIFY 中的随机性以高概率成立。不过 Appendix H.2 表明,当 (\alpha) 较小时,这两个量之间的差别可以忽略。因此,在实验中我们为简单起见省去这一步骤,并报告近似认证准确率。

In all experiments, unless otherwise stated, we ran CERTIFY with (\alpha=0.001), so there was at most a 0.1% chance that CERTIFY returned a radius in which (g) was not truly robust. Unless otherwise stated, when running CERTIFY we used (n_0=100) Monte Carlo samples for selection and (n=100{,}000) samples for estimation.

在全部实验中,除非另有说明,我们以 (\alpha=0.001) 运行 CERTIFY,因此 CERTIFY 返回一个 (g) 并非真正鲁棒的半径的机会至多是 0.1%。除非另有说明,运行 CERTIFY 时,我们用 (n_0=100) 个蒙特卡洛样本做选择,用 (n=100{,}000) 个样本做估计。

In the figures above that plot certified accuracy as a function of radius (r), the certified accuracy always decreases gradually with (r) until reaching some point where it plummets to zero. This drop occurs because for each noise level (\sigma) and number of samples (n), there is a hard upper limit to the radius we can certify with high probability, achieved when all (n) samples are classified by (f) as the same class.

在上面那些把认证准确率画成半径 (r) 的函数的图中,认证准确率总是随 (r) 逐渐下降,直到在某一点骤降为零。出现这一下降,是因为对每个噪声水平 (\sigma) 和样本数 (n),我们能以高概率认证的半径有一个硬上界,该上界在全部 (n) 个样本都被 (f) 分成同一类时达到。

Approximate certified accuracy of randomized smoothing on CIFAR-10 and ImageNet

Figure 6. Approximate certified accuracy attained by randomized smoothing on CIFAR-10 (top) and ImageNet (bottom). The hyperparameter (\sigma) controls a robustness/accuracy tradeoff. The dashed black line is an upper bound on the empirical robust accuracy of an undefended classifier with the base classifier's architecture.

图 6. 随机平滑在 CIFAR-10(上)和 ImageNet(下)上达到的近似认证准确率。超参数 (\sigma) 控制着鲁棒性与准确率的权衡。黑色虚线是具有基分类器架构、且未加防御的分类器经验鲁棒准确率的上界。

ImageNet and CIFAR-10 results. We applied randomized smoothing to CIFAR-10 (Krizhevsky, 2009) and ImageNet (Deng et al., 2009). On each dataset we trained several smoothed classifiers, each with a different (\sigma). On CIFAR-10 our base classifier was a 110-layer residual network; certifying each example took 15 seconds on an NVIDIA RTX 2080 Ti. On ImageNet our base classifier was a ResNet-50; certifying each example took 110 seconds. We also trained a neural network with the base classifier's architecture on clean data, and subjected it to a DeepFool (\ell_2) adversarial attack (Moosavi-Dezfooli et al., 2016), in order to obtain an empirical upper bound on its robust accuracy. We certified the full CIFAR-10 test set and a subsample of 500 examples from the ImageNet test set.

ImageNet 与 CIFAR-10 上的结果。 我们将随机平滑应用到 CIFAR-10(Krizhevsky, 2009)和 ImageNet(Deng et al., 2009)。在每个数据集上,我们训练了若干平滑分类器,各自使用不同的 (\sigma)。在 CIFAR-10 上,基分类器是 110 层残差网络;在一块 NVIDIA RTX 2080 Ti 上,每个例子的认证耗时 15 秒。在 ImageNet 上,基分类器是 ResNet-50;每个例子的认证耗时 110 秒。我们还在干净数据上训练了一个具有基分类器架构的神经网络,并对其施加 DeepFool (\ell_2) 对抗攻击(Moosavi-Dezfooli et al., 2016),以得到其鲁棒准确率的经验上界。我们认证了全部 CIFAR-10 测试集,以及 ImageNet 测试集中 500 个例子的子样本。

Comparison of randomized smoothing with the Wong et al. 2018 certified defense

Figure 7. Comparison betwen randomized smoothing and Wong et al. (2018). Each green line is a small resnet classifier trained and certified using the method of Wong et al. (2018) with a different setting of its hyperparameter (\epsilon). The purple line is our method using the same small resnet architecture as the base classifier; the blue line is our method with a larger neural network as the base classifier. Wong et al. (2018) gives deterministic robustness guarantees, whereas smoothing gives high-probabaility guaranatees; therefore, we plot here the certified accuracy of Wong et al. (2018) against the “approximate” certified accuracy of smoothing.

图 7. 随机平滑与 Wong et al. (2018) 的比较。每条绿线是用 Wong et al. (2018) 的方法、在其超参数 (\epsilon) 的不同设定下训练并认证的小 ResNet 分类器。紫线是我们的方法,基分类器采用同样的小 ResNet 架构;蓝线是我们的方法,基分类器采用更大的神经网络。Wong et al. (2018) 给出的是确定性鲁棒性保证,而平滑给出的是高概率保证;因此,这里把 Wong et al. (2018) 的认证准确率与平滑的“近似”认证准确率画在一起。

Figure 6 plots the certified accuracy attained by smoothing with each (\sigma). The dashed black line is the empirical upper bound on the robust accuracy of the base classifier architecture; observe that smoothing improves substantially upon the robustness of the undefended base classifier architecture. We see that (\sigma) controls a robustness/accuracy tradeoff. When (\sigma) is low, small radii can be certified with high accuracy, but large radii cannot be certified. When (\sigma) is high, larger radii can be certified, but smaller radii are certified at a lower accuracy. This observation echoes the finding in Tsipras et al. (2019) that adversarially trained networks with higher robust accuracy tend to have lower standard accuracy. Tables of these results are in Appendix E.

图 6 画出了用各个 (\sigma) 做平滑所达到的认证准确率。黑色虚线是基分类器架构鲁棒准确率的经验上界;可以看到,平滑相对未加防御的基分类器架构,在鲁棒性上有明显提升。我们看到 (\sigma) 控制着鲁棒性与准确率的权衡。当 (\sigma) 较低时,小半径可以较高准确率被认证,但大半径认证不了。当 (\sigma) 较高时,更大的半径可以被认证,但较小半径是在较低准确率下被认证的。这一观察与 Tsipras et al. (2019) 的发现相呼应:鲁棒准确率更高的对抗训练网络,往往具有更低的标准准确率。这些结果的表格见 Appendix E。

Figure 8 (left) plots the certified accuracy obtained using our Theorem 1 guarantee alongside the certified accuracy obtained using the analogous bounds of Lecuyer et al. (2019) and Li et al. (2018). Since our expression for the certified radius (R) is greater (and, in fact, tight), our bound delivers higher certified accuracies. Figure 8 (middle) projects how the certified accuracy would have changed had CERTIFY used more or fewer samples (n) (under the assumption that the relative class proportions in counts would have remained constant). Finally, Figure 8 (right) plots the certified accuracy as the confidence parameter (\alpha) is varied. Observe that the certified accuracy is not very sensitive to (\alpha).

图 8(左)把用我们定理 1 的保证得到的认证准确率,与用 Lecuyer et al. (2019) 和 Li et al. (2018) 的类似界得到的认证准确率画在一起。由于我们对认证半径 (R) 的表达式更大(而且事实上是紧的),我们的界给出了更高的认证准确率。图 8(中)推演了如果 CERTIFY 使用更多或更少的样本 (n),认证准确率会如何变化(假定 counts 中的相对类比例保持不变)。最后,图 8(右)画出认证准确率随置信参数 (\alpha) 变化的情况。可以看到,认证准确率对 (\alpha) 并不十分敏感。

ImageNet smoothing experiments comparing bounds, sample sizes, and confidence levels

Figure 8. Experiments with randomized smoothing on ImageNet with (\sigma=0.25). Left: certified accuracies obtained using our Theorem 1 versus those obtained using the robustness guarantees derived in prior work. Middle: projections for the certified accuracy if the number of samples (n) used by CERTIFY had been larger or smaller. Right: certified accuracy as the failure probability (\alpha) of CERTIFY is varied.

图 8. 在 ImageNet 上、(\sigma=0.25) 时的随机平滑实验。左:用我们的定理 1 得到的认证准确率,对比用先前工作中导出的鲁棒性保证得到的结果。中:如果 CERTIFY 使用的样本数 (n) 更大或更小,认证准确率的推演。右:认证准确率随 CERTIFY 失败概率 (\alpha) 的变化。

Comparison to baselines. We compared randomized smoothing to three baseline approaches for certified (\ell_2) robustness: the duality approach from Wong et al. (2018), the Lipschitz approach from Tsuzuku et al. (2018), and the approach from Weng et al. (2018a); Zhang et al. (2018). The strongest baseline was Wong et al. (2018); we defer the comparison to the other two baselines to Appendix H.

与基线的比较。 我们将随机平滑与三种认证 (\ell_2) 鲁棒性的基线方法做了比较:Wong et al. (2018) 的对偶方法、Tsuzuku et al. (2018) 的 Lipschitz 方法,以及 Weng et al. (2018a); Zhang et al. (2018) 的方法。最强的基线是 Wong et al. (2018);与另外两条基线的比较放到 Appendix H。

In Figure 7, we compare the largest publicly released model from Wong et al. (2018), a small resnet, to two randomized smoothing classifiers: one which used the same small resnet architecture for its base classifier, and one which used a larger 110-layer resnet for its base classifier. First, observe that smoothing with the large 110-layer resnet substantially outperforms the baseline (across all hyperparameter settings) at all radii. Second, observe that smoothing with the small resnet also outperformed the method of Wong et al. (2018) at all but the smallest radii. We attribute this latter result to the fact that neural networks trained using the method of Wong et al. (2018) are “typically overregularized to the point that many filters/weights become identically zero,” per that paper. In contrast, the base classifier in randomized smoothing is a fully expressive neural network.

在图 7 中,我们把 Wong et al. (2018) 公开的最大模型(一个小 ResNet)与两个随机平滑分类器进行比较:一个用同样的小 ResNet 架构作为基分类器,另一个用更大的 110 层残差网络作为基分类器。首先可以看到,用 110 层残差网络做平滑,在所有半径上都明显超过基线(以及其全部超参数设定)。其次可以看到,用小 ResNet 做平滑,在除最小半径外的范围内也超过了 Wong et al. (2018) 的方法。我们把后一结果归因于:用 Wong et al. (2018) 的方法训练的神经网络,用该文的话说,“通常被过度正则化,以至于许多滤波器/权重恒等于零”。相比之下,随机平滑中的基分类器是一个充分表达的神经网络。

Prediction. It is computationally expensive to certify the robustness of (g) around a point (x), since the value of (n) in CERTIFY must be very large. However, it is far cheaper to evaluate (g) at (x) using PREDICT, since (n) can be small. For example, when we ran PREDICT on ImageNet ((\sigma=0.25)) using (n=100), making each prediction only took 0.15 seconds, and we attained a top-1 test accuracy of 65% (Appendix E).

预测。 认证 (g) 在点 (x) 附近的鲁棒性计算代价很高,因为 CERTIFY 中的 (n) 必须非常大。然而,用 PREDICT 在 (x) 处计算 (g) 要便宜得多,因为 (n) 可以较小。例如,当我们在 ImageNet((\sigma=0.25))上用 (n=100) 运行 PREDICT 时,每次预测只需 0.15 秒,并达到了 65% 的 top-1 测试准确率(Appendix E)。

As discussed earlier, an adversary can potentially force PREDICT to abstain with high probability. However, it is relatively rare for PREDICT to abstain on the actual data distribution. On ImageNet ((\sigma=0.25)), PREDICT with failure probability (\alpha=0.001) abstained 12% of the time when (n=100), 4% when (n=1000), and 1% when (n=10{,}000).

如前所述,对手有可能迫使 PREDICT 以高概率弃权。不过,在真实数据分布上,PREDICT 弃权相对少见。在 ImageNet((\sigma=0.25))上,失败概率 (\alpha=0.001) 的 PREDICT 在 (n=100) 时弃权 12%,在 (n=1000) 时弃权 4%,在 (n=10{,}000) 时弃权 1%。

Empirical tightness of bound. When (f) is linear, the bound in Theorem 1 is tight, in that there always exists a class-changing perturbation just beyond the certified radius. Since deep neural networks are not linear, we empirically assessed the tightness of our bound by subjecting an ImageNet randomized smoothing classifier ((\sigma=0.25)) to a projected gradient descent-style adversarial attack. For each example, we ran CERTIFY with (\alpha=0.01), and, if the example was correctly classified and certified robust at radius (R), we tried finding an adversarial example for (g) within radius (1.5R) and within radius (2R). We succeeded 17% of the time at radius (1.5R) and 53% of the time at radius (2R). See Appendix J.3 for more details on the attack.

界的经验紧密程度。 当 (f) 为线性时,定理 1 中的界是紧的,因为总存在一个刚好超出认证半径、能够改变类别的扰动。由于深度神经网络不是线性的,我们通过把一个 ImageNet 上的随机平滑分类器((\sigma=0.25))置于投影梯度下降式的对抗攻击下来经验地评估该界的紧密程度。对每个例子,我们以 (\alpha=0.01) 运行 CERTIFY;如果该例子被正确分类并在半径 (R) 处被认证为鲁棒,我们就尝试在半径 (1.5R) 和半径 (2R) 内为 (g) 寻找对抗例子。在半径 (1.5R) 内成功率为 17%,在半径 (2R) 内为 53%。关于该攻击的更多细节见 Appendix J.3。

5. Conclusion

5. 结论

Theorem 2 establishes that smoothing with Gaussian noise naturally confers adversarial robustness in (\ell_2) norm: if we have no knowledge about the base classifier beyond the distribution of (f(x+\varepsilon)), then the set of perturbations to which the smoothed classifier is provably robust is precisely an (\ell_2) ball. We suspect that smoothing with other noise distributions may lead to similarly natural robustness guarantees for other perturbation sets such as general (\ell_p) norm balls.

定理 2 表明,用高斯噪声做平滑会自然地赋予 (\ell_2) 范数下的对抗鲁棒性:如果对基分类器除 (f(x+\varepsilon)) 的分布之外一无所知,那么平滑分类器可被证明鲁棒应对的扰动集合,恰好是一个 (\ell_2) 球。我们猜想,用其他噪声分布做平滑,也许会对一般 (\ell_p) 范数球等其他扰动集合给出同样自然的鲁棒性保证。

Our strong empirical results suggest that randomized smoothing is a promising direction for future research into adversarially robust classification. Most empirical approaches (except PGD adversarial training) have been “broken,” and provable approaches based on certifying neural network classifiers have not been shown to scale to networks of modern size. It seems to be computationally infeasible to reason in any sophisticated way about the decision boundaries of a large, expressive neural network. Randomized smoothing circumvents this problem: the smoothed classifier is not itself a neural network, though it leverages the discriminative ability of a neural network base classifier. To make the smoothed classifier robust, one need simply make the base classifier classify well under noise. In this way, randomized smoothing reduces the unsolved problem of adversarially robust classification to the comparably solved domain of supervised learning.

我们较强的经验结果表明,随机平滑是未来对抗鲁棒分类研究的一个有前途的方向。大多数经验方法(投影梯度下降对抗训练除外)都已被“打破”,而基于认证神经网络分类器的可证明方法,也还没有被证明能扩展到现代规模的网络。以任何精细的方式去推断一个大且有表达能力的神经网络的决策边界,在计算上似乎并不可行。随机平滑绕开了这一问题:平滑分类器本身并不是神经网络,尽管它借助了神经网络基分类器的判别能力。要使平滑分类器鲁棒,只需让基分类器在噪声下分类得好。这样,随机平滑就把对抗鲁棒分类这个尚未解决的问题,归结到了相对已经解决的有监督学习领域。

6. Acknowledgements

6. 致谢

We thank Mateusz Kwaśnicki for help with Lemma 4 in the appendix, Aaditya Ramdas for pointing us toward the work of Hung & Fithian (2019), and Siva Balakrishnan for helpful discussions regarding the confidence interval in Appendix D. We thank Tolani Olarinre, Adarsh Prasad, Ben Cousins, and Ramon Van Handel for useful conversations. Finally, we are very grateful to Vaishnavh Nagarajan, Arun Sai Suggala, Shaojie Bai, Mikhail Khodak, Han Zhao, and Zachary Lipton for reviewing drafts of this work. Jeremy Cohen is supported by a grant from the Bosch Center for AI.

我们感谢 Mateusz Kwaśnicki 对附录中 Lemma 4 的帮助,感谢 Aaditya Ramdas 向我们指出 Hung & Fithian (2019) 的工作,并感谢 Siva Balakrishnan 就 Appendix D 中的置信区间所作的有益讨论。我们感谢 Tolani Olarinre、Adarsh Prasad、Ben Cousins 和 Ramon Van Handel 的有用交谈。最后,非常感谢 Vaishnavh Nagarajan、Arun Sai Suggala、Shaojie Bai、Mikhail Khodak、Han Zhao 和 Zachary Lipton 审阅本文草稿。Jeremy Cohen 由 Bosch Center for AI 的一项资助支持。

References

参考文献

Anil, C., Lucas, J., and Grosse, R. B. Sorting out lipschitz function approximation. In Proceedings of the 36th International Conference on Machine Learning, 2019.

Athalye, A. and Carlini, N. On the robustness of the cvpr 2018 white-box adversarial example defenses. The Bright and Dark Sides of Computer Vision: Challenges and Opportunities for Privacy and Security, 2018.

Athalye, A., Carlini, N., and Wagner, D. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. In Proceedings of the 35th International Conference on Machine Learning, 2018.

Biggio, B., Corona, I., Maiorca, D., Nelson, B., ˇSrndi´c, N., Laskov, P., Giacinto, G., and Roli, F. Evasion attacks against machine learning at test time. Joint European Conference on Machine Learning and Knowledge Discovery in Database, 2013.

Blanchard, G. Lecture Notes, 2007. URL http://www.math.uni-potsdam.de/~blanchard/lectures/lect_2.pdf.

Bunel, R. R., Turkaslan, I., Torr, P., Kohli, P., and Mudigonda, P. K. A unified view of piecewise linear neural network verification. In Advances in Neural Information Processing Systems 31. 2018.

Cao, X. and Gong, N. Z. Mitigating evasion attacks to deep neural networks via region-based classification. 33rd Annual Computer Security Applications Conference, 2017.

Carlini, N. and Wagner, D. Adversarial examples are not easily detected: Bypassing ten detection methods. In Proceedings of the 10th ACM Workshop on Artificial Intelligence and Security, 2017.

Carlini, N., Katz, G., Barrett, C., and Dill, D. L. Provably minimally-distorted adversarial examples. arXiv preprint arXiv: 1709.10207, 2017.

Cheng, C.-H., N¨uhrenberg, G., and Ruess, H. Maximum resilience of artificial neural networks. International Symposium on Automated Technology for Verification and Analysis, 2017.

Cisse, M., Bojanowski, P., Grave, E., Dauphin, Y., and Usunier, N. Parseval networks: Improving robustness to adversarial examples. In Proceedings of the 34th International Conference on Machine Learning, 2017.

Clopper, C. J. and Pearson, E. S. The use of confidence or fiducial limits illustrated in the case of the binomial. Biometrika, 26(4):pp. 404–413, 1934. ISSN 00063444.

Croce, F., Andriushchenko, M., and Hein, M. Provable robustness of relu networks via maximization of linear regions. In Proceedings of the 22nd International Conference on Artificial Intelligence and Statistics, 2019.

Deng, J., Dong, W., Socher, R., Li, L.-J., Li, K., and Fei-Fei, L. ImageNet: A Large-Scale Hierarchical Image Database. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2009.

Dodge, S. and Karam, L. A study and comparison of human and deep learning recognition performance under visual distortions. 2017 26th International Conference on Computer Communication and Networks (ICCCN), 2017.

Duchi, J. C., Bartlett, P. L., and Wainwright, M. J. Randomized smoothing for stochastic optimization. SIAM Journal on Optimization, 2012. URL https://doi.org/10.1137/110831659.

Dutta, S., Jha, S., Sanakaranarayanan, S., and Tiwari, A. Output range analysis for deep neural networks. arXiv preprint arXiv:1709.09130, 2017.

Dvijotham, K., Gowal, S., Stanforth, R., Arandjelovic, R., O’Donoghue, B., Uesato, J., and Kohli, P. Training verified learners with learned verifiers. arXiv preprint arXiv:1805.10265, 2018a.

Dvijotham, K., Stanforth, R., Gowal, S., Mann, T., and Kohli, P. A dual approach to scalable verification of deep networks. Proceedings of the Thirty-Fourth Conference Annual Conference on Uncertainty in Artificial Intelligence (UAI-18), 2018b.

Ehlers, R. Formal verification of piece-wise linear feedforward neural networks. In Automated Technology for Verification and Analysis, 2017.

Fawzi, A., Moosavi-Dezfooli, S.-M., and Frossard, P. Robustness of classifiers: from adversarial to random noise. In Advances in Neural Information Processing Systems 29. 2016.

Fischetti, M. and Jo, J. Deep neural networks and mixed integer linear optimization. Constraints, 23(3):296–309, July 2018.

Ford, N., Gilmer, J., and Cubuk, E. D. Adversarial examples are a natural consequence of test error in noise. In Proceedings of the 36th International Conference on Machine Learning, 2019.

Franceschi, J.-Y., Fawzi, A., and Fawzi, O. Robustness of classifiers to uniform ℓp and gaussian noise. In 21st International Conference on Artificial Intelligence and Statistics (AISTATS). 2018.

Gehr, T., Mirman, M., Drachsler-Cohen, D., Tsankov, P., Chaudhuri, S., and Vechev, M. T. AI2: safety and robustness certification of neural networks with abstract interpretation. In 2018 IEEE Symposium on Security and Privacy, SP 2018, Proceedings, 21-23 May 2018, San Francisco, California, USA, pp. 3–18, 2018.

Goodfellow, I. J., Shlens, J., and Szegedy, C. Explaining and harnessing adversarial examples. In International Conference on Learning Representations, 2015.

Gouk, H., Frank, E., Pfahringer, B., and Cree, M. Regularisation of neural networks by enforcing lipschitz continuity. arXiv preprint arXiv:1804.04368, 2018.

Gowal, S., Dvijotham, K., Stanforth, R., Bunel, R., Qin, C., Uesato, J., Arandjelovic, R., Mann, T., and Kohli, P. On the effectiveness of interval bound propagation for training verifiably robust models, 2018.

Hein, M. and Andriushchenko, M. Formal guarantees on the robustness of a classifier against adversarial manipulation. In Advances in Neural Information Processing Systems 30. 2017.

Huang, X., Kwiatkowska, M., Wang, S., and Wu, M. Safety verification of deep neural networks. Computer Aided Verification, 2017.

Hung, K. and Fithian, W. Rank verification for exponential families. The Annals of Statistics, (2):758–782, 04 2019.

Kannan, H., Kurakin, A., and Goodfellow, I. Adversarial logit pairing. arXiv preprint arXiv:1803.06373, 2018.

Katz, G., Barrett, C., Dill, D. L., Julian, K., and Kochenderfer, M. J. Reluplex: An efficient smt solver for verifying deep neural networks. Lecture Notes in Computer Science, pp. 97–117, 2017. ISSN 1611-3349.

Kolter, J. Z. and Madry, A. Adversarial robustness: Theory and practice. https://adversarial-ml-tutorial.org/adversarial_examples/, 2018.

Krizhevsky, A. Learning multiple layers of features from tiny images. Technical report, 2009.

Kurakin, A., Goodfellow, I. J., and Bengio, S. Adversarial machine learning at scale. 2017. URL https://arxiv.org/abs/1611.01236.

Lecuyer, M., Atlidakis, V., Geambasu, R., Hsu, D., and Jana, S. Certified robustness to adversarial examples with differential privacy. In IEEE Symposium on Security and Privacy (SP), 2019.

Li, B., Chen, C., Wang, W., and Carin, L. Second-order adversarial attack and certifiable robustness. arXiv preprint arXiv:1809.03113, 2018.

Liu, X., Cheng, M., Zhang, H., and Hsieh, C.-J. Towards robust neural networks via random self-ensemble. In The European Conference on Computer Vision (ECCV), September 2018.

Lomuscio, A. and Maganti, L. An approach to reachability analysis for feed-forward relu neural networks, 2017.

Madry, A., Makelov, A., Schmidt, L., Tsipras, D., and Vladu, A. Towards deep learning models resistant to adversarial attacks. In International Conference on Learning Representations, 2018.

Mirman, M., Gehr, T., and Vechev, M. Differentiable abstract interpretation for provably robust neural networks. In Proceedings of the 35th International Conference on Machine Learning, 2018.

Moosavi-Dezfooli, S.-M., Fawzi, A., and Frossard, P. Deepfool: A simple and accurate method to fool deep neural networks. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.

Neyman, J. and Pearson, E. S. On the problem of the most efficient tests of statistical hypotheses. Philosophical Transactions of the Royal Society of London. Series A, Containing Papers of a Mathematical or Physical Character, 231:289–337, 1933.

Raghunathan, A., Steinhardt, J., and Liang, P. Certified defenses against adversarial examples. In International Conference on Learning Representations, 2018a.

Raghunathan, A., Steinhardt, J., and Liang, P. Semidefinite relaxations for certifying robustness to adversarial examples. In Advances in Neural Information Processing Systems 31, 2018b.

Singh, G., Gehr, T., Mirman, M., P¨uschel, M., and Vechev, M. Fast and effective robustness certification. In Advances in Neural Information Processing Systems 31. 2018.

Smilkov, D., Thorat, N., Kim, B., Vi´egas, F., and Wattenberg, M. Smoothgrad: removing noise by adding noise. arXiv preprint arXiv:1706.03825, 2017.

Szegedy, C., Zaremba, W., Sutskever, I., Bruna, J., Erhan, D., Goodfellow, I., and Fergus, R. Intriguing properties of neural networks. In International Conference on Learning Representations, 2014.

Tjeng, V., Xiao, K. Y., and Tedrake, R. Evaluating robustness of neural networks with mixed integer programming. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id=HyGIdiRqtm.

Tsipras, D., Santurkar, S., Engstrom, L., Turner, A., and Madry, A. Robustness may be at odds with accuracy. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id=SyxAb30cY7.

Tsuzuku, Y., Sato, I., and Sugiyama, M. Lipschitz-margin training: Scalable certification of perturbation invariance for deep neural networks. In Advances in Neural Information Processing Systems 31. 2018.

Uesato, J., O’Donoghue, B., Kohli, P., and van den Oord, A. Adversarial risk and the dangers of evaluating against weak attacks. In Proceedings of the 35th International Conference on Machine Learning, 2018.

Wang, S., Chen, Y., Abdou, A., and Jana, S. Mixtrain: Scalable training of formally robust neural networks. arXiv preprint arXiv:1811.02625, 2018a.

Wang, S., Pei, K., Whitehouse, J., Yang, J., and Jana, S. Efficient formal safety analysis of neural networks. In Advances in Neural Information Processing Systems 31. 2018b.

Webb, S., Rainforth, T., Teh, Y. W., and Kumar, M. P. Statistical verification of neural networks. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id=S1xcx3C5FX.

Weng, L., Zhang, H., Chen, H., Song, Z., Hsieh, C.-J., Daniel, L., Boning, D., and Dhillon, I. Towards fast computation of certified robustness for ReLU networks. In Proceedings of the 35th International Conference on Machine Learning, 2018a.

Weng, T.-W., Zhang, H., Chen, P.-Y., Yi, J., Su, D., Gao, Y., Hsieh, C.-J., and Daniel, L. Evaluating the robustness of neural networks: An extreme value theory approach. In International Conference on Learning Representations, 2018b.

Wong, E. and Kolter, J. Z. Provable defenses against adversarial examples via the convex outer adversarial polytope. In Proceedings of the 35th International Conference on Machine Learning, 2018.

Wong, E., Schmidt, F., Metzen, J. H., and Kolter, J. Z. Scaling provable adversarial defenses. In Advances in Neural Information Processing Systems 31, 2018.

Zantedeschi, V., Nicolae, M.-I., and Rawat, A. Efficient defenses against adversarial attacks. Proceedings of the 10th ACM Workshop on Artificial Intelligence and Security - AISec ’17, 2017.

Zhang, H., Weng, T.-W., Chen, P.-Y., Hsieh, C.-J., and Daniel, L. Efficient neural network robustness certification with general activation functions. In Advances in Neural Information Processing Systems 31. 2018.