Intrinsic Certified Robustness of Bagging against Data Poisoning Attacks

Jinyuan Jia, Xiaoyu Cao, Neil Zhenqiang Gong

Introduction

Machine learning models trained on user-provided data are vulnerable to data poisoning attacks (Nelson et al., 2008, Biggio et al., 2012, Xiao et al., 2015, Li et al., 2016, Steinhardt et al., 2017, Shafahi et al., 2018), in which malicious users carefully poison (i.e., modify, delete, and/or insert) some training examples such that the learnt model is corrupted and makes predictions for testing examples as an attacker desires. In particular, the corrupted model predicts incorrect labels for a large fraction of testing examples indiscriminately (i.e., a large testing error rate) or for some attacker-chosen testing examples. Unlike adversarial examples (Szegedy et al., 2014, Carlini and Wagner, 2017), which carefully perturb each testing example such that a model predicts an incorrect label for the perturbed testing example, data poisoning attacks corrupt the model such that it predicts incorrect labels for many clean testing examples. Like adversarial examples, data poisoning attacks pose severe security threats to machine learning systems.

To mitigate data poisoning attacks, various defenses (Cretu et al., 2008, Barreno et al., 2010, Suciu et al., 2018, Tran et al., 2018, Feng et al., 2014, Jagielski et al., 2018, Ma et al., 2019, Wang et al., 2020, Rosenfeld et al., 2020) have been proposed in the literature. Most of these defenses (Cretu et al., 2008, Barreno et al., 2010, Suciu et al., 2018, Tran et al., 2018, Feng et al., 2014, Jagielski et al., 2018) achieve empirical robustness against certain data poisoning attacks and are often broken by strong adaptive attacks. To end the cat-and-mouse game between attackers and defenders, certified defenses (Ma et al., 2019, Wang et al., 2020, Rosenfeld et al., 2020) were proposed. We say a learning algorithm is certifiably robust against data poisoning attacks if it can learn a classifier that provably predicts the same label for a testing example when the number of poisoned training examples is bounded. For instance, Ma et al. (2019) showed that a classifier trained with differential privacy certifies robustness against data poisoning attacks. Wang et al. (2020) and Rosenfeld et al. (2020) leveraged randomized smoothing (Cao and Gong, 2017, Cohen et al., 2019), which was originally designed to certify robustness against adversarial examples, to certify robustness against data poisoning attacks that modify labels and/or features of existing training examples.

However, these certified defenses suffer from two major limitations. First, they are only applicable to limited scenarios, i.e., Ma et al. (2019) is limited to learning algorithms that can be differentially private, while Wang et al. (2020) and Rosenfeld et al. (2020) are limited to data poisoning attacks that only modify existing training examples. Second, their certified robustness guarantees are loose, meaning that a learning algorithm is certifiably more robust than their guarantees indicate. We note that Steinhardt et al. (2017) derives an approximate upper bound of the loss function for data poisoning attacks. However, their method cannot certify that the learnt model predicts the same label for a testing example.

We aim to address these limitations in this work. Our approach is based on a well-known ensemble learning method called Bootstrap Aggregating (bagging) (Breiman, 1996). Given a training dataset, we create a random subsample with kk training examples sampled from the training dataset uniformly at random with replacement. Moreover, we use a deterministic or randomized base learning algorithm to learn a base classifier on the subsample. Due to the randomness in sampling the subsample and the (randomized) base learning algorithm, the label predicted for a testing example x\mathbf{x} by the learnt base classifier is random. Therefore, we define pjp_{j} as the probability that the learnt base classifier predicts label jj for x\mathbf{x}, where j=1,2,⋯ ,cj=1,2,\cdots,c. We call pjp_{j} label probability. In bagging, the ensemble classifier essentially predicts the label with the largest label probability for x\mathbf{x}.

Our first major theoretical result is that we prove the ensemble classifier in bagging predicts the same label for a testing example when the number of poisoned training examples is no larger than a threshold. We call the threshold certified poisoning size. Our second major theoretical result is that we prove our derived certified poisoning size is tight (i.e., it is impossible to derive a certified poisoning size larger than ours) if no assumptions on the base learning algorithm are made. Note that the certified poisoning sizes may be different for different testing examples.

Our certified poisoning size for a testing example is the optimal solution to an optimization problem, which involves the testing example’s largest and second largest label probabilities predicted by the bagging’s ensemble classifier. However, it is computationally challenging to compute the exact largest and second largest label probabilities, as there are an exponential number of subsamples with kk training examples. To address the challenge, we propose a Monto Carlo algorithm to simultaneously estimate a lower bound of the largest label probability and an upper bound of the second largest label probability for multiple testing examples via training NN base classifiers on NN random subsamples. Moreover, we design an efficient algorithm to solve the optimization problem with the estimated largest and second largest label probabilities to compute certified poisoning size.

We empirically evaluate our method on MNIST and CIFAR10. For instance, our method can achieve a certified accuracy of 91.1%91.1\% on MNIST when 100 training examples are arbitrarily poisoned, where k=100k=100 and N=1,000N=1,000. Under the same attack setting, Ma et al. (2019), Wang et al. (2020), and Rosenfeld et al. (2020) achieve certified accuracy on a simpler MNIST 1/7 dataset. Moreover, we show that training the base classifiers using transfer learning can significantly improve the certified accuracy.

Our contributions are summarized as follows:

We derive the first intrinsic certified robustness of bagging against data poisoning attacks and prove the tightness of our robustness guarantee.

We develop algorithms to compute the certified poisoning size in practice.

We evaluate our method on MNIST and CIFAR10.

All our proofs are shown in the Supplemental Material.

Certified Robustness of Bagging

Assuming we have a training dataset D={(x1,y1),(x2,y2),⋯ ,(xn,yn)}\mathcal{D}=\{(\mathbf{x}_{1},y_{1}),(\mathbf{x}_{2},y_{2}),\cdots,(\mathbf{x}_{n},y_{n})\} with nn examples, where xi\mathbf{x}_{i} and yiy_{i} are the feature vector and label of the iith training example, respectively. Moreover, we are given an arbitrary deterministic or randomized base learning algorithm A\mathcal{A}, which takes a training dataset D\mathcal{D} as input and outputs a classifier ff, i.e., f=A(D)f=\mathcal{A}(\mathcal{D}). f(x)f(x) is the predicted label for a testing example x\mathbf{x}. For convenience, we jointly represent the training and testing processes as A(D,x)\mathcal{A}(\mathcal{D},\mathbf{x}), which is x\mathbf{x}’s label predicted by a classifier that is trained using algorithm A\mathcal{A} and training dataset D\mathcal{D}.

Data poisoning attacks: In a data poisoning attack, an attacker poisons the training dataset D\mathcal{D} such that the learnt classifier makes predictions for testing examples as the attacker desires. In particular, the attacker can carefully modify, delete, and/or insert some training examples in D\mathcal{D} such that A(D,x)≠A(D′,x)\mathcal{A}(\mathcal{D},\mathbf{x})\neq\mathcal{A}(\mathcal{D}^{\prime},\mathbf{x}) for many testing examples x\mathbf{x} or some attacker-chosen x\mathbf{x}, where D′\mathcal{D}^{\prime} is the poisoned training dataset. We note that modifying a training example means modifying its feature vector and/or label. We denote the set of poisoned training datasets with at most rr poisoned training examples as follows:

Intuitively, max⁡{∣D∣,∣D′∣}−∣D∩D′∣\max\{|\mathcal{D}|,|\mathcal{D}^{\prime}|\}-|\mathcal{D}\cap\mathcal{D}^{\prime}| is the minimum number of modified/deleted/inserted training examples that can change D\mathcal{D} to D′\mathcal{D}^{\prime}.

Bootstrap aggregating (Bagging) (Breiman, 1996): Bagging is a well-known ensemble learning method. Roughly speaking, bagging creates many subsamples of a training dataset with replacement and trains a base classifier on each subsample. For a testing example, bagging uses each base classifier to predict its label and takes majority vote among the predicted labels as the label of the testing example. Figure 1 shows a toy example to illustrate why bagging certifies robustness against data poisoning attacks. When the poisoned training examples are minority in the training dataset, a majority of the subsamples do not include any poisoned training examples. Therefore, a majority of the base classifiers and the bagging’s predicted labels for testing examples are not influenced by the poisoned training examples.

Next, we describe a probabilistic view of bagging, which makes it possible to theoretically analyze its certified robustness against data poisoning attacks. Specifically, we denote by g(D)g(\mathcal{D}) a random subsample, which is a list of kk examples that are sampled from D\mathcal{D} with replacement uniformly at random. We use the base learning algorithm A\mathcal{A} to learn a base classifier on g(D)g(\mathcal{D}). Due to the randomness in sampling the subsample g(D)g(\mathcal{D}) and the (randomized) base learning algorithm A\mathcal{A}, the label A(g(D),x)\mathcal{A}(g(\mathcal{D}),\mathbf{x}) predicted by the base classifier learnt on g(D)g(\mathcal{D}) for x\mathbf{x} is random. We denote by pj=Pr(A(g(D),x)=j)p_{j}=\text{Pr}(\mathcal{A}(g(\mathcal{D}),\mathbf{x})=j) the probability that the learnt base classifier predicts label jj for x\mathbf{x}, where j=1,2,⋯ ,cj=1,2,\cdots,c. We call pjp_{j} label probability. The ensemble classifier hh in bagging essentially predicts the label with the largest label probability for x\mathbf{x}, i.e., we have:

where h(D,x)h(\mathcal{D},\mathbf{x}) is the predicted label for x\mathbf{x} when the ensemble classifier hh is trained on D\mathcal{D}.

Certified robustness of bagging: We prove the certified robustness of bagging against data poisoning attacks. In particular, we show that the ensemble classifier in bagging predicts the same label for a testing example when the number of poisoned training examples is no larger than some threshold (called certified poisoning size). Formally, we aim to show h(D′,x)=h(D,x)h(\mathcal{D}^{\prime},\mathbf{x})=h(\mathcal{D},\mathbf{x}) for ∀D′∈B(D,r∗)\forall\mathcal{D}^{\prime}\in{B}(\mathcal{D},r^{*}), where r∗r^{*} is the certified poisoning size. For convenience, we define the following two random variables:

where XX and YY are two random subsamples with kk examples sampled from D\mathcal{D} and D′\mathcal{D}^{\prime} with replacement uniformly at random, respectively. pj=Pr(A(X,x)=j)p_{j}=\text{Pr}(\mathcal{A}(X,\mathbf{x})=j) and pj′=Pr(A(Y,x)=j)p_{j}^{\prime}=\text{Pr}(\mathcal{A}(Y,\mathbf{x})=j) are the label probabilities of label jj for testing example x\mathbf{x} when the training dataset is D\mathcal{D} and its poisoned version D′\mathcal{D}^{\prime}, respectively. For simplicity, we use Ω\Omega to denote the joint space of XX and YY, i.e., each element in Ω\Omega is a subsample of kk examples sampled from D\mathcal{D} or D′\mathcal{D}^{\prime} uniformly at random with replacement.

Suppose the ensemble classifier predicts label ll for x\mathbf{x} when trained on the clean training dataset, i.e., h(D,x)=lh(\mathcal{D},\mathbf{x})=l. Our goal is to find the maximal poisoning size rr such that the ensemble classifier still predicts label ll for x\mathbf{x} when trained on the poisoned training dataset with at most rr poisoned training examples. Formally, our goal is to find the maximal poisoning size rr such that the following inequality is satisfied for ∀D′∈B(D,r)\forall\mathcal{D}^{\prime}\in{B}(\mathcal{D},r):

However, it is challenging to compute pl′p_{l}^{\prime} and max⁡j≠lpj′\max_{j\neq l}p_{j}^{\prime} due to the complicated base learning algorithm A\mathcal{A}. To address the challenge, we aim to derive a lower bound of pl′p_{l}^{\prime} and an upper bound of max⁡j≠lpj′\max_{j\neq l}p_{j}^{\prime}, where the lower bound and upper bound are independent from the base learning algorithm A\mathcal{A} and can be easily computed for a given rr. In particular, we derive the lower bound and upper bound as the probabilities that the random variable YY is in certain regions of the space Ω\Omega via the Neyman-Pearson Lemma (Neyman and Pearson, 1933). Then, we can find the maximal rr such that the lower bound is larger than the upper bound for any D′∈B(D,r)\mathcal{D}^{\prime}\in B(\mathcal{D},r), and such maximal rr is our certified poisoning size r∗r^{*}.

Next, we show the high-level idea of our approach to derive the lower and upper bounds (details are in Supplemental Material). Our key idea is to construct regions in the space Ω\Omega such that the random variables XX and YY satisfy the conditions of the Neyman-Pearson Lemma (Neyman and Pearson, 1933), which enables us to derive the lower and upper bounds using the probabilities that YY is in these regions. Next, we discuss how to construct the regions. Suppose we have a lower bound pl‾\underline{p_{l}} of the largest label probability pl{p_{l}} and an upper bound p‾s\overline{p}_{s} of the second largest label probability psp_{s} when the ensemble classifier is trained on the clean training dataset. Formally, pl‾\underline{p_{l}} and p‾s\overline{p}_{s} satisfy:

We use the probability bounds instead of the exact label probabilities pl{p_{l}} and ps{p}_{s}, because it is challenging to compute them exactly. We first divide the space Ω\Omega into three regions B\mathcal{B}, C\mathcal{C}, and E\mathcal{E}, which include subsamples with kk examples sampled from D\mathcal{D}, D′\mathcal{D}^{\prime}, and D∩D′\mathcal{D}\cap\mathcal{D}^{\prime}, respectively. Then, we can find a region B′⊆E\mathcal{B}^{\prime}\subseteq\mathcal{E} such that we have Pr(X∈B∪B′)=pl‾−δl\text{Pr}(X\in\mathcal{B}\cup\mathcal{B}^{\prime})=\underline{p_{l}}-\delta_{l}, where δl=pl‾−(⌊pl‾⋅nk⌋)/nk\delta_{l}=\underline{p_{l}}-(\lfloor\underline{p_{l}}\cdot n^{k}\rfloor)/n^{k} is a small residual. We have the residual δl\delta_{l} because Pr(X∈B∪B′)\text{Pr}(X\in\mathcal{B}\cup\mathcal{B}^{\prime}) is an integer multiple of 1nk\frac{1}{n^{k}}. The reason we assume we can find such region B′\mathcal{B}^{\prime} is that we aim to derive a sufficient condition. Similarly, we can find Cs⊆E\mathcal{C}_{s}\subseteq\mathcal{E} such that we have Pr(X∈Cs)=p‾s+δs\text{Pr}(X\in\mathcal{C}_{s})=\overline{p}_{s}+\delta_{s}, where δs=(⌈p‾s⋅nk⌉)/nk−p‾s\delta_{s}=(\lceil\overline{p}_{s}\cdot n^{k}\rceil)/n^{k}-\overline{p}_{s} is a small residual. Given these regions, we leverage the Neyman-Pearson Lemma (Neyman and Pearson, 1933) to derive a lower bound of pl′p_{l}^{\prime} and an upper bound of max⁡j≠lpj′\max_{j\neq l}p_{j}^{\prime} as follows:

where the lower bound Pr(Y∈B∪B′)\text{Pr}(Y\in\mathcal{B}\cup\mathcal{B}^{\prime}) and upper bound Pr(Y∈C∪Cs)\text{Pr}(Y\in\mathcal{C}\cup\mathcal{C}_{s}) can be easily computed for a given rr. Finally, we find the maximal rr such that the lower bound is still larger than the upper bound, which is our certified poisoning size r∗r^{*}. The following Theorem 1 formally summarizes our certified robustness guarantee of bagging.

Given a training dataset D\mathcal{D}, a deterministic or randomized base learning algorithm A\mathcal{A}, and a testing example x\mathbf{x}. The ensemble classifier hh in bagging is defined in Equation (2). Suppose ll and ss respectively are the labels with the largest and second largest label probabilities predicted by hh for x\mathbf{x}. Moreover, the probability bounds pl‾\underline{p_{l}} and p‾s\overline{p}_{s} satisfy (5). Then, hh still predicts label ll for x\mathbf{x} when the number of poisoned training examples is bounded by r∗r^{*}, i.e., we have:

where r∗r^{*} is the solution to the following optimization problem:

where n=∣D∣n=|\mathcal{D}|, n′=∣D′∣n^{\prime}=|\mathcal{D}^{\prime}|, δl=pl‾−(⌊pl‾⋅nk⌋)/nk\delta_{l}=\underline{p_{l}}-(\lfloor\underline{p_{l}}\cdot n^{k}\rfloor)/n^{k}, and δs=(⌈p‾s⋅nk⌉)/nk−p‾s\delta_{s}=(\lceil\overline{p}_{s}\cdot n^{k}\rceil)/n^{k}-\overline{p}_{s}.

Given Theorem 1, we have the following corollaries.

Suppose a data poisoning attack only modifies existing training examples. Then, we have n′=nn^{\prime}=n and the solution to optimization problem (9) is r∗=⌈n⋅(1−1−pl‾−p‾s−δl−δs2k)−1⌉r^{*}=\lceil n\cdot(1-\sqrt[k]{1-\frac{\underline{p_{l}}-\overline{p}_{s}-\delta_{l}-\delta_{s}}{2}})-1\rceil.

Suppose a data poisoning attack only deletes existing training examples. Then, we have n′=n−rn^{\prime}=n-r and r∗=⌈n⋅(1−1−(pl‾−p‾s−δl−δs)k)−1⌉r^{*}=\lceil n\cdot(1-\sqrt[k]{1-(\underline{p_{l}}-\overline{p}_{s}-\delta_{l}-\delta_{s})})-1\rceil.

Suppose a data poisoning attack only inserts new training examples. Then, we have n′=n+rn^{\prime}=n+r and r∗=⌈n⋅(1+(pl‾−p‾s−δl−δs)k−1)−1⌉r^{*}=\lceil n\cdot(\sqrt[k]{1+(\underline{p_{l}}-\overline{p}_{s}-\delta_{l}-\delta_{s})}-1)-1\rceil.

The next theorem shows that our derived certified poisoning size is tight.

Assuming we have pl‾+p‾s≤1\underline{p_{l}}+\overline{p}_{s}\leq 1, pl‾+(c−1)⋅p‾s≥1\underline{p_{l}}+(c-1)\cdot\overline{p}_{s}\geq 1, and δl=δs=0\delta_{l}=\delta_{s}=0. Then, for any r>r∗r>r^{*}, there exist a base learning algorithm A∗\mathcal{A}^{*} consistent with (5) and a poisoned training dataset D′\mathcal{D}^{\prime} with rr poisoned training examples such that h(D′,x)≠lh(\mathcal{D}^{\prime},\mathbf{x})\neq l or there exist ties.

We have several remarks about our theorems.

Remark 1: Our Theorem 1 is applicable for any base learning algorithm A\mathcal{A}, i.e., bagging with any base learning algorithm is provably robust against data poisoning attacks.

Remark 2: For any lower bound pl‾\underline{p_{l}} of the largest label probability and upper bound p‾s\overline{p}_{s} of the second largest label probability, Theorem 1 derives a certified poisoning size. Moreover, our certified poisoning size is related to the gap between the two probability bounds. If we can estimate tighter probability bounds, then the certified poisoning size may be larger.

Remark 3: Theorem 2 shows that when no assumptions on the base learning algorithm are made, it is impossible to certify a poisoning size that is larger than ours.

Computing the Certified Poisoning Size

Given a base learning algorithm A\mathcal{A}, a training dataset D\mathcal{D}, subsampling size kk, and ee testing examples in De\mathcal{D}_{e}, we aim to compute the label li{l}_{i} predicted by the ensemble classifier and the corresponding certified poisoning size ri∗{r}_{i}^{*} for each testing example xi\mathbf{x}_{i}. For a testing example xi\mathbf{x}_{i}, our certified poisoning size relies on a lower bound pli‾\underline{p_{{l}_{i}}} of the largest label probability and an upper bound p‾si\overline{p}_{{s}_{i}} of the second largest label probability. We design a Monte-Carlo algorithm to estimate the probability bounds for the ee testing examples simultaneously via training NN base classifiers. Next, we first describe estimating the probability bounds. Then, we describe our efficient algorithm to solve the optimization problem in (9) with the estimated probability bounds to compute the certified poisoning sizes.

