Certified Robustness for Top-k Predictions against Adversarial Perturbations via Randomized Smoothing

Jinyuan Jia, Xiaoyu Cao, Binghui Wang, Neil Zhenqiang Gong

Introduction

Classifiers are vulnerable to adversarial perturbations (Szegedy et al., 2014; Goodfellow et al., 2015; Carlini & Wagner, 2017b; Jia & Gong, 2018). Specifically, given an example x\mathbf{x} and a classifier ff, an attacker can carefully craft a perturbation δ\delta such that ff makes predictions for x+δ\mathbf{x}+\delta as the attacker desires. Various empirical defenses (e.g., Goodfellow et al. (2015); Svoboda et al. (2019); Buckman et al. (2018); Ma et al. (2018); Guo et al. (2018); Dhillon et al. (2018); Xie et al. (2018); Song et al. (2018)) have been proposed to defend against adversarial perturbations. However, these empirical defenses were often soon broken by adaptive adversaries (Carlini & Wagner, 2017a; Athalye et al., 2018). As a response, certified robustness (e.g., Wong & Kolter (2018); Raghunathan et al. (2018a); Liu et al. (2018); Lecuyer et al. (2019); Cohen et al. (2019)) against adversarial perturbations has been developed. In particular, a robust classifier verifiably predicts the same top-1 label for data points in a certain region around any example x\mathbf{x}.

In many applications such as recommender systems, web search, and image classification cloud service (Clarifai, ; Google Cloud Vision, ), top-kk predictions are more relevant. In particular, given an example, a set of kk most likely labels are predicted for the example. However, existing certified robustness results are limited to top-1 predictions, leaving top-kk robustness unexplored. To bridge this gap, we study certified robustness for top-kk predictions in this work. Our certified top-kk robustness leverages randomized smoothing (Cao & Gong, 2017; Cohen et al., 2019), which turns any base classifier ff to be a robust classifier via adding random noise to an example. For instance, Cao & Gong (2017) is the first to propose randomized smoothing with uniform noise as an empirical defense. We consider random Gaussian noise because of its certified robustness guarantee (Cohen et al., 2019). Specifically, we denote by pip_{i} the probability that the base classifier ff predicts label ii for the Gaussian random variable N(x,σ2I)\mathcal{N}(\mathbf{x},\sigma^{2}I). The smoothed classifier gk(x)g_{k}(\mathbf{x}) predicts the kk labels with the largest probabilities pip_{i}’s for the example x\mathbf{x}. We adopt randomized smoothing because it is scalable to large-scale neural networks and applicable to any base classifier.

Our contributions are summarized as follows:

Theory. We derive the first certified radius for top-kk predictions. Moreover, we prove our certified radius is tight for randomized smoothing with Gaussian noise.

Algorithm. We develop algorithms to estimate our certified radius in practice.

Evaluation. We empirically evaluate our method on CIFAR10 and ImageNet.

Certified Radius for Top-k𝑘k Predictions

Suppose we are given an example x\mathbf{x}, an arbitrary base classifier ff, ϵ∼N(0,σ2I)\epsilon\sim\mathcal{N}(0,\sigma^{2}I), a smoothed classifier gg, an arbitrary label l∈{1,2,⋯ ,c}l\in\{1,2,\cdots,c\}, and pl‾,p‾1,⋯ ,p‾l−1,p‾l+1,⋯ ,p‾c∈\underline{p_{l}},\overline{p}_{1},\cdots,\overline{p}_{l-1},\overline{p}_{l+1},\cdots,\overline{p}_{c}\in that satisfy the following conditions:

where p‾\underline{p} and p‾\overline{p} indicate lower and upper bounds of pp, respectively. Let p‾bk≥p‾bk−1≥⋯≥p‾b1\overline{p}_{b_{k}}\geq\overline{p}_{b_{k-1}}\geq\cdots\geq\overline{p}_{b_{1}} be the kk largest ones among {p‾1,⋯ ,p‾l−1,p‾l+1,⋯ ,p‾c}\{\overline{p}_{1},\cdots,\overline{p}_{l-1},\overline{p}_{l+1},\cdots,\overline{p}_{c}\}, where ties are broken uniformly at random. Moreover, we denote by St={b1,b2,⋯ ,bt}S_{t}=\{b_{1},b_{2},\cdots,b_{t}\} the set of tt labels with the smallest probability upper bounds in the kk largest ones and by p‾St=∑j=1tp‾bj\overline{p}_{S_{t}}=\sum_{j=1}^{t}\overline{p}_{b_{j}} the sum of the tt probability upper bounds, where t=1,2,⋯ ,kt=1,2,\cdots,k. Then, we have:

where RlR_{l} is the unique solution to the following equation:

where Φ\Phi and Φ−1\Phi^{-1} are the cumulative distribution function and its inverse of the standard Gaussian distribution, respectively.

Assuming we have pl‾+∑j=1kp‾bj≤1\underline{p_{l}}+\sum_{j=1}^{k}\overline{p}_{b_{j}}\leq 1 and pl‾+∑i=1,⋯ ,l−1,l+1,⋯ ,cp‾i≥1\underline{p_{l}}+\sum_{i=1,\cdots,l-1,l+1,\cdots,c}\overline{p}_{i}\geq 1. Then, for any perturbation ∣∣δ∣∣2>Rl||\delta||_{2}>R_{l}, there exists a base classifier f∗f^{*} consistent with (1) but we have l∉gk(x+δ)l\notin g_{k}(\mathbf{x}+\delta).

We have several observations about our theorems.

Our certified radius is applicable to any base classifier ff.

According to Equation 3, our certified radius RlR_{l} depends on σ\sigma, pl‾\underline{p_{l}}, and the kk largest probability upper bounds {p‾bk,p‾bk−1,⋯ ,p‾b1}\{\overline{p}_{b_{k}},\overline{p}_{b_{k-1}},\cdots,\overline{p}_{b_{1}}\} excluding p‾l\overline{p}_{l}. When the lower bound pl‾\underline{p_{l}} and the upper bounds {p‾bk,p‾bk−1,⋯ ,p‾b1}\{\overline{p}_{b_{k}},\overline{p}_{b_{k-1}},\cdots,\overline{p}_{b_{1}}\} are tighter, the certified radius RlR_{l} is larger. When Rl<0R_{l}<0, the label ll is not among the top-kk labels predicted by the smoothed classifier even if no perturbation is added, i.e., l∉gk(x)l\notin g_{k}(\mathbf{x}).

When k=1k=1, we have Rl=σ2(Φ−1(pl‾)−Φ−1(p‾b1))R_{l}=\frac{\sigma}{2}(\Phi^{-1}(\underline{p_{l}})-\Phi^{-1}(\overline{p}_{b_{1}})), where p‾b1\overline{p}_{b_{1}} is an upper bound of the largest label probability excluding p‾l\overline{p}_{l}. The certified radius derived by Cohen et al. (2019) for top-1 predictions (i.e., their Equation 3) is a special case of our certified radius with k=1k=1, l=Al=A, and b1=Bb_{1}=B.

Prediction and Certification in practice

With probability at least 1−α1-\alpha over the randomness in Predict, if Predict returns a set TT (i.e., does not ABSTAIN), then we have gk(x)=Tg_{k}(\mathbf{x})=T.

2 Certification

Given a base classifier ff, an example x\mathbf{x}, a label ll, and the standard deviation σ\sigma of the Gaussian noise, we aim to compute the certified radius RlR_{l}. According to our Equation 3, our RlR_{l} relies on a lower bound of plp_{l}, i.e., pl‾\underline{p_{l}}, and the upper bound of pStp_{S_{t}}, i.e., p‾St\overline{p}_{S_{t}}, which are related to ff, x\mathbf{x}, and σ\sigma. We first discuss two Monte Carlo methods to estimate pl‾\underline{p_{l}} and p‾St\overline{p}_{S_{t}} with probabilistic guarantees. However, given pl‾\underline{p_{l}} and p‾St\overline{p}_{S_{t}}, it is still challenging to exactly solve RlR_{l} as the Equation 3 does not have an analytical solution. To address the challenge, we design an algorithm to obtain a lower bound of RlR_{l} via solving Equation 3 through binary search. Our lower bound can be tuned to be arbitrarily close to RlR_{l}.

