VC Classes are Adversarially Robustly Learnable, but Only Improperly
Omar Montasser, Steve Hanneke, Nathan Srebro
Introduction
Learning predictors that are robust to adversarial perturbations is an important challenge in contemporary machine learning. There has been a lot of interest lately in how predictors learned by deep learning are not robust to adversarial examples (Szegedy et al., 2013; Biggio et al., 2013; Goodfellow et al., 2014), and there is an ongoing effort to devise methods for learning predictors that are adversarially robust. In this paper, we consider the problem of learning, based on a (non-adversarial) i.i.d. sample, a predictor that is robust to adversarial examples at test time. We emphasize that this is distinct from the learning process itself being robust to an adversarial training set.
The common approach to adversarially robust learning is to pick a hypothesis class (e.g. neural networks) and learn through robust empirical risk minimization:
How can we ensure that is small? All prior approaches that we are aware of for ensuring adversarially robust generalization are based on uniform convergence, i.e. showing that w.h.p. for all predictors , the estimation error is small, perhaps for some surrogate loss (Bubeck et al., 2018; Cullina et al., 2018; Khim and Loh, 2018; Yin et al., 2018). Such approaches justify , and in particular yield M-estimation type proper learning rules: we are learning a hypothesis class by choosing a predictor in the class that minimizes some empirical functional. For standard supervised learning we know that proper learning, and specifically , is sufficient for learning, and so it is sensible to limit attention to such methods.
But it has also been observed in practice that the adversarial error does not generalize as well as the standard error, i.e. there can be a large gap between and even when their non-robust versions are similar (Schmidt et al., 2018). This suggests that perhaps the robust risk does not concentrate as well as the standard risk, and so RERM in adversarially robust learning might not work as well as ERM in standard supervised learning. Does this mean that such problems are not adversarially robustly learnable? Or is it perhaps that proper learners might not be sufficient?
In this paper we aim to characterize which hypothesis classes are adversarially robustly learnable, and using what learning rules. That is, for a given hypothesis class and adversary , we ask whether it is possible, based on an i.i.d. sample to learn a predictor that has population robust risk almost as good as any predictor in (see Definition 2.1 in Section 2). We discover a stark contrast between proper learning rules which output predictors in , and improper learning rules which are not constrained to predictors in . Our main results are:
We show that there exists an adversary and a hypothesis class with finite VC dimension that cannot be robustly PAC learned with any proper learning rule (including ).
We show that for any adversary and any hypothesis class with finite VC dimension, there exists an improper learning rule that can robustly PAC learn (although with sample complexity that is sometimes exponential in the VC dimension).
Our results suggest that we should start considering improper learning rules to ensure adversarially robust generalization. They also demonstrate that previous approaches to adversarially robust generalization are not always sufficient, as all prior work we are aware of is based on uniform convergence of the robust risk, either directly for the loss of interest (Bubeck et al., 2018; Cullina et al., 2018) or some carefully constructed surrogate loss (Khim and Loh, 2018; Yin et al., 2018), which would still justify the use of M-estimation type proper learning. The approach of Attias et al. (2018) for the case where (i.e. finite number of perturbations) is most similar to ours, as it uses an improper learning rule, but their analysis is still based on uniform convergence and so would apply also to (the improperness is introduced only for computational, not statistical, reasons). Also, in this specific case, our approach would give an improved sample complexity that scales only roughly logarithmically with , as opposed to the roughly linear scaling in Attias et al. (2018)—see discussion at the end of Section 4 for details.
A related negative result was presented by Schmidt et al. (2018), where they showed that there exists a family of distributions (namely, mixtures of two -dimensional spherical Gaussians) where the sample complexity for standard learning is , but the sample complexity for adversarially robust learning is at least . This an interesting instance where there is a large separation in sample complexity between standard learning and robust learning. But distribution-specific learning is known to be less easily characterizable, with the uniform convergence not being necessary for learning, and ERM not always being optimal, even for standard (non-robust) supervised learning. In this paper we focus on “worst case” distribution-free robust learning, as in standard PAC learnability.
A different notion of robust learning was studied by Xu and Mannor (2012). They use empirical robustness as a design technique for learning rules, but their goal, and the guarantees they establish are on the standard non-robust population risk, and so do not inform us about robust learnability.
Problem Setup
.
If no such exists, define . We say that is robustly PAC learnable in the agnostic setting with respect to adversary if , is finite.
.
If no such exists, define . We say that is robustly PAC learnable in the realizable setting with respect to adversary if , is finite.
We say that is properly robustly PAC learnable (in the agnostic or realizable setting) if it can be learned as in Definitions 2.1 or 2.2 using a learning rule that always outputs a predictor in . We refer to learning using any learning rule , as in the definitions above, as improper learning.
We say that a sequence is shattered by if such that . The VC dimension of (denoted ) is then defined as the largest integer for which there exists that is shattered by . If no such exists, then is said to be infinite.
In the standard PAC learning framework, we know that a hypothesis class is PAC learnable if and only if the VC dimension of is finite (Vapnik and Chervonenkis, 1971, 1974; Blumer et al., 1989; Ehrenfeucht et al., 1989). In particular, is properly PAC learnable with and therefore proper learning is sufficient for supervised learning. A natural question to ask, based on the definition of robust PAC learning, is what is a necessary and sufficient condition on that implies that it is robustly PAC learnable with respect to adversary . We can easily obtain a sufficient condition based on Vapink’s “General Learning” (Vapnik, 1982). Denote by the robust loss class of ,
If the robust loss class has finite VC dimension (), then is robustly PAC learnable with and sample complexity that scales linearly with . One might then wish to relate the VC dimension of the hypothesis class () to the VC dimension of the robust loss class (). But as we show in Sections 3 and 5, there can be arbitrarily large gaps between them.
As mentioned earlier, for supervised learning finite VC dimension of the loss class (which is equal to the VC dimension of the hypothesis class) is also necessary for learning. For general learning, unlike supervised learning, the loss class having finite VC dimension, and uniform convergence over this class, is not, in general, necessary, and rules other than might be needed for learning (e.g. Vapnik, 1982; Shalev-Shwartz et al., 2009; Daniely et al., 2015). In the following Sections, we show that this is also the case for robust learning. We show that can be arbitrarily larger, we might not have uniform convergence, might not ensure learning, while the problem is still learnable with a different (improper, in our case) learning rule.
Sometimes There are no Proper Robust Learners
We start by showing that even for hypothesis classes with finite VC dimension, indeed even if , robust PAC learning might not be possible using any proper learning rule. In particular, even if there is a robust predictor in , and even with an unbounded number of samples, (or any other M-estimator or other proper learning rules), will not ensure a low robust risk.
There exists a hypothesis class with and an adversary such that is not properly robustly PAC learnable with respect to in the realizable setting.
Pick points in such that for all . In other words, we want the perturbation sets to be mutually disjoint.
We will construct a hypothesis class in the following iterative manner. Initialize set . For each bit string , initialize . For each , if then pick a point and add it to , i.e. . Once we finish picking points based on all bits that are set to , we add to (i.e. ). We define as:
h_{b}(x)=\left\{\begin{array}[]{ll}+1&\text{if }x\notin Z_{b}\\ -1&\text{if }x\in Z_{b}\end{array}\right.
Then, let . We can think of each mapping as being characterized by a unique signature that indicates the points that it labels with . These points are carefully picked such that, first, they are inside the perturbation sets of ; and second, no two mappings label the same point with , i.e. for any , where , . Also, we make sure that all mappings in label the set with .
Next, we proceed with proving two claims about . First, that . Pick any two points . Consider the following cases. In case or is in . Suppose W.L.O.G that . Then we know that all mappings label in the same way with label , because for all . Therefore, we cannot shatter with . In case and are both in . Since by our construction, and for any , we have two sub-cases. Either for some , which means that the only labelings we can obtain are with , and with for any . Second case is that and for . By our construction, we know that we cannot label both points and with , because they don’t belong to the same set. Therefore, in both subcases, we cannot shatter with . This concludes that .
a distribution over and a predictor where .
With probability at least over , .
We now proceed with the proof of Theorem 3.1.
h_{b}(x)=\left\{\begin{array}[]{ll}-1&\text{if }x\in Z_{b}\text{ or }x\in X_{m^{\prime}}\text{ for }m^{\prime}\neq m\\ +1&\text{otherwise }\end{array}\right.
Finite VC Dimension is Sufficient for (Improper) Robust Learnability
In the previous section we saw that finite VC dimension is not sufficient for proper robust learnability. We now show that it is sufficient for improper robust learnability, thus (1) establishing that if is learnable, it is also robustly learnable, albeit possibly with a higher sample complexity; and (2) unlike the standard supervised learning setting, to achieve learnability we might need to escape properness, as improper learning is necessary for some hypothesis classes.
We begin, in Section 4.1 with the realizable case, i.e. where there exists with zero robust risk. Then in Section 4.2 we turn to the agnostic setting, and observe that a version of a recent reduction by David, Moran, and Yehudayoff (2016) from agnostic to realizable learning applies also for robust learning. We thus establish agnostic robust learnability of finite VC classes by using this reduction and relying on the realizable learning result of Section 4.1.
We will in fact establish a bound in terms of the dual VC dimension. Formally, for each , define a function such that for each . Then the dual VC dimension of , denoted , is defined as the VC dimension of the set . This quantity is known to satisfy (Assouad, 1983), though for many spaces it satisfies or even, as is the case for linear separators, .
For any and , ,
Since Assouad (1983) has shown , this implies the following corollary.
For any and , ,
Our approach to this proof is via sample compression arguments. Specifically, we make use of a lemma (Lemma B.1 in Appendix 4.2), which extends to the robust loss the classic compression-based generalization guarantees from the - loss. We now proceed with the proof of Theorem 4.1.
The learning algorithm achieving this bound is a modification of a sample compression scheme recently proposed by Moran and Yehudayoff (2016), or more precisely, a variant of that method explored by Hanneke, Kontorovich, and Sadigurschi (2019). Our modification forces the compression scheme to also have zero empirical robust loss. Fix and a sample size , and denote by any distribution with .
By classic PAC learning guarantees (Vapnik and Chervonenkis, 1974; Blumer et al., 1989), there is a positive integer with the property that, for any distribution over with , for iid -distributed samples , with nonzero probability, every satisfying also has .
By our choice of , we know that for any distribution over , iid samples sampled from would have the property that, with nonzero probability, all with also have . In particular, this implies at least that there exists a subset with such that every with has . For such a set , note that , and therefore there exists a set with and . Furthermore, since for every , we know , and hence . Altogether, we have that, for any distribution over , with .
We will use the above as a weak hypothesis in a boosting algorithm. Specifically, we run the -Boost algorithm (Schapire and Freund, 2012, Section 6.4.2) with as its data set, using the above mapping to produce the weak hypotheses for the distributions produced on each round of the algorithm. As proven in (Schapire and Freund, 2012), for an appropriate a-priori choice of in the -Boost algorithm, running this algorithm for rounds suffices to produce a sequence of hypotheses s.t.
From this observation, we already have a sample complexity bound, only slightly worse than the claimed result. Specifically, the above implies that satisfies . Note that each of these classifiers is equal for some with . Thus, the classifier is representable as the value of an (order-dependent) reconstruction function with a compression set size
Thus, invoking Lemma B.1, if (for a sufficiently large numerical constant ), we have that with probability at least ,
,
and setting this less than and solving for a sufficient size of to achieve this yields a sample complexity bound, which is slightly larger than that claimed in Theorem 4.1. We next proceed to further refine this bound via a sparsification step. However, as an aside, we note that the above intermediate step will be useful in a discussion below, where the size of this compression scheme in the second expression in (1) offers an improvement over a result of Attias, Kontorovich, and Mansour (2018).
so that the majority vote predictor satisfies , and hence . Since again, each is the result of for some of size , we have that can be represented as the value of an (order-dependent) reconstruction function with a compression set size . Thus, Lemma B.1 implies that, for (for an appropriately large numerical constant ), with probability at least , . Setting this less than and solving for a sufficient size of to achieve this yields the stated bound.
2 Agnostic Robust Learnability
For the agnostic case, we can establish an upper bound via reduction to the realizable case, following an argument from David, Moran, and Yehudayoff (2016). Specifically, we have the following result.
For any and , ,
As above, since Assouad (1983) has shown , this implies the following corollary.
For any and , ,
We establish the theorem via a reduction to the realizable case, following an approach used by David, Moran, and Yehudayoff (2016), except here applied to the robust loss. The reduction is summarized in the following Theorem, whose proof can be found in Appendix C:
Denote . Then
From this, Theorem 4.4 follows immediately by combining Theorem 4.6 with Theorem 4.1.
Their analysis proceeds by bounding the Rademacher complexity of the robust loss class of the convex hull of , which implies the sample complexity (2) can also be achieved by (they propose an alternative, improper, learning rule for computational reasons). But when , the second expression in our (1) would be at most . Thus, following the compression argument as in the proof of Theorem 4.1 would yield the following sample complexity for our improper rule:
In particular, our approach reduces the dependence on from in (2) as obtained by Attias, Kontorovich, and Mansour (2018), to . To do so, our approach does rely on improper learning, and our arguments are not valid for . We do not know whether improperness is required to obtain this improvement, or whether in this case a dependence is possible even with or some other proper learning rule. It follows from the construction of our negative result for proper learning in Theorem 3.1, that at least a factor is sometimes necessary for proper learning (regardless of the VC dimension), whereas our Corollary 4.5 implies that improper learning can achieve a sample complexity that is entirely independent of (albeit with a worse dependence on the VC dimension).
Necessary and Sufficient conditions for Robust Learnability
In the previous section, we saw that having finite VC dimension is sufficient for robust learnability. But a simple construction shows that it is not necessary: consider an infinite domain , the hypothesis class of all possible predictors , and an all-powerful adversary specified by . In this case, the hypothesis minimizing the population robust risk would always be the all-positive or the all-negative hypothesis, and so these are the only two hypothesis we should compete with. And so, even though , a single example suffices to inform the learner of whether to produce the all-positive or all-negative function.
Can we then have a tight characterization of robust learnability? Is there a weaker notion that is both necessary and sufficient for learning? A simple complexity measure one might consider is the maximum number of points such that the entire perturbation sets are shattered by . That is, such that . We denote this as . When are balls around , which is the typical case in metric-based robustness, this can be thought of shattering with a margin in input space. Indeed, for linear predictors and when is a Euclidean ball around , exactly agrees with the fat shattering dimension at scale (or the dimension).
While it is fairly obvious that provides a lower bound on the sample complexity of robust learning, and thus its finiteness is necessary for learning, we construct an example in Appendix D showing that it is not sufficient. Specifically, there are classes where no points can be shattered in this way, and yet the classes are not robustly learnable. Formally,
There exist , , such that but .
We now attempt to refine the above measure, and introduce a weaker notion of robust shattering that that can still be used to lower bound the sample complexity for robust learnability. Given an adversary and a hypothesis class , consider the following notion of -robust shattering,
A sequence is said to be -robustly shattered by if with , and , with , , . The -robust shattering dimension is defined as the largest for which there exist points -robustly shattered by .
We have that , where the first inequality follows since disjoint robust shattering is a special case of robust shattering with , and so is a plausible candidate for a necessary and sufficient dimension of robust learnability. The following theorem (proof provided in appendix D) establishes that the sample complexity of robust learnability is indeed lower bounded by the -robust shattering dimension ,
For any , , and , and .
Based on Corollary 4.2 and Theorem 5.3, for any adversary and any hypothesis class , we have
That is, the VC dimension is sufficient, and the robust shattering dimension is necessary for robust learnability. As discussed at the beginning of the Section, we know the VC dimension is not necessary and there can be an arbitrary large, even infinite, gap in the second inequality. We do not know whether the robust shattering dimension is also sufficient for learning, or whether there can also be a big gap in the first inequality. Establishing a complexity measure that characterizes robust learnability thus remains an open question.
Discussion and Future Directions
Perhaps one of the most interesting takeaways from this work is that we should start considering improper learning algorithms for adversarially robust learning. Even though our improper learning rule might not be practical, our results suggest to consider departing from robust empirical risk minimization and M-estimation (as in almost all published work), and considering improper learning rules such as bagging or other ensemble methods.
Although we settled the question of robust learnability of VC classes, there remains a large gap in the question of what is the optimal sample complexity for robust learning. Can the exponential dependence on in Corollaries 4.2 and 4.5 be improved to a linear dependence? Perhaps this is possible with a new analysis of our learning rule or a different improper learning rule. Since our learning rule and analysis stem from recent progress on compression schemes for VC classes (Moran and Yehudayoff, 2016), it is certainly possible that further progress on the celebrated open problem regarding the existence of compression schemes (Floyd and Warmuth, 1995; Warmuth, 2003) could also assist in progress on adversarially robust learning.
Our results demonstrate that there exist hypothesis classes with large gaps between what can be done with proper vs. improper robust learning. This means that when studying a particular class, such as classes corresponding to neural networks, one should consider the possibility that there might be such a gap and that improper learning might be necessary. It remains open to establish whether such gaps actually exist for specific interesting neural net classes (e.g., functions representable by a specific architecture, possibly with a bounded weight norm).
Throughout the paper we ignored computational considerations. Our learning rule can be viewed as an algorithm with black-box access to , but making order such calls, and additionally requiring order time and space to represent and update the distributions used by the boosting algorithm. Without significantly increasing the sample complexity, is it possible to robustly learn with an algorithm making only a polynomial (in ) number of calls to or even , plus polynomial additional time and space? What about ? This question becomes even more interesting if there is such an algorithm that also only requires sample size , rather than the sufficient for our algorithm. Would another type of oracle be useful? For example, can one devise efficient methods that rely on black-box access to on the dual of the hypothesis class (i.e. finding an example that is correct for the largest number of hypotheses in a given finite set of hypotheses)? More ambitiously, one may ask whether efficient PAC learnability implies efficient robust PAC learnability, roughly translating to asking whether access to any (non-robust) learning rule is sufficient for efficient robust learning.
As a final remark, we note that our results easily extend to the multiclass setting (). In that case, by essentially the same algorithms and proofs, Theorems 4.1 and 4.4 (and Corollaries 4.2 and 4.5) will hold with replaced by the graph dimension (Natarajan, 1989; Ben-David et al., 1995; Daniely et al., 2015). The lower bound in Theorem 5.3 also holds, by the same arguments, but with generalized analogous to the Natarajan dimension (Natarajan, 1989): that is, in the definition of robust shattering, after “and”, we now require s.t. , with , , . We leave as an open question whether one can also express an upper bound controlled by this quantity.
This work is partially funded by NSF-BSF award 1718970 and NSF award 1764032.
References
Appendix A Auxilliary Proofs Related to Proper Robust Learnability
Pick an arbitrary sequence . Consider a uniform weighting over the distributions . Denote by the event that for a distribution that is picked uniformly at random. We will lower bound the expected robust loss of the classifier that rule outputs, namely , given the event ,
We can lower bound the robust loss of the classifier by conditioning on the event that denoted ,
Since , by construction of , we know that there are at least points in where is not robustly correct. We can unroll the expectation over as follows
Appendix B Auxilliary Proofs Related to Realizable Robust Learnability
The following lemma extends the classic compression-based generalization guarantees from the - loss to also hold for the robust loss. It is used in the proof of Theorem 4.1. Generally, it is also possible to extend other generalization guarantees for compression schemes to the robust loss, such as improved bounds for permutation-invariant compression schemes, or convergence guarantees for the agnostic case (as discussed in Section 4.2).
For completeness, we include a brief proof, which merely notes that the classic argument of (Littlestone and Warmuth, 1986; Floyd and Warmuth, 1995) establishing generalization guarantees for sample compression schemes under the - loss remains valid under the robust loss.
For any indices ,
and a union bound over all possible choices of implies a probability at most that there exist with and yet . This is at most for a choice of .
Appendix C Proof of Agnostic Robust Learnability
The argument follows closely a proof of an analogous result by David, Moran, and Yehudayoff (2016) for non-robust learning. Denote by the optimal realizable-case learner achieving sample complexity , and denote , as above.
Then, in the agnostic case, given a data set , we first do robust-ERM to find a maximal-size subsequence of the data where the robust loss can be zero: that is, . Then for any distribution over , there exists a sequence such that has ; this follows since, by definition of , there is a chance that a random draw from yields , so at least one such exists. We use this to define a weak robust-learner for distributions over : i.e., for any , the weak learner chooses as its weak hypothesis.
Now we run the -Boost boosting algorithm (Schapire and Freund, 2012, Section 6.4.2) on data set , but using the robust loss rather than - loss. That is, we start with uniform on .We ignore the possibility of repeats; for our purposes we can just remove any repeats from before this boosting step. Then for each round , we get as a weak robust classifier with respect to , and for each we define a distribution over satisfying
where is a parameter we can set. Following the argument from Schapire and Freund (2012, Section 6.4.2), after rounds we are guaranteed
so we will plan on running until round with value to guarantee
Furthermore, note that, since each is given by , where is an -tuple of points in , the classifier is specified by an ordered sequence of points from . Altogether, is a function specified by an ordered sequence of points from , and which has
Similarly to the realizable case (see the proof of Lemma B.1), uniform convergence guarantees for sample compression schemes (see Graepel, Herbrich, and Shawe-Taylor, 2005) remain valid for the robust loss, by essentially the same argument; the essential argument is the same as in the proof of Lemma B.1 except using Hoeffding’s inequality to get concentration of the empirical robust risks for each fixed index sequence, and then a union bound over the possible index sequnces as before. We omit the details for brevity. In particular, denoting , for , with probability at least ,
Let (supposing the min is realized, for simplicity; else we could take an with very-nearly minimal risk). By Hoeffding’s inequality, with probability at least ,
By the union bound, if , with probability at least ,
Since , the above is at most for an appropriate choice of sample size .
Appendix D Auxilliary Proofs Related to Necessary Conditions for Robust Learnability
Note that by construction we have . Now, consider an arbitrary learning rule . We will assume that always gets the prediction of correct. Let and let be the set of all sequences of size containing at most elements from . Fix an arbitrary sequence . Denote by the sequence of examples induced by the indices sequence . Then,
Since the inequality above holds for any sequence , it follows that
To finish the proof, we need to show that
For this just consider a distribution with mass on and mass on , and another distribution with mass on and mass on . If , with probability at least , we will only observe samples of , and thus learning rule will make a mistake on (which is in ) with probability at least , therefore having error at least . By combining both parts, we arrive at the theorem statement.
For the agnostic case, we briefly describe the construction. The remainder of the proof more or less follows a standard argument, for instance see Anthony and Bartlett (1999, Chapter 5). Let , and fix a sequence -robustly shattered by , and let be as in definition 5.2; in particular, note that any and any necessarily have . For , define distribution as follows, for :
where is appropriately chosen based on and .