Computing the predicted label and probability bounds for one testing example: We first discuss estimating the predicted label li{l}_{i} and probability bounds pli‾\underline{p_{{l}_{i}}} and p‾si\overline{p}_{{s}_{i}} for one testing example xi\mathbf{x}_{i}. We first randomly sample NN subsamples L1,L2,⋯ ,LN\mathcal{L}_{1},\mathcal{L}_{2},\cdots,\mathcal{L}_{N} from D\mathcal{D} with replacement, each of which has kk training examples. Then, we train a base classifier fof_{o} for each subsample Lo\mathcal{L}_{o} using the base learning algorithm A\mathcal{A}, where o=1,2,⋯ ,No=1,2,\cdots,N. We use the base classifiers to predict labels for xi\mathbf{x}_{i}, and we denote by NjN_{j} the frequency of label jj, i.e., NjN_{j} is the number of base classifiers that predict label jj for xi\mathbf{x}_{i}. We estimate the label with the largest frequency as the label lil_{i} predicted by the ensemble classifier hh for xi\mathbf{x}_{i}. Moreover, based on the definition of label probability, the frequency NjN_{j} of the label jj among the NN base classifiers follows a binomial distribution with parameters NN and pjp_{j}. Therefore, given the label frequencies, we can use the Clopper-Pearson (Clopper and Pearson, 1934) based method called SimuEM (Jia et al., 2020a) to estimate the following probability bounds simultaneously:

where 1−α1-\alpha is the confidence level and Beta(β;λ,θ)\text{Beta}(\beta;\lambda,\theta) is the β\betath quantile of the Beta distribution with shape parameters λ\lambda and θ\theta. One natural method to estimate p‾si\overline{p}_{s_{i}} is that p‾si=max⁡j≠lip‾j\overline{p}_{s_{i}}=\max_{j\neq l_{i}}\overline{p}_{j}. However, this bound may be loose. For example, pli‾+p‾si\underline{p_{l_{i}}}+\overline{p}_{s_{i}} may be larger than 1. Therefore, we estimate p‾si\overline{p}_{s_{i}} as p‾si=min⁡(max⁡j≠lip‾j,1−pli‾)\overline{p}_{s_{i}}=\min(\max_{j\neq l_{i}}\overline{p}_{j},1-\underline{p_{l_{i}}}).

Computing the predicted labels and probability bounds for ee testing examples: One way of estimating the predicted labels and probability bounds for ee testing examples is to apply the above process for each testing example separately. However, such process requires training NN base classifiers for each testing example, which is computationally intractable. To address the challenge, we propose a method to estimate them for ee testing examples simultaneously via training NN base classifiers in total. Our key idea is to divide the confidence level among the ee testing examples such that we can estimate their predicted labels and probability bounds using the same NN base classifiers with a simultaneous confidence level at least 1−α1-\alpha. Specifically, we still use the NN base classifiers to predict the label for each testing example as we described above. Then, we follow the above process to estimate the probability bounds pli‾\underline{p_{{l}_{i}}} and p‾si\overline{p}_{{s}_{i}} for a testing example xi\mathbf{x}_{i} via replacing α\alpha as α/e\alpha/e in Equation (10) and (11). Based on the Bonferroni correction, the simultaneous confidence level of estimating the probability bounds for the ee testing examples is at least 1−α1-\alpha.

Computing the certified poisoning sizes: Given the estimated probability bounds pli‾\underline{p_{{l}_{i}}} and p‾si\overline{p}_{{s}_{i}} for a testing example xi\mathbf{x}_{i}, we solve the optimization problem in (9) to obtain its certified poisoning size ri∗r_{i}^{*}. We design an efficient binary search based method to solve ri∗r_{i}^{*}. Specifically, we use binary search to find the largest rr such that the constraint in (9) is satisfied. We denote the left-hand side of the constraint as max⁡n−r≤n′≤n+rL(n)\max_{n-r\leq n^{\prime}\leq n+r}L(n). For a given rr, a naive way to check whether the constraint max⁡n−r≤n′≤n+rL(n′)<0\max_{n-r\leq n^{\prime}\leq n+r}L(n^{\prime})<0 holds is to check whether L(n′)<0L(n^{\prime})<0 holds for each n′n^{\prime} in the range [n−r,n+r][n-r,n+r], which could be inefficient when rr is large. To reduce the computation cost, we derive an analytical form of n′n^{\prime} at which L(n′)L(n^{\prime}) reaches its maximum value. Our analytical form enables us to only check whether L(n′)<0L(n^{\prime})<0 holds for at most two different n′n^{\prime} for a given rr. The details of deriving the analytical form are shown in Supplemental Material.

Complete certification algorithm: Algorithm 1 shows our certification process to estimate the predicted labels and certified poisoning sizes for ee testing examples in De\mathcal{D}_{e}. The function TrainUnderSample randomly samples NN subsamples and trains NN base classifiers. The function SimuEM estimates the probability bounds pli‾\underline{p_{l_{i}}} and p‾si\overline{p}_{s_{i}} with confidence level 1−αe1-\frac{\alpha}{e}. The function BinarySearch solves the optimization problem in (9) using the estimated probability bounds pli‾\underline{p_{l_{i}}} and p‾si\overline{p}_{s_{i}} to obtain the certified poisoning size ri∗r_{i}^{*} for testing example xi\mathbf{x}_{i}.

Since the probability bounds are estimated using a Monte Carlo algorithm, they may be estimated incorrectly, i.e., pli‾>pli\underline{p_{l_{i}}}>p_{l_{i}} or p‾si<psi\overline{p}_{s_{i}}<{p}_{s_{i}}. When they are estimated incorrectly, our algorithm Certify may output an incorrect certified poisoning size. However, the following theorem shows that the probability that Certify returns an incorrect certified poisoning size for at least one testing example is at most α\alpha.

The probability that Certify returns an incorrect certified poisoning size for at least one testing example in De\mathcal{D}_{e} is at most α\alpha, i.e., we have:

Experiments

Datasets and classifiers: We use MNIST and CIFAR10 datasets. The base learning algorithm is neural network, and we use the example convolutional neural network architecture and ResNet20 (He et al., 2016) in Keras for MNIST and CIFAR10, respectively. The number of training examples in the two datasets are 60,00060,000 and 50,00050,000, respectively, which are the training datasets that we aim to certify. Both datasets have 10,000 testing examples, which are the De\mathcal{D}_{e} in our algorithm. When we train a base classifier, we adopt the example data augmentation in Keras for both datasets.

Evaluation metric: We use certified accuracy as our evaluation metric. In particular, we define the certified accuracy at rr poisoned training examples of a classifier as the fraction of testing examples whose labels are correctly predicted by the classifier and whose certified poisoning sizes are at least rr. Formally, we have the certified accuracy CArCA_{r} at rr poisoned training examples as follows:

where yiy_{i} is the ground truth label for testing example xi\mathbf{x}_{i}, and lil_{i} and ri∗r_{i}^{*} respectively are the label predicted by the classifier and the corresponding certified poisoning size for xi\mathbf{x}_{i}. Intuitively, CArCA_{r} of a classifier means that, when the number of poisoned training examples is rr, the classifier’s testing accuracy for De\mathcal{D}_{e} is at least CArCA_{r} no matter how the attacker manipulates the rr poisoned training examples. Based on Theorem 3, the CArCA_{r} computed using the predicted labels and certified poisoning sizes outputted by our Certify algorithm has a confidence level 1−α1-\alpha.

Parameter setting: Our method has three parameters, i.e., kk, α\alpha, and NN. Unless otherwise mentioned, we adopt the following default settings for them: α=0.001\alpha=0.001, N=1,000N=1,000, k=30k=30 for MNIST, and k=500k=500 for CIFAR10. We will study the impact of each parameter while setting the remaining parameters to their default values. Note that training the NN base classifiers can be easily parallelized. We performed experiments on a server with 80 CPUs@2.1GHz, 8 GPUs (RTX 6,000), and 385 GB main memory.

2 Experimental Results

Comparing different data poisoning attacks: An attacker can modify, delete, and/or insert training examples in data poisoning attacks. We compare the certified accuracy of our method when an attacker only modifies, deletes, or inserts training examples. Our Corollary 1-3 show the certified poisoning sizes for such attacks. Figure 2(a) shows the comparison results, where “All” corresponds to the attacks that can use modification, deletion, and insertion. Our method achieves the best certified accuracy for attacks that only delete training examples. This is because deletion simply reduces the size of the clean training dataset. The curves corresponding to Modification and All overlap and have the lowest certified accuracy. This is because modifying a training example is equivalent to deleting an existing training example and inserting a new one. In the following experiments, we use the All attacks unless otherwise mentioned.

Impact of kk, α\alpha, and NN: Figure 2 shows the impact of kk, α\alpha, and NN on the certified accuracy of our method. As the results show, kk controls a tradeoff between accuracy under no poisoning and robustness. Specifically, when kk is larger, our method has a higher accuracy when there are no data poisoning attacks (i.e., r=0r=0) but the certified accuracy drops more quickly as the number of poisoned training examples increases. The reason is that a larger kk makes it more likely to sample poisoned training examples when creating the subsamples in bagging. The certified accuracy increases as α\alpha or NN increases. The reason is that a larger α\alpha or NN produces tighter estimated probability bounds, which make the certified poisoning sizes larger. We also observe that the certified accuracy is relatively insensitive to α\alpha.

Transfer learning improves certified accuracy: Our method trains multiple base classifiers and each base classifier is trained using kk training examples. Improving the accuracy of each base classifier can improve the certified accuracy. We explore using transfer learning to train more accurate base classifiers. Specifically, we use the Inception-v3 classifier pretrained on ImageNet to extract features and we use a public implementationhttps://github.com/alexisbcook/keras_transfer_cifar10 to train our base classifiers on CIFAR10. Figure 3(a) shows that transfer learning can significantly increase our certified accuracy, where k=100k=100, α=0.001\alpha=0.001, and N=1,000N=1,000. Note that we assume the pretrained classifier is not poisoned in this experiment.

Comparing with Ma et al. (2019), Wang et al. (2020), and Rosenfeld et al. (2020): Since these methods are not scalable because they train NN classifiers on the entire training dataset, we perform comparisons on the MNIST 1/7 dataset that just includes digits 1 and 7. This subset includes 13,007 training examples and 2,163 testing examples. Note that our above experiments used the entire MNIST dataset.

Ma et al. (2019). Ma et al. showed that a classifier trained with differential privacy achieves certified robustness against data poisoning attacks. Suppose ACCrACC_{r} is the testing accuracy for De\mathcal{D}_{e} of a differentially private classifier trained on a poisoned training dataset with rr poisoned training examples. Based on the Theorem 3 in (Ma et al., 2019), we have the expected testing accuracy E(ACCr)E(ACC_{r}) is lower bounded by a certain function of E(ACC)E(ACC), rr, and (ϵ,δ)(\epsilon,\delta) (the function can be found in their Theorem 3), where E(ACC)E(ACC) is the expected testing accuracy of a differentially private classifier that is trained using the clean training dataset and (ϵ,δ)(\epsilon,\delta) are the differential privacy parameters. The randomness in E(ACCr)E(ACC_{r}) and E(ACC)E(ACC) are from differential privacy. This lower bound is the certified accuracy that the method achieves. A lower bound of E(ACC)E(ACC) can be further estimated with confidence level 1−α1-\alpha via training NN differentially private classifiers on the entire clean training dataset. For simplicity, we estimate E(ACC)E(ACC) as the average testing accuracies of the NN differentially private classifiers, which gives advantages for this method. We use DP-SGD (Abadi et al., 2016) implemented in TensorFlow to train differentially private classifiers. Moreover, we set ϵ=0.3\epsilon=0.3 and δ=10−5\delta=10^{-5} such that this method and our method achieve comparable certified accuracies when r=0r=0.

Wang et al. (2020) and Rosenfeld et al. (2020). Wang et al. proposed a randomized smoothing based method to certify robustness against backdoor attacks via randomly flipping features and labels of training examples as well as features of testing examples. Rosenfeld et al. leveraged randomized smoothing to certify robustness against label flipping attacks. Both methods can be generalized to certify robustness against data poisoning attacks that modify both features and labels of existing training examples via randomly flipping features and labels of training examples. Moreover, the two methods become the same after such generalization. Therefore, we only show results for Wang et al. (2020). In particular, we binarize the features to apply this method. We train NN classifiers to estimate the certified accuracy with a confidence level 1−α1-\alpha. Unlike our method, when training a classifier, they flip each feature/label value in the training dataset with probability β\beta and use the entire noisy training dataset. When predicting the label of a testing example, this method takes a majority vote among the NN classifiers. We set β=0.3\beta=0.3 such that this method and our method achieve comparable certified accuracies when r=0r=0. We note that this method certifies the number of poisoned features/labels in the training dataset. We transform this certificate to the number of poisoned training examples as ⌊Fd+1⌋\lfloor\frac{F}{d+1}\rfloor, where FF is the certified number of features/labels and d+1d+1 is the number of features/label of a training example (dd features + one label). We have d=784d=784 for MNIST.

Figure 3(b) shows the comparison results, where k=50k=50, α=0.001\alpha=0.001, and N=1,000N=1,000. To be consistent with previous work, we did not use data augmentation when training the base classifiers for all three methods in these experiments. Our method significantly outperforms existing methods. For example, our method can achieve 96.95%96.95\% certified accuracy when the number of poisoned training examples is r=50r=50, while the certified accuracy is under the same setting for existing methods. Figure 3(c) shows that our method is also more efficient than existing methods. This is because our method trains base classifiers on a small number of training examples while existing methods train classifiers on the entire training dataset. Ma et al. outperforms Wang et al. and Rosenfeld et al. because differential privacy directly certifies robustness against modification/deletion/insertion of training examples while randomized smoothing was designed to certify robustness against modifications of features/labels.

Related Work

Data poisoning attacks carefully modify, delete, and/or insert some training examples in the training dataset such that a learnt model makes incorrect predictions for many testing examples indiscriminately (i.e., the learnt model has a large testing error rate) or for some attacker-chosen testing examples. For instance, data poisoning attacks have been shown to be effective for Bayes classifiers (Nelson et al., 2008), SVMs (Biggio et al., 2012), neural networks (Yang et al., 2017a, Muñoz-González et al., 2017, Suciu et al., 2018, Shafahi et al., 2018), linear regression models (Mei and Zhu, 2015b, Jagielski et al., 2018), PCA (Rubinstein et al., 2009), LASSO (Xiao et al., 2015), collaborative filtering (Li et al., 2016, Yang et al., 2017b, Fang et al., 2018, 2020b), clustering (Biggio et al., 2013, 2014), graph-based methods (Zügner et al., 2018, Wang and Gong, 2019, Jia et al., 2020b, Zhang et al., 2020), federated learning (Fang et al., 2020a, Bhagoji et al., 2019, Bagdasaryan et al., 2020), and others (Mozaffari-Kermani et al., 2014, Mei and Zhu, 2015a, Koh et al., 2018, Zhu et al., 2019). We note that backdoor attacks (Gu et al., 2017, Liu et al., 2017) also poison the training dataset. However, unlike data poisoning attacks, backdoor attacks also inject perturbation (i.e., a trigger) to testing examples.

One category of defenses (Cretu et al., 2008, Barreno et al., 2010, Suciu et al., 2018, Tran et al., 2018) aim to detect the poisoned training examples based on their negative impact on the error rate of the learnt model. Another category of defenses (Feng et al., 2014, Jagielski et al., 2018) aim to design new loss functions, solving which detects the poisoned training examples and learns a model simultaneously. For instance, Jagielski et al. (2018) proposed to jointly optimize the selection of a subset of training examples with a given size and a model that minimizes the loss function; and the unselected training examples are treated as poisoned ones. Steinhardt et al. (2017) assumes that a model is trained only using examples in a feasible set and derives an approximate upper bound of the loss function for any data poisoning attacks under these assumptions. However, all of these defenses cannot certify that the learnt model predicts the same label for a testing example under data poisoning attacks.

Ma et al. (2019) shows that differentially private models certify robustness against data poisoning attacks. Wang et al. (2020) proposes to use randomized smoothing to certify robustness against backdoor attacks, which is also applicable to certify robustness against data poisoning attacks. Rosenfeld et al. (2020) leverages randomized smoothing to certify robustness against label flipping attacks. However, these defenses achieve loose certified robustness guarantees. Moreover, Ma et al. (2019) is only applicable to learning algorithms that can be differentially private, while Wang et al. (2020) and Rosenfeld et al. (2020) are only applicable to data poisoning attacks that modify existing training examples. Biggio et al. (2011) proposed bagging as an empirical defense against data poisoning attacks. However, they did not derive the certified robustness of bagging. We note that a concurrent work (Levine and Feizi, 2020) proposed to certify robustness against data poisoning attacks via partitioning the training dataset using a hash function. However, their results are only applicable to deterministic learning algorithms.

Conclusion

Data poisoning attacks pose severe security threats to machine learning systems. In this work, we show the intrinsic certified robustness of bagging against data poisoning attacks. Specifically, we show that bagging predicts the same label for a testing example when the number of poisoned training examples is bounded. Moreover, we show that our derived bound is tight if no assumptions on the base learning algorithm are made. We also empirically demonstrate the effectiveness of our method using MNIST and CIFAR10. Our results show that our method achieves much better certified robustness and is more efficient than existing certified defenses. Interesting future work includes: 1) generalizing our method to other types of data, e.g., graphs, and 2) improving our method by leveraging meta-learning.

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

We first define some notations that will be used in our proof. Given a training dataset D\mathcal{D} and its poisoned version D′\mathcal{D}^{\prime}, we define the following two random variables:

where XX and YY respectively are two random lists with kk examples sampled from D\mathcal{D} and D′\mathcal{D}^{\prime} with replacement uniformly at random. We denote by I=D∩D′\mathcal{I}=\mathcal{D}\cap\mathcal{D}^{\prime} the set of training examples that are in both D\mathcal{D} and D′\mathcal{D}^{\prime}. We denote n=∣D∣n=|\mathcal{D}|, n′=∣D′∣n^{\prime}=|\mathcal{D}^{\prime}|, and m=∣I∣m=|\mathcal{I}|, which are the number of training examples in D\mathcal{D}, D′\mathcal{D}^{\prime}, and D∩D′\mathcal{D}\cap\mathcal{D}^{\prime}, respectively. We use Ω\Omega to denote the joint space of random variables XX and YY, i.e., each element in Ω\Omega is a list with kk examples sampled from D\mathcal{D} or D′\mathcal{D}^{\prime} with replacement uniformly at random. For convenience, we define operators ⊑,⋢\sqsubseteq,\not\sqsubseteq as follows:

Assuming ω∈Ω\omega\in\Omega is a list of kk examples and S\mathcal{S} is a set of examples, we say ω⊑S\omega\sqsubseteq\mathcal{S} if  ∀w∈ω,w∈S\text{ }\forall\mathbf{w}\in\omega,\mathbf{w}\in\mathcal{S}. We say ω⋢S\omega\not\sqsubseteq\mathcal{S} if  ∃w∈ω,w∉S\text{ }\exists\mathbf{w}\in\omega,\mathbf{w}\not\in\mathcal{S}.

For instance, we have X⊑DX\sqsubseteq\mathcal{D} and Y⊑D′Y\sqsubseteq\mathcal{D}^{\prime}. Before proving our theorem, we show a variant of the Neyman-Pearson Lemma (Neyman and Pearson, 1933) that will be used in our proof.

Suppose XX and YY are two random variables in the space Ω\Omega with probability distributions μx\mu_{x} and μy\mu_{y}, respectively. Let M:Ω→{0,1}M:\Omega\xrightarrow{}\{0,1\} be a random or deterministic function. Then, we have the following:

If S1={ω∈Ω:μx(ω)>t⋅μy(ω)}S_{1}=\{\omega\in\Omega:\mu_{x}(\omega)>t\cdot\mu_{y}(\omega)\} and S2={ω∈Ω:μx(ω)=t⋅μy(ω)}S_{2}=\{\omega\in\Omega:\mu_{x}(\omega)=t\cdot\mu_{y}(\omega)\} for some t>0t>0. Let S=S1∪S3S=S_{1}\cup S_{3}, where S3⊆S2S_{3}\subseteq S_{2}. If we have Pr(M(X)=1)≥Pr(X∈S)\text{Pr}(M(X)=1)\geq\text{Pr}(X\in S), then Pr(M(Y)=1)≥Pr(Y∈S)\text{Pr}(M(Y)=1)\geq\text{Pr}(Y\in S).

If S1={ω∈Ω:μx(ω)<t⋅μy(ω)}S_{1}=\{\omega\in\Omega:\mu_{x}(\omega)<t\cdot\mu_{y}(\omega)\} and S2={ω∈Ω:μx(ω)=t⋅μy(ω)}S_{2}=\{\omega\in\Omega:\mu_{x}(\omega)=t\cdot\mu_{y}(\omega)\} for some t>0t>0. Let S=S1∪S3S=S_{1}\cup S_{3}, where S3⊆S2S_{3}\subseteq S_{2}. If we have Pr(M(X)=1)≤Pr(X∈S)\text{Pr}(M(X)=1)\leq\text{Pr}(X\in S), then Pr(M(Y)=1)≤Pr(Y∈S)\text{Pr}(M(Y)=1)\leq\text{Pr}(Y\in S).

We show the proof of the first part, and the second part can be proved similarly. For simplicity, we use M(1∣ω)M(1|\omega) and M(0∣ω)M(0|\omega) to denote the probabilities that M(ω)=0M(\omega)=0 and M(ω)=1M(\omega)=1, respectively. We use ScS^{c} to denote the complement of SS, i.e., Sc=Ω∖SS^{c}=\Omega\setminus S. We have the following:

We obtain (21) from (19) because μx(ω)≥t⋅μy(ω),∀ω∈S\mu_{x}(\omega)\geq t\cdot\mu_{y}(\omega),\forall\omega\in S and μx(ω)≤t⋅μy(ω),∀ω∈Sc\mu_{x}(\omega)\leq t\cdot\mu_{y}(\omega),\forall\omega\in S^{c}. We have the last inequality because Pr(M(X)=1)≥Pr(X∈S)\text{Pr}(M(X)=1)\geq\text{Pr}(X\in S). ∎

Next, we prove our Theorem 1. Our goal is to show that h(D′,x)=lh(\mathcal{D}^{\prime},\mathbf{x})=l, i.e., Pr(A(Y,x)=l)>max⁡j≠lPr(A(Y,x)=j)\text{Pr}(\mathcal{A}(Y,\mathbf{x})=l)>\max_{j\neq l}\text{Pr}(\mathcal{A}(Y,\mathbf{x})=j). Our key idea is to derive a lower bound of Pr(A(Y,x)=l)\text{Pr}(\mathcal{A}(Y,\mathbf{x})=l) and an upper bound of max⁡j≠lPr(A(Y,x)=j)\max_{j\neq l}\text{Pr}(\mathcal{A}(Y,\mathbf{x})=j), where the lower bound and upper bound can be easily computed. We derive the lower bound and upper bound using the Neyman-Pearson Lemma. Then, we derive the certified poisoning size by requiring the lower bound to be larger than the upper bound. Next, we derive the lower bound, the upper bound, and the certified poisoning size.

Deriving a lower bound of Pr(A(Y,x)=l)\text{Pr}(\mathcal{A}(Y,\mathbf{x})=l): We first define the following residual:

Since we sample kk training examples with replacement uniformly at random, we have the following:

Recall that the size of I\mathcal{I} is mm, i.e., m=∣I∣m=|\mathcal{I}|. Then, we have the following:

We have Pr(X∈E)=(mn)k\text{Pr}(X\in\mathcal{E})=(\frac{m}{n})^{k} because each of the kk examples is sampled independently from I\mathcal{I} with probability mn\frac{m}{n}. Furthermore, since Pr(X∈B)+Pr(X∈E)=1\text{Pr}(X\in\mathcal{B})+\text{Pr}(X\in\mathcal{E})=1, we obtain Pr(X∈B)=1−(mn)k\text{Pr}(X\in\mathcal{B})=1-(\frac{m}{n})^{k}. Since X⋢D′X\not\sqsubseteq\mathcal{D}^{\prime}, we have Pr(X∈C)=0\text{Pr}(X\in\mathcal{C})=0. Similarly, we can compute the probabilities in (32).

We assume pl‾−δl−(1−(mn)k)≥0\underline{p_{l}}-\delta_{l}-(1-(\frac{m}{n})^{k})\geq 0. We can make this assumption because we only need to find a sufficient condition for h(D′,x)=lh(\mathcal{D}^{\prime},\mathbf{x})=l. We define B′⊆E\mathcal{B}^{\prime}\subseteq\mathcal{E}, i.e., B′\mathcal{B}^{\prime} is a subset of E\mathcal{E}, such that we have the following:

We can find such subset because pl‾−δl\underline{p_{l}}-\delta_{l} is an integer multiple of 1nk\frac{1}{n^{k}}. Moreover, we define R\mathcal{R} as follows:

Furthermore, we have Pr(X=ω)>γ⋅Pr(Y=ω)\text{Pr}(X=\omega)>\gamma\cdot\text{Pr}(Y=\omega) if and only if ω∈B\omega\in\mathcal{B} and Pr(X=ω)=γ⋅Pr(Y=ω)\text{Pr}(X=\omega)=\gamma\cdot\text{Pr}(Y=\omega) if ω∈B′\omega\in\mathcal{B}^{\prime}, where γ=(n′n)k\gamma=(\frac{n^{\prime}}{n})^{k}. Therefore, based on the definition of R\mathcal{R} in (34) and the condition (36), we can apply Lemma 1 to obtain the following:

Pr(Y∈R)\text{Pr}(Y\in\mathcal{R}) is a lower bound of Pr(A(Y,x)=l)\text{Pr}(\mathcal{A}(Y,\mathbf{x})=l) and can be computed as follows:

where we have (40) from (39) because Pr(Y∈B)=0\text{Pr}(Y\in\mathcal{B})=0, (41) from (40) because Pr(X=ω)=γ⋅Pr(Y=ω)\text{Pr}(X=\omega)=\gamma\cdot\text{Pr}(Y=\omega) for ω∈B′\omega\in\mathcal{B}^{\prime}, and the last equation from (33).

Deriving an upper bound of max⁡j≠lPr(A(Y,x)=j)\max_{j\neq l}\text{Pr}(\mathcal{A}(Y,\mathbf{x})=j): We define the following residual:

We leverage the second part of Lemma 1 to derive such an upper bound. We assume Pr(X∈E)≥p‾j+δj\text{Pr}(X\in\mathcal{E})\geq\overline{p}_{j}+\delta_{j}, ∀j∈{1,2,⋯ ,c}∖{l}\forall j\in\{1,2,\cdots,c\}\setminus\{l\}. We can make the assumption because we derive a sufficient condition for h(D′,x)=lh(\mathcal{D}^{\prime},\mathbf{x})=l. For ∀j∈{1,2,⋯ ,c}∖{l}\forall j\in\{1,2,\cdots,c\}\setminus\{l\}, we define Cj⊆E\mathcal{C}_{j}\subseteq\mathcal{E} such that we have the following:

We can find such Cj\mathcal{C}_{j} because p‾j+δj\overline{p}_{j}+\delta_{j} is an integer multiple of 1nk\frac{1}{n^{k}}. Moreover, we define the following space:

where Pr(Y∈Qj)\text{Pr}(Y\in\mathcal{Q}_{j}) can be computed as follows:

where p‾s+δs≥max⁡j≠l(p‾j+δj)\overline{p}_{s}+\delta_{s}\geq\max\limits_{j\neq l}(\overline{p}_{j}+\delta_{j}).

Deriving the certified poisoning size: To reach the goal Pr(A(Y,x)=l)>max⁡j≠lPr(A(Y,x)=j)\text{Pr}(\mathcal{A}(Y,\mathbf{x})=l)>\max\limits_{j\neq l}\text{Pr}(\mathcal{A}(Y,\mathbf{x})=j), it is sufficient to have the following:

Taking all poisoned training datasets D′\mathcal{D}^{\prime} (i.e., n−r≤n′≤n+rn-r\leq n^{\prime}\leq n+r) into consideration, we have the following sufficient condition:

Note that m=max⁡(n,n′)−rm=\max(n,n^{\prime})-r. Furthermore, when the above condition (59) is satisfied, we have pl‾−δl−(1−(mn)k)≥0\underline{p_{l}}-\delta_{l}-(1-(\frac{m}{n})^{k})\geq 0 and Pr(X∈E)=(mn)k≥p‾j+δj,∀j∈{1,2,⋯ ,c}∖{l}\text{Pr}(X\in\mathcal{E})=(\frac{m}{n})^{k}\geq\overline{p}_{j}+\delta_{j},\forall j\in\{1,2,\cdots,c\}\setminus\{l\}, which are the conditions when we can construct the spaces B′\mathcal{B}^{\prime} and Cj\mathcal{C}_{j}. The certified poisoning size r∗r^{*} is the maximum rr that satisfies the above sufficient condition. In other words, our certified poisoning size r∗r^{*} is the solution to the following optimization problem:

Appendix B Proof of Theorem 2

Our idea is to construct a learning algorithm A∗\mathcal{A}^{*} such that the label ll is not predicted by the bagging predictor or there exist ties. When r>r∗r>r^{*} and δl=δs=0\delta_{l}=\delta_{s}=0, there exists a poisoned training dataset D′\mathcal{D}^{\prime} with a certain n′∈[n−r,n+r]n^{\prime}\in[n-r,n+r] such that we have:

where m=max⁡(n,n′)−rm=\max(n,n^{\prime})-r and γ=(n′n)k\gamma=(\frac{n^{\prime}}{n})^{k}. We let Qs=C∪Cs′\mathcal{Q}_{s}=\mathcal{C}\cup\mathcal{C}^{\prime}_{s}, where Cs′\mathcal{C}^{\prime}_{s} satisfies the following:

Note that we can construct such Cs′\mathcal{C}^{\prime}_{s} because pl‾+p‾s≤1\underline{p_{l}}+\overline{p}_{s}\leq 1. Then, we divide the remaining space Ω∖(R∪Qs)\Omega\setminus(\mathcal{R}\cup\mathcal{Q}_{s}) into c−2c-2 subspaces such that Pr(X∈Qj)≤p‾s\text{Pr}(X\in\mathcal{Q}_{j})\leq\overline{p}_{s}, where j∈{1,2,⋯ ,c}∖{l,s}j\in\{1,2,\cdots,c\}\setminus\{l,s\}. We can construct such subspaces because pl‾+(c−1)⋅p‾s≥1\underline{p_{l}}+(c-1)\cdot\overline{p}_{s}\geq 1. Then, based on these subspaces, we construct the following learning algorithm:

Then, we have the following based on the above definition of the learning algorithm A∗\mathcal{A}^{*}:

Therefore, the learning algorithm A∗\mathcal{A}^{*} is consistent with (5). Next, we show that ll is not predicted by the bagging predictor or there exist ties when the training dataset is D′\mathcal{D}^{\prime}. In particular, we have the following:

where γ=(n′n)k\gamma=(\frac{n^{\prime}}{n})^{k} and we have (73) from (72) because of (64). Therefore, label ll is not predicted for x\mathbf{x} or there exist ties when the training dataset is D′\mathcal{D}^{\prime}.

Appendix C Proof of Theorem 3

Based on the definition of SimuEM in (Jia et al., 2020a), we have:

Therefore, the probability that Certify returns an incorrect certified poisoning size for a testing example xi\mathbf{x}_{i} is at most αe\frac{\alpha}{e}, i.e., we have:

We have (80) from (79) according to the Boole’s inequality.

We have the following analytical form of n′n^{\prime} at which L(n′)L(n^{\prime}) reaches its maximum:

Next, we show details on how to derive such analytical form of n′n^{\prime}. When n−r≤n′≤nn-r\leq n^{\prime}\leq n, we have the following:

Therefore, when n−r≤n′≤nn-r\leq n^{\prime}\leq n, L(n′)L(n^{\prime}) increases as n′n^{\prime} increases. Thus, L(n′)L(n^{\prime}) reaches its maximum value when n≤n′≤n+rn\leq n^{\prime}\leq n+r. When n≤n′≤n+rn\leq n^{\prime}\leq n+r, we have the following:

k⋅xk−1nk\frac{k\cdot x^{k-1}}{n^{k}} is larger than . Moreover, 1−2⋅(1−rx)k−11-2\cdot(1-\frac{r}{x})^{k-1} decreases as xx increases when x≥rx\geq r and it only has one root that is no smaller than rr which is as follows:

Therefore, we have ∂L(x)∂x>0\frac{\partial L(x)}{\partial x}>0 when r≤x<r1−12k−1r\leq x<\frac{r}{1-\sqrt[k-1]{\frac{1}{2}}} and ∂L(x)∂x<0\frac{\partial L(x)}{\partial x}<0 when x>r1−12k−1x>\frac{r}{1-\sqrt[k-1]{\frac{1}{2}}}. L(x)L(x) increases as xx increases in the range [r,r1−12k−1)[r,\frac{r}{1-\sqrt[k-1]{\frac{1}{2}}}) and decreases as xx increases in the range (r1−12k−1,+∞)(\frac{r}{1-\sqrt[k-1]{\frac{1}{2}}},+\infty). Therefore, we have the following three cases:

Case I: When r≤n⋅(1−12k−1)r\leq n\cdot(1-\sqrt[k-1]{\frac{1}{2}}), L(n′)L(n^{\prime}) reaches its maximum value at n′=nn^{\prime}=n since L(n′)L(n^{\prime}) decreases as n′n^{\prime} increases in the range [n,n+r][n,n+r].

Case II: When n⋅(1−12k−1)<r<n⋅(2k−1−1)n\cdot(1-\sqrt[k-1]{\frac{1}{2}})<r<n\cdot(\sqrt[k-1]{2}-1), L(n′)L(n^{\prime}) reaches its maximum value at n′=⌈r1−12k−1⌉ or ⌊r1−12k−1⌋n^{\prime}=\lceil\frac{r}{1-\sqrt[k-1]{\frac{1}{2}}}\rceil\text{ or }\lfloor\frac{r}{1-\sqrt[k-1]{\frac{1}{2}}}\rfloor since L(n′)L(n^{\prime}) increases as n′n^{\prime} increases in the range [n,r1−12k−1][n,\frac{r}{1-\sqrt[k-1]{\frac{1}{2}}}] and decreases as n′n^{\prime} increases in the range [r1−12k−1,n+r][\frac{r}{1-\sqrt[k-1]{\frac{1}{2}}},n+r].

Case III: When r≥n⋅(2k−1−1)r\geq n\cdot(\sqrt[k-1]{2}-1), L(n′)L(n^{\prime}) reaches its maximum value at n′=n+rn^{\prime}=n+r since L(n′)L(n^{\prime}) increases as n′n^{\prime} increases in the range [n,n+r][n,n+r].