Our approach has two steps. The first step is to estimate pl‾\underline{p_{l}} and p‾i\overline{p}_{i} for i≠li\neq l. The second step is to estimate p‾St\overline{p}_{S_{t}} using p‾i\overline{p}_{i} for i≠li\neq l.

Estimating pl‾\underline{p_{l}} and p‾i\overline{p}_{i} for i≠li\neq l: The probabilities p1,p2,⋯ ,pcp_{1},p_{2},\cdots,p_{c} can be viewed as a multinomial distribution over the labels {1,2,⋯ ,c}\{1,2,\cdots,c\}. If we sample a Gaussian noise ϵ\epsilon uniformly at random, then the label f(x+ϵ)f(\mathbf{x}+\epsilon) can be viewed as a sample from the multinomial distribution. Therefore, estimating pl‾\underline{p_{l}} and p‾i\overline{p}_{i} for i≠li\neq l is essentially a one-sided simultaneous confidence interval estimation problem. In particular, we aim to estimate these bounds with a confidence level at least 1−α1-\alpha. In statistics, Goodman (1965); Sison & Glaz (1995) are well-known methods for simultaneous confidence interval estimations. However, these methods are insufficient for our problem. Specifically, Goodman’s method is based on Chi-square test, which requires the expected count for each label to be no less than 5. We found that this is usually not satisfied, e.g., ImageNet has 1,000 labels, some of which have close-to-zero probabilities and do not have more than 5 counts even if we sample a large number of Gaussian noise. Sison & Glaz’s method guarantees a confidence level of approximately 1−α1-\alpha, which means that the confidence level could be (slightly) smaller than 1−α1-\alpha. However, we aim to achieve a confidence level of at least 1−α1-\alpha. To address these challenges, we discuss two confidence interval estimation methods as follows:

where 1−α1-\alpha is the confidence level and B(α;u,v)B(\alpha;u,v) is the α\alphath quantile of the Beta distribution with shape parameters uu and vv. We note that the Clopper-Pearson method was also adopted by Cohen et al. (2019) to estimate label probability for their certified radius of top-1 predictions.

Estimating p‾St\overline{p}_{S_{t}}: One natural method is to estimate p‾St=∑j=1tp‾bj\overline{p}_{S_{t}}=\sum_{j=1}^{t}\overline{p}_{b_{j}}. However, this bound may be loose. For example, when using BinoCP to estimate the probability bounds, we have p‾St=t⋅(1−pl‾)\overline{p}_{S_{t}}=t\cdot(1-\underline{p_{l}}), which may be bigger than 11. To address the challenge, we derive another bound for p‾St\overline{p}_{S_{t}} from another perspective. Specifically, we have pSt≤∑i≠lpi≤1−pl‾{p}_{S_{t}}\leq\sum_{i\neq l}p_{i}\leq 1-\underline{p_{l}}. Therefore, we can use 1−pl‾1-\underline{p_{l}} as an upper bound of pSt{p}_{S_{t}}, i.e., p‾St=1−pl‾\overline{p}_{S_{t}}=1-\underline{p_{l}}. Finally, we combine the above two estimations by taking the minimal one, i.e., p‾St=min⁡(∑j=1tp‾bj,1−pl‾)\overline{p}_{S_{t}}=\min(\sum_{j=1}^{t}\overline{p}_{b_{j}},1-\underline{p_{l}}).

It is challenging to compute the certified radius RlR_{l} exactly because Equation 3 does not have an analytical solution. To address the challenge, we design a method to estimate a lower bound of RlR_{l} that can be tuned to be arbitrarily close to RlR_{l}. Specifically, we first approximately solve the following equation for each t∈{1,2,⋯ ,k}t\in\{1,2,\cdots,k\}:

We note that it is still difficult to obtain an analytical solution to Equation 7 when t>1t>1. However, we notice that the left-hand side has the following properties: 1) it decreases as RltR_{l}^{t} increases; 2) when Rlt→−∞R_{l}^{t}\rightarrow-\infty, it is greater than 0; 3) when Rlt→∞R_{l}^{t}\rightarrow\infty, it is smaller than 0. Therefore, there exists a unique solution RltR_{l}^{t} to Equation 7. Moreover, we leverage binary search to find a lower bound Rl‾t\underline{R_{l}}^{t} that can be arbitrarily close to the exact solution RltR_{l}^{t}. In particular, we run the binary search until the left-hand side of Equation 7 is non-negative and the width of the search interval is less than a parameter μ>0\mu>0. Formally, we have:

After obtaining Rl‾t\underline{R_{l}}^{t}, we let Rl‾=max⁡t=1kRl‾t\underline{R_{l}}=\max_{t=1}^{k}\underline{R_{l}}^{t} be our lower bound of RlR_{l}. Based on Rl=max⁡t=1kRltR_{l}=\max_{t=1}^{k}R_{l}^{t} and Equation 8, we have the following guarantee:

2.3 Complete Certification Algorithm

Algorithm 2 shows our algorithm to estimate the certified radius for a given example x\mathbf{x} and a label ll. The function SampleUnderNoise is the same as in Algorithm 1. Functions BinoCP and SimuEM return the estimated probability bound for each label. Function BinarySearch performs binary search to solve the Equation 7 and returns a solution satisfying Equation 8. Formally, our algorithm has the following guarantee:

With probability at least 1−α1-\alpha over the randomness in Certify, if Certify returns a radius Rl‾\underline{R_{l}} (i.e., does not ABSTAIN), then we have l∈gk(x+δ)l\in g_{k}(\mathbf{x}+\delta), ∀∣∣δ∣∣2<Rl‾\forall||\delta||_{2}<\underline{R_{l}}.

Experiments

Datasets and models: We conduct experiments on the standard CIFAR10 (Krizhevsky & Hinton, 2009) and ImageNet (Deng et al., 2009) datasets to evaluate our method. We use the publicly available pre-trained models from Cohen et al. (2019). Specifically, the architectures of the base classifiers are ResNet-110 and ResNet-50 for CIFAR10 and ImageNet, respectively.

Parameter setting: We study the impact of kk, the confidence level 1−α1-\alpha, the noise level σ\sigma, the number of samples nn, and the confidence interval estimation methods on the certified radius. Unless otherwise mentioned, we use the following default parameters: k=3k=3, α=0.001\alpha=0.001, σ=0.5\sigma=0.5, n=100,000n=100,000, and μ=10−5\mu=10^{-5}. Moreover, we use SimuEM to estimate bounds of label probabilities. When studying the impact of one parameter on the certified radius, we fix the other parameters to their default values.

Approximate certified top-kk accuracy: For each testing example x\mathbf{x} whose true label is ll, we compute the certified radius Rl‾\underline{R_{l}} using the Certify algorithm. Then, we compute the certified top-kk accuracy at a radius rr as the fraction of testing examples whose certified radius are at least rr. Note that our computed certified top-kk accuracy is an approximate certified top-kk accuracy instead of the true certified top-kk accuracy. However, we can obtain a lower bound of the true certified top-kk accuracy based on the approximate certified top-kk accuracy. Appendix E shows the details. Moreover, the gap between the lower bound of the true certified top-kk accuracy and the approximate top-kk accuracy is negligible when α\alpha is small. For convenience, we simply use the term certified top-kk accuracy in the paper.

2 Experimental results

Related Work

Numerous defenses have been proposed against adversarial perturbations in the past several years. These defenses either show robustness against existing attacks empirically, or prove the robustness against arbitrary bounded-perturbations (known as certified defenses).

The community has proposed many empirical defenses. The most effective empirical defense is adversarial training (Goodfellow et al., 2015; Kurakin et al., 2017; Tramèr et al., 2018; Madry et al., 2018). However, adversarial training does not have certified robustness guarantees. Other examples of empirical defenses include defensive distillation (Papernot et al., 2016), MagNet (Meng & Chen, 2017), PixelDefend (Song et al., 2017), Feature squeezing (Xu et al., 2018), and many others (Liu et al., 2019; Svoboda et al., 2019; Schott et al., 2019; Buckman et al., 2018; Ma et al., 2018; Guo et al., 2018; Dhillon et al., 2018; Xie et al., 2018; Song et al., 2018; Samangouei et al., 2018; Na et al., 2018; Metzen et al., 2017). However, many of these defenses were soon broken by adaptive attacks (Carlini & Wagner, 2017a; Athalye et al., 2018; Uesato et al., 2018; Athalye & Carlini, 2018).

