On the Power of Differentiable Learning versus PAC and SQ Learning
Emmanuel Abbe, Pritish Kamath, Eran Malach, Colin Sandon, Nathan Srebro
Introduction
A leading paradigm that has become the predominant approach to learning is that of differentiable learning, namely using a parametric function class , and learning by performing mini-batch Stochastic Gradient Descent () updates (using gradients of the loss on a mini-batch of independent samples per iteration) or full-batch Gradient Descent () updates (full gradient descent on the empirical loss, using the same samples in all iterations). Feed-forward neural networks are a particularly popular choice for the parametric model . One approach to understanding differentiable learning is to think of it as a method for minimizing the empirical error of with respect to , i.e. as an empirical risk minimization (). is indeed well understood, and is in a sense a universal learning rule, in that any hypothesis class that is learnable is also learnable using . Furthermore, since poly-sized feed-forward neural networks can represent any poly-time computable function, we can conclude that on neural networks can efficiently learn any tractable problem. But this view of differentiable learning ignores two things.
Firstly, many problems, including on any non-trivial neural network, are highly non-convex and (stochastic) gradient descent might not find the global minimizer. As we just discussed, pretending that or do find the global minimizer would mean we can learn all poly-time computable functions, which is known to be impossibleSubject to mild cryptographic assumptions, such as the existence of one-way functions, i.e. the existence of cryptography itself, and where we are referring to running for polynomially many steps. (e.g. Kearns and Valiant, 1994; Klivans and Sherstov, 2009). In fact, even minimizing the empirical risk on a neural net with two hidden units, and even if we assume data is exactly labeled by such a network, is already NP-hard, and cannot be done efficiently with / (Blum and Rivest, 1992). We already see that and are not the same as , and asking “what can be learned by /” is quite different from asking “what can be learned by ”.
Furthermore, and might also be more powerful than . Consider using a highly overparametrized function class , with many more parameters than the number of training examples, as is often the case in modern deep learning. In such a situation there would typically be many empirical risk minimizers (zero training error solutions), and most of them would generalize horribly, and so the principal on its own is not sufficient for learning (Neyshabur et al., 2015). Yet we now understand how and incorporate intricate implicit bias that leads to particular empirical risk minimizers which might well ensure learning (Soudry et al., 2018; Nacson et al., 2019).
All this justifies studying differentiable learning as a different and distinct paradigm from empirical risk minimization. The question we ask is therefore:
What can be learned by performing mini-batch stochastic gradient descent, or full-batch gradient descent, on some parametric function class , and in particular on a feed-forward neural network?
Answering this question is important not only for understanding the limits of what we could possibly expect from differentiable learning, but even more so in guiding us as to how we should study differentiable learning, and ask questions, e.g., about its power relative to kernel methods (e.g. Yehudai and Shamir, 2019; Allen-Zhu and Li, 2019, 2020; Li et al., 2020; Daniely and Malach, 2020; Ghorbani et al., 2019, 2020; Malach et al., 2021), or the theoretical benefits of different architectural innovations (e.g. Malach and Shalev-Shwartz, 2020).
A significant, and perhaps surprising, advance toward answering this question was recently presented by Abbe and Sandon (2020), who showed that with a single example per iteration (i.e. a minibatch of size ) can simulate any poly-time learning algorithm, and hence is as powerful as learning. On the other hand, they showed training using population gradients (infinite batch size, or even very large batch sizes) and low-precision (polynomial accuracy, i.e. a logarithmic number of bits of precision), is no more powerful than learning with Statistical Queries (), which is known to be strictly less powerful than learning (Kearns, 1998; Blum et al., 2003). This seems to suggest non-stochastic , or even with large batch sizes, is not universal in the same way as single-example . As we will see below, it turns out this negative result depends crucially on the allowed precision, and its relationship to the batch, or sample, size.
In this paper, we take a more refined view of this dichotomy, and consider learning with with larger mini-batch sizes , as is more typically done in practice, as well as with . We ask whether the ability to simulate learning is indeed preserved also with larger mini-batch sizes, or even full batch GD? Does this universality rest on using single examples, or perhaps very small mini-batches, or can we simulate any learning algorithm also without such extreme stochasticity? We discover that this depends on the relationship of the batch size and the precision of the gradient calculations. That is, to understand the power of differentiable learning, we need to also explicitly consider the numeric precision used in the gradient calculations, where is an arbitrary additive error we allow.
We first show that regardless of the mini-batch size, is always able to simulate any method, and so is at least as powerful as learning. When the mini-batch size is large relative to the precision, namely , where is the input dimension and we assume the model size and number of iterations are polynomial in , is not any more powerful than . But when , or in other words with fine enough precision , can again simulate any sample-based learning method, and is as powerful as learning (the number of SGD iterations and size of the model used depend polynomially on the sample complexity of the method being simulated, but the mini-batch size and precision do not, and only need to satisfy —see formal results in Section 3). We show a similar result for , with a dependence on the sample size : with low precision (large ) relative to the sample size , is no more powerful than . But with fine enough precision relative to the sample size, namely when , can again simulate any sample-based learning method based on samples (see formal results in Section 6).
We see then, that with fine enough precision, differentiable learning with any mini-batch size, or even using full-batch gradients (no stochasticity in the updates), is as powerful as any sample-based learning method. The required precision does depend on the mini-batch or sample size, but only linearly. That is, the number of bits of precision required is only logarithmic in the mini-batch or sample sizes. And with a linear (or even super-logarithmic) number of bits of precision (i.e. ), and can simulate arbitrary sample-based methods with any polynomial mini-batch size; this is also the case if we ignore issue of precision and assume exact computation (corresponding to ).
On the other hand, with low precision (high , i.e. only a few bits of precision, which is frequently the case when training deep networks), the mini-batch size plays an important role, and simulating arbitrary sample based methods is provably not possible using , or with with a mini-batch size that is too large, namely . Overall, except for an intermediate regime between and , we can precisely capture the power of .
Computationally Bounded and Unbounded Learning.
Another difference versus the work of Abbe and Sandon is that we discuss both computationally tractable and intractable learning. We show that poly-time and are related, in the sense described above, to and on a poly-sized neural network, whereas computationally unbounded and (i.e. limited only by the number of samples or number of statistical queries, but not runtime) are similarly related to and on an arbitrary differentiable model . In fact, to simulate and , we first construct an arbitrary , and then observe that if the or method is poly-time computable, then the computations within it can be expressed as poly-size circuits, which can in turn be simulated as poly-size sub-networks, allowing us to implement as a neural net.
Answering 𝗦𝗤𝗦𝗤{\mathsf{SQ}}s using Samples.
Our analysis relies on introduction of a variant of learning which we refer to as mini-batch Statistical Queries (, and we similarly introduce a full-batch variant, ). In this variant, which is related to the - model (Yang, 2001, 2005), statistical queries are answered using a mini-batch of samples drawn from the source distribution, up to some precision. We first show that methods can always be simulated by , by constructing a differentiable model where at each step the derivatives with respect to some of the parameters contain the answers to the statistical queries. We then relate to and , based on the relationship between the mini-batch size and precision. In order to simulate using , we develop a novel “sample extraction” that uses mini-batch statistical queries (on independently sampled mini-batches) to extract a single sample drawn from the source distribution. This procedure might be of independent interest, perhaps also in studying privacy, where such an extraction is not desirable. Our study of the relationship of to and , summarized in Section 4, also sheds light on how well the framework captures learning by answering queries using empirical averages on a sample, which is arguably one of the main motivations for the inverse-polynomial tolerance parameter in the SQ framework.
Learning Paradigms
where is a -approximate rounding of the mini-batch (empirical) clipped gradient
Precision, Rounding and Clipping.
Learning with 𝗯𝗦𝗚𝗗𝗯𝗦𝗚𝗗{\mathsf{bSGD}}.
Full-batch Gradient Descent (𝗳𝗯𝗚𝗗𝗳𝗯𝗚𝗗{\mathsf{fbGD}}).
𝗣𝗔𝗖𝗣𝗔𝗖{\mathsf{PAC}} and 𝗦𝗤𝗦𝗤{\mathsf{SQ}} Learning.
Relating Classes of Methods.
That is, means that is at least as powerful as . Observe that for all classes of methods , if and then .
Main Results : 𝗯𝗦𝗚𝗗𝗯𝗦𝗚𝗗{\mathsf{bSGD}} versus 𝗣𝗔𝗖𝗣𝗔𝗖{\mathsf{PAC}} and 𝗦𝗤𝗦𝗤{\mathsf{SQ}}
Our main result, given below as a four-part Theorem, establishes the power of learning relative to (i.e. arbitrary sample based) and learning. As previously discussed, the exact relation depends on the mini-batch size and gradient precision . First, we show that for any mini-batch size , with fine enough precision , can simulate .
For all and , and for all , it holds that
To establish equivalence (when Theorem 1a holds), we also note that is always at least as powerful as (since can be implemented using samples):
For all , and , it holds that
Furthermore, for all poly-time computable activations , it holds that
On the other hand, if the mini-batch size is large relative to the precision, cannot go beyond :
There exists a constant such that for all , for all , , , , , such that , it holds that
Furthermore, for all poly-time computable activations , it holds that
To complete the picture, we also show that regardless of the mini-batch size, i.e. even when cannot simulate , can always, at the very least, simulate any method. This also establishes equivalence to when Theorem 1c holds:
There exists a constant such that for all , for all and all , it holds that
In the above Theorems, the reductions hold with parameters on the left-hand-side (the parameters of the model being reduced to) that are polynomially related to the dimension and the parameters on the right-hand-side. But the mini-batch size and gradient precision play an important role. In Theorem 1a, we may choose and as we wish, as long as they satisfy —they do not need to be chosen based on the parameters of the method, and we can always simulate with any and satisfying . Similarly, in Theorem 1d, we may chose arbitrarily, and can always simulate , although does have to be chosen according to . The reverse reduction of Theorem 1c, establishing the limit of when cannot go beyond , is valid when , if the size of the model and number of SGD iterations are restricted to be polynomial in .
Focusing on the mini-batch size , and allowing all other parameters to be chosen to be polynomially related, Theorems 1a, 1b, 1c and 1d can be informally summarized as:
where the left relationship is tight if and the right relationship is tight if . Equivalently, focusing on the precision and how it depends on the mini-batch size , and allowing all other parameters to be polynomially related, Theorems 1a, 1b, 1c and 1d can be informally summarized as:
For any (poly bounded, possible constant) dependence , and for the activation function in Figure 1, it holds that
Moreover, if , then inclusions and are tight, and if , then inclusions and are tight.
For any (poly bounded, possibly constant) , and from Figure 1:
In Corollaries 1 and 2, for the sake of simplicity, we focused on realizable learning problems, where the minimal loss for each . However, we note that Theorems 1a, 1b, 1c and 1d are more general, as they preserve the performance of learning methods (up to an additive ) on all source distributions . So, a result similar to Corollary 1 could be stated for other forms of learning, such as agnostic learning, weak learning etc.
Activation Functions and Fixed Weights.
The neural net simulations in Theorems 1a and 1d use a specific “stage-wise ramp” piecewise linear activation function with five linear pieces, depicted in Figure 1. A convenient property of this activation function is that it is has a central flat piece, making it easier for us to deal with weight drift due to rounding errors during training, and in particular drift of weights we would rather not change at all. Since any piecewise linear activation function can be simulated with ReLU activation, we could instead use a more familiar ReLU activation. However, the simulation “gadget” would involve weights that we would need fixed during training. That is, if we allow neural networks where some of the weights are fixed while others are trainable, we could use ReLU activation to simulate sample-based methods in Theorem 1a and SQ methods in Theorem 1d. As stated, we restrict ourselves only to neural nets where all edges have trainable weights, for which it is easier to prove the theorems with the specific activation function of Figure 1.
The Mini-Batch Statistical Query Model
En route to proving Theorems 1a, 1b, 1c and 1d, we introduce the model of mini-batch Statistical Queries (). In this model, similar to the standard Statistical Query () learning model, learning is performed through statistical queries. But in , these queries are answered based on an empirical average over a mini-batch of i.i.d. samples from the source distribution. That is, each query is answered with a response s,t,
Note that we allow -dimensional vector “queries”, that is, concurrent scalar queries are answered based on the same mini-batch , drawn independently for each vector query.
The first step of our simulation of and with is to simulate (a variant of) using . But beyond its use as an intermediate model in studying differentiable learning, can also be though of as a realistic way of answering statistical queries. In fact, one of the main justifications for allowing errors in the model, and the demand that the error tolerance be polynomial, is that it is possible to answer statistical queries about the population with tolerance by calculating empirical averages on samples of size . In the model we make this explicit, and indeed answer the queries using such samples. We do also allow additional arbitrary error beyond the sampling error, which we might think of as “precision”. The model can thus be thought of as decomposing the tolerance to a sampling error and an additional arbitrary error . If the arbitrary error indeed captures “precision”, it is reasonable to take it to be exponentially small (corresponding to polynomially many bits of precision), while the sampling error would still be polynomial in a poly-time poly-sample method. Studying the model can reveal to us how well the standard model captures what can be done when most of the error in answering statistical queries is due to the sampling error.
Our model is similar to the honest-SQ model studied by Yang (2001, 2005), who also asked whether answering queries based on empirical averages changes the power of the model. But the two models have some significant differences, which lead to different conclusions, namely: - does not allow for an additional arbitrary error (i.e. it uses in our notation), but an independent mini-batch is used for each single-bit query , whereas allows for concurrent real-valued scalar queries on the same mini-batch. Yang showed that, with a single bit query per mini-batch, and even if , it is not possible to simulate arbitrary sample-based methods, and honest-SQ is strictly weaker than . But we show that once multiple bits can be queried concurrentlyWe do so with polynomially many binary-valued queries, i.e. , and polynomial. It is also possible to encode this into a single real-valued query with polynomially many bits of precision. Once we use real-valued queries, if we do not limit the precision at all, i.e. , and do not worry about processing time, its easy to extract the entire minibatch using exponentially many bits of precision. Theorem 2a shows that polynomially many bits are sufficient for extracting a sample and simulating . the situation is quite different.
In fact, we show that when the arbitrary error is small relative to the sample size (and thus the sampling error), can actually go well beyond learning, and can in fact simulate any sample-based method. That is, does not capture learning using statistical queries answered (to within reasonable precision) using empirical averages:
( to ) For all , for all , and , and for all , it holds for , , that
The main ingredient is a method Sample-Extract (Algorithm 1) that extracts a sample by performing mini-batch statistical queries over independently sampled mini-batches. For ease of notation, let identifying it with and denote as . Sample-Extract operates by sampling the bits of one by one, drawing from the conditional distribution .
To complement the Theorem, we also note that sample-based learning is always at least as powerful as , since is specified based on a sample of size (see Section A.1 for a complete proof):
( to ) For all , and , it holds that
On the other hand, when the the mini-batch size is large relative to the precision (i.e. the arbitrary error is large relative to the sampling error ), is no more powerful than standard :
( to ) There exists a constant such that for all , for all , , , , , such that , it holds that
When , the differences between the empirical and population averages become (with high probability) much smaller than the tolerance , the population statistical query answers are valid responses to queries on the mini-batch, and we can thus simulate using . We do need to make sure this holds uniformly for the parallel scalar queries, and across all rounds—see Section A.3 for a complete proof. ∎
Finally, we show that with any mini-batch size, and enough rounds of querying, we can always simulate any method using :
( to ) There exists a constant such that for all , for all and all , it holds that
To obtain an answer to a statistical query on the population, even if the sample-size per query is small, we can average the responses for the same query over multiple mini-batches (i.e. over multiple rounds). This allows us to reduce the sampling error arbitrarily, and leaves us with only the arbitrary error (the arbitrary errors also get averaged, and since each element in the average is no larger than , the magnitude of this average is also no large than ). See full proofs in Section A.3. ∎
Simulating Mini-Batch Statistical Queries with Differentiable Learning
Instead of working with, and simulating, any method, we consider only alternating methods, denoted , where in each round, only one of the two possible labels is involved in the query. Formally, we say that a (mini-batch) statistical query is a -query for if for all , or equivalently for some . A (analogously, ) method is a (analogously, ) method such that for all odd rounds , is a -query, and at all even rounds , is a -query. As minor extensions of Theorems 2a and 2d (simulation and using methods), we show that these simulations can in-fact be done using alternating queries, thus relating and to . We present the full details in Sections A.1 and A.3 respectively.
( to ) For all , for all , and , then and for all , it holds for , , that
( to ) There exists a constant , such that for all , for all and all , it holds that
We now show how to to simulate a method with , with corresponding mini-batch and precision:
We first show how a single -query can be simulated using a single step of on a specific differentiable model. Given a -query , consider the following model:
With , the model “guesses” the label to be for all examples, and therefore suffers a loss only for examples with the label . Using a simple gradient calculations we get:
Combining Lemma 3a with Lemmas 1 and 2 establishes the first statements (about computationally unbounded learning) of Theorems 1a and 1d; full details in Appendix D.
Implementing the differentiable model as a Neural Network.
The simulation in Lemma 3a, as described above, uses some arbitrary differentiable model , that is defined in terms of the mappings from responses to queries in the method. If the method is computationally bounded, the simulation can also be done using a neural network:
Combining Lemma 3b with Lemmas 1 and 2 establishes the second statements (about computationally bounded learning) of Theorems 1a and 1d; full details in Appendix D.
In order to establish Theorems 1b and 1c we rely on Theorems 2b and 2c and for that purpose note that can be directly implemented using (proof in Appendix D):
( to ) For all , it holds that
Furthermore, for every poly-time computable activation , it holds that
So far we considered learning with mini-batch stochastic gradient descent (), where an independent mini-batch of examples is used at each step. But this stochasticity, and the use of independent fresh samples for each gradient step, is not crucial for simulating and , provided enough samples overall, and a correspondingly fine enough precision. We show that analogous results hold for learning with full-batch Gradient Descent (), i.e. gradient descent on the (fixed) empirical loss.
For all and and for all , it holds that
For all , and , it holds that
Furthermore, for all poly-time computable activations , it holds that
There exists a constant such that for all , for all , , , , , such that , it holds that
Furthermore, for all poly-time computable activations , it holds that
There exists a constant such that for all , for all , it holds for such that , that
The above theorems are analogous to Theorems 1a, 1b, 1c and 1d. They are proved in an analogous manner in Appendix E, by going through the intermediate model of fixed-batch statistical query , in place of . An method is described identically to an method, except that the responses for all queries are obtained using the same batch of samples in all rounds (i.e. for all , where in Equation 8). Simulating methods using , or can be done using the exact same constructions as in Lemmas 3a and 3b. To establish Theorem 3a, we use an algorithm similar to (and simpler than) Algorithm 1 to extract all the samples batch of samples (see details in Lemma 5a in Section A.2). Relating to and establishing Theorems 3c and 3d requires more care, because of the adaptive nature of on the full-batch. Instead, we consider all possible queries the method might make, based on previous responses. Since we have at most or bits of response to choose a new query based on, we need to take a union bound over a number of queries exponential in this quantity, which results in the sample sized required to ensure validity scaling linear in . See Section A.4 for complete proofs and details.
and .
But a significant difference versus is that with the precision depends (even if only polynomially) on the total number of samples used by the method. This is in contrast to , where the precision only has to be related to the mini-batch size used, and with constant precision (and constant mini-batch size), we could simulate any sample based based method, regardless of the number of samples used by the method (only the number of SGD iterations and the size of the model increase with the number of samples used). Viewed differently, consider what can be done with some fixed precision (that is not allowed to depend on the problem size or sample size ): methods that use up to samples can be simulated even with . But allows us to simulate methods that use even more samples, by keeping the mini-batch size below .
Perhaps the most realistic differentiable learning approach is to use a fixed training set , and then at each iteration calculate a gradient estimate based on a mini-batch chosen at random, with replacement, from within the training set (as opposed to using fresh samples from the population distribution, as in ). Analogs of Theorems 1a and 1d and Theorem 3c should hold also for this hybrid class, but we do not provide details here.
Summary and Discussion
We provided an almost tight characterization of the learning power of mini-batch SGD, relating it to the well-studied learning paradigms and , and thus (nearly) settling the question of “what can be learned using mini-batch SGD?”. That single-sample SGD is able to simulate learning was previously known, but we extended this result considerably, studied its limit, and showed that even outside this limit, can still always simulate . A gap still remains, when the mini-batch size is between and , where we do not know where sits between and . We furthermore showed that with sufficient (polynomial) precision, even full Gradient Descent on an empirical loss can simulate learning.
It is tempting to view our results, which show the theoretical power of differentiable learning, as explaining the success of this paradigm. But we do not think that modern deep learning behaves similar to the constructions in our work. While we show how any or algorithm can be simulated, this requires a very carefully constructed network, with an extremely particular initialization, which doesn’t look anything like deep learning in current practice. Our result certainly does not imply that SGD on a particular neural net can learn anything learnable by or , as this would imply that such network can learn any computationally tractable functionObserve that for any tractable function , there exists a trivial learning algorithm that returns regardless of its input, which means that the class is learnable., which is known to be impossible (subject to mild cryptographic assumptions).
Rather, we view our work as guiding us as to what questions we should ask toward understanding how actual deep learning works. We see that understanding differentiable learning in such a broad generality as we did here is probably too strong, as it results in answers involving unrealistic initialization, and no restriction, and thus no insight, as to what makes learning problems learnable using deep learning. Can we define a class of neural networks, or initializations, which is broad enough to capture the power of deep learning, yet disallows such crazy initialization and does provide insight as to when deep learning is appropriate? Perhaps even mild restrictions on the initialization can already severely restrict the power of differentiable learning. E.g., Malach et al. (2021) recently showed that even just requiring that the output of the network at initialization is close to zero can significantly change the power of differentiable learning, Abbe et al. (2021) showed that imposing certain additional regularity assumptions on the architecture/initialization of neural networks restricts the learning power of (S)GD to function classes with a certain hierarchical property. An interesting direction for future work is understanding the power of differentiable learning under these, or other, restrictions. Does this lead to a different class of learnable problems, distinct from and , which is perhaps more related to deep learning in practice?
This work was done as part of the NSF-Simons Sponsored Collaboration on the Theoretical Foundations of Deep Learning. Part of this work was done while PK was at TTIC, and while NS was visiting EPFL. PK and NS were supported by NSF BIGDATA award 1546500 and NSF CCF/IIS award 1764032.
References
In this section, we prove Theorems 2a, 2b, 2c and 2d. Additionally, we state and prove analogous statements relating to and .
For all , satisfying , we first design a algorithm Sample-Extract (Algorithm 1) that generates a single sample ; technically, this algorithm runs in at most expected number of steps, but as we will see this is sufficient to complete the proof. For ease of notation, we let and we identify with and denote as . Sample-Extract operates by sampling the bits of one by one, drawing from the conditional distribution . We show two things: (i) Once the algorithm is at a prefix , the algorithm indeed returns a sample drawn from the conditional distribution , and (ii) The algorithm returns a sample in expected number of steps.
Thus, the expected number of steps before we get at least one sample starting with is at most . Also, . So, for and (that is, the probabilities that a sample from starts with and respectively), the expected number of steps remaining in the algorithm is at most
as claimed. Next, we show that if the algorithm currently has a prefix and , then the expected number of steps remaining is at most . We again prove this with a reverse induction on . The base case of is trivial. With , the probability that a batch of samples has at least one sample starting with prefix is at least . So, the expected remaining number of steps before the algorithm terminates is at most
as desired. That completes the induction argument. The algorithm starts with , which every sample will start with, so the expected number of steps before the algorithm terminates is at most .
This is immediate, since a method can generate valid responses using samples for each of the rounds by simply computing the empirical averages per batch. The number of random bits used remains unchanged. ∎
Finally we show that with a slight modification, Sample-Extract can be implemented as a algorithm, thereby proving Lemma 1, restated below for convenience.
Since , all queries of Sample-Extract are already of the form for . It can also be implemented as a algorithm as follows: After the first query we fix . If , we use only even rounds to perform the queries as done by Sample-Extract and when , we use only odd rounds. This increases the total number of rounds by a factor of . ∎
A.2 𝗳𝗯𝗦𝗤𝗳𝗯𝗦𝗤{{\mathsf{fbSQ}}} versus 𝗣𝗔𝗖𝗣𝗔𝗖{\mathsf{PAC}}
We show the analogs of Theorems 2a and 2b for .
( to ) For all , and and for all , it holds that
Starting with the prefix (empty string) and knowledge of , we can recover all samples using at most s, after which we can simply simulate the method. Note that unlike the reduction to , here the algorithm always succeeds in extracting samples in steps. Hence there is no loss in the error ensured. ∎
( to ) For all , and , it holds that
This is immediate, since a method can generate valid responses using samples for each of the rounds by simply computing the empirical averages over the entire batch of samples. The number of random bits used remains unchanged. ∎
Finally, we show that with a slight modification, in the same regime of Lemma 5a, any method can be simulated by a method, analogous to Lemma 1.
( to ) For all , and , and for all , it holds that
By modifying proof of Lemma 5a, analogous to the modification to proof of Theorem 2a to get Lemma 1. ∎
A.3 𝗯𝗦𝗤𝗯𝗦𝗤{{\mathsf{bSQ}}} versus 𝗦𝗤𝗦𝗤{\mathsf{SQ}}
Fix a method , and consider any query . Using Chernoff-Hoeffding’s bound and a union bound over entries, we have that
Finally we show that any method can be simulated by a method thereby proving Lemma 2, restated below for convenience. The proof goes via an intermediate method (defined analogous to ).
Finally, we use essentially the same argument as in Theorem 2d to obtain a method from . The only change needed to preserve the alternating nature of is that we perform all the -queries in odd rounds, interleaved with -queries in even rounds. This completes the proof. ∎
A.4 𝗳𝗯𝗦𝗤𝗳𝗯𝗦𝗤{{\mathsf{fbSQ}}} versus 𝗦𝗤𝗦𝗤{\mathsf{SQ}}
We show the analogs of Theorems 2c and 2d for . The number of samples required depends linearly on the number of queries, instead of logarithmically. The reason for this is that unlike in the proof of Theorems 2c and 2d, a naive union bound does not suffice, since the queries can be adaptive.
( to ) There exist a constant such that for all , for all such that , it holds that
Using Chernoff-Hoeffding’s bound (Equation 10) and a union bound over all these possible queries we have that with probability at least over sampling , it holds for each such query that
( to ) There exist a constant such that for all , , it holds for and all such that that
Finally, we show that with a slight modification, in the same regime of Lemma 5d, any method can be simulated by a method, analogous to Lemma 2.
( to ) There exist a constant such that for all , , it holds for and all such that that
By modifying proof of Lemma 5d, analogous to the modification to proof of Theorem 2d to get Lemma 2. ∎
Appendix B Simulating 𝗯𝗦𝗤𝗯𝗦𝗤{{\mathsf{bSQ}}} with 𝗯𝗦𝗚𝗗𝗯𝗦𝗚𝗗{\mathsf{bSGD}} : Proof of Lemma 3a
In this section, we show how to simulate any method as on some differentiable model constructed according to , and thus prove Lemma 3a:
As a first step towards showing Lemma 3a, we show how a single -query can be simulated using a single step of . We consider parameterized queries, that can depend on some of parameters of the differentiable model. Namely, is a query that given some parameters , an input and a label , returns some vector value . We show the following:
,
Assume is a -query, namely . Then, we define a differentiable model as follows:
Then, after performing one step of we have:
And therefore, after one step of we have .
Assume is a -query, namely . Then, we define a differentiable model as follows:
Then, after performing one step of we have:
And therefore, after one step of we have .∎
Our goal is to use Lemma 8 to simulate a method. Any method is completely described by a sequence of (potentially adaptive) queries , and a predictor which depends on the answer to previous queries, namely:
depends on random bits, and on the answers of the previous queries, namely:
For every compact set and open set such that , there exists a smooth function such that for every and for every .
Our differentiable model will use the following parameter:
“clock” parameters , that indicate which query should be issued next. We initialize .
We denote by the value of the -th set of parameters in the -th iteration of SGD. The differentiable model is defined as follows:
Now, denote , and for every denote . We have the following claim:
Claim: for every iteration of ,
For every we have and .
For we have .
For we have .
For , notice that by the initialization, for every . Fix some , and note that , so the gradient w.r.t , is zero, and so condition 1 hold (the initialization is zero, and the gradient is zero). For , notice that since , we have:
and by applying Lemma 8 with we get:
and so condition 4 follows. Finally, condition 3 is vacuously true.
Fix some , and assume the claim holds for . We will prove the claim for . By the assumption, we have for every and for every . Therefore, by definition of , we have . So,
Therefore, conditions 1 and 3 follow from the fact that the gradient with respect to and , for every , is zero. Now, using Lemma 8 with , condition 2 follows, and we also have . Finally, for every , by the assumption we have , and since the gradient with respect to is zero, we also have . Therefore, condition 4 follows.
Finally, to prove the Theorem, observe that by the previous claim, for every :
So, is a valid response for the -th query.
By the previous claim, we have for every . Therefore, we have:
and, using the fact that are valid responses to the method’s queries, we get the required. ∎
B.1 From Arbitrary Differentiable Models to Neural Networks.
In this section we proved the key lemma for our main results, showing that alternating batch-SQ methods can be simulated by gradient descent over arbitrary differentiable models. We would furthermore like to show that if the alternative batch-SQ method is computationally bounded, the differentiable model we defined can be implemented as a neural network of bounded size.
Indeed, observe that when the method can be implemented using a Turing-machine, each query (denoted by in the proof) can be simulated by a Boolean circuit [see Arora and Barak, 2009], and hence by a neural network with some fixed weights. Therefore, one can show with little extra effort that the differentiable model introduced in the proof of Lemma 3a can be written as a neural network, with some of the weights being fixed. To show that the same behavior is guaranteed even when all the weights are trained, it is enough to show that all the relevant weights (e.g., ) have zero gradient, unless they are correctly updated. This can be achieved using the “clock” mechanism (the function in the construction), which in turn can be implemented by a neural network that is robust to small perturbations of its weights, and hence does not suffer from unwanted updates of gradient descent. One possible way to implement the clock mechanism using a neural network that is robust to small perturbations is to rely either on large weight magnitudes and small step-sizes, or on the clipping of large gradients.
We do not include these details, Instead, in the next Section, we provide complete details and a rigorous proof of an alternate, more direct, construction of a neural network defining a differentiable model that simulates a given method. This direct neural-network construction is based on the same ideas, but is different in implementation from the construction shown in this section, involving some technical details to ensure that the network is well behaved under the gradient descent updates.
In this section, we show a direct construction of a neural network such that gradient descent on the neural net simulates a given method, thus proving Lemma 3b:
Given a algorithm with a specified bounded runtime, we will design a neural network such that the mini-batch gradients at each step correspond to responses to queries of the algorithm. Our proof of this is based on the fact that any efficient algorithm must decide what query to make next and what to output based on some efficient computation performed on random bits and the results of previous queries. Any efficient algorithm can be performed by a neural net, and it is possible to encode any circuit as a neural net of comparable size in which every vertex is always at a flat part of the activation function. Doing that would ensure that none of the edge weights ever change, and thus that the net would continue computing the desired function indefinitely. So, that allows us to give our net a subgraph that performs arbitrary efficient computations on the net’s inputs and on activations of other vertices.
Also, we can rewrite any algorithm to only perform binary queries by taking all of the queries it was going to perform, and querying the th bit of their binary representation for all sufficiently small instead. For each of the resulting binary queries, we will have a corresponding vertex with an edge going to it from the constant vertex and no other edges going to it. So, the computation subgraph of the net will be able to determine the current weights of the edges leading to the query vertices by checking their activations. Also, each query vertex will have paths from it to the output vertex with intermediate vertices that will either get inputs in the flat parts of their activation function or not depending on the output of some vertices in the computation subgraph. The net effect of this will be to allow the computation subgraph to either make the value encoded by the query edge stay the same or make it increase if the net’s output differs from the sample output based on any efficiently computable function of the inputs and other query vertices’ activations. This allows us to encode an arbitrary algorithm as a neural net.
In order to prove the capabilities of a neural net trained by batch stochastic gradient descent, we will start by proving that any algorithm in can be emulated by a neural net trained by batch stochastic gradient descent under appropriate parameters. In this section our net will use an activation function , as defined in Figure 1, namely
Any algorithm repeatedly makes a query and then computes what query to perform next from the results of the previous queries. So, our neural net will have a component designed so that we can make it update targeted edge weights by an amount proportional to the value of an appropriate query on the current batch and a component designed to allow us to perform computations on these edge weights. We will start by proving that we can make the latter component work correctly. More formally, we assert the following.
Let be a function that can be computed by a circuit made of AND, OR, and NOT gates with a total of gates. Also, consider a neural net with inputNote that these will not be the data input of the general neural net that is being built; these input vertices take both the data inputs and some inputs from the memory component. vertices , and choose real numbers for each . It is possible to add a set of at most new vertices to the net, including output vertices , along with edges leading to them such that for any possible addition of edges leading from the new vertices to old vertices, if the net is trained by bSGD, the output of is either less than or more than for every in every timestep, then the following hold:
The derivative of the loss function with respect to the weight of each edge leading to a new vertex is in every timestep, and no paths through the new vertices contribute to the derivative of the loss function with respect to edges leading to the .
In any given time step, if the output of encodes with values less than and values greater than representing and respectively for each , then the output of encodes for each with and encoding and respectively.
In order to do this, we will add one new vertex for each gate and each input in a circuit that computes . When the new vertices are used to compute , we want each vertex to output if the corresponding gate or input outputs a and if the corresponding gate or input outputs a , and we want the derivative of its activation with respect to its input to be . In order to do that, we need the vertex to receive an input of more than if the corresponding gate outputs a and an input of less than if the corresponding gate outputs a .
In order to make one new vertex compute the NOT of another new vertex, it suffices to have an edge of weight to the vertex computing the NOT and no other edges to that vertex. We can compute an AND of two new vertices by having a vertex with two edges of weight from these vertices and an edge of weight from the constant vertex. Similarly, we can compute an OR of two new vertices by having a vertex with two edges of weight from these vertices and an edge of weight from the constant vertex. For each , in order to make a new vertex corresponding to the th input, we add a vertex and give it an edge of weight from the associated and an edge of weight from the constant vertex. These provide an overall input of at least to the new vertex if has an output greater than and an input of at most if has an output less than .
This ensures that if the outputs of the encode binary values appropriately, then each of the new vertices will output the value corresponding to the output of the appropriate gate or input. So, these vertices compute correctly. Furthermore, since the input to each of these vertices is outside of $v^{\prime}_{i}$. ∎
Our next order of business is to show that we can perform queries successfully. So, we define the query subgraph as follows:
Given , let be the weighted directed graph with vertices , , , , , , , and for and the following edges:
An edge of weight from to
Edges of weight from to and , and from and to .
An edge of weight from to .
An edge of weight from to .
An edge of weight from to .
An edge of weight from to .
An edge of weight from to for each .
An edge of weight from to for each .
An edge of weight from to for each .
Also, let be the graph that is exactly like except that in it the edge from to has a weight of .
The idea behind this construction is as follows. will be the constant vertex, and will be the output vertex. If has activation then will have activation and will have activation , leaving with activation . So, this subgraph will have no effect on the output and the derivative of the loss with respect to any of its edge weights will be . However, if has activation then this subgraph will contribute to the net’s output, and the weights of the edges will change. So, when we do not want to use this subgraph to perform a query we simply set to . In a timestep where we do want to use it to perform a query, we set to or based on the query’s value on the current input so that the weight of the edge from to will change based on the value of the query. The activations of the will always give a binary representation of the activation of . So, we can read off the current weight of the edge from to . This construction works in the following sense.
Let be an integer greater than , and . Next, let be a neural net such that contains or as a subgraph with as the constant vertex and as ’s output vertex, and there are no edges from vertices outside this subgraph to vertices in the subgraph other than and . Now, assume that this neural net is trained using bSGD with learning rate and loss function for time steps, and the following hold:
outputs or on every sample in every time step.
There is at most one timestep in which the net has a sample on which outputs . On any such sample, the output of the net is if the subgraph is and if the subgraph is .
The derivatives of the loss function with respect to the weights of all edges leaving this subgraph are always .
The edge from to makes no contribution to on any sample where is , a contribution of exactly on any sample where is if the subgraph is , and a contribution of exactly on any sample where is if the subgraph is . Also, if we regard an output of as representing the digit and an output of as representing the digit then the binary string formed by concatenating the outputs of ,…, is within of the number of samples in previous steps where output and the net’s output did not match the sample output divided by plus double the total number of samples in previous steps where output divided by .
First, let let be the timestep on which there is a sample with outputting if any, and otherwise. We claim that none of the weights of edges in this subgraph change on any timestep except step , and prove it by induction on . First, observe that by the definition of , given any sample the net receives on a timestep before , has an output of . So, on any such sample and will output and respectively, which results in having an input of and output of , and thus in both the derivative of with respect to the weight of the edge from to and the derivative of with respect to the input of being . So, the derivative of the loss with respect to any of the edge weights in this component is on all samples received before step .
During step , for any sample on which has an output of , , , and all have output . That results in having an output of . So, the derivative of the loss with respect to the weight of the edge from to is if the net’s output agrees with the sample output and otherwise. That means that the weight of the edge from to increases by times the number of samples in this step for which had output and the net’s output disagreed with the sample output plus times the total number of samples in this step for which had an output of plus an error term of size at most . Meanwhile, all of the other edges in the subgraph change by at most , and the weights of the edges from and to are left with weights within of each other because the derivatives of the gradients with respect to their weights are the same by symmetry, so only the error term differentiates them. The weights of the edges from do not change because the samples for which this subgraph’s gradient is nonzero all have outputting and thus making their weights irrelevant.
On any step after step , gives an output of on every sample. The weights of the edges from to and have absolute value of at most , so the edges from still provide enough input to them to ensure that they output and respectively. That means that the input to is within of , and thus that outputs . That in turn means that the derivative of the loss with respect to any of the edge weights in the subgraph are so their weights do not change. All of this combined shows that the edge weights only ever change in step as desired.
Now, define even such that the weight of the edge from to increased by in step . We know that is within of the fraction of samples in step for which output and the net’s output did not match the sample output plus times the overall fraction of samples in step for which output . The output of is until step and after step . Also, let . Now, pick some and let be the output of on step . In order to prove that the will be a binary encoding of we induct on . So, assume that ,…, encode the correct binary digits. Then the input to is
If the digit of ’s binary representation is this will be at least while if it is it will be at most , so will output if the digit is and if it is as desired. Showing that they all output before step is just the case of this.
Finally, recall that on every sample received after step , will output , will output , and thus the edge from to will provide no input to . During or before step , the edges in this subgraph will all still have their original weights. So, if outputs then outputs and makes no contribution to , while if outputs then outputs and makes a contribution of magnitude and the appropriate sign to , as desired. ∎
At this point, we claim that we can build a neural net that emulates any algorithm using the same value of and an error of , provided . In order to do that, we will structure our net as follows. First of all, we will have copies of and . Then, we build a computation component that takes input from all the copies of the and computes from them what to output in the next step, what to query next, and what values those queries take on the current input. This component is built never to change as explained in Lemma 10. We will use a loss function of and learning rate of when we train this net.
The net will also have primary output control vertices, secondary output control vertices, and final output control vertex. Each of these will have edges of weight from two different outputs of the computation component and an edge of weight from the constant vertex. That way, the computation component will be able to control whether each of these vertices outputs , , or . Each primary output control vertex will have an edge of weight to the output, each secondary output control vertex will have an edge of weight to the output, and the final output control vertex will have an edge of weight to the output. Our plan is to set a new group of output control vertices to nonzero values in each timestep and to use it to control the net’s output.
Each copy of will have an edge of weight from an output of the computation component and an edge of weight from the constant vertex so the computation component will be able to control if it outputs or . That allows the computation component to query an arbitrary function to that is whenever the sample output takes on the wrong value by setting to on every input for which the function is potentially nonzero and on every input on which it is regardless of the sample output. Then the computation component can use a primary output control vertex to provide a value of to the output and use a set of secondary output control vertices to cancel out the effects of the copies of and on the output.
A little more precisely, we will have one primary output control vertex, secondary output control vertices, and copies of and associated with each time step. Then, in that step it will determine what queries the algorithm it is emulating would have made, and use the copies of and to query the first digits of each of them and the constant function . In order to determine the details of this, it will consider the current time step as being the first step for which the component querying the constant function still gives an output of and consider each prior query performed by the algorithm as having given an output equal to the sum over of times the value given by the copy of or used to query its th bit. For any given input/output pair the actual value of the query will be within of the value given by its first binary digits. Also, if the conditions of Lemma 11 are satisfied then the value derived from the outputs of the and will be within of the average of the values of the first bits of the queried function on the batch. So, the values used by the computation component will be within of the average values of the queried functions on the appropriate batches, as desired. Also, any component that was ever used to query the function will always return a nonzero value, so the computation component will be able to track the current timestep correctly.
We claim that in every timestep the net will output or as determined by the computation component, the query subgraphs will update so that the computation component can read the results of the desired queries from them, and none of the edges will change in weight except the appropriate edges in copies of or and possibly weights of edges from the output control vertices used in this timestep to the output, and we can prove this by induction on the timesteps.
So, assume that this has held so far. In the current timestep all of the output control vertices except those designated for this timestep are set to , and the ones designated for this timestep are set to the value chosen by the computation component. The weights of the edges from the current output control vertices still have their original values because the only way they could not is if they had been set to nonzero values before. The edges from the other output control vertices to the output have no effect on its value so the primary output control vertices as a whole make a contribution of as chosen by the computation component to the output. Meanwhile, there at most copies of or that have set to for any sample, so the computation component can compute the contribution they make to the output and use the secondary output control vertices for the timestep to cancel it out. So, the input to the output vertex will be exactly what we wanted it to be, which means that the copies of and will update in the manner given by Lemma 11. That in turn means that the query subgraphs will update in the desired manner and the computation component will be able to determine valid values for the queries the algorithm would have made. None of the edges in or to the computation component will change by Lemma 10, and none of the edges from the computation component to any of the copies of or any output control vertices will change because they are always at flat parts of their activation functions. So, the net behaves as described. That means that the net continues to be able to make queries, perform arbitrary efficient computations on the results of those queries, and output the result of an arbitrary efficient computation.
Once it is done training the compuation component can use the final output control vertex to make the net output or based on the current input and the valuesof the previous queries. This process takes steps to run, and uses a polynomial number of query subgraphs per step. Any Turing machine can be converted into a circuit with size polynomial in the number of steps it runs for, so this can all be done by a net of size polynomial in the parameters. ∎
Before proving Theorems 1a, 1b, 1c and 1d, we first prove Lemma 4, restated below for convenience.
Using the tools developed in Sections 4 and 5 we now prove Theorems 1a, 1b, 1c and 1d. We only show the proofs for the computationally unbounded case, as a near identical derivation achieves the required results for the computationally bounded case, since all relevant Theorems/Lemmas have both versions (except Lemmas 3a and 3b which are stated as different lemmas).
From Lemma 1, we have that for all and , and , and , it holds that
From Lemma 3a (correspondingly Lemma 3b for the computationally bounded case), we then have that for , , , it holds that
The proof is complete by combining the above. ∎
Any algorithm can be simulated by a algorithm with samples, since samples are required to perform one iteration. Moreover, there is no loss in the error ensured by this simulation. ∎
From Lemma 4 it holds for all and , that
And by Theorem 2c, there exists a constant such that for and it holds for all such that that
The proof is complete by combining the above. ∎
From Lemma 2, it holds for all , , and that
Finally, from Lemma 3a (correspondingly Lemma 3b for the computationally bounded case) we have that for , and that
The proof is complete by combining the above. ∎
Before proving Theorems 3a, 3b, 3c and 3d, we state the analogs of Lemmas 3a, 3b and 4 relating and () (the proofs follow in an identical manner, so we skip it).
( to ) For all , it holds that
Finally, we put together all the tools developed in Sections 4 and 5 along with the above Lemmas to prove Theorems 3a, 3b, 3c and 3d. As in Appendix D, we only show the proofs for the computationally unbounded case, as a near identical derivation achieves the required results for the computationally bounded case.
From Lemma 6, we have that for all , and , it holds for , , that
From Lemma 12a (correspondingly Lemma 12b for the computationally bounded case), we then have that for , , , it holds that
The proof is complete by combining the above. ∎
Any algorithm can be simulated by a algorithm with samples. Moreover, there is no loss in the error ensured by this simulation. ∎
From Lemma 13 it holds for all and , that
And by Lemma 5c, there exists a constant such that for and it holds for all such that that
The proof is complete by combining the above. ∎
From Lemma 7, there exists a constant such that for all , satisfying it holds for and that
Finally, from Lemma 12a (correspondingly Lemma 12b for the computationally bounded case) we have that for , and that
The proof is complete by combining the above. ∎