On Exact Computation with an Infinitely Wide Neural Net
Sanjeev Arora, Simon S. Du, Wei Hu, Zhiyuan Li, Ruslan Salakhutdinov, Ruosong Wang
Introduction
How well does a classic deep net architecture like AlexNet or VGG19 perform on a standard dataset such as CIFAR-10 when its “width”— namely, number of channels in convolutional layers, and number of nodes in fully-connected internal layers — is allowed to increase to infinity? Questions about these “infinite limits” of deep nets have naturally emerged in the ongoing effort to understand the power of deep learning. In mathematics it is often easier to study objects in the infinite limit. Furthermore, the infinite limit could conceivably make sense in deep learning, since over-parametrization seems to help optimization a lot and doesn’t hurt generalization much (Zhang et al., 2017): deep neural nets with millions of parameters work well even for datasets with k training examples. So why not imagine nets whose width goes to infinity?
Allowing width to go to infinity also connects deep learning in an interesting way with other areas of machine learning. A single hidden-layer neural network with i.i.d. random parameters, in the limit of infinite width, is a function drawn from a Gaussian process (GP) (Neal, 1996). This model as well as analogous ones with multiple layers (Lee et al., 2018; Matthews et al., 2018), convolutional filters (Novak et al., 2019; Garriga-Alonso et al., 2019) and other architectures (Yang, 2019) make up the GP view of deep learning. These correspond to infinitely wide deep nets whose all parameters are chosen randomly (with careful scaling), and only the top (classification) layer is optimized.
From now on we will use weakly-trained nets to refer to nets whose layers receive random initialization and only the top layer is trained by gradient descent. We use fully-trained to refer to nets whose all parameters are trained by gradient descent. It has long been known that weakly-trained convolutional nets have reasonable performance on MNIST and CIFAR-10. Weakly-trained nets that are fully-connected instead of convolutional, can also be thought of as “multi-layer random kitchen sinks,” which also have a long history.
where are two inputs. This kernel method makes sense when the width goes to infinity.
The objects of interest in this paper are not weakly-trained nets, but fully-trained nets. In the finite case, analysis of optimization and generalization of fully-trained nets is of course an open problem. One may also ask:
Can we understand the power of fully-trained nets whose width goes to infinity?
A priori this question doesn’t seem any easier than the finite case, and empirical evaluation seems computationally infeasible due to the infinite limit. They also do not correspond to a kernel method in any obvious way.
Recent papers suggest that neural nets whose width greatly exceeds the number of training data points can rapidly reduce training error to via gradient descent, and under some conditions, the trained net also exhibits good generalization (Du et al., 2019, 2018b; Li and Liang, 2018; Allen-Zhu et al., 2018a, b; Zou et al., 2018; Arora et al., 2019; Cao and Gu, 2019). Extra-wideness plays a crucial role in the proof: it is shown that as width increases, training causes increasingly smaller changes (in a proportionate sense) in the parameters. This raises the possibility that as one increases the width to infinity, a certain limiting behavior can emerge even in the fully-trained net. A recent paper by Jacot et al. (2018) isolated a notion implicit in the above papers, which they called the Neural Tangent Kernel (NTK). They suggested — via a proof that is slightly heuristic — that this fixed kernel characterizes the behavior of fully-connected infinite width neural networks whose layers have been trained by gradient descent. The NTK is different from the Gaussian process kernels discussed earlier, and is defined using the gradient of the output of the randomly initialized net with respect to its parameters, i.e.,
Here, the gradient appears from considering gradient descent, as will be explained in Section 3. One may also generalize the NTK to convolutional neural nets, and we call the corresponding kernel Convolutional Neural Tangent Kernel (CNTK).
Though NTK and CNTK are defined by an infinite limit, a recent paper (Lee et al., 2019) attempted to understand their properties via a finite approximation of the infinite limit kernel by Monte Carlo methods. However, as will be shown in Section B, using random features generated from practically sized nets can degrade the performance a lot. It was still open what is the full power of exact CNTK on modern datasets. This is a challenging question especially for CNTK with pooling operations, since when convolution with pooling is involved, it was believed that exact computation of kernels (for either convolutional Gaussian process kernel or CNTK) is infeasible for large datasets like CIFAR-10 (Novak et al., 2019).
Furthermore, we give a more rigorous, non-asymptotic proof that the NTK captures the behavior of a fully-trained wide neural net under weaker condition than previous proofs. We also experimentally show that the random feature methods for approximating CNTK in earlier work do not compute good approximations, which is clear from their much worse performance on CIFAR.
1 Notation
Related Work
From a Gaussian process (GP) viewpoint, the correspondence between infinite neural networks and kernel machines was first noted by Neal (1996). Follow-up work extended this correspondence to more general shallow neural networks (Williams, 1997; Roux and Bengio, 2007; Hazan and Jaakkola, 2015). More recently, this was extended to deep and convolutional neural networks (Lee et al., 2018; Matthews et al., 2018; Novak et al., 2019; Garriga-Alonso et al., 2019) and a variety of other architectures (Yang, 2019). However, these kernels, as we discussed in Section 1, represent weakly-trained nets, instead of fully-trained nets.
Beyond GPs, the connection between neural networks and kernels is also studied in the compositional kernel literature. Cho and Saul (2009) derived a closed-form kernel formula for rectified polynomial activations, which include ReLU as a special case. Daniely et al. (2016) proposed a general framework to transform a neural network to a compositional kernel and later Daniely (2017) showed for sufficiently wide neural networks, stochastic gradient descent can learn functions that lie in the corresponding reproducing kernel Hilbert space. However, the kernels studied in these works still correspond to weakly-trained neural networks.
This paper is inspired by a line of recent work on over-parameterized neural networks (Du et al., 2019, 2018b; Du and Hu, 2019; Li and Liang, 2018; Allen-Zhu et al., 2018b, a; Zou et al., 2018; Cao and Gu, 2019). These papers established that for (convolutional) neural networks with large but finite width, (stochastic) gradient descent can achieve zero training error. A key component in these papers is showing that the weight matrix at each layer is close to its initialization. This observation implies that the kernel defined in Equation (2) is still close to its initialization. Arora et al. (2019) explicitly used this observation to derive generalization bounds for two-layer over-parameterized neural networks. Chizat and Bach (2018) argued that these results in the kernel regime may be too simple to be able to explain the success of deep learning, while on the other hand, out results show that CNTK is at least able to perform well on tasks like CIFAR-10 classification. Also see the survey Fan et al. (2019) for recent advance in deep learning theory.
Jacot et al. (2018) derived the exact same kernel from kernel gradient descent. They showed that if the number of neurons per layer goes to infinity in a sequential order, then the kernel remains unchanged for a finite training time. They termed the derived kernel Neural Tangent Kernel (NTK). We follow the same naming convention and name its convolutional extension Convolutional Neural Tangent Kernel (CNTK). Later, Yang (2019) derived a formula of CNTK as well as a mechanistic way to derive NTK for different architectures. Comparing with (Yang, 2019), our CNTK formula has a more explicit convolutional structure and results in an efficient GPU-friendly computation method. Recently, Lee et al. (2019) tried to empirically verify the theory in (Jacot et al., 2018) by studying the linearization of neural nets. They observed that in the first few iterations, the linearization is close to the actual neural net. However, as will be shown in Section B, such linearization can decrease the classification accuracy by even on a “CIFAR-2" (airplane V.S. car) dataset. Therefore, exact kernel evaluation is important to study the power of NTK and CNTK.
Neural Tangent Kernel
Note that the above dynamics is identical to the dynamics of kernel regression under gradient flow, for which at time the final prediction function is (assuming )
In Theorem 3.2, we rigorously prove that a fully-trained sufficiently wide ReLU neural network is equivalent to the kernel regression predictor (5) on any given data point.
To give the formula of NTK, we also need to define a derivative covariance:
The final NTK expression for the fully-connected neural network is
where we let for convenience. We refer readers to Section D for the derivation of this formula. Rigorously, for ReLU activation, we have the following theorem that gives a concrete bound on the hidden widths that is sufficient for convergence to the NTK at initialization:
The proof of Theorem 3.1 is given in Section E. Theorem 3.1 improves upon previous results (Jacot et al., 2018; Yang, 2019) that also established similar convergence in the following sense:
Previous results are asymptotic, i.e., they require the widths to go to infinity, while Theorem 3.1 gives a non-asymptotic bound on the required layer widths.
Jacot et al. (2018) required sequential limit, i.e., go to infinity one by one, and Yang (2019) let go to infinity at the same rate. On the other hand, Theorem 3.1 only requires to be sufficiently large, which is the weakest notion of limit.
Equivalence between wide neural net and kernel regression with NTK.
Built on Theorem 3.1, we can further incorporate the training process and show the equivalence between a fully-trained sufficiently wide neural net and the kernel regression solution using the NTK, as described in Lemma 3.1 and the discussion after it.
Since the above solution corresponds to the linear dynamics in Equation (4) with zero initialization, in order to establish equivalence between neural network and kernel regression, we would like the initial output of the neural network to be small. Therefore, we apply a small multiplier , and let the final output of the neural network be We let be the prediction of the neural network at the end of training.
The following theorem establishes the equivalence between the fully-trained wide neural network and the kernel regression predictor using the NTK.
Several comments are in sequel. Theorem 3.2 is, to our knowledge, the first result that rigorously shows the equivalence between a fully-trained neural net and a kernel predictor. Comparing with (Jacot et al., 2018), our bound is non-asymptotic whereas (Jacot et al., 2018) only has an asymptotic result; furthermore, Jacot et al. (2018) required the width of every layer to go to infinity in a sequential order, while we can have the same number of neurons per layer, which is closer to practice. Comparing with recent results on over-parameterized neural nets (Arora et al., 2019; Allen-Zhu et al., 2018b, a; Du et al., 2019, 2018b; Li and Liang, 2018; Zou et al., 2018), our theorem is a more precise characterization of the learned neural network. That is, the prediction is essentially a kernel predictor. Therefore, to study the properties of these over-parameterized nets, such as their generalization power, it is sufficient to study the corresponding NTK.
While this theorem only gives guarantee for a single point, using a union bound, we can show that this guarantee holds for (exponentially many) finite testing points. Combing this with the standard analysis of hold-out validation set, we can conclude that a fully-trained wide neural net enjoys the same generalization ability as its corresponding NTK.
For the proof of Theorem 3.2, we first use a generic argument to show that the perturbation on the prediction can be reduced to the perturbation on kernel value at the initialization and during training. Theorem 3.1 guarantees a small perturbation on kernel value at initialization. For the perturbation during training, we use high level proof idea from Du et al. (2018b); Arora et al. (2019) to reduce the perturbation on the kernel value to the perturbation on the gradient of each prediction with respect to weight matrices. Then we adopt technical lemmas from Allen-Zhu et al. (2018b) to obtain bounds on the perturbation of the gradient. The proof of Theorem 3.2 is given in Section F. We remark that Jacot et al. (2018); Lee et al. (2019) provided proofs for the training part. However, both are asymptotic results and only apply to finite training time. In contrast, we give a finite-width perturbation bound and our result applies to infinite training time.
Convolutional Neural Tangent Kernel
In this section we study convolutional neural nets (CNNs) and their corresponding CNTKs. We study two architectures, vanilla CNN and CNN with global average pooling (GAP). In this section we define vanilla CNN and present its corresponding CNTK formula. The derivation of this formula is deferred to Section G. We present the definition of CNN with GAP and its CNTK in Section H.
Equation (10) shows that patch depends on . Our CNTK formula also relies on this dependency. For , define
A vanilla CNN consisting of convolution layers and one fully-connected layer is formally defined as follows:
For , , the intermediate outputs are defined as
For this architecture, using the same reasoning as in Section D, we obtain the following convolutional neural tangent kernel formula. The details are provided in Section G.
We let be two input images.
For , , define
For , define
Note that and share similar structures as their NTK counterparts in Equations (7) and (8). The only difference is that we have one more step, taking the trace over patches. This step represents the convolution operation in the corresponding CNN. Next, we can use a recursion to compute the CNTK:
First, we define .
For and , we define
For , we define
In Section H we give the CNTK formula for CNNs with GAP, which is similar to vanilla CNNs. To compute the CNTK matrix corresponding to a CNN with GAP that has convolution layers and one fully-connected layer on samples, the time complexity is . Previous work assumed that directly computing convolutional kernel (with pooling) exactly is computationally infeasible, and thus resorted to approximations like Monte Carlo sampling (Novak et al., 2019). We are able to scale the exact CNTK computation to the full CIFAR-10 dataset and 20-layer CNN with GAP. We present our efficient computation approach in Section I.
Experiments
We evaluate the performances of CNNs and their corresponding CNTKs on the CIFAR-10 dataset. The implementation details are in Section A. We also compare the performances between CNTKs and their corresponding random feat Due to space limit, we defer these results on random features to Section B.
We test two types of architectures, vanilla CNN and CNN with global average pooling (GAP), as described in Sections 4 and H. We also test CNTKs with only 2,000 training data to see whether their performances are consistent with CNTKs and CNNs using the full training set. The results are summarized in Table 1. Notice that in Table 1, depth is the total number of layers (including both convolution layers and fully-connected layers).
Several comments are in sequel. First, CNTKs are very powerful kernels. The best kernel, 11-layer CNTK with GAP, achieves 77.43% classification accuracy on CIFAR-10. This results in a significant new benchmark for performance of a pure kernel-based method on CIFAR-10, being higher than methods reported in (Novak et al., 2019).
Second, we find that for both CNN and CNTK, depth can affect the classification accuracy. This observation demonstrates that depth not only matters in deep neural networks but can also affect the performance of CNTKs.
Third, the global average pooling operation can significantly increase the classification accuracy by 8% - 10% for both CNN and CNTK. Based on this finding, we expect that many techniques that improve the performance of neural networks are in some sense universal, i.e., these techniques can also benefit kernel methods.
Fourth, we find that there is still a 5% - 6% performance gap between CNTKs and CNNs. Since CNTKs exactly correspond to infinitely wide CNNs, this performance gap implies that finite width has its benefits. Therefore, it is likely that recent theoretical work on over-parameterization that operates in the NTK regime cannot fully explain the success of neural networks yet, and we believe it is an interesting open problem to characterize this gap.
Potential application in neural architecture search.
Finally, we find that performances of CNTK-V-2Ks and CNTK-GAP-2Ks are highly correlated to their CNN-V, CNTK-V, CNN-GAP and CNTK-GAP counterparts. Again we see CNTK-GAP-2Ks outperform CNTK-V-2Ks by a large margin (about - ). One potential application of this observation is to guide neural architecture search. We can compute the kernel on a small training data, test it on a validation set, and choose neural network architectures based on the performance of this small kernel on the validation set. We leave large scale experiments of this idea for future work.
Conclusion
By giving the first practical algorithm for computing CNTKs exactly, this paper allows investigation of the behavior of infinitely wide (hence infinitely over-parametrized) deep nets, which turns out to not be much worse than that of their finite counterparts. We also give a fully rigorous proof that a sufficiently wide net is approximately equivalent to the kernel regression predictor, thus yielding a powerful new off-the-shelf kernel. We leave it as an open problem to understand the behavior of infinitely wide nets with features such as Batch Normalization or Residual Layers. Of course, one can also hope that the analysis of infinite nets provides rigorous insight into finite ones.
Acknowledgments
We thank Jason D. Lee, Haochuan Li and Xiyu Zhai for useful discussions. S. Arora, W. Hu and Z. Li are supported by NSF, ONR, Simons Foundation, Schmidt Foundation, Mozilla Research, Amazon Research, DARPA and SRC. R. Salakhutdinov and R. Wang are supported in part by NSF IIS-1763562, Office of Naval Research grant N000141812861, and Nvidia NVAIL award. We thank Amazon Web Services for providing compute time for the experiments in this paper. This work was done while S. S. Du was a Ph.D. student at Carnegie Mellon University.
References
Appendix A Experiment Details
Due to efficiency considerations, for all experiments, we use no data augmentation. Tricks like batch normalization, dropout, weight decay, etc. are not used for proper comparison. We fix the filter to be and stride to be . We use zero padding to make sure the number of patches keeps unchanged after each convolutional layer. We set the number of convolution layers to be , , , , or . For both CNNs and CNTKs, we use the quadratic loss as the objective function.
and choose the class with largest value as the prediction.
The architecture of CNNs is as described in Section 4 and Section H. We set the number of the channels of the network as 1024 and as . To train CNNs, we use stochastic gradient descent (SGD) with fixed learning rate. We report the best average performance over 3 trials among the different learning rate chosen from . The test accuracy is measured by taking average of the 10 epochs after reaching full training accuracy except the depth-3 vanilla CNN, which couldn’t attain full training accuracy within 3000 epochs for all learning rates
Our neural networks are trained using the PyTorch package, using (possibly multiple) NVIDIA Tesla V100 GPUs. We calculate the kernel values using the CuPyhttps://cupy.chainer.org. package. For time-consuming operations, we write native CUDA codes to speed up the calculation. All experiments are performed on Amazon Web Services (AWS).
Appendix B Additional Experiments on Random Features
We verify the importance of using the exact kernels instead of the approximated ones from random features (as done in [Lee et al., 2019]). The random features are generated by taking the gradient of the randomly initialized CNNs with respect to the weight matrices. For all CNNs we set the number of channels to be . We compare the performances of the exact kernels and the random kernels on a CIFAR-2 dataset, i.e., the first two class in CIFAR-10. For each kernel generated by random features, we test times and report the median. The results are summarized in Table 2.
Note that even on the simple CIFAR-2 dataset, random features have much worse accuracies than exact kernels by a large margin. This experiment demonstrates the importance of using the exact kernels instead of approximated ones.
Appendix C Proof of Lemma 3.1
The parameters evolve according to the differential equation
where is a continuous time index. Under Equation (13), the evolution of the network output can be written as
Appendix D NTK Derivation
In this section we derive NTK for the fully-connected neural net defined in Section 3.
First we explain how the Gaussian process covariance in Equation (7) is obtained. The intuition is that is a centered Gaussian process conditioned on (), with covariance
which converges to as given that each is a centered Gaussian process with covariance . This yields the inductive definition in Equation (7).
Recall that we need to compute the value that converges to at random initialization in the infinite width limit. We can write the partial derivative with respect to a particular weight matrix in a compact form:
Then, for any , we can compute
Note that we have established in Equation (16) that
For the other factor , from Equation (17) we get
Although and are dependent, the Gaussian initialization of allows us to replace with a fresh new sample without changing its limit: (This is made rigorous for ReLU activation in Theorem 3.1.)
Applying this approximation inductively in Equation (19), we get
Finally, since , we obtain the final NTK expression for the fully-connected neural network:
Appendix E Proof of Theorem 3.1
When is k-homogeneous function, we have
Thus can be written as ,
For all activation function , .
For all 1-homogeneous activation , and .
For , , and .
For any , .
.
(1). From we know , which implies that . Thus,
(2). Note that , is decreasing on . Thus .
(3). Let , such that . W.l.o.g., we assume , . Combing (1) and (2), we have . Thus ∎
Recall the definition in Equation (7) and (8), we have
For , we have
Let is a 0-1 diagonal matrix. We define the following events:
,
;
.
;
;
;
;
;
.
For simplicity, we will omit when there’s no ambiguity. For events , we define the event as .
For matrix , define the projection matrix for the column space of , and the orthogonal projection matrix . For two random variables and , means is equal to in distribution conditioned on the -algebra generated by .
where is a fresh i.i.d. copy of .
This lemma is straightforward when is a diagonal matrix.
where we used the fact that if , then for any orthogonal , twice. ∎
E.2 Proof Sketch
Recall that , thus it suffices to show that if , then w.p. , for every , it holds that
which is a direct consequence of Theorem E.2 ∎
In other words, if , , then for fixed ,
In other words, if , , then for fixed ,
Note that for for , by definition of , we have
The proof is based on a careful control of the following events.
We will use induction on Lemma E.7 to prove Theorem E.2. In the statement of Theorem E.1, we set , , for some , we have
In the statement of Lemma E.6, we set , and . Note that for large enough and thus we have
In the statement of Lemma E.4, we set , and , we have
Using union bound on Equation (21),(22),(23), we have
For in the statement of Lemma E.7, we set , , , . Note that for large enough, . Thus we have
Using union bound again on Equation (24) and Equation (25) for every in , we have
E.3 Proof of Lemma E.4
For fixed , . Thus by subgaussian concentration[cite], we know w.p. over the randomness of , .
For , we have , which implies , and thus taking union bound over , we have w.p. , ,.
E.4 Proof of Lemma E.5
Define , we have for every ,
For simplicity, we denote , by , respectively.
Since is 0-homogeneous, we have
It is easy to verify that , and thus
Note that .
Combining Lemma E.8 and Lemma E.9, we have for any ,
Taking union bound over for the choice of , we have
E.5 Proof of Lemma E.7
The proof of Lemma E.7 is based on the following 3 claims, Claim E.1, E.2 and E.3.
If , then we have
For any fixed , let ,
w.p. , if , then we have for any ,
As a by-product, for any , we have
It suffices to prove this claim conditioned on every possible realization of
Recall that , we further define . Applying Lemma E.3 on each row of , we have
where is an iid copy of .
where .
Thus conditioned on , we have
Now we are ready to prove Claim E.1 by applying Lemma E.10. Let , we have
Thus by Lemma E.10 with we have w.p. ,
The main part of the claim is completed by taking union bound over . For the by-product, let , and we have
w.p. , if , then
It suffices to prove the claim for . We will denote by , by and by . We also define as , and . Clearly, is still a projection matrix of rank or .
Since , it suffices to bound these two terms separately.
Recall is defined as the gradient of with respect to the pre-activation of layer , , thus if we view as a function , by the rule of back propagation, we have
Note that , we have
where . Hence w.p. over the randomness of , .
Thus by assumption , we have . ∎
Wrapping things up, by combining Claim E.2 and Claim E.3, we have w.p. , for any pair of ,
Using Equation (28) together with Claim E.1 and Claim E.2, we’ve finished the proof for Lemma E.7.
Appendix F Proof of Theorem 3.2
i.e., the kernel induced from the gradient of the prediction with respect to the parameters of the neural network at time .
We prove a lemma to reduce the prediction perturbation bound to the kernel perturbation bound.
Fix . Suppose for and and . Furthermore, if for all and , then we have
Our proof relies a careful analysis on the trajectories induced by gradient flows for optimizing the neural network and the NTK predictor.
The solution to this program can written as applying gradient flow on
with initialization . We use to denote this parameter at time trained by gradient flow and be the predictor for at time . With these notations, we rewrite
where we have used the fact that the initial prediction is . Now we take a closer look at the time derivative:
We thus we analyze the difference between the NN predictor and NTK predictor via this integral form
For the second term, recall by our assumption so . Using this fact we know . Therefore, we can bound
To bound , we observe that and with linear convergence rate. Therefore, we can choose some so that
By Lemma F.1, the problem now reduces to (i) choose small enough to make and (ii) show when the width is large enough then and are both . For (i), based on Theorem E.1 and the union bound, we can just choose to make with probability . For (ii), we will use Theorem 3.1 and Lemma F.2 below, and then apply the union bound. ∎
In this subsection we prove the following lemma.
If and , we have
By the proof of Theorem 3.1, we know . Then we can just use triangle inequality. ∎
For , , we denote
Note . Here we use instead of for the ease of presentation.
Recall the gradient to is:
Then with probability at least over random initialization, if for all , we have for all .
While Allen-Zhu et al. [2018b] did not consider the perturbation on , by scrutinizing their proof, it is easy to see that the perturbation bounds still hold even if there is a small perturbation on .
The next lemma bounds the backward vector, adapted from
While Allen-Zhu et al. [2018b] did not consider the perturbation on , by scrutinizing their proof, it is easy to see that the perturbation bounds still hold even if there is a small perturbation on .
Combing these two lemmas and the result for the initialization (Theorem 3.1), we have the following “gradient-Lipschitz" lemma.
We use the triangle inequality to bound the perturbation
The following lemma shows for given weight matrix, if we have linear convergence and other weight matrices are only perturbed by a little, then the given matrix is only perturbed by a little as well.
We let be some absolute constants.
The last step we used . Suppose there exists such that Denote
For any , we know for all , Therefore, by Lemma F.6, we know
Therefore, using the fact that is sufficiently small we can bound
Since we also know is sufficiently large to make , we have a contradiction. ∎
The next lemma shows if all weight matrices only have small perturbation, then we still have linear convergence.
Under this assumption and the result of initialization, we know for all , . This in turn directly imply the linear convergence result we want. ∎
Lastly, with these lemmas at hand, using an argument similar to [Du et al., 2019], we can show during training, weight matrices do not move by much.
We analyze case by case. Suppose at time , . By Lemma F.7, we know there exists some such that either there exists such that
However, this violates the minimality of . For the other case, if
By Lemma F.8, we know there exists such that there exists ,
However, again this violates the minimality of . ∎
Now we can finish the proof of Lemma F.2.
By Lemma F.9, we know for , for if is sufficiently. Applying Lemma F.6, we know we only have a small perturbation on the gradient. Applying Lemma F.3, we know we only have small perturbation on kernel values. ∎
Appendix G CNTK Derivation
i.e., this operator extracts the -th patch. By this definition, we can rewrite the CNN definition:
For , , the intermediate outputs are defined as
We expand to show we can write it as the sum of terms with each term representing the inner product between the gradients with respect to the weight matrix of one layer. We first define an linear operator
With this operator, we can expand CNTK as (for simplicity we drop on and )
which could be rewritten as the following by Property 31,
G.2 Derivation
We first compute the derivative of the prediction with respect to one single filter.
With this expression, we proceed to we compute the inner product between gradients with respect to the -th layer matrix
Similar to our derivation to NTK, we can use the following approximation
Thus it remains to show that ,
Now, we tackle the term . Notice that
where the first approximation is due to our initialization of . In other words, we’ve shown
Since we use a fully-connected weight matrix as the last layer, we have .
Thus by induction with Equation 36, we have derived Equation 34, which completes the derivation of CNTK.
Appendix H Formula of CNTK with Global Average Pooling
In this section we define CNN with global average pooling considered in this paper and its corresponding CNTK formula.
For , , the intermediate outputs are defined as
Besides using global average pooling, another modification is that we do not train the first and the layer. This is inspired by Du et al. [2018a] in which authors showed that if one applies gradient flow, then at any training time , the difference between the squared Frobenius norm of the weight matrix at time and that at initialization is same for all layers. However, note that and are special because they are smaller matrices compared with other intermediate weight matrices, so relatively, these two weight matrices change more than the intermediate matrices during the training process, and this may dramatically change the kernel. Therefore, we choose to fix and to the make over-parameterization theory closer to practice.
CNTK formula.
We let be two input images. Note because CNN with global average pooling and vanilla CNN shares the same architecture except the last layer, , and are the same for these two architectures. the only difference is in calculating the final kernel value. To compute the final kernel value, we use the following procedure.
First, we define . Note this is different from CNTK for vanilla CNN which uses as the initial value because we do not train the first layer.
For and , we define
For , we define .
Lastly, the final kernel value is defined as
Note that we ignore comparing with the CNTK of CNN. This is because we do not train the last layer. The other difference is we calculate the mean over all entries, instead of calculating the summation over the diagonal ones. This is because we use global average pooling so the cross-variances between every two patches will contribute to the kernel.
Appendix I Fast Computation for ReLU-Activated CNTK
In this section we present our approach to compute CNTK exactly. Notably, most computation required by our new approach can be described as entry-wise operations over matrices and tensors, which allows efficient implementations on GPUs.
Following the formulas in Sections 4 and H, the trickiest part is computing the expectation of the post-activation output, i.e., Equations (11) and (12). These two expectations depend on (the same) matrices . To obtain faster implementations, our key observation is that if the diagonal entries of are all ones and the activation function is ReLU, there are closed-form formulas for the the corresponding expectations. To see this, let us suppose for now that for some . When the activation function is ReLU, one can show that
Here, we interpret , , and as matrices of size . If the diagonal entries of are all ones, then the diagonal entries of are all ones for all possible , in which case we can calculate and by simply applying the closed-form formulas described in (37) and (38) on .
However, in general, the diagonal entries of are not always all ones, in which case we resort to the homogeneity of the ReLU activation function. Suppose for some , and for some , then one can show that
Inspired by this, our final approach is described as follows.
Let , where and are diagonal matrices whose diagonal entries are square roots of the diagonal entries of and , respectively.
Applying Equations (39) and (40) on , where the diagonal entries of are all ones.
Notice that the implementation above requires us to store the whole matrix, which has size . To further optimize the efficiency, we notice that to implement the approach described above, we only need to store the diagonal entries of and , together with the matrix , which has size .