2 Certified defenses

Randomized smoothing was first proposed as an empirical defense (Cao & Gong, 2017; Liu et al., 2018) without deriving the certified robustness guarantees. For instance, Cao & Gong (2017) proposed randomized smoothing with uniform noise from a hypercube centered at an example. Lecuyer et al. (2019) was the first to prove the certified robustness guarantee of randomized smoothing for top-1 predictions. Their results leverage differential privacy. Subsequently, Li et al. (2018) further leverages information theory to improve the certified radius bound. Cohen et al. (2019) obtains a tight certified radius bound for randomized smoothing with Gaussian noise by leveraging the Neyman-Pearson Lemma. Pinot et al. (2019) theoretically demonstrated the robustness to adversarial attacks of randomized smoothing when adding noise from Exponential family distributions and devised an upper bound on the adversarial generalization gap of randomized neural networks. Lee et al. (2019) generalized randomized smoothing to discrete data. Salman et al. (2019) employed adversarial training to improve the performance of randomized smoothing. Unlike the other certified defenses, randomized smoothing is scalable to large neural networks and applicable to arbitrary classifiers. Our work derives the first certified robustness guarantee of randomized smoothing for top-kk predictions. Moreover, we show that our robustness guarantee is tight for randomized smoothing with Gaussian noise.

Conclusion

ACKNOWLEDGMENTS We thank the anonymous reviewers for insightful reviews. This work was supported by NSF grant No. 1937786.

References

Appendix A Proof of Theorem 1

Given an example x\mathbf{x}, we define the following two random variables:

where ϵ∼N(0,σ2I)\epsilon\sim\mathcal{N}(0,\sigma^{2}I). The random variables X\mathbf{X} and Y\mathbf{Y} represent random samples obtained by adding isotropic Gaussian noise to the example x\mathbf{x} and its perturbed version x+δ\mathbf{x}+\delta, respectively. Cohen et al. (2019) applied the standard Neyman-Pearson Lemma (Neyman & Pearson, 1933) to the above two random variables, and obtained the following lemma:

Moreover, we have the following lemma from Cohen et al. (2019).

Given an example x\mathbf{x}, a number q∈q\in, and regions A\mathcal{A} and B\mathcal{B} defined as follows:

Based on Lemma 1 and 2, we derive the following lemma:

Suppose we have an arbitrary base classifier ff, an example x\mathbf{x}, a set of labels which are denoted as SS, two probabilities pS‾\underline{p_{S}} and p‾S\overline{p}_{S} that satisfy pS‾≤pS=Pr(f(X)∈S)≤p‾S\underline{p_{S}}\leq p_{S}=\text{Pr}(f(\mathbf{X})\in S)\leq\overline{p}_{S}, and regions AS\mathcal{A}_{S} and BS\mathcal{B}_{S} defined as follows:

which is the first inequality in (21). The second inequality in (21) can be obtained similarly. ∎

Next, we restate Theorem 1 and show our proof.

Roughly speaking, our idea is to make the probability that the base classifier ff predicts ll when taking Y\mathbf{Y} as input larger than the smallest one among the probabilities that ff predicts for a set of arbitrary kk labels selected from all labels except ll. For simplicity, we let Γ={1,2,⋯ ,c}∖{l}\Gamma=\{1,2,\cdots,{c}\}\setminus\{l\}, i.e., all labels except ll. We denote by Γk\Gamma_{k} a set of kk labels in Γ\Gamma. We aim to find a certified radius RlR_{l} such that we have max⁡Γk⊆Γmin⁡i∈ΓkPr(f(Y)=i)<Pr(f(Y)=l)\max_{\Gamma_{k}\subseteq\Gamma}\min_{i\in\Gamma_{k}}\text{Pr}(f(\mathbf{Y})=i)<\text{Pr}(f(\mathbf{Y})=l), which guarantees l∈gk(x+δ)l\in g_{k}(\mathbf{x}+\delta). We first upper bound the minimal probability min⁡i∈ΓkPr(f(Y)=i)\min_{i\in\Gamma_{k}}\text{Pr}(f(\mathbf{Y})=i) for a given Γk\Gamma_{k}, and then we upper bound the maximum value of the minimal probability among all possible Γk⊆Γ\Gamma_{k}\subseteq\Gamma. Finally, we obtain the certified radius RlR_{l} via letting the upper bound of the maximum value smaller than Pr(f(Y)=l)\text{Pr}(f(\mathbf{Y})=l).

Bounding min⁡i∈ΓkPr(f(Y)=i)\min_{i\in\Gamma_{k}}\text{Pr}(f(\mathbf{Y})=i) for a given Γk\Gamma_{k}: We use SS to denote a non-empty subset of Γk\Gamma_{k} and use ∣S∣|S| to denote its size. We define p‾S=∑i∈Sp‾i\overline{p}_{S}=\sum_{i\in S}\overline{p}_{i}, which is the sum of the upper bounds of the probabilities for the labels in SS. Moreover, we define the following region associated with the set SS:

We have Pr(f(Y)∈S)≤Pr(Y∈BS)\text{Pr}(f(\mathbf{Y})\in S)\leq\text{Pr}(\mathbf{Y}\in\mathcal{B}_{S}) by applying Lemma 3 to the set SS. In addition, we have ∑i∈SPr(f(Y)=i)=Pr(f(Y)∈S)\sum_{i\in S}\text{Pr}(f(\mathbf{Y})=i)=\text{Pr}(f(\mathbf{Y})\in S). Therefore, we have:

where we have the first inequality because SS is a subset of Γk\Gamma_{k} and we have the second inequality because the smallest value in a set is no larger than the average value of the set. Equation 27 holds for any S⊆ΓkS\subseteq\Gamma_{k}. Therefore, by taking all possible sets SS into consideration, we have the following:

where StS_{t} is the set of tt labels in Γk\Gamma_{k} whose probability upper bounds are the smallest, where ties are broken uniformly at random. We have Equation 30 from Equation 29 because Pr(Y∈BS)\text{Pr}(\mathbf{Y}\in\mathcal{B}_{S}) decreases as p‾S\overline{p}_{S} decreases.

Bounding max⁡Γk⊆Γmin⁡i∈ΓkPr(f(Y)=i)\max_{\Gamma_{k}\subseteq\Gamma}\min_{i\in\Gamma_{k}}\text{Pr}(f(\mathbf{Y})=i): Since Pr(Y∈BSt)\text{Pr}(\mathbf{Y}\in\mathcal{B}_{S_{t}}) increases as p‾St\overline{p}_{S_{t}} increases, Equation 30 reaches its maximum value when Γk={b1,b2,⋯ ,bk}\Gamma_{k}=\{b_{1},b_{2},\cdots,b_{k}\}, i.e., when Γk\Gamma_{k} is the set of kk labels in Γ\Gamma with the largest probability upper bounds. Formally, we have:

where St={b1,b2,⋯ ,bt}S_{t}=\{b_{1},b_{2},\cdots,b_{t}\}.

Obtaining RlR_{l}: According to Lemma 3, we have the following for S={l}S=\{l\}:

Recall that our goal is to make Pr(f(Y)=l)>max⁡Γk⊆Γmin⁡i∈ΓkPr(f(Y)=i)\text{Pr}(f(\mathbf{Y})=l)>\max_{\Gamma_{k}\subseteq\Gamma}\min_{i\in\Gamma_{k}}\text{Pr}(f(\mathbf{Y})=i). It suffices to let:

According to Lemma 2, we have Pr(Y∈A{l})=Φ(Φ−1(pl‾)−∣∣δ∣∣2σ))\text{Pr}(\mathbf{Y}\in\mathcal{A}_{\{l\}})=\Phi(\Phi^{-1}(\underline{p_{l}})-\frac{||\delta||_{2}}{\sigma})) and Pr(Y∈BSt)=Φ(Φ−1(p‾St)+∣∣δ∣∣2σ))\text{Pr}(\mathbf{Y}\in\mathcal{B}_{S_{t}})=\Phi(\Phi^{-1}(\overline{p}_{S_{t}})+\frac{||\delta||_{2}}{\sigma})). Therefore, we have the following constraint on δ\delta:

Since the left-hand side of the above inequality 1) decreases as ∣∣δ∣∣2||\delta||_{2} increases, 2) is larger than 0 when ∣∣δ∣∣2→−∞||\delta||_{2}\rightarrow-\infty, and 3) is smaller than 0 when ∣∣δ∣∣2→∞||\delta||_{2}\rightarrow\infty, we have the constraint ∣∣δ∣∣2<Rl||\delta||_{2}<R_{l}, where RlR_{l} is the unique solution to the following equation:

Appendix B Proof of Theorem 2

Following the terminology we used in proving Theorem 1, we define a region A{l}\mathcal{A}_{\{l\}} as follows:

According to Lemma 2, we have Pr(X∈A{l})=pl‾\text{Pr}(\mathbf{X}\in\mathcal{A}_{\{l\}})=\underline{p_{l}}. We first show the following lemma, which is the key to prove our Theorem 2.

where the random variables X\mathbf{X} and Y\mathbf{Y} are defined in Equation 10 and 11, respectively; and {b1,b2,⋯ ,bk}\{b_{1},b_{2},\cdots,b_{k}\} and StS_{t} are defined in Theorem 1.

Our proof is based on mathematical induction and the intermediate value theorem. For convenience, we defer the proof to Appendix B.1. ∎

Next, we restate Theorem 2 and show our proof. See 2

Based on the definition of f∗f^{*}, we have the following:

Therefore, f∗f^{*} satisfies the conditions in (1). Next, we show that ll is not among the top-kk labels predicted by the smoothed classifier for any perturbed example x+δ\mathbf{x}+\delta when ∣∣δ∣∣2>Rl||\delta||_{2}>R_{l}. Specifically, we have:

where j=1,2,⋯ ,kj=1,2,\cdots,k. Since we have found kk labels whose probabilities are larger than the probability of the label ll, we have l∉gk(x+δ)l\notin g_{k}(\mathbf{x}+\delta) when ∥δ∥2>Rl\left\|\delta\right\|_{2}>R_{l}. ∎

We first define some key notations and lemmas that will be used in our proof.

Given two values q1q_{1} and q2q_{2} that satisfy 0≤q1<q2≤10\leq q_{1}<q_{2}\leq 1, we define the following region:

where the Gaussian random variable X\mathbf{X} is defined in Equation 10. Moreover, assuming we have pairs of (q1i,q2i)(q_{1}^{i},q_{2}^{i}), i=1,2,3,⋯i=1,2,3,\cdots, where q1i,q2i∈[q1,q2]q_{1}^{i},q_{2}^{i}\in[q_{1},q_{2}], ∀i\forall i. We define the following region:

C′(q1,q2)\mathcal{C}^{\prime}(q_{1},q_{2}) is the remaining region of C(q1,q2)\mathcal{C}(q_{1},q_{2}) excluding C(q11,q21),C(q12,q22),⋯\mathcal{C}(q_{1}^{1},q_{2}^{1}),\mathcal{C}(q_{1}^{2},q_{2}^{2}),\cdots. Given two values q1λq_{1}^{\lambda} and q2λq_{2}^{\lambda} that satisfy q1≤q1λ≤q2λ≤q2q_{1}\leq q_{1}^{\lambda}\leq q_{2}^{\lambda}\leq q_{2}, we also define the following two functions:

where the random variables X\mathbf{X} and Y\mathbf{Y} are defined in Equation 10 and 11, respectively.

Next, we show a key property of our defined functions rx(q1λ,q2λ)r_{x}(q_{1}^{\lambda},q_{2}^{\lambda}) and ry(q1λ,q2λ)r_{y}(q_{1}^{\lambda},q_{2}^{\lambda}).

If rx(q1κ,q2κ)≤rx(q1λ,q2λ)r_{x}(q_{1}^{\kappa},q_{2}^{\kappa})\leq r_{x}(q_{1}^{\lambda},q_{2}^{\lambda}) and q2κ≥q2λq_{2}^{\kappa}\geq q_{2}^{\lambda} (or q1κ≥q1λ)q_{1}^{\kappa}\geq q_{1}^{\lambda}), then we have ry(q1κ,q2κ)≤ry(q1λ,q2λ)r_{y}(q_{1}^{\kappa},q_{2}^{\kappa})\leq r_{y}(q_{1}^{\lambda},q_{2}^{\lambda}).

Scenario I: q2κ≥q1κ≥q2λ≥q1λq_{2}^{\kappa}\geq q_{1}^{\kappa}\geq q_{2}^{\lambda}\geq q_{1}^{\lambda}. We denote hxh_{x} and hyh_{y} as the probability densities for the random variables X\mathbf{X} and Y\mathbf{Y}, respectively. Then, we have hx(z)=(12πσ)dexp⁡(−∑i=1d(zi−xi)22σ2)h_{x}(\mathbf{z})=(\frac{1}{\sqrt{2\pi}\sigma})^{d}\exp(-\frac{\sum_{i=1}^{d}(z_{i}-x_{i})^{2}}{2\sigma^{2}}) and hy(z)=(12πσ)dexp⁡(−∑i=1d(zi−xi−δi)22σ2)h_{y}(\mathbf{z})=(\frac{1}{\sqrt{2\pi}\sigma})^{d}\exp(-\frac{\sum_{i=1}^{d}(z_{i}-x_{i}-\delta_{i})^{2}}{2\sigma^{2}}). Therefore, the ratio of the probability density of Y\mathbf{Y} and the probability density of X\mathbf{X} at a given point z\mathbf{z} is as follows:

Next, we compare the ratio for the points in different regions and have the following:

The Equation 57 from 56 is based on Equation 55 and the fact that δT(z−x)≤σ∥δ∥2Φ−1(1−q1κ)\delta^{T}(\mathbf{z}-\mathbf{x})\leq\sigma\left\|\delta\right\|_{2}\Phi^{-1}(1-q_{1}^{\kappa}) for any point z\mathbf{z} in the region C′(q1κ,q2κ)\mathcal{C}^{\prime}(q_{1}^{\kappa},q_{2}^{\kappa}) from Definition 1. Similarly, we can obtain Equation 59 from 58. We note that the Equation 58 from 57 is because q2λ≤q1κq_{2}^{\lambda}\leq q_{1}^{\kappa}. Based on Equation 57 and 58, we know that there exists a real number uu such that:

Combining the Equation 56, 57, and 60, we have the following:

Taking an integral on both sides of the Equation 61 in the region C′(q1κ,q2κ)\mathcal{C}^{\prime}(q_{1}^{\kappa},q_{2}^{\kappa}) and recalling the definition of rx(q1κ,q2κ)r_{x}(q_{1}^{\kappa},q_{2}^{\kappa}) and ry(q1κ,q2κ)r_{y}(q_{1}^{\kappa},q_{2}^{\kappa}), we have the following:

Based on Equation 62, 63, and the condition that rx(q1κ,q2κ)≤rx(q1λ,q2λ)r_{x}(q_{1}^{\kappa},q_{2}^{\kappa})\leq r_{x}(q_{1}^{\lambda},q_{2}^{\lambda}), we have the following:

Scenario II: q2κ≥q2λ≥q1κ≥q1λq_{2}^{\kappa}\geq q_{2}^{\lambda}\geq q_{1}^{\kappa}\geq q_{1}^{\lambda}. We have:

Therefore, we have the following equation:

Similar to Scenario I, we know that there exists uu such that:

Similar to Scenario I, we have the following based on Equation 66:

Scenario III: q2κ≥q2λ≥q1λ≥q1κq_{2}^{\kappa}\geq q_{2}^{\lambda}\geq q_{1}^{\lambda}\geq q_{1}^{\kappa}. As rx(q1κ,q2κ)≤rx(q1λ,q2λ)r_{x}(q_{1}^{\kappa},q_{2}^{\kappa})\leq r_{x}(q_{1}^{\lambda},q_{2}^{\lambda}), we have rx(q1κ,q2κ)=rx(q1λ,q2λ)r_{x}(q_{1}^{\kappa},q_{2}^{\kappa})=r_{x}(q_{1}^{\lambda},q_{2}^{\lambda}). Therefore, we have ry(q1κ,q2κ)=ry(q1λ,q2λ)r_{y}(q_{1}^{\kappa},q_{2}^{\kappa})=r_{y}(q_{1}^{\lambda},q_{2}^{\lambda}). ∎

Next, we list the well-known Intermediate Value Theorem and show several other properties of our defined functions rx(q1λ,q2λ)r_{x}(q_{1}^{\lambda},q_{2}^{\lambda}) and ry(q1λ,q2λ)r_{y}(q_{1}^{\lambda},q_{2}^{\lambda}).

If a function FF is continuous at every point in the interval [a,b][a,b] and (F(a)−v)⋅(F(b)−v)≤0(F(a)-v)\cdot(F(b)-v)\leq 0, then there exists xx such that F(x)=vF(x)=v.

Roughly speaking, the Intermediate Value Theorem tells us that if a continuous function has values no larger and no smaller (or no smaller and no larger) than vv at the two end points of an interval, respectively, then the function takes value vv at some point in the interval.

Given two probabilities qx,qyq_{x},q_{y}, if we have:

Then, there exists q1′,q2′∈[q1,q2]q_{1}^{\prime},q_{2}^{\prime}\in[q_{1},q_{2}] such that:

then there exists q1′′,q2′′∈[q1,q2]q_{1}^{\prime\prime},q_{2}^{\prime\prime}\in[q_{1},q_{2}] such that:

We define function F(x)=rx(q1,x)F(x)=r_{x}(q_{1},x). Then, we have (F(q1)−qx)⋅(F(q2)−qx)≤0(F(q_{1})-q_{x})\cdot(F(q_{2})-q_{x})\leq 0 since F(q1)=0≤qxF(q_{1})=0\leq q_{x} and F(q2)=rx(q1,q2)>qxF(q_{2})=r_{x}(q_{1},q_{2})>q_{x} based on Equation 70. Therefore, according to Lemma 6, there exists q1′∈[q1,q2]q_{1}^{\prime}\in[q_{1},q_{2}] such that:

Similarly, we can prove that there exists q2′∈[q1,q2]q_{2}^{\prime}\in[q_{1},q_{2}] such that rx(q1′,q2)=qxr_{x}(q_{1}^{\prime},q_{2})=q_{x}.

For any q2e∈[q2′,q2]q_{2}^{e}\in[q_{2}^{\prime},q_{2}], we define H(x)=rx(x,q2e)H(x)=r_{x}(x,q_{2}^{e}). Then, we know H(q1)=rx(q1,q2e)≥rx(q1,q2′)=qxH(q_{1})=r_{x}(q_{1},q_{2}^{e})\geq r_{x}(q_{1},q_{2}^{\prime})=q_{x} since q2e≥q2′q_{2}^{e}\geq q_{2}^{\prime}. Moreover, we have H(q2e)=0≤qxH(q_{2}^{e})=0\leq q_{x}. Therefore, we have (H(q1)−qx)⋅(H(q2e)−qx)≤0(H(q_{1})-q_{x})\cdot(H(q_{2}^{e})-q_{x})\leq 0. According to Lemma 6,we know there exists q1e∈[q1,q2e]q_{1}^{e}\in[q_{1},q_{2}^{e}] such that rx(q1e,q2e)=qxr_{x}(q_{1}^{e},q_{2}^{e})=q_{x} for arbitrary q2e∈[q2′,q2]q_{2}^{e}\in[q_{2}^{\prime},q_{2}]. We define G(x)=ry(q1e,x)G(x)=r_{y}(q_{1}^{e},x) where x∈[q2′,q2]x\in[q_{2}^{\prime},q_{2}], and q1eq_{1}^{e} are a value such that rx(q1e,x)=qxr_{x}(q_{1}^{e},x)=q_{x} for a given xx. When x=q2′x=q_{2}^{\prime}, we can let q1e=q1q_{1}^{e}=q_{1} since rx(q1,q2′)=qxr_{x}(q_{1},q_{2}^{\prime})=q_{x}, and when x=q1x=q_{1}, we can let q1e=q2′q_{1}^{e}=q_{2}^{\prime} since rx(q2′,q2)=qxr_{x}(q_{2}^{\prime},q_{2})=q_{x}. Based on Equation 73 and Lemma 6, we know that there exists x∈[q2′,q2]x\in[q_{2}^{\prime},q_{2}] such that G(x)=qyG(x)=q_{y}. Therefore, there exists q1′′q_{1}^{\prime\prime} and q2′′q_{2}^{\prime\prime} such that:

Assuming we have q1λ=0q_{1}^{\lambda}=0, q2λ=p‾Stq_{2}^{\lambda}=\overline{p}_{S_{t}}. If q2λ=p‾St≤min⁡iq1iq_{2}^{\lambda}=\overline{p}_{S_{t}}\leq\min_{i}q_{1}^{i}, then we have the following:

If q2λ≤min⁡iq1iq_{2}^{\lambda}\leq\min_{i}q_{1}^{i}, then we have C′(q1,q2)∩C(q1λ,q2λ)=C(q1λ,q2λ)\mathcal{C}^{\prime}(q_{1},q_{2})\cap\mathcal{C}(q_{1}^{\lambda},q_{2}^{\lambda})=\mathcal{C}(q_{1}^{\lambda},q_{2}^{\lambda}) since no region is excluded. Therefore, we have ry(q1λ,q2λ)=Pr(Y∈C′(q1,q2)∩C(q1λ,q2λ))=Pr(Y∈C(q1λ,q2λ))=q2λ−q1λ=p‾Str_{y}(q_{1}^{\lambda},q_{2}^{\lambda})=\text{Pr}(\mathbf{Y}\in\mathcal{C}^{\prime}(q_{1},q_{2})\cap\mathcal{C}(q_{1}^{\lambda},q_{2}^{\lambda}))=\text{Pr}(\mathbf{Y}\in\mathcal{C}(q_{1}^{\lambda},q_{2}^{\lambda}))=q_{2}^{\lambda}-q_{1}^{\lambda}=\overline{p}_{S_{t}} based on Equation 51. We note that C(q1λ,q2λ)=BSt\mathcal{C}(q_{1}^{\lambda},q_{2}^{\lambda})=\mathcal{B}_{S_{t}} when q1λ=0q_{1}^{\lambda}=0 and q2λ=p‾Stq_{2}^{\lambda}=\overline{p}_{S_{t}}. Therefore, we can obtain Equation 80 based on the definition of ry(q1λ,q2λ)r_{y}(q_{1}^{\lambda},q_{2}^{\lambda}) from Definition 1. ∎

If we have q1≤q2o≤q2q_{1}\leq q_{2}^{o}\leq q_{2}, then we have the following:

We further generalize Lemma 5 to two regions. Specifically, we have the following lemma:

Assuming we have a region Cw⊆C(q1w,q2w)\mathcal{C}_{w}\subseteq\mathcal{C}(q_{1}^{w},q_{2}^{w}) and we have C′(q1,q2)∩C(q1w,q2w)=∅\mathcal{C}^{\prime}(q_{1},q_{2})\cap\mathcal{C}(q_{1}^{w},q_{2}^{w})=\emptyset. If q1≥q1wq_{1}\geq q_{1}^{w}, q2≥q2wq_{2}\geq q_{2}^{w} and rx(q1′,q2′)≤Pr(X∈Cw)r_{x}(q_{1}^{\prime},q_{2}^{\prime})\leq\text{Pr}(\mathbf{X}\in\mathcal{C}_{w}), then we have:

We let q1=max⁡(q1,q2w)q_{1}=\max(q_{1},q_{2}^{w}). As C′(q1,q2)∩C(q1w,q2w)=∅\mathcal{C}^{\prime}(q_{1},q_{2})\cap\mathcal{C}(q_{1}^{w},q_{2}^{w})=\emptyset and q1≥q1wq_{1}\geq q_{1}^{w}, we can obtain the conclusion by applying Lemma 5 on C′(q1,q2)∪Cw\mathcal{C}^{\prime}(q_{1},q_{2})\cup\mathcal{C}_{w}. ∎

Next, we restate Lemma 4 and show our proof. See 4

Our proof leverages Mathematical Induction, which contains two steps. In the first step, we show that the statement holds initially. In the second step, we show that if the statement is true for the mmth iteration, then it also holds for the (m+1)(m+1)th iteration. Without loss of generality, we assume τ=argmin⁡t=1kPr(Y∈BSt)t\tau=\operatornamewithlimits{argmin}_{t=1}^{k}\frac{\text{Pr}(\mathbf{Y}\in\mathcal{B}_{S_{t}})}{t}. Therefore, we have the following:

Recall the definition of BSτ\mathcal{B}_{S_{\tau}} and we have the following:

where p‾Sτ=∑j∈Sτp‾j\overline{p}_{S_{\tau}}=\sum_{j\in S_{\tau}}\overline{p}_{j}. We can split BSk\mathcal{B}_{S_{k}} into two parts: BSτ\mathcal{B}_{S_{\tau}} and BSk∖BSτ\mathcal{B}_{S_{k}}\setminus\mathcal{B}_{S_{\tau}}. We will show that ∀j∈[1,τ]\forall j\in[1,\tau], we can find disjoint Cbj⊆BSτ\mathcal{C}_{b_{j}}\subseteq\mathcal{B}_{S_{\tau}} whose union is BSτ\mathcal{B}_{S_{\tau}} such that:

For the other part, we will show that ∀j∈[τ+1,k]\forall j\in[\tau+1,k], we can find disjoint Cbj⊆BSk∖BSτ\mathcal{C}_{b_{j}}\subseteq\mathcal{B}_{S_{k}}\setminus\mathcal{B}_{S_{\tau}} whose union is BSk∖BSτ\mathcal{B}_{S_{k}}\setminus\mathcal{B}_{S_{\tau}} such that:

We first show that ∀j∈[1,τ]\forall j\in[1,\tau], we can find Cbj⊆BSτ\mathcal{C}_{b_{j}}\subseteq\mathcal{B}_{S_{\tau}} that satisfy Equation 85 and 86. Since our proof leverages Mathematical Induction, we iteratively construct each Cbj,∀j∈[1,τ]\mathcal{C}_{b_{j}},\forall j\in[1,\tau]. Specifically, we first show that we can find Cbτ⊆BSτ\mathcal{C}_{b_{\tau}}\subseteq\mathcal{B}_{S_{\tau}} that satisfies the requirements. Then, assuming we can find Cbτ,⋯ ,Cbτ−m+1\mathcal{C}_{b_{\tau}},\cdots,\mathcal{C}_{b_{\tau-m+1}}, we show that we can find Cbτ−m⊆BSτ∖(∪j=τ−m+1τCbj)\mathcal{C}_{b_{\tau-m}}\subseteq\mathcal{B}_{S_{\tau}}\setminus(\cup_{j=\tau-m+1}^{\tau}\mathcal{C}_{b_{j}}). We will leverage Lemma 7 to prove the existence for each Cbj\mathcal{C}_{b_{j}}. Next, we show the two steps.

Step I: We show that we can find Cbτ⊆BSτ\mathcal{C}_{b_{\tau}}\subseteq\mathcal{B}_{S_{\tau}} that satisfies Equation 85 and 86. We let q1=0q_{1}=0 and q2=p‾Sτq_{2}=\overline{p}_{S_{\tau}}, and we define the following region:

which can be directly obtained as C′(q1,q2)=BSτ\mathcal{C}^{\prime}(q_{1},q_{2})=\mathcal{B}_{S_{\tau}}. As we have p‾bτ≤rx(q1,q2)=p‾Sτ=∑j=1τp‾bj\overline{p}_{b_{\tau}}\leq r_{x}(q_{1},q_{2})=\overline{p}_{S_{\tau}}=\sum_{j=1}^{\tau}\overline{p}_{b_{j}}, there exist q1′=p‾Sτ−p‾bτ,q2′=p‾bτq_{1}^{\prime}=\overline{p}_{S_{\tau}}-\overline{p}_{b_{\tau}},q_{2}^{\prime}=\overline{p}_{b_{\tau}} such that:

The equality in the middle is from Lemma 8, the left inequality is because q2′=p‾bτ≥p‾b1q_{2}^{\prime}=\overline{p}_{b_{\tau}}\geq\overline{p}_{b_{1}}, and the right inequality is from Equation 83. Furthermore, we have the following:

We obtain Equation 100 from Equation 99 based on Lemma 8, and Equation 101 from Equation 100 based on Equation 83. Therefore, we have the following:

Thus, there exists (q1τ,q2τ)(q_{1}^{\tau},q_{2}^{\tau}) such that rx(q1τ,q2τ)=p‾bτ,ry(q1τ,q2τ)=Pr(Y∈BSτ)τr_{x}(q_{1}^{\tau},q_{2}^{\tau})=\overline{p}_{b_{\tau}},r_{y}(q_{1}^{\tau},q_{2}^{\tau})=\frac{\text{Pr}(\mathbf{Y}\in\mathcal{B}_{S_{\tau}})}{\tau} based on Lemma 7. Then, we have the following based on the definition of rx,ryr_{x},r_{y}:

Finally, we let Cbτ=C′(q1,q2)∩C(q1τ,q2τ)\mathcal{C}_{b_{\tau}}=\mathcal{C}^{\prime}(q_{1},q_{2})\cap\mathcal{C}(q_{1}^{\tau},q_{2}^{\tau}), which meets our goal.

Step II: Assuming we can find {(q1τ,q2τ),(q1τ−1,q2τ−1),⋯ ,(q1τ−m+1,q2τ−m+1)}\{(q_{1}^{\tau},q_{2}^{\tau}),(q_{1}^{\tau-1},q_{2}^{\tau-1}),\cdots,(q_{1}^{\tau-m+1},q_{2}^{\tau-m+1})\} (∀j∈[τ−m+1,τ],q1≤q1j≤q2j≤q2\forall j\in[\tau-m+1,\tau],q_{1}\leq q_{1}^{j}\leq q_{2}^{j}\leq q_{2}) where 1≤m≤τ−11\leq m\leq\tau-1 such that ∀j∈[τ−m+1,τ]\forall j\in[\tau-m+1,\tau], we have:

We denote e=τ−me=\tau-m. We show we can find Cbe\mathcal{C}_{b_{e}} such that we have:

We let q1=0,q2=p‾Sτq_{1}=0,q_{2}=\overline{p}_{S_{\tau}} and denote

The Equation 116 from 115 is based on the Equation 108, and the Equation 117 from 116 is based the Equation 51 and 106. Furthermore, we have the following:

The Equation 123 from 122 is because C(q1,q2)=BSτ\mathcal{C}(q_{1},q_{2})=\mathcal{B}_{S_{\tau}} and the Equation 107. We have p‾be≤rx(q1,q2)\overline{p}_{b_{e}}\leq r_{x}(q_{1},q_{2}). Therefore, based on Lemma 7, there exist q1′,q2′q_{1}^{\prime},q_{2}^{\prime} such that:

Equation 128 from 127 is based on Lemma 9, Equation 129 from 128 is based on Equation 90 and 125, and Equation 130 from 129 is obtained from Equation 91 and the fact that ⌈(∑j=1ep‾bj)/p‾be⌉≥τ\lceil(\sum_{j=1}^{e}\overline{p}_{b_{j}})/\overline{p}_{b_{e}}\rceil\geq\tau. Next, we show:

In particular, we consider two scenarios.

Scenario 1). q1′≥min⁡j=τ−m+1τq1jq_{1}^{\prime}\geq\min_{j=\tau-m+1}^{\tau}q_{1}^{j}. We denote t=argmin⁡j=τ−m+1τq1jt=\operatornamewithlimits{argmin}_{j=\tau-m+1}^{\tau}q_{1}^{j}. We let Cw=Cbt⊆C(q1t,q2t)\mathcal{C}_{w}=\mathcal{C}_{b_{t}}\subseteq\mathcal{C}(q_{1}^{t},q_{2}^{t}). As q1′≥q1t,q2≥q2tq_{1}^{\prime}\geq q_{1}^{t},q_{2}\geq q_{2}^{t} and rx(q1′,q2)=p‾be≤Pr(X∈Cw)=p‾btr_{x}(q_{1}^{\prime},q_{2})=\overline{p}_{b_{e}}\leq\text{Pr}(\mathbf{X}\in\mathcal{C}_{w})=\overline{p}_{b_{t}}, we have the following based on Lemma 10:

Scenario 2). q1′<min⁡j=τ−m+1τq1jq_{1}^{\prime}<\min_{j=\tau-m+1}^{\tau}q_{1}^{j}. We have the following:

Moreover, we have rx(q1,q1′)=q1′−q1r_{x}(q_{1},q_{1}^{\prime})=q_{1}^{\prime}-q_{1} from Lemma 8. The above two should be equal. Thus, we have q1′=∑j=1e−1p‾bj=p‾Sτ−m−1q_{1}^{\prime}=\sum_{j=1}^{e-1}\overline{p}_{b_{j}}=\overline{p}_{S_{\tau-m-1}} since e=τ−me=\tau-m. we have:

We obtain Equation 140 from Equation 139 based on Lemma 8.

Therefore, we have the following in both scenarios:

Based on Lemma 7, there exist q1e,q2eq_{1}^{e},q_{2}^{e} such that rx(q1e,q2e)=p‾bτ,ry(q1e,q2e)=Pr(Y∈BSτ)τr_{x}(q_{1}^{e},q_{2}^{e})=\overline{p}_{b_{\tau}},r_{y}(q_{1}^{e},q_{2}^{e})=\frac{\text{Pr}(\mathbf{Y}\in\mathcal{B}_{S_{\tau}})}{\tau}. Then, we have the following based on the definition of rx,ryr_{x},r_{y}:

We let Ce=C′(q1,q2)∩C(q1e,q2e)\mathcal{C}_{e}=\mathcal{C}^{\prime}(q_{1},q_{2})\cap\mathcal{C}(q_{1}^{e},q_{2}^{e}). From the definition of C′(q1,q2)\mathcal{C}^{\prime}(q_{1},q_{2}), we have ∀j∈[e+1,τ],C′(q1,q2)∩Cbj=∅\forall j\in[e+1,\tau],\mathcal{C}^{\prime}(q_{1},q_{2})\cap\mathcal{C}_{b_{j}}=\emptyset. Thus, we have ∀j∈[e+1,τ],Cbe∩Cbj=∅\forall j\in[e+1,\tau],\mathcal{C}_{b_{e}}\cap\mathcal{C}_{b_{j}}=\emptyset since Cbe⊆C′(q1,q2)\mathcal{C}_{b_{e}}\subseteq\mathcal{C}^{\prime}(q_{1},q_{2}).

Therefore, we reach our goal by Mathematical Induction, i.e., for ∀j∈[1,τ]\forall j\in[1,\tau], we have:

We can also verify that ∪j=1τCbj=BSτ\cup_{j=1}^{\tau}\mathcal{C}_{b_{j}}=\mathcal{B}_{S_{\tau}}.

Next, we show our proof based on Mathematical Induction for the other part, i.e., BSk∖BSτ\mathcal{B}_{S_{k}}\setminus\mathcal{B}_{S_{\tau}}. Our construction process is similar to the above first part but has subtle differences.

Step I: Let q1=∑j=1τp‾bjq_{1}=\sum_{j=1}^{\tau}\overline{p}_{b_{j}} and q2=∑j=1kp‾bjq_{2}=\sum_{j=1}^{k}\overline{p}_{b_{j}}. We define:

The Equation 150 is based on the fact that C′(q1,q2)=C(q1,q2)\mathcal{C}^{\prime}(q_{1},q_{2})=\mathcal{C}(q_{1},q_{2}) and Definition 1, and we obtain Equation 154 from 155 based on Equation 83. We have p‾bk≤rx(q1,q2)\overline{p}_{b_{k}}\leq r_{x}(q_{1},q_{2}). Therefore, based on Lemma 7, we know that there exists q1′=q2−p‾bk,q2′=q1+p‾bkq_{1}^{\prime}=q_{2}-\overline{p}_{b_{k}},q_{2}^{\prime}=q_{1}+\overline{p}_{b_{k}} such that:

Scenario 1). In this scenario, we consider ry(q1′,q2)>Pr(Y∈BSτ)τr_{y}(q_{1}^{\prime},q_{2})>\frac{\text{Pr}(\mathbf{Y}\in\mathcal{B}_{S_{\tau}})}{\tau}. We let q1k=q1′,q2k=q2q_{1}^{k}=q_{1}^{\prime},q_{2}^{k}=q_{2}, i.e., we have Cbk=C(q1′,q2)∩C′(q1,q2)\mathcal{C}_{b_{k}}=\mathcal{C}(q_{1}^{\prime},q_{2})\cap\mathcal{C}^{\prime}(q_{1},q_{2}). Then, we have:

Scenario 2). In this scenario, we consider ry(q1′,q2)≤Pr(Y∈BSτ)τr_{y}(q_{1}^{\prime},q_{2})\leq\frac{\text{Pr}(\mathbf{Y}\in\mathcal{B}_{S_{\tau}})}{\tau}. We have the following:

We obtain Equation 167 from 166 via Lemma 9, and we obtain Equation 168 from 167 based on Equation 150 to 156 and the fact rx(q1,q2)/rx(q1,q2′)=∑j=τ+1kp‾bjp‾bτ+1≥k−τr_{x}(q_{1},q_{2})/r_{x}(q_{1},q_{2}^{\prime})=\frac{\sum_{j=\tau+1}^{k}\overline{p}_{b_{j}}}{\overline{p}_{b_{\tau+1}}}\geq k-\tau. We have (ry(q1′,q2)−Pr(Y∈BSτ)τ)⋅(ry(q1,q2′)−Pr(Y∈BSτ)τ)≤0(r_{y}(q_{1}^{\prime},q_{2})-\frac{\text{Pr}(\mathbf{Y}\in\mathcal{B}_{S_{\tau}})}{\tau})\cdot(r_{y}(q_{1},q_{2}^{\prime})-\frac{\text{Pr}(\mathbf{Y}\in\mathcal{B}_{S_{\tau}})}{\tau})\leq 0. Therefore, from Lemma 7, we know that there exist (q1k,q2k)(q_{1}^{k},q_{2}^{k}) such that:

Similarly, we let Cbk=C′(q1,q2)∩C(q1k,q2k)\mathcal{C}_{b_{k}}=\mathcal{C}^{\prime}(q_{1},q_{2})\cap\mathcal{C}(q_{1}^{k},q_{2}^{k}).

Based on the conditions of our constructions in the two scenarios, we know that if Pr(Y∈Bbk)>Pr(Y∈BSτ)τ\text{Pr}(\mathbf{Y}\in\mathcal{B}_{b_{k}})>\frac{\text{Pr}(\mathbf{Y}\in\mathcal{B}_{S_{\tau}})}{\tau}, then we have q2k=q2q_{2}^{k}=q_{2}.

Step II: We show that if we can find (q1k,q2k),⋯ ,(q1k−m+1,q2k−m+1)(q_{1}^{k},q_{2}^{k}),\cdots,(q_{1}^{k-m+1},q_{2}^{k-m+1}) where m∈[1,k−τ−1]m\in[1,k-\tau-1] and Cbj,∀j∈[k,k−m+1]\mathcal{C}_{b_{j}},\forall j\in[k,k-m+1] such that:

Then, we can find (q1k−m,q2k−m)(q_{1}^{k-m},q_{2}^{k-m}) such that:

For simplicity, we denote e=k−me=k-m, we let q1=∑j=1τp‾bjq_{1}=\sum_{j=1}^{\tau}\overline{p}_{b_{j}} and q2=∑j=1kp‾bjq_{2}=\sum_{j=1}^{k}\overline{p}_{b_{j}}, and we define:

We have p‾be≤rx(q1,q2)\overline{p}_{b_{e}}\leq r_{x}(q_{1},q_{2}). Therefore, based on Lemma 7, we know that there exists q1′,q2′q_{1}^{\prime},q_{2}^{\prime} such that:

Scenario 1). In this scenario, we consider that the following holds:

We let q1e=q1′,q2e=q2q_{1}^{e}=q_{1}^{\prime},q_{2}^{e}=q_{2}, i.e., Cbe=C(q1′,q2)∩C′(q1,q2)\mathcal{C}_{b_{e}}=\mathcal{C}(q_{1}^{\prime},q_{2})\cap\mathcal{C}^{\prime}(q_{1},q_{2}). Then, we have:

We note that we have q1′≤min⁡j=e+1kq1iq_{1}^{\prime}\leq\min_{j=e+1}^{k}q_{1}^{i} in this scenario. Otherwise, Equation 186 will not hold based on Lemma 10. We give a short proof.

Assuming q1′>min⁡j=k−m+1kq1jq_{1}^{\prime}>\min_{j=k-m+1}^{k}q_{1}^{j}. We denote w=argmin⁡j=k−m+1kq1jw=\operatornamewithlimits{argmin}_{j=k-m+1}^{k}q_{1}^{j}. We let Cw=Cbw⊆C(q1w,q2w)\mathcal{C}_{w}=\mathcal{C}_{b_{w}}\subseteq\mathcal{C}(q_{1}^{w},q_{2}^{w}). Note that in this case, we have q2w<q2q_{2}^{w}<q_{2} because q2w=q2q_{2}^{w}=q_{2} and q1′>q1wq_{1}^{\prime}>q_{1}^{w} cannot hold at the same time as long as ry(q1′,q2)>0r_{y}(q_{1}^{\prime},q_{2})>0. Thus, we have Pr(Y∈Cw)=Pr(Y∈BSτ)τ\text{Pr}(\mathbf{Y}\in\mathcal{C}_{w})=\frac{\text{Pr}(\mathbf{Y}\in\mathcal{B}_{S_{\tau}})}{\tau} because if Pr(Y∈Cw)>Pr(Y∈BSτ)τ\text{Pr}(\mathbf{Y}\in\mathcal{C}_{w})>\frac{\text{Pr}(\mathbf{Y}\in\mathcal{B}_{S_{\tau}})}{\tau}, we have q2w=q2q_{2}^{w}=q_{2}. As we have q1′>q1w,q2>q2wq_{1}^{\prime}>q_{1}^{w},q_{2}>q_{2}^{w} and rx(q1′,q2)=p‾be≤Pr(X∈Cw)=p‾bwr_{x}(q_{1}^{\prime},q_{2})=\overline{p}_{b_{e}}\leq\text{Pr}(\mathbf{X}\in\mathcal{C}_{w})=\overline{p}_{b_{w}}. We have the following based on Lemma 10:

Since Equation 186 and Equation 189 cannot hold at the same time, the assumption q1′>min⁡j=k−m+1kq1jq_{1}^{\prime}>\min_{j=k-m+1}^{k}q_{1}^{j} must be wrong. Therefore, we have q1′≤min⁡j=k−m+1kq1jq_{1}^{\prime}\leq\min_{j=k-m+1}^{k}q_{1}^{j}.

Based on q1′≤min⁡j=k−m+1kq1jq_{1}^{\prime}\leq\min_{j=k-m+1}^{k}q_{1}^{j}, we have the following:

Therefore, we have rx(q1,q1′)=q1′−q1r_{x}(q_{1},q_{1}^{\prime})=q_{1}^{\prime}-q_{1} from Definition 1. Moreover, we have the following:

The above two should be equal. Therefore, we have q1′=∑j=τ+1e−1pbj+q1=∑j=1e−1pbjq_{1}^{\prime}=\sum_{j=\tau+1}^{e-1}p_{b_{j}}+q_{1}=\sum_{j=1}^{e-1}p_{b_{j}}. Recall that we let Cbe=C′(q1,q2)∩C(q1′,q2)\mathcal{C}_{b_{e}}=\mathcal{C}^{\prime}(q_{1},q_{2})\cap\mathcal{C}(q_{1}^{\prime},q_{2}). Thus, we have:

Scenario 2). In this scenario, we consider that the following holds:

We obtain Equation 203 from 202 via Lemma 9, and we obtain Equation 204 from 203 based on Equation 183 and the fact rx(q1,q2)/rx(q1,q2′)=∑j=τ+1ep‾bjp‾bτ+1≥k−τ−mr_{x}(q_{1},q_{2})/r_{x}(q_{1},q_{2}^{\prime})=\frac{\sum_{j=\tau+1}^{e}\overline{p}_{b_{j}}}{\overline{p}_{b_{\tau+1}}}\geq k-\tau-m. We have (ry(q1′,q2)−Pr(Y∈BSτ)τ)⋅(ry(q1,q2′)−Pr(Y∈BSτ)τ)≤0(r_{y}(q_{1}^{\prime},q_{2})-\frac{\text{Pr}(\mathbf{Y}\in\mathcal{B}_{S_{\tau}})}{\tau})\cdot(r_{y}(q_{1},q_{2}^{\prime})-\frac{\text{Pr}(\mathbf{Y}\in\mathcal{B}_{S_{\tau}})}{\tau})\leq 0. Based on Lemma 7, we can find (q1e,q2e)(q_{1}^{e},q_{2}^{e}) such that we have:

We let Cbe=C′(q1,q2)∩C(q1e,q2e)\mathcal{C}_{b_{e}}=\mathcal{C}^{\prime}(q_{1},q_{2})\cap\mathcal{C}(q_{1}^{e},q_{2}^{e}). We also have the following:

Similar to Step I, we still hold the conclusion that if Pr(Y∈Cbe)>Pr(Y∈BSτ)τ\text{Pr}(\mathbf{Y}\in\mathcal{C}_{b_{e}})>\frac{\text{Pr}(\mathbf{Y}\in\mathcal{B}_{S_{\tau}})}{\tau}, we have q2e=q2q_{2}^{e}=q_{2}. Then, we can apply Mathematical Induction to reach the conclusion. Also, we can verify ∪j=τ+1kCbj=BSk∖BSτ\cup_{j=\tau+1}^{k}\mathcal{C}_{b_{j}}=\mathcal{B}_{S_{k}}\setminus\mathcal{B}_{S_{\tau}}. ∎

Appendix C Proof of Proposition 1

Proposition 1: With probability at least 1−α1-\alpha over the randomness in Predict, if Predict returns a set TT (i.e., does not ABSTAIN), then we have gk(x)=Tg_{k}(\mathbf{x})=T.

We aim to compute the probability that Predict returns a set which not equals to gk(x)g_{k}(\mathbf{x}), which happens if and only if gk(x)≠Tg_{k}(\mathbf{x})\neq T and Predict doesn’t abstain. Specifically, we have:

Theorem 1 in Hung et al. (2019) shows the above conditional probability is as follows:

Appendix D Proof of Proposition 2

Proposition 2: With probability at least 1−α1-\alpha over the randomness in Certify, if Certify returns a radius Rl‾\underline{R_{l}} (i.e., does not ABSTAIN), then we have l∈gk(x+δ),∀∥δ∥2<Rl‾l\in g_{k}(\mathbf{x}+\delta),\forall\left\|\delta\right\|_{2}<\underline{R_{l}}.

From the definition of BinoCP and SimuEM, we know the probability that the following inequalities simultaneously hold is at least 1−α1-\alpha over the sampling of counts:

Then, with the returned bounds, we can invoke Theorem 1 to obtain the robustness guarantee if the calculated radius is larger than 0. Note that otherwise Certify abstains. ∎

Appendix E Certified top-k𝑘k accuracy

We show how to derive a lower bound of the certified top-kk accuracy based on the approximate certified top-kk accuracy. The process is similar to that Cohen et al. (2019) used to derive a lower bound of the certified top-11 accuracy based on the approximate certified top-11 accuracy. Specifically, we have the following lemma from Cohen et al. (2019).

Let ziz_{i} be a binary variable and YiY_{i} be a Bernoulli random variable. Suppose if zi=1z_{i}=1, then Pr(Yi=1)≤α\text{Pr}(Y_{i}=1)\leq\alpha. Then, for any ρ>0\rho>0, with probability at least 1−ρ1-\rho, we have the following:

Assuming we have a test dataset Dtest={(x1,y1),(x2,y2),⋯ ,(xm,ym)}D_{test}=\{(\mathbf{x}_{1},y_{1}),(\mathbf{x}_{2},y_{2}),\cdots,(\mathbf{x_{m}},y_{m})\} as well as a radius rr. We define the following indicate value:

Then, the certified top-kk accuracy of the smoothed classifier gg at radius rr can be computed as 1m∑i=1mai\frac{1}{m}\sum_{i=1}^{m}a_{i}. For each sample xi\mathbf{x}_{i}, we run the Certify function with 1−α1-\alpha confidence level and we use a random variable YiY_{i} to denote that the function Certify returns a radius bigger than rr. From Proposition 2, we know:

The approximate certified top-kk accuracy of the smoothed classifier at radius rr is 1m∑i=1mYi\frac{1}{m}\sum_{i=1}^{m}Y_{i}. Then, we can use Lemma 11 to obtain a lower bound of 1m∑i=1mai\frac{1}{m}\sum_{i=1}^{m}a_{i}. Specifically, for any ρ>0\rho>0, with probability at least 1−ρ1-\rho over the randomness of Certify, we have:

We can see that the difference between the certified top-kk accuracy and the approximate certified top-kk accuracy is negligible when α\alpha is small.