Tensor Programs IVb: Adaptive Optimization in the Infinite-Width Limit
Greg Yang, Etai Littwin
Chapter 1 Introduction
While historically the deep learning theory literature has by-and-large (carelessly in hindsight) identified “infinite-width neural networks” with “neural tangent kernel” or “gaussian process” , by now we understand these are just particular kinds of infinite-width limit with simple mathematics. Indeed, there also exists a “feature learning regime” with much more complex mathematics but also all the actually desired properties of a neural network . Yang & Hu precisely characterized this so-called Dynamical Dichotomy: there is no other regime that can happen for MLPs trained by SGD in finite time.
In practice, of course, most neural networks of importance are trained by adaptive optimizers like Adam . Can new phenomenon arise in the infinite-width limit of adaptive optimizers? For example, if one invokes the (not-quite-correct) intuition that neural network trained with small learning rate exhibits kernel behavior, then one might suppose that these optimizers may adaptively enforce large effective learning rates. This prevents kernel behavior and may even “supercharge” feature learning.
But it turns out there’s nothing special about adaptive optimizers in this regard. Essentially the exact dichotomy of feature learning vs kernel regime plays out for any adaptive optimizer. This means there is also a “neural tangent kernel” limit for any adaptive optimizer, where the network evolution can be captured solely by some kind of evolution equation in the function space — albeit no longer a linear equation. This also means that “maximal update” parametrization can be defined for e.g., Adam, that maximizes feature learning in a suitable sense. Indeed, already contained an intuitive derivation of this P for Adam, and showed it preserves optimal hyperparameters as ones scales the width of a model (e.g., Transformer ). Part of this work serves to fill the gap in ’s theoretical foundations.
To achieve this result, we leverage the Tensor Programs framework: express the adaptive optimization of a network in any parametrization in a Tensor Program, and invoke the Master Theorem to take the infinite-width limit of the whole computation, obtaining in particular the limit at the end of training.
Yet, there is one problem: no previous Tensor Program language can express adaptive optimization! The main issue is the expression of the entrywise “normalization” of the gradient done by the optimizer: For example, in the first step of training, Adam essentially just takes the sign of the gradient; while previous Tensor Program languages like can express this operation for the input and output weights, they cannot do so for the hidden weights.More generally, can only express this for vector-like (1 dimension tends to infinity) parameters but not matrix-like (2 dimensions).
We prove the Master Theorem for (i.e., how to take the infinite width limit for any program), for both the classical Gaussian case (where matrices are sampled from Gaussians) as well as the general non-Gaussian case, following the strategy of .
The Tensor Programs series is known for architecturally universal results — results that hold for all “natural deep learning architectures”, past and future. For example, established the architectural universality of Neural Network-Gaussian Process (NNGP) Correspondence, established the same for the Neural Network-Tangent Kernel Correspondence, and likewise for Free Independence Principle. Yet, ’s theoretical development of maximal update parametrization only focused on multi-layer perceptrons.with a brief discussion of defining P for any architecture in the appendix, but nothing about its limit; did a thorough empirical investigation of muP for a variety of architectures but nothing theoretical
Here we write down the -limit (as well as the neural tangent limit) for any architecture and any adaptive optimizer. The key innovation here is the definition of what “any architecture” means, while the proofs follow essentially the MLP examples.
Prior works did not write down the -limits for all “natural” architectures mainly because the Tensor Programs notation was not efficient enough to deal with this arbitrary complexity. The mundane looking but vital innovation of this work is a new set of Tensor Programs notations that enables concise expression of all of the above: the bra-ket (aka Dirac) notation, borrowed from quantum physics. For readers familiar with prior Tensor Programs papers, in short:
The expectation inner product becomes notably succinct in the new notation, which also enables much more efficient expressions of the nonlinear outer product that is at the center of adaptive optimization.
We formalize a general notion of adaptive optimization in deep learning, called entrywise updates — the property that gradients are processed entrywise — satisfied by common optimizers like SGD and Adam .
We define the neural tangent and maximal update parametrizations for entrywise optimizers and derive their infinite-width limits. While we focus on MLPs in most of this paper for pedagogical purposes, we eventually write down the limits for any “reasonable” architecture.
More generally, like , we identify all “natural” infinite-width limits in this setting and dichotomize them into feature learning vs a nonlinear version of kernel regime. The maximal update limit remains the “optimal” feature learning limit for all entrywise optimizers.
All of the above results are made possible by a new version of Tensor Program, called , that can express the adaptive updates using the new instruction of nonlinear outer product. This forms the bulk of the technical advances made in this work.
Even so, the most vital contribution of this work is perhaps introducing the bra-ket notation to drastically simplify expressions and calculations common in Tensor Programs.
The infinite-width limits of adaptive optimizers take the headline for this paper and may be what piques readers’ interest in the near term. But the new Tensor Program and the new notation will likely have longer lasting impact, pushing forward our fundamental knowledge of large neural network behavior and lowering the translation tax between how this knowledge is stored on paper and in our heads.
In a way, this work gathers and generalizes all previous results in the Tensor Programs series about infinite-width limits: 2.9.19 generalizes the architecturally universal Neural Network-Gaussian Process correspondence and Neural Network-Tangent Kernel correspondence ; the new Tensor Program, (2.6.1), generalizes the of ; its Master Theorem (2.6.10) holds for both Gaussian and non-Gaussian matrices, generalizing ; the Dynamical Dichotomy for entrywise updates (2.8.20) generalizes that for SGD ; our -limit equations generalize those of for SGD and, for the first time, we even write down the general -limit equations for any architecture (2.9.25).
1 Related Work
Here we briefly overview past works on infinite-width neural networks, but we recommend the reader to refer to [45, Sec 2] for a more comprehensive review. A large body of literature exists on both the kernel (NTK) limit and the mean field limit for 2-layer neural network . Various papers describe the kernel and feature learning regimes more generally without taking an infinite-width limit. describes the “lazy training” regime in arbitrary differentiable programs, and is controlled by a single parameter which scales the output. It is shown that when is large, the weight need only move slightly to fit the training data, and network essentially performs kernel learning. Many papers view the kernel and feature learning regimes as learning in different timescales, explicitly incorporating the time dependence in the infinite-width limit, and others derive finite width corrections to the NTK for finite width networks . In this paper, as in , we consider training time to be constant, and take only the width to infinity.
Tensor Programs, first introduced in and expanded upon in , were developed as a theoretical framework to analyze the infinite-width limits of any architecture expressible in a simple formal language, in an attempt to unify the per-architecture analysis prevalent in the literature . defined a natural space of neural network parametrizations (abc-parametrizations), and classified all resulting infinite-width limits into two possible catagories: 1) the kernel regime, in which the neural network function evolves as a linear model, and 2) the feature learning regime, in which the representations change and adapt to data over the course of training. The parametrization was then identified as the “optimal” parametrization for arbitrary architectures in which all layers learn features, and was later heuristically extended to adaptive optimizers .
Adaptive optimizers and their variants were developed to accelerate learning by adapting the learning rate on a per parameter basis, and currently is a critical component of large scale pretraining of transformer models . No previous work has developed their theory for infinite-width neural network, but a concurrent work has derived the infinite-width NTK for SignSGD in the batch-size 1 setting (which is not equivalent to the general batch-size setting).
2 Notations
One of the the key innovations of this work is a set of much cleaner notations to express ideas in Tensor Programs. While this sizeable section may be off-putting to some readers, it’s better to explain the notation sooner than later. We recommend skimming until the end of the Outer Product subsection and then move on, coming back to read other parts when necessary.
2.1 The Tensor Program Ansatz: Representing Vectors via Random Variables
As we will see, as width becomes large, the entries of the (pre-)activation vectors and their gradients will become roughly iid (just like in the SGD case), both at initialization (which is easy to see) and training (which is harder to see). Hence any such vector’s behavior can be tracked via a random variable that reflects the distribution of its entries. While we call this the “Tensor Program Ansatz”, it is a completely rigorous calculus as seen below in Section 2.6 (as well as in previous papers in the Tensor Programs series for SGD).
Furthermore, this notation cleanly handles the multi-vector case when is an matrix where is fixed as :
represents the limit of .Note that later, we will consider of shape , in which case and both have shape , and has shape .
Because we will often need to multiply a ket with a diagonal matrix, we introduce a shorthand:
if is and is a -dimensional vector.
Likewise, if both and have shape , the expression
which corresponds to the limit of . This definition of makes the expressions
unambiguous (since any way of ordering the operations give the same answer).
where \left(\hstretch{0.7}{\talloblong}y^{1}\rangle^{\mathord{\ThisStyle{\LMpt\kern 1.0pt\LMpt\framebox{\SavedStyle 1}\kern 1.0pt\LMpt}}},\ldots,\hstretch{0.7}{\talloblong}y^{k}\rangle^{\mathord{\ThisStyle{\LMpt\kern 1.0pt\LMpt\framebox{\SavedStyle 1}\kern 1.0pt\LMpt}}},\hstretch{0.7}{\talloblong}\bm{z}\rangle^{\mathord{\ThisStyle{\LMpt\kern 1.0pt\LMpt\framebox{\SavedStyle 1}\kern 1.0pt\LMpt}}}\right) is an iid copy of independent from and the expectation is taken only over the former. This is just like, in the finite case,
where denotes outer product of vectors and expectation is taken over everything.
Note is not the image of the operator under in the continuous function calculus of operators, but rather a “coordinatewise application” of . For example, if , then is not , the latter being what typically “squaring an operator” means, but rather .
In later applications, when is an update function (such as in Eq. 2.1), this will be clear from context. For example, the bar notation in abbreviates where are the same as in inside. Then we use the much lighter “bar” notation
In contrast to the cases above, when an expression involves only kets (or bras), then the usual calculus of kets as random variables or vectors apply, e.g., is just the random vector formed from entrywise product of and .From readers with quantum mechanics background, beware that in our context is the product of random variables and , which is not equal to their “tensor product” (which would be written \hstretch{0.7}{\talloblong}x\rangle\hstretch{0.7}{\talloblong}y\rangle^{\mathord{\ThisStyle{\LMpt\kern 1.0pt\LMpt\framebox{\SavedStyle 1}\kern 1.0pt\LMpt}}}).
For readers familiar with the Tensor Programs papers, this new “bra-ket” notation (aka Dirac notation) relates to the old notation by
2.2 IID Copies
2.3 Big-O Notation
Following previous papers of the Tensor Programs series, we adopt the following semantics of big-O notation, which concerns the “typical size” of entries of a tensor rather than the norm of the tensor (as is the more common usage of big-O notation). Therefore, the reader must internalize this notation sooner rather than later to avoid confusion.
Given a sequence of random tensors, where can have different shapes for different , we write and say has coordinates (or entries) of size if there exist constants such that almost surely,Here “almost surely” is with respect to the probability of the entire sequence . for sufficiently large ,
where is the number of entries in . We make similar definitions for and .
Note the constants can depend on everything except ; in concrete contexts below, such constants can, for example, depend on neural network architecture, training time, optimizer, etc, but just not width.
Most often, will have “approximately iid” coordinates, so the notation can be interpreted intuitively to say has coordinates of “empirical standard deviation” , which justifies the name.
Chapter 2 Exposition of Main Results
Here we explain our main results while later chapters will prove them. We begin by isolating a concept that captures most of adaptive optimizers, namely entrywise optimizers (Section 2.1), which forms the focus of this work. By considering how to scale the learning rate, initialization, and multipliers (a so-called abcd-parametrization), we catalogue all natural ways of taking infinite-width limits (Section 2.2). We study the archetypical examples, the (canonical generalizations of) neural tangent (NT) (Section 2.4) and the maximal update () (Sections 2.5 and LABEL:{sec:deepmaximalupdate}) parametrizations, and describe their infinite-width limits. More generally, we classify all possible limits of abcd-parametrizations (Section 2.8): while most parametrizations are degenerate in one way or another, the rest can be divided into the feature learning and the operator regimes, the latter being the nonlinear counterpart of kernel regime. The and NT limits are respectively the “maximal” elements of each regime in that all parameters contribute to the function evolution. Nevertheless, like in the SGD case, all operator regime limits, including the NT limit, do not learn features and trivialize transfer learning. While all of the above stars the MLP as the instructional architecture, finally we write down the NT and limits for any architecture (Section 2.9).
Underlying these results is the new Tensor Program language, , that expresses the so-called nonlinear outer products (Section 2.6). We formulate the algorithm, aka the Master Theorem, to compute the infinite-width limit of any program. New techniques, such as new notions of equivalence of random vectors, are needed to prove the Master Theorem; we overview the proof in Section 2.11 before giving it in full in Chapter 4.
What does one mean by adaptive optimization? Both SGD and Adam, prototypical optimizers in deep learning, have entrywise updates, where parameter updates take the form of a function of the current and/or past gradients. This turns out to be a concept that captures most of adaptive optimizers.
where and are both functions of the past gradients and is there for numerical stability. For example, in Adam , and are respectively the exponential moving averages of them and their squares, resulting in the following unwieldy expression:
where are Adam’s momentum hyperameters. We can also consider a simpler “memoryless” version of this, namely SignSGD :
We will also write memoryful and nonstationary for the opposite of memoryless and stationary. In this sense, SGD and SignSGD are both memoryless and stationary but Adam is neither. We will always present the memoryless stationary versions of our theorems first, as they carry across the main ideas. The full version (i.e., memoryful nonstationary) will always be a straightforward modification, though often requiring more notations.
Many other optimizers are covered by this entrywise update framework Eq. 2.1, including RMSProp, Adagrad, Adadelta, NAdam, Adamax, etc . However, some other ingredients of “adaptive” optimization, such as gradient clipping, weight decay, or momentum factoring as in Adafactor , are not directly covered. Nevertheless, using our new extension of Tensor Programs discussed in Section 2.6, it is straightforward to derive and classify the infinite-width limits including such ingredients, and we do so in Section 2.10. Such theorems will be by-and-large the same as what we have here (e.g., Dynamical Dichotomy 2.8.20 still holds), but the definitions of neural tangent and maximal update parametrizations (2.4.1,2.5.1) can change, as well as, e.g., the equations characterizing feature learning. See [47, Sec B.3] for further intuitive discussions.
If in Eq. 2.1 is nonlinear, then , the most advanced version of Tensor Programs before this work, is unable to express Eq. 2.1 for hidden weights of a network (weight matrices where both dimensions tend to infinity). In this work, we extend to that can express it and develop its Master Theorem.
2 abcd-Parametrizations
In this work, we consider how such optimization should be parametrized wrt the width of a neural network, generalizing the the abc-parametrization of .
We parametrize each weight as for actual trainable parameter
We initialize each
The learning rate is for some width-independent
The gradients of are multiplied by before being processed by : i.e., the update at time is
where , are the gradients of at time and is applied entrywise.
A simple example is the “standard parametrization” that is the default for, e.g., PyTorch, where nothing scales with width other than the initialization.
The standard abcd-parametrization (SP) is defined by
In 2.2.1, beyond the obvious addition of scaling exponent , compared to abc-parametrization of , we also now have layer dependent . This is without loss of generality, because of the redundancy in , as shown in [45, Eq 5]. This takes the more general form as follows for abcd-parametrization:
In the case of SGD (i.e., when ), an abcd-parametrization reduces to an abc-parametrization with the mapping
As in , our concern here is the correct way to scale with width. In practice, there should be tunable hyperparameters in front of the powers of in 2.2.1, as investigated in .
In the idealized case of Adam and similar adaptive optimizers where the in Eq. 2.2 is 0, is degree-0 homogeneous and itself is redundant. When , this is no longer true. But the almost homogeneity yields an alterative but equivalent way to define : instead of being multiplied by , we let be multiplied by .
If one sets the global learning rate for SP (2.2.2) to its largest stable value, then for SGD, SP is in the kernel regime . But for SignSGD and Adam, assuming perfect scale invariance, SP’s largest stable learning rate is , so that with this setting (i.e., setting for every ), SP is actually in the feature learning regime. The reader is not expected to understand the underlying reasoning at this point, but the claim above can be derived by calculating from 2.8.5 and invoking 2.8.12 and 2.8.19. This difference in default scaling may be a contributing factor to the success of Adam compared to SGD.
3 Setup
Here we set up the notation and conventions regarding the data, (pre)activations, and training of the network as well as the main technical assumptions for our rigorous results.
While considered only the batch-size-1 case to simplify notation, here, because of our notational advance, we can afford to consider the following more general setting.
Furthermore, we can implement train-test split via : For example, can be split into two parts, such that is always 0 on the . Then the evolution of can track the evolution of function values on the test set due to changes from the training set.
The framework more generally covers settings like reinforcement and online learning where the error signal is not obtained from just a simple loss function.
For all rigorous results in this work, we will consider the following smoothness assumption. This is sufficient for deriving the NTK and P limits but more assumptions, stated later, are required for Dynamical Dichotomy, i.e., the classification of abcd-parametrizations.
This is a very weak assumption satisfied by typical loss functions (e.g., MSE or cross entropy), update functions (e.g., SGD or Adamspecifically, Adam in the form Eq. 2.2 with ), and nonlinearities (e.g., tanh or gelu). The notable exception here is that relu itself is not covered because its derivative has a discontinuity. But this is a common technicality not treated in the theoretical literature. Nevertheless, we expect all theorems in this work should apply to relu as well and can be proven rigorously in the future.
With this setup in mind, we next describe the two prototypical infinite-width limits, the neural tangent and maximal update limits, for nonlinear entrywise updates before completely classifying the space of abcd-parametrization.
4 Neural Tangent
The “classical” neural tangent (abc-)parametrization (NTP) can be generalized easily to an abcd-parametrization using the intuition that the input to any nonlinear update function should be (we won’t go through this calculation here but c.f. 2.8.8 and LABEL:{lemma:faithfulconditionsinit}). After defining this generalization next, we adapt the well-known continuous-time heuristic for deriving the NTK limit to the nonlinear updates case (Eq. 2.7), before writing down a succinct expression of the infinite-width limit made possible by our new bra-ket notation (Eqs. 2.8 and 2.9).
The neural tangent abcd-parametrization (NTP) is defined (modulo Eq. 2.5) by
Reducing to abc-parametrization in the SGD case via Eq. 2.6 (i.e., subtracting the last 2 rows), we recover exactly the classical NTP [45, Table 1].
4.1 Continuous Time Intuition
where and is the loss function. For a general (memoryless stationary) update function , this just becomesTechnically, we should include terms involving from 2.2.1 in Eq. 2.7, but for simplicity, let’s just assume that is temporarily redefined to have already included them
Now we turn to make this intuition rigorous.
4.2 Infinite-Width Limit
where the “bar” notation abbreviates application of as in Eq. 1.2.
As an example, when is identity, the “bar” can be removed, and reduces to the linear operator represented by the NTK:Again, is a row vector. In prior works, it’s usually treated as a column vector in which case one would write instead.
As another example, consider (Eq. with ). If the batch size is 1, i.e., is nonzero on exactly one input, say , then Eq. 2.8 is linear in because . Thus,
for each . This expression was concurrently derived in . However, when batch size is larger than 1, is no longer linear in generally, and there is no simplification like this. In particular, in the continuous time gradient flow setting, SignSGD with a large batch size is not equivalent to that with batch size 1 but very small learning rate, in contrast to SGD.
We can now state the generalized Neural Tangent limit for memoryless stationary updates. In particular, this covers SGD and SignSGD (Eq. ).
Consider any training routine (2.3.1) with memoryless stationary update function (2.1.1). Adopt 2.3.2. Then
The proof can be found in Section 3.3. Note, as in the SGD case, is deterministic conditioned on . We remind the reader that Eq. 2.9 simultaneously covers full batch, mini-batch, train-test split, and other schemes by changing , as discussed under 2.3.1. This will be the same for all theorems in this work.
The memoryless stationary condition allowed a clean mathematical formulation of the NT limit. But we can remove it easily at the cost of some more notation.
where is shorthand for .
With this in mind, the following theorem yields the NT limit of Adam (Eq. ) as a corollary.
If the update functions are memoryless but not necessarily stationary, then 2.4.7 holds with Eq. 2.9 replaced by
For general , not necessarily memoryless, 2.4.7 holds with Eq. 2.9 replaced by
The proof is a straightforward adaptation of the proof of 2.4.7 in Section 3.3.
4.3 Lack of Feature Learning
Just as for the SGD case, the neural tangent limit cannot learn features, for example, in the sense that the feature kernel (the Gram matrix of the input representations) does not evolve during training (2.8.19). Likewise, pretraining is futile in this limit as finetuning it would be no different than finetuning a randomly initialized network (2.8.22). Nevertheless, the NT limit is “maximal” among all nondegenerate limits without feature learning in that all other limits are just given by a neural tangent operator that involves a subsum of Eq. 2.8 (2.8.21).
5 Maximal Update
As for NTP, the “classical” maximal update (abc-)parametrization can be generalized easily to an abcd-parametrization using the intuition that the input to any nonlinear update function should be (c.f. 2.8.8 and LABEL:{lemma:faithfulconditionsinit}). After defining this generalization next, we study its limit for shallow MLP. The deep case will have to wait until we develop the new Tensor Program theory in the next section.
The maximal update abcd-parametrization (P) is defined (modulo Eq. 2.5) by
If we assume that the Adam update function (Eq. ) is perfectly scale-invariant, then the row can be dropped, yielding [47, Table 8] regarding Adam LR scaling.
To recover the abc version of P in [45, Table 1] for SGD, just apply Eq. 2.5 to the columns with and then apply Eq. 2.6 (i.e., subtracting the last 2 rows).
5.1 Shallow Infinite-Width Limit
We focus on the shallow case first because its -limit is fairly easy to describe. We shall cover the general case after we describe the outer product tensor program in Section 2.6. Adopt the following leaner notation:
Consider any training routine (2.3.1) with memoryless stationary update function (2.1.1). Adopt 2.3.2. As , for the network in Eq. 2.13 converges almost surely to some for every , which is recursively defined from by the following dynamics:
where the bar notation (Eq. 1.2) abbreviates application of and denotes dot product.
Again, one can note that if is identity, then we recover the SGD equations from [45, Theorem 6.1].
The proof of 2.5.2 is given in Section 3.2. This can be adapted straightforwardly to cover the nonstationary or memoryful cases:
If is memoryless but not stationary, then 2.5.2 holds if the bar in Eq. 2.15 (resp. Eq. 2.14) is interpreted as (resp. ).
If is not memoryless, then 2.5.2 holds if Eqs. 2.15 and 2.14 are replaced with
2.5.2 and 2.5.3 also hold if the output dimension is greater than 1, in which case the equations should be interpreted slightly differently; see Eq. 2.35.
As mentioned above, the gradient processing done by entrywise optimizers in general cannot be expressed previously by even the most expressive Tensor Program language. Here we fix this issue by adding “nonlinear outer products” to Tensor Programs. Like in previous works, we algebraically construct such programs’ limit objects (“kets”, in our new notation) and link them to the analytic properties of vectors in the corresponding programs via a Master Theorem. Unlike previous works, we also construct the limits of matrices, which are operators on kets. This is purely a conceptual change, but this perspective helps express the deep -limit much more efficiently than possible before.
choose a matrix and vector , and append to the vector
where is the th row in as a matrix and is the number of vectors in . We call the order of in this context.
Note that while 2.6.1 doesn’t directly give an instruction to transform scalars into scalars (in contrast to MatMul and OuterNonlin that transforms vectors into vectors), this can be done by combining instructions.
Think of as a function that ignores vector arguments and depend only on scalars, and use it in OuterNonlin to create the vector whose entries are identically equal to . Applying Avg to this vector gives the desired result. ∎
6.2 Setups
We are interested in the behavior of programs in two typical settings:
AssumeCompared to , we have WLOG simplified the setup by assuming 1) for every , 2) , and 3) for every . This is WLOG because , , and the mean and covariance of can all be absorbed into OuterNonlin via the appropriate linear functions.
Every entry of every is sampled iid from .
Every entry of every initial vector is sampled iid from .
The initial scalars converge almost surely to 0.
All functions used in OuterNonlin are pseudo-Lipschitz.
Assume the same as 2.6.3 but replace 1) and 4) with
there exists a sequence such that all matrices have independent entriesFor all of our results, it does not matter how the matrices for different are correlated, e.g., whether they are independent or the matrices are all upper left submatrix of fixed infinite iid matrix. This is because our proof only depends on how moments of vectors behave with , which does not care about such inter- correlations. drawn from distributions with zero mean, variance , and all higher th moment bounded by ; andInitial vectors are still sampled from , as in .
We further require initial scalars to have moments of all orders bounded in .But the moments do not need to be bounded as a function of the order.
While 2.6.4 allows more general distributions for matrix entries, its nonlinearities need to have more smoothness than 2.6.3. See for more discussions on these setups.
6.3 Limit Objects
As before, when the width of the program goes to infinity, one can infer how the program behaves via a calculus of random variables. We define them below via the new ket notation instead of the earlier notation.
We recursively define the random variable (called a ket) for each vector and deterministic number for each scalar in the program. For a vector produced by MatMul, we also define random variables and (called hat-ket and dot-ket respectively) such that . Their recursive definitions are given below.
If is generated by OuterNonlin as in Eq. 2.17, then
Every dot-ket is a linear combination of previous kets, expressed by the following equation
Eq. 2.19 is the same equation [45, Zdot] but formulated much more succinctly in the bra-ket notation:
The bra is really the “dual” of in the sense thatBut note this identity only holds when contains all vectors where depends on .
This follows from Stein’s lemma. In the language of Riemannian geometry, if we think of as a metric tensor in a Riemannian manifold, then is obtained from by “lowering the index.” Thus, a more appropriate notation for is perhaps
However, this “duality” is not essential for understanding this paper, so we keep the more intuitive notation instead.
Let be an initial matrix in a program. We define to be the linear operator on kets To be rigorous, we need to specify the “Hilbert space” of kets. This is somewhat pedantic and not crucial to the key points of this paper, but the Hilbert space can be constructed as follows: Let be the -algebra generated by the kets of the program . Let \Sigma(\pi)\mathrel{\raisebox{-1.29167pt}{\mathbin{\overset{\text{{def}}}{=}}}}\bigcup_{\pi^{\prime}\supseteq\pi}\sigma(\pi) be the union (more precisely, the direct limit) of over all programs extending . Then the Hilbert space in question is the space of random variables over the of our program. that acts by
Any linear operator that is equal to for some initial matrix is called an initial operator. A set of initial operators is called independent if their corresponding initial matrices are distinct.i.e., independently sampled in 2.6.3 or 2.6.4.
We have already seen an example of a linear operator on kets: expressions like . 2.6.7 puts in the same space as . This allows us to add them in the sequel, which simplifies the presentation of the -limit.
We can immediately see a few properties of by considering the counterpart when is finite.
For any initial matrix , the operator is bounded.i.e., there exists real number such that for any ket , .
This follows from the classical operator norm tail bounds on iid random matrices (see, e.g., ), which passes to the limit via 2.6.10 below. ∎
For any initial matrix, the operator is the adjoint“adjoint” in the sense of Hilbert space operators; see Footnote 24. of the operator .
i.e., is the adjoint of . ∎
6.4 The Master Theorem
Our key foundational result is that the Master Theorem of earlier Tensor Programs generalizes to programs. This underlies all of our theorems about adaptive optimization.
Consider a program with (Gaussian) 2.6.3 or (non-Gaussian) 2.6.4. Then, as , its scalars satisfy
7 Maximal Update for Deep MLP
In this section we describe the infinite-width limit of P for arbitrarily deep MLP. The main difference here compared to the shallow case (Section 2.5.1) is the presence of iid matrices in the middle of the network, which behaves like initial operators (2.6.7) in the limit.
Consider any training routine (2.3.1) with memoryless stationary update function (2.1.1). Adopt 2.3.2. As , converges almost surely to some for every , which is recursively defined from by the following dynamics: We remind the reader that, in P (2.5.1), is the output layer weights normalized so that has -sized entries (whereas ). The same point applies to (but ). We use lower case for input and output weights while upper case for other layers to emphasize that the former are vector-like parameters (one dimension going to ) while others are matrix-like (two dimensions going to ).
(Initialization) are independent initial operators (2.6.7), and
One can check that when , we recover 2.5.2.
Here, Eq. 2.21 uses the operator semantics discussed in and below 2.6.7 to cleanly express the parameter update. When unwinded, Eq. 2.21 is equivalent to
The proof of 2.7.1 and 2.5.2 can be found in Section 3.2.
Observe that all of the equations above are essentially the “ket” versions of what one does in a finite network. This holds for general architectures: the -limit can always be obtained straightforwardly transcribing the tensor operations in a finite network to their counterparts acting on kets in the infinite-width limit. See 2.9.25. In this sense, P is the most natural parametrization.
As before, the general case without stationarity or memorylessness is straightforward given 2.7.1, albeit with some more notation.
If is memoryless but not stationary, then 2.7.1 holds if the bars in Eqs. 2.21, 2.20 and 2.22 are interpreted as (where is the same as the layer index appearing in or on the LHS).
If is not memoryless, then 2.7.1 holds if Eqs. 2.21, 2.20 and 2.22 are replaced with
2.5.2 and 2.5.3 also hold if the output dimension is greater than 1, but the equations need to be interpreted slightly differently. See Eq. 2.35.
For SGD, showed P is the unique stable parametrization where every weight matrix is updated maximally [45, Defn 5.2] and the output weight matrix is also initialized maximally [45, Defn 5.4]. These definitions still make sense here and this statement holds as well if “stable” is replaced with “stable and faithful” (2.8.7, 2.8.8).
8 Dynamical Dichotomy: The Classification of abcd-Parametrizations
In this section, we characterize the infinite-width limits of all possible abcd-parametrizations under reasonable assumptions of the optimizer and network nonlinearity, generalizing the work done for SGD in . First, we filter out the uninteresting limits: the unstable (training blows up), the trivial (training gets stuck at initialization), and the unfaithful (the update functions and/or nonlinearities are trivialized). We sort all other limits into a Dynamical Dichotomy (2.8.20) between feature learning and operator regimes (the latter being the nonlinear version of kernel regime in the SGD case). The and NT limits are respectively their archetypes (indeed, the maximal parametrizations in these regimes (LABEL:{rem:maximality})). Like in the SGD case, this dichotomy is not tautological: it implies certain network training dynamics cannot be the infinite-width limit of any abcd-parametrization (2.8.24). Likewise, pretraining is still futile in the operator regime even with adaptive optimizers (2.8.22).
Our results here hold for not only memoryless stationary but also memoryful nonstationary updates.
For proving the Dynamical Dichotomy Theorem for entrywise updates, we will make the following technical assumptions. Roughly speaking, we will focus only on “relu-like” nonlinearities and sign-preserving update functions with mild smoothness.
and are nonnegative and pseudo-Lispchitz.
is pseudo-Lipschitz for all , and preserves sign for all .
As in , the pseudo-Lipschitzness of are sufficient for letting us use our new Master Theorem (2.6.10) to take the limits of any parametrization, get the operator limits, and prove their properties. Any assumptions beyond such is required only for proving that implies feature learning (3.1.3). In particular, the reason we only require to preserve signs (instead of for all ) is because we will only need to show that features evolve in the first step.
8.2 Size of Feature Learning
In , the number of an abc-parametrization measures how much the features change over training. We adapt its definition to abcd-parametrizations.
Morally, in any “reasonable” abcd-parametrization (in the sense of stable (2.8.7) and faithful (2.8.8) discussed below), we have and , where is the cumulative change of . Concretely, for NTP and P we have, for all ,
The reader should sanity check that and are invariant to the symmetry in Eq. 2.5.
Ostensibly, 2.8.5 is different from and much simpler than [45, Defn 3.2] for abc-parametrizations. But, in fact, they are equivalent for stable and faithful abcd-parametrizations (under the reduction Eq. 2.6 to abc-parametrizations). The comparative simplicity of 2.8.5 is also due to the faithfulness.
8.3 Stability and Faithfulness
We will only care about any parametrization satisfying two basic properties: 1) does not blow up during at initialization or during training as width and 2) does not trivialize the update functions . The former property is known as stability and has already been studied in for SGD. The latter is specific to nonlinear entrywise updates, and we will call this the faithful property. By “trivialize,” we mean that the input to is either i) too small and thus linearizing around the origin or ii) too large and only depends on ’s behavior “around infinity”. Both scenarios ignore the bulk of ’s values as a function. If such behaviors are actually desired, then one can change to such effects. For example, the linearizing behavior in case i) can be implemented by choosing a linear and modifying appropriately so that the input to has constant typical size (wrt width).
Recall from Section 1.2.3 the entry-wise semantics of big-O notation. We formalize the stability and faithfulness properties below.
We say an abcd-parametrization of an -hidden layer MLP is
stable during training if for any training routine, any time , , we have
We say the parametrization is stable if it is stable both at initialization and during training.
We say an abcd-parametrization is faithful at time if the input to is for every . We also say it is faithful at initialization if this is true at .
The condition in Eq. 2.24 is in truth more of a “faithfulness to ” condition than just stability (which would strictly speaking be more like than ). But we never need to distinguish these notions, so following , we will keep the definition as is.
Adopt 2.8.2. An abcd-parametrization is stable at initialization iff
This condition is the same as [45, Thm H.6(1)]. For example, SP, NTP, and P are all stable at initialization. In this situation, some easy calculation shows that, at initialization, the last layer gradients have entry size and while all other layers’ gradients have entry size . Hence,
In Lemma 2.8.10, the abcd-parametrization is furthermore faithful at initialization iff
For example, NTP and P are faithful at initialization but SP (2.2.2) is not (but if is scale invariant then SP is equivalent to a faithful parametrization).
Adopt 2.8.2. Suppose, at initialization, an abcd-parametrization is both faithful and stable. Then it remains so for all iff
In words: 1) for all ensures the features do not blow up, while 2) and resp. ensure that , so does not blow up;Recall is the cumulative change of . finally, 3) ensures that does not change scale after updates, since otherwise the in Eq. 2.26 is no longer faithful.
One can check that 2.8.12 reduces to [45, Thm 3.3] (the stability characterization of abc-parametrizations) plus the additional constraint that for all (which is imposed by in Eq. 2.27). As remarked above, this constraint is due to the faithfulness requirement. But in fact, if we allow to vary during training, then this constraint can be removed and the appropriate version of 2.8.12 would be equivalent to [45, Thm 3.3].
8.4 Nontriviality
Even among stable and faithful parametrizations, we are only interested in nontrivial parametrizations (as in ), where in the infinite width limit the network will not be stuck at initialization during training.
Nontriviality is characterized by a disjunction of equations in , just as for SGD in .
Adopt 2.8.2. A stable and faithful abcd-parametrization is nontrivial iff
This is essentially equivalent to [45, Thm 3.4]. For example, NTP and P are both nontrivial.
8.5 Feature Learning and Operator Regimes
Finally, we ask: what are the different possible behaviors among the nontrivial, stable, and faithful parametrizations? As in , we will see a dichotomy between feature learning and a nonlinear version of the kernel regime which we call the operator regime.
For memoryless, nonstationary updates, we allow to depend on . For general entrywise updates, we make the same definition if for all ,
Notice that the operator regime is defined solely in the function space, without talking about the internals of the network, in contrast to feature learning.
We say an abcd-parametrization of an -hidden layer MLP admits feature learning in the th layer if there exists some training routine such that
for some . We say the parametrization admits feature learning if it does so in any layer.
We say the parametrization fixes the th layer features if for all training routine,
for all . We say the parametrization fixes all features if it does so in every layer.
We make similar definitions as above replacing feature with prefeature and with .
We say an abcd-parametrization of an -hidden layer MLP evolves the th layer feature kernel if there exists some training routine such that
for some . We say the parametrization evolves feature kernels if it does so in any layer.
We say the parametrization fixes the th layer feature kernel if for all training routine,
for all . We say the parametrization fixes all feature kernels if it does so in every layer.
We make similar definitions as above replacing feature with prefeature and with .
8.6 Classification of abcd-Parametrizations
The classification of abcd-parametrizations is similar to that of abc-parametrizations [45, Thm H.13]. We remind the reader that this holds for not only memoryless stationary but more generally memoryful nonstationary updates.
Adopt 2.8.2. Consider a nontrivial, stable, and faithful abcd-parametrization of an -hidden layer MLP. Then
feature kernel evolution in the th layer
prefeature kernel evolution in the th layer
fixes prefeature kernel in the th layer
If there is feature learning or feature kernel evolution or prefeature learning or prefeature kernel evolution in layer , then there is feature learning and feature kernel evolution and prefeature learning and prefeature kernel evolution in layers .
Consequently, we can generalize Dynamical Dichotomy to (nonlinear) entrywise updates.
A nontrivial, stable, and faithful abcd-parametrization either admits feature learning or is in the operator regime, but not both.
Of course, the canonical examples here are P in the feature learning regime and NTP in the operator regime. In the SGD case, LABEL:{thm:abcdclassification} and 2.8.20 are equivalent to their counterparts [45, Thm H.13, Cor H.14] other than a minor technical difference as discussed in 2.8.13.
The and NT limits are resp. the “maximal” limits in the feature learning and operator regimes, in the sense that all parameter tensors contribute to the function update, and that any other limits in those regimes are just “downgrades” of and NT limits by zeroing out the initialization or learning rate of some parameters. See also 2.7.5.
[45, Thm H.17] holds almost verbatim in our case as well, after replacing “stable” with “stable and faithful” and “kernel regime” with “operator regime”: Finetuning any pretrained network in the operator regime would be equivalent to finetuning a randomly initialized network. Thus, pretraining in the operator regime is useless.
In the memoryless stationary case, an operator regime limit resides solely in the function space picture, i.e. being solely determined by the function values themselves (as opposed to the internal activations of as well) along with learning rate and error signals . However, as in [45, Remark 3.11], this is not true of any feature learning limit because one can construct counterexamples where are close for two infinite-width limits but are far.
Compared to the kernel regime in the SGD case, the operator regime now allows nonlinear evolution in the function space picture. Nevertheless, in such dynamics, must be linear in for every . Thus, any function space evolution nonlinear in cannot be the infinite-width limit of any entrywise optimizer.The same holds for any adaptive optimizer with ingredients discussed under Optimizer Coverage of Section 2.1. For example, is not a valid limit.
[45, Sec G] identified a subclass of abc-parametrizations, called uniform parametrizations, where all layers “learn the same amount of features” and the output layer is initialized and updated maximally. This is used in to give an alternative presentation of P as well as discussion of joint width-depth limit. This notion also makes sense for abcd-parametrizations: For every , there is a unique stable and faithful abcd-parametrization, called UPs such that for all and and . For example, UP0 is P and UP is NTP.
9 Infinite-Width Limits for Any Architecture
Having written down the infinite-width limits of adaptive optimizers for MLPs, we now turn to general architectures. An astute reader may have already absorbed the key insights from the previous sections and can use them to derive the NT or limits for each new architecture in an ad hoc fashion. In contrast, here we describe the algorithm to do this once and for all, uniformly for all “reasonable” architectures. This uniformity of course requires abstraction, which is not conducive to quick comprehension; on the flip side, this algorithm will always be here for someone to fall back to if the ad hoc approach does not work out.
The main work here is not the proofs (which can be easily adapted from the MLP case and so are omitted), but the definitions: What is an architecture? What architecture counts as “reasonable”? How to define abcd-parametrization for any such architecture? What are their infinite-width limits? Answering these questions in the most generality requires careful thought.
As demonstrated in , 2.9.1 covers essentially every architecture in practice: RNNs, residual network, transformers, etc.
In this definition, only the symbolic structure of the program matters; the random sampling of 2.6.3 and 2.6.4 plays no role.
For simplicity, we only considered the case when the notion of “width” is the same throughout the network. Nevertheless, this definition can be easily modified to cover the nonuniform case, but stating it would be much more complex.
In truth, we could have phrased 2.9.1 using instead of , since we do not know of any neural network in the wild that is not -representable ( is only required for expressing adaptive optimization like Adam). But there is little cost in stating the more general version, which can potentially matter in the future.
also defined a notion of representable functions using . In comparison, our definition is much more general: Beyond the superficial difference of here vs there, dealt with input and output layer weights in special ways, whereas here we do not, instead opting to uniformly deal with scalar, vector, and matrix parameters. The input and output weights of are vector parameters in this view.
The -hidden-layer MLP in Eq. 2.3 has vector parameters (where corresponds to input dimension and corresponds to output dimension) and matrix parameters. It is represented by the program that generates 1) using OuterNonlin and using MatMul; 2) using OuterNonlin; and 3) generate function output by summing (so we can take in 2.9.1 to be ).
9.2 abcd-Parametrization for Any Architecture
We parametrize as for actual trainable parameter ;
We initialize each entry of iid from ;
The learning rate is for some width-independent ;
The gradients of are multiplied by before being processed by : i.e., the update at time is
where , are the gradients of at time and is applied entrywise;
As always, we are only concerned with scaling with here, but there can be a tunable constant hyperparameter in front of every power of in 2.2.1.
The random initialization in 2.9.7 is always mean-zero. For some applications, such as layernorm/batchnorm weights (that is initialized as all 1s), this may seem insufficient. However, one can just refactor the parameter: For this particular example, we can refactor where is the initial vector of the program . can then be initialized as for some tunable constant hyperparameter (which is set to 0 by practitioners typically).
NTP and P naturally generalize to general representable architectures.
In comparison to their counterparts for MLP, the NTP and P above consider scalar parameters (which are not present in the MLP in Eq. 2.3). Otherwise, 2.4.1 can be recovered from 2.9.11 by mapping the columns to “matrix,” to “vector,” and to “vector” but with the value of taken from the “out” column. 2.5.1 can be recovered likewise from 2.9.12.
Before we formulate their limits, we need to discuss how to construct the “backpropagation” of an arbtrary of program.This has been constructed previously for programs in .
9.3 Interlude: Backpropagation and Total Programs
Consider any program and a vector in . Then ’s backpropagation program wrt is an extension of defined by constructing the following objects on top of : (Intuitively, one should interpret if is a vector and if is a scalar.)
For any MatMul instruction in , we construct (via another MatMul)
Suppose . For each , let
Finally, for every vector or scalar in other than ,
where ranges over all vector or scalar in whose construction used .If this sum is empty, then the RHS is set to 0.
The subprogramThe notion of subprogram is formally defined in [44, Defn I.1]. Roughly it means a contiguous subset of instructions in the program. constructing all of these new objects is denoted (so that the backpropagation program is ).
Recall ([44, Defn I.1]) that “” (as in “”) signifies the concatenation of programs.
If in OuterNonlin (i.e., we just have a Nonlin+ instruction), then the formulas simplify to
Consider a representable architecture with representation . Gather all of ’s backpropagation programs wrt into a single (large) program:
whose initial data are the scalars, vectors, and matrices corresponding to in 2.9.1; they are shared among all subprograms . We call the total program of .
9.4 Training Setup
Assume and for all are pseudo-Lipschitz and all nonlinearities used in the representing program has pseudo-Lipschitz derivatives.
9.5 Neural Tangent Limit
where the “bar” notation abbreviates application of as in Eq. 1.2 and all kets and bras are evaluated in (2.9.16) via 2.6.5. To interpret these formulas, we need to tell you two things:
1) Ranges of arguments. Here, ranges over all matrix parameters and over all vector parameters of , and all kets are calculated from by sampling matrix parameters from and vector parameters from .Again, we can insert hyperparameters like and , but for simplicity we omit them here. The sum in Eq. 2.32 sums over all vectors in satisfying and (potentially and ).
Consider a representable architecture with representation and any training routine in NTP (2.9.11) with memoryless stationary update function . Adopt 2.9.17. Further assume
for every input and output index at initialization.More precisely, the ket is evaluated in (2.9.16) via 2.6.5.
Recall denotes the function after steps of updates from random initialization. Then
Note Simple GIA Check may not be satisfied in general architectures, so that we cannot necessarily calculate kets like by assuming matrix parameters and their transposes are independent (even if no transposes occur in ), e.g., ignoring in our calculations. Nevertheless, 2.9.19 still holds if one calculates correctly using the rules of 2.6.5.
Assumption 39 ( being mean zero) in 2.9.19 is obviously necessary for us to arrive at a Gaussian Process limit at initialization. Assumption 1 is also necessary for two reasons: 1) at initialization, random initialization of scalar parameters would make the initial process a mixture of Gaussian processes (or a GP conditioned on the values of scalar parameters). Even if the scalar parameters are deterministic, the gradient wrt scalar parameters will also be a random process (possibly correlated to the process of the function) at initialization. 2) Function space picture (c.f. 2.8.23 and [45, Remark 3.11]) would no longer hold: One cannot track the evolution of the solely by knowing what it is at time . Instead, one would need to track the values of the scalar parameters and their gradients as well. So in a sense we will have a “function space + scalar parameters” picture. The complete evolution of can then be described by a) the joint process of the function output, scalar parameters, and their gradients at initialization, together with b) an evolution equation involving how they evolve given their previous values in time. This is similar to .
As before, with some more notation we can write down the NT limit for any representable architecture.
where is shorthand for and is shorthand for
With this in mind, the following theorem yields the NT limit of Adam (Eq. ) as a corollary.
If the update functions are memoryless but not necessarily stationary, then 2.9.19 holds with Eq. 2.36 replaced by
For general , not necessarily memoryless, 2.9.19 holds with Eq. 2.36 replaced by
9.6 Maximal Update Limit
Given a representable architecture, the representing program describes the symbolic procedure for computing the output of the network given an assignment of the input and parameters to concrete values. This procedure is well defined for any network width (by construction). Naturally, it remains well defined as explicitly spelled out below even when we “pass to the infinite-width limit.” In short, 2.9.24 specifies what it means for a program to compute something given an assignment of the input and parameters to concrete infinite-width limits (e.g., kets and operators).
For any program and a vector in , can be thought of as a function, defined via 2.6.5, of where range over the initial matrices, vectors, and scalars respectively. Consider an assignment that assigns an operator to each initial matrix , ket to each initial vector , and a deterministic number to each initial scalar . Then we write
for , and computed using this assignment (i.e., swapping out for , for , and for ).
where we write for each initial matrix , for each initial vector , and for each initial scalar .so that and are just redundant affirmations of the “shape” of , rather than saying is some object in some program and or are their “limits.”
Consider a representable architecture with representation and any training routine in P (2.9.12) with memoryless stationary update function . Adopt 2.9.17.
Then for each , converges almost surely to computed from the following.
(Forward and Backward Propagation) Let be the assignment that assigns to each matrix parameter , to each vector parameter , and to each scalar parameter .
Here is the multi-vector consisting of evaluated on all inputs, and all kets and limits are calculated in via 2.6.5.
where the tensor operations and summation over should be interpreted as in 2.9.18.
(Initialization) \{\hstretch{0.7}{\talloblong}W_{0}\hstretch{0.7}{\talloblong}:\text{matrix parameterW}\} is a set of independent initial operators. Additionally,
Here, we used the notation for matrix, vector, and scalar parameters, in contrast to and for vector and scalar generated by the program . The former are exemplified by weights while the latter by (pre)activations.
In the MLP case with program given in Eq. 2.3, there are no generated scalars, so we can ignore Eq. 2.44. The generated vectors (in ) are and as well as their error signals . So Eq. 2.43 reduces to the 2nd and 3rd rows in 2.7.1(1). Finally, the function output is given by averaging , so the in Eq. 2.42 reduces to in 2.7.1(1).
As discussed in 2.7.2, P is in a sense the most natural parametrization because its infinite-width limit is just a direct “ket-translation” of the finite-width computations, no matter the architecture. Compare this with NTP, where the Gaussian process and kernel behaviors can only happen under some relative restrictive conditions, like “no scalar parameters” (2.9.19 and 2.9.21).
In the -limit for a general architecture, no longer needs to be 0, unlike 2.7.1. For example, if in an MLP with relu activation, the output is given by the average entry of the last layer activation vector, then obviously will always be positive.
If is memoryless but not stationary, then 2.9.25 holds if the bars in LABEL:{eqn:muP_op_update_general}, LABEL:{eqn:muP_ket_update_general} and LABEL:{eqn:muP_scalar_update_general} are interpreted as and .
If is not memoryless, then 2.9.25 holds if LABEL:{eqn:muP_op_update_general}, LABEL:{eqn:muP_ket_update_general} and LABEL:{eqn:muP_scalar_update_general} are replaced with
10 Extensions
Consider the update equation (Eq. 2.4) with decoupled weight decay :We will assume all layers have the same , for simplicity. The generalization to layer-specific is straightforward.
This decoupled weight decay is equivalent to a traditional weight decay value . It’s obvious that should be invariant to the width : if with , then eventually; if with , then weight decay has no effect in the limit.
The theory in this section covers AdamW , SGD with weight decay, and so on.
2.7.1 holds with Eqs. 2.20, 2.21 and 2.22 replaced with
With decoupled weight decay , 2.4.7 holds with the update equation Eq. 2.9 replaced by
For memoryless nonstationary updates, interpret the bar as . For memoryful nonstationary updates, replace the nonlinear outer product with (c.f. 2.7.3 for the notation).
Note that when , is invariant to as are , and this exponentially weighted sum just reduces to a simple sum and thus to Eq. 2.9.
In the memoryful case, interpreting the bar in 2.10.3 as Eq. yields the NT limit of AdamW. The limit theorems (2.9.19 and 2.9.23) for general architecture also hold with analogous modifications.
10.2 Update Clipping and Normalization
We now add update clipping or normalization to Eq. 2.50:Traditionally, gradient clipping for SGD clips the norm of the entire gradient (for the whole network). Naively, one would just do this before applying the update function . However, in Adam, for example, this would be meaningless because of Adam’s normalization. For general , the terms can be trivially adjusted according to how the global gradient norm scales. So this notion of clipping or normalization (before ) is not very interesting.
if we are doing update normalization, then we set ;
if we are doing update clipping, then calculate additionally where is a threshold hyperparameter for layer .
Some recent works normalize the update by the current weight (Frobenius) norm instead of by the update norm. We explore its implications in LABEL:{sec:normbycurrentweightnorm}. For now we focus on the formulation above.
How should the abcd values adjust to update clipping and normalization?
What do the neural tangent and maximal update limits look like?
How should the threshold hyperparameter scale with width ?
The key intuition is as follows: In all “reasonable” parametrizations (more precisely, faithful ones (2.8.8)), is entrywise . Thus, its norm scales like , as can be verified via the Master Theorem (2.6.10). For example, for the input and output weights of the MLP (Eq. 2.3), this is , while for the hidden weights, this is . Therefore, for update clipping, the threshold should be
for some tunable hyperparameter independent of width. Otherwise, either the clipping has no effect (if is larger than this) or after update clipping is always equal to the threshold (if is smaller than this).
At the same time, should be smaller than if there is no update normalization or clipping (i.e., the learning rate should be larger). Thus, for example,
The NTP with update normalization or clipping is
where update clipping thresholds scale as in Eq. 2.55.
The P with update normalization or clipping is
where update clipping thresholds scale as in Eq. 2.55.
Likewise, the classification of parametrizations in Section 2.8 hold for update normalization or clipping if we replace all mentions of in Section 2.8 with . For example,
With update clipping or normalization, we redefine
Then still and it remains that for NTP (2.10.4) and for P (2.10.5) with the new definitions above.
For general architectures, there is one for every parameter tensor , and should be set to and respectively for scalar, vector, and matrix parameters. Then the obvious generalization of the above discussion holds.
Similar statements hold for other -limit theorems, including those in general architectures.
Now suppose in Eq. 2.54, we normalizd by the current weight norm instead, i.e.,
For simpicity, assume the weight decay is zero; our conclusion will turn out to hold even when this is not the case.
for any as .The fact that is essentially really implies that this is not the right quantity to normalize or clip the update by. For example, other norms (like spectral norm) does not have this property and could be better suited (if we ignore the computational issues for the moment). As another example, if Frobenius norm is desired, we should perhaps want to normalize by instead of . So (in fact, ).
In contrast, for the input layer weight , we have (entrywise and in Frobenius norm) in a stable parametrization. If the parametrization is furthermore faithful (2.8.8), then for , this is true as well (c.f. 2.8.13). So and are both (but generally) and in both cases.
Therefore, if we subtract from in Eq. 2.55, then all discussion above applies. For example, the parametrizations for current weight norm can be obtained by adding the row to the row.
The NTP with update normalization or clipping with current weight norm is the same as 2.10.4.
The P with update normalization or clipping with current weight norm is
where the clipping thresholds scale as .
The limit equations for P in this case is just Eqs. 2.56, 2.57 and 2.58 but with the tilde interpreted as dividing by , , and respectively. Similar modifications apply to the NT limits.
Likewise, the classification of parametrizations hold if we replace each with .
We have assumed that the weight decay is 0 at the beginning. In the general case, define instead, but the same calculations will yield the same conclusions.
10.3 Second Moment Factoring ala Adafactor
The key observation here is that, even though the factored update function is not entrywise anymore, the update itself is still a nonlinear outer product of and (with some scalars variables inserted in an appropriate program), All of our theory in fact holds as-is for this more general kind of update function, since they all factor through the OuterNonlin instruction of .
10.4 Future Optimizers
As technology advances, we may get better optimizers of very different forms than we discussed here. But we can quite reasonably expect them to continue to efficiently utilize GPUs, i.e., perform large matrix-multiplies. As such, these optimizers can always be analyzed in a Tensor Program. So the lesson is: as long as one understands Tensor Programs, one can always derive the correct way of scaling an optimizer (with width).
11 Proof Sketch
programs equipped with their Master Theorem (2.6.10) provide the main tool to all of our rigorous results. For example, to prove the neural tangent or limit equations, one can: express the optimization dynamics using a program, mechanically compute the kets according to 2.6.5, and apply 2.6.10 to compute the limit (see full proofs in Sections 3.2 and 3.3). What remains is to prove 2.6.10 using a strategy which we now outline.
To prove this core insight, there are two parts.
We show that, in any program (i.e., a program with no scalar variables and no Tensor operation), is dequivalent to . This can be done by re-analyzing the proof of the Master Theorem in in a fairly straightforward way.
For any program (the subject of our work here), we construct a parallel program (4.8.1) and show, by induction, that the vectors of the two programs are dequivalent (i.e., distributed exactly the same after subtracting “small” vectors). This parallel program essentially replaces 1) all scalar variables in the original program by their deterministic limits, as computed in 2.6.5(Avg), and 2) all OuterNonlin operations by Nonlin operations, as computed in 2.6.5(OuterNonlin), so that the corresponding vectors of these programs share their kets. Then, by Part 1 above, we will have proven dequivalent to for the original program .
Chapter 3 Proofs of Infinite-Width Limits
Here we prove the classificatioon of abcd-parametrizations as well as the NT and -limit equations, assuming the Master Theorem (2.6.10).
Here we seek to prove the main claims of Section 2.8: 2.8.19, 2.8.15, and 2.8.12.
The proof is a straightforward modification of the proof of [45, H.13]. The main subtle point is how implies Item 1 of 2.8.19 (Item 4(a)iii in the proof outline below). The reasoning for this in is very specific to SGD and the activation functions tanh and (smoothed) relu. Here, we adopt a different logic, given in Section 3.1.4 and 3.1.3, based on the “asymptotic relu-ness” of the nonlinearity.
On the other hand, the implication of Item 2 in 2.8.19 by is similar to , adapted naturally to general functions, so we omit the full proof here. However, we provide the derivation of the NT limit in Section 2.4, which gives an instructive example of the proof for general operator regime parametrizations.
In the sequel, we provide full details of Items 4(a)i and LABEL:{item:r=0} of the outline below. All other steps in this outline are straightforward adaptations of or easy in a self-contained way.
The characterization of stability at initialization (Lemma 2.8.10) is already proven in [45, Thm H.19]. So assume stability at initialization from here on.
Some simple calculations then verifies the characterization of faithfulness at initialization (Lemma 2.8.11). So assume faithfulness at initialization from here on.Note this effectively fixes given , so that the abcd-parametrization now has the same degrees of freedom as an abc-parametrization. This is a sanity check for why we can adapt most of the arguments from .
If , then it’s easy to see that we lose faithfulness after 1 step of update (because the input to is ).
First, assume that for all and . (i.e., we assume Eq. 2.27)
Then we can build a program computing the network evolution (which we do in Sections 3.1.1 and 3.1.2). The Master Theorem yields its infinite-width limit, described in Section 3.1.3, which will be obviously stable and faithful (Lemma 3.1.2).
If , then, by adapting the corresponding reasoning in , it’s easy to derive all properties in 2.8.19(2), as well as the validity of 2.8.15 (assuming ). We derive the NT limit in Section 3.3 as an example.
If , then the reasoning in cannot be straightforwardly adapted. In Section 3.1.4, using a different method based on “asymptotic relu-ness” of the nonlinearity (2.8.2), we prove all properties in 2.8.19(1,3,4), the validity of 2.8.15 (assuming ), and the fact that we are not in operator regime.
Suppose for some , and is the smallest such . Then the infinite-width limit derived above up to time 1, layer shows that for some choice of and training routine, so we lose stability.
Otherwise, if or , then the infinite-width limit derived above up to time 1 shows that , so we lose stability as well.
Combining all caseworks, we 1) derive the nontriviality condition 2.8.15; 2) see Eq. 2.27 is necessary for faithfulness and stability as well, proving 2.8.12; and 3) prove 2.8.19.
1.1 Program Setup
In Sections 3.1.1, 3.1.2 and 3.1.3, we implement Item 4(a)i: we construct the Tensor Program that encodes the training of an -hidden layer MLP under an abcd-parametrization satisfying Eqs. 2.25, 2.26 and LABEL:{eqn:stable_faithful} and take its infinite-width limit. For the most part, they are straightforward adaptations of [45, Sec. H.3-H.5]; nevertheless, we show full details to demonstrate the usage of the new language and its Master Theorem (2.6.10).
In this section, we first describe the initial matrices, vectors, and scalars of the program, along with necessary notations.
For ease of presentation, we assume the input dimension . The general case is a trivial adaptation.
Initial matrices: , sampled like .
Initial scalars: We define the following scalars (where we explain the intuition in parenthesis). The reader can skip this part on a first read but come back when referred to.
( times the scale of coordinates of ) For , define
(scale of coordinates of and ) Define
(scale of coordinates of )
(scale of and ) For , define
Note that with defined in 2.8.5.
Depending on the the value of , we will also construct the values of at initialization as initial scalars. See Section 3.1.2 for an explanation.
Eq. 2.27 implies all of these s either converge to 0 or stay constant at 1. This means that, assuming appropriate regularity conditions on the nonlinearities and rank stability, we can apply the Master Theorem (if blows up to then we can’t do that).
We use to more clearly denote assignment happening in the program, as opposed to mathematical equality. To clearly demonstrate the application of OuterNonlin, we will rewrite expressions in the form
This is the order-2 form of Eq. 2.17. We also write
This is the order-1 form of Eq. 2.17. All usages of OuterNonlin in the program below will be through (majority of cases) and (only when weight updates are involved). This program will not use OuterNonlin order higher than 2.
In the program, for each , we will construct vectors to mathematically represent (intuition: change in scaled to have coordinates). Similarly, for , we will construct to mathematically represent (intuition: change in scaled to have coordinates). Then, mathematically, .
We will also construct to mathematically represent (intuition: gradient scaled to have coordinates). For weight changes, we have the following identity
Here, the 2nd equality of each block is due to our assumption of Eqs. 2.25, 2.26 and LABEL:{eqn:stable_faithful} (see discussion at the start of this section), which means for all above and .
1.2 Program Construction
Here we construct the Program encoding the training of an MLP. We separately describe the first forward and backward passes followed by the later forward and backward passes.
We compute via and then construct the following multi-vectors via and MatMul respectively:
The distribution of conditioned on is given by
where is shorthand for , is an iid copy of , and is the orthogonal projection into the orthogonal complement of the column space of (and denotes the pseudo-inverse transpose as usual).
By standard formulas for pseudo-inverse and orthogonal projection, we can write
If we further define \bm{\gamma}\mathrel{\raisebox{-1.29167pt}{\mathbin{\overset{\text{{def}}}{=}}}}\bm{x}^{\top}\widetilde{W}_{0}^{L+1}/n, then
Thus, the mathematical conditioning done in Eq. 3.9 is achieved programmatically as follows:
We introduce as an initial vector and (the value of ) as initial scalars
We introduce as a multi-scalar via ( followed by Avg)
We introduce as a multi-scalar via ( followed by Avg)
We replace (an initial vector) in the program with (the non-initial vector)
constructed using .recall from Eq. 3.2.
For the above reason, we will assume , and remark whenever the case involves subtleties.
where is the -dimensional vector of all 1s, recall, mathematically equals .
The error signal at the output is expressed using followed by Avg as in Lemma 2.6.2.Here, if ; otherwise, is the we conditioned on in Eq. 3.9.
to represent the (normalized) change in due to the first gradient step.
We iteratively define to mathematically represent , for . Then we eventually set
Likewise, we will define so that . In the program, we will not directly use but instead use its normalized version
where . Mathematically, .
We start with : By Eq. 3.7, we have
For higher layers, if for brevity we write , , and , then . By Eq. 3.6, we have, mathematically,
Recall . We construct
If , , then , and (using (Eq. 3.1)),
where the function in is precisely the difference quotient for the function .The pseudo-Lipschitzness of assumed in 2.8.2 implies that the nonlinearity (the difference quotient function) represented by here is pseudo-Lipschitz, so that we can ultimately apply our Master Theorem.
We do not construct directly, but rather through scalars , so that
Mathematically, , but we shall write it slightly differently in the program:
where and is constructed in Eq. 3.10.
(i.e., outer product between the vector and the vector ).
For each for and for , we also calculate
Using Lemma 2.6.2, we define the error signal
Finally, we compute the (normalized) change in after this update as in Eq. 3.5.
1.3 The Infinite-Width Limit
In this section, we describe the kets (2.6.5) corresponding to the vectors of the program constructed above. According to the Master Theorem, each such vector will have roughly iid coordinates distributed like in the large limit.
Let denote the limit of any in Section 3.1.1. If pseudostability holds, then is either 0 or 1, as one can easily verify. We can construct the kets for each vector in the program, as follows.
For the first forward and backward passes, we have,
For , we have where is the nonlinearity represented by Nonlin1 in Eq. 3.12. If (e.g. if ), then
Otherwise, (e.g. if ), and
where the bar notation abbreviates .
For , we have
As usual, we can decompose by 2.6.5.
where is the multi-vector . Here we simplified because only depends on among previous vectors.
(where the bar notation abbreviates ) and
where if (3.1.1); otherwise (), equals the value (from the initial NNGP) we conditioned on (as specified in the discussion above 3.1.1).
From this description of the infinite-width limit, it’s clear that the resulting dynamics is both faithful and stable.
Eqs. 2.25, 2.26 and LABEL:{eqn:stable_faithful} imply stability and faithfulness.
1.4 r=0𝑟0r=0 Implies Feature Learning
In this section, we implement Item 4(a)iii of the proof outline.
Adopt 2.8.2. Consider a parametrization satisfying Eqs. 2.25, LABEL:{eqn:faithful_init}, LABEL:{eqn:stable_faithful} and LABEL:{eqn:nontrivial}.For reader’s convenience, these equations are resp. the proposed conditions for stability at init, faithful at init, stable and faithful throughout training, and nontriviality.
If , then the following are true of this parametrization:
feature kernel evolution in the th layer
prefeature kernel evolution in the th layer
if there is feature learning or feature kernel evolution or prefeature learning or prefeature kernel evolution in layer , then there is feature learning and feature kernel evolution and prefeature learning and prefeature kernel evolution in layers .
WLOG, assume where the sole input is nonzero; our construction will work obviously for general by masking the error signal . Correspondingly, we use notation instead of , etc.
We will show that as learning rate , , so that and for sufficiently large . This would imply (pre)feature kernel evolution and (pre)feature learning of the parametrization. In addition, we will show that (output of function after 1 step of update) asympotically grows like for some . If , then the dynamics cannot satisfy the the operator equation Eq. 2.29, which is linear in . If , then we can calculate that , so that the update is not perfectly linear in , violating Eq. 2.29, so we are not in the operator regime. The other claims will also naturally follow over the course of the proof.
This reasoning should work for “generic” activations. However, for concreteness, we impose the conditions of 2.8.2 to be able to easily prove that certain pathological behavior cannot happen where certain inner products vanish, such as , allowing this reasoning to become rigorous.
This already implies that scales like and scales like in , so the (pre)feature kernel evolves.
By Eq. 2.28, either (last update is maximal) or (last layer initialization is maximal).
If the last layer update is maximal, then its contribution to the output has the property
If the last layer initialization is maximal, then its contribution to the output has the property
by Stein’s lemma and Lemma 3.1.5. This means the contribution scales like in .An important role of 2.8.2 is to prevent pathological cases where the above expectations vanish.
Thus, the output of the function scales either like or . This means that, if the last layer update is maximal or is not among the discrete set of values where , then does not scale linearly in .
If the last layer update is not maximal and takes one of such values (such as when for exactly one ), then one can calculate
which means that is not perfectly linear in .
In either case, Eq. 2.29 cannot be satisfied.
The above proof (especially the section on “Output scaling”) in fact also yields the following.
If Eq. 2.28 is not satisfied in 3.1.3 (but is still 0), then the parametrization is trivial.
The significance of the positivity and sign preservation properties in 2.8.2 is that they allow us to apply the following lemmas in our reasoning.
Again, here takes value in .
In the language of kets, this implies: For nonnegative kets and any ket ,
is 0 almost surely if but otherwise satisfies
2 Proof of Maximal Update Limit
In P (2.5.1), all of the s in Section 3.1.3 will equal 1. Some straightforward simplifications then lead to 2.5.2 for the shallow case and 2.7.1 for the deep case. (We made some simplification in notation as well: in 2.7.1 corresponds to in Section 3.1.3 and in 2.7.1 corresponds to in Section 3.1.3)
3 Proof of Neural Tangent Limit
In this section, we prove LABEL:{thm:memorylessNTK} by specializing the limit formula in Section 3.1.3 above for general abcd-parametrizations.
In NTP (2.4.1), all equal (Eq. 2.23). In particular, from Eq. 3.13, we see that
for all and all . Likewise, from Eq. 3.19, we see that
In addition, plugging in the NTP values of abcd to Eqs. 3.14, LABEL:{eq:Zdelh} and LABEL:{eq:delflimit} gives
To show 2.4.7, we need to calculate and show it equals .
There are two contributions to from Eq. 3.25. We first calculate the former. By Eq. 3.18,
(where the bar notation abbreviates ) which matches with the output weight contribution from Eq. 2.8.
To calculate the latter term from Eq. 3.25, we employ the following lemma.
For , this follows trivially from Eq. 3.16. For , by Eq. 3.24,
So it remains to show . But applying Lemma 4.8.3,
which, by Eq. 3.26 and a trivial induction with Lemma 3.3.1, gives
Chapter 4 Proof of Master Theorem
To prove our main foundational theorem 2.6.10, we had an editorial choice: we could bash our way to a proof by repeating (over and over again) analytical arguments involving the likes of Holder and Cauchy-Schwarz, or we could encapsulate them into neat objects with neat properties that then make the underlying algebraic structure more transparent. Even though the writing is more arduous, we chose the latter way, because of this transparency and because it builds a more extensible foundation for future work.extensible in the sense that properties can be used as black-boxes for more advanced theorems. This is definitely a more algebraic style, compared to analysts who tend to open black boxes and constantly tweak the insides. The drawback is perhaps that there can be many long sections building up the underlying structures before the payoff — but that’s the choice we made, and the reader is stuck with it, for better (hopefully) or worse.
Here we just record some basic lemmas that we would use frequently. The reader can skip this on first read and come back when necessary.
Expand the power in the LHS using the multinomial theorem, apply AM-GM to each summand, and finally aggregate using triangle inequality. ∎
By Markov’s inequality, for any ,
By Borel-Cantelli Lemma, almost surely, for all large . Then, if we pick a sequence converging to 0, we have that, almost surely, for each , for large enough — i.e. almost surely, . ∎
Furthermore, can be taken to be where
is a polynomial that depends only on .
We recall Moore-Penrose pseudo-inverse and some properties of it.
If has real entries, then so does .
The pseudo-inverse always exists and is unique.
, which we denote as .
.
is the orthogonal projector to the column space of ; is the orthogonal project to the null space of .
If has singular value decomposition where and are orthogonal and has the singular values on its diagonal, then where inverts all nonzero entries of .
For any collection of vectors in a Hilbert space, , where , is the projection operator to the linear span of .
1.2 Baranyai’s Theorem
The complete hypergraph is a hypergraph containing vertices in which every subset of vertices forms a hyperedge. A perfect matching of it is a set of hyperedges that (thought of as subsets of vertices) partitions the vertices of .
Suppose integer divides integer . The collection of all hyperedges in can be partitioned into perfect matchings.
See Fig. 4.1 for a graphical illustration. The hyperedges of are just the -element subsets of . A version of Baranyai’s Theorem also holds for ordered -element subsets, i.e., length- sequences of distinct elements of .
Suppose integer divides integer . The collection of all length- sequences of distinct elements of can be partitioned into perfect matchings.
The proof follows from 4.1.5 and symmetrization.
2 Basic Objects and Operations
In this section, we define the basic objects and operations on them recurring in our quest to understand Tensor Programs. In the next, we describe their properties.
2.2 Space of Random Sequences
Prior papers in the Tensor Programs series often talk about objects like scalars, vectors, and matrices whose size varies with a global notion of “width” denoted . Formally, each such object is a sequence (of scalars, vectors, or matrices) in , but to be intuitive, these works downplay this sequence aspect (for example, by suppressing the dependence on notationally).
However, here we need to talk about more complex high order tensors who can contain both dimensions that scale with and those that do not. In addition, we will formulate a notion of “vanishing” tensors that is really an asymptotic property as rather than a nonasymptotic one; this notion turns out to interact cleanly with typical operations like pseudo-Lipschitz nonlinearities that is involved in Tensor Programs. As such, for these reasons, we will be explicit that the objects we play with here are sequences in :
So, for example, contains all infinite sequences of scalar random variables, and contains all infinite sequences of random vectors of linearly increasing size.
We will use Greek letters (with values in ) to denote indices of an -tensor. For higher order -tensors in , we also use their bolded counterparts (with values in ) to denote multi-indices, where (for example) is understood to have components . For example, if , then has entries . We can also mix single indices and multi-indices, e.g., .
As in prior works, even though we will work with sequences of tensors , we will suppress the dependence on notationally and talk about as if it’s a fixed tensor. So, for example, for an -matrix , refers to the entry where the is from context.
2.3 Multi-Tensors
In many results we shall discuss, we often talk about lists of -tensors, e.g., . Going forward, it will be helpful to think of such lists as (a sequence of) a single tensor of shape (or other arrangements of dimensions, as discussed below) for each . We generalize this further in the following definition.
More abstractly, we can let be any finite-dimensional Euclidean space, in which case is the space of sequences of tensors with shape , taking values in . However, in this work, we will primarly concern ourselves with the being tensor spaces as in 4.2.2.
In this work, by Euclidean space we mean any finite-dimensional real vector space. We will use notation and its cousins to denote such spaces.
We will always use lower case letters to denote -tensors (i.e., elements of ). On the other hand, we will always use their bolded counterparts to denote multi-tensors (i.e., elements of ).
2.4 Constant Tensors
Often we will need to talk about some sequence (in ) that equals a fixed value, say , for all . Then we shall denote this sequence by as well, which should not cause confusion in our contexts.
2.5 IID Tensors
For every integer , We define the iid operator
2.6 Averaging over n𝑛n
Let be a finite-dimensional Euclidean space, and let be a multi-tensor. For , we write
for averaging over multi-index while fixing multi-index .
This notation can be nested, e.g., for some function . When is identity, this is obviously just .
2.7 Implicit Broadcasting of Nonlinearities on Multi-Tensors
In general, this implicit broadcast rule holds for any -tensors or multi-tensors.
More generally, if is another Euclidean space and , then with .
In other words, the implicit broadcasting lifts to a function for any .
2.8 Nonlinear Outer Products
Let be any finite dimensional Euclidean spaces. Suppose , where we format ’s arguments in blocks , with the th block “” corresponding to . Then given for , we write
for the multi-tensor in with entries
We call this the -outer product of .
Let’s unpack the multi-tensor notation a bit. For example, if for every , then
In other words, arguments in the same block have matching (multi-)indices, while arguments in different blocks have freely varying indices. This in particular generalizes 4.2.11, which applies when there is only one block in . Likewise, the implicit broadcasting in this nonlinear outer product lifts to a function .
We isolate the case when is the identity function with .
is called the semicolon product of . It has entries
The importance of this operation is that: for any , the -outer product is just the composition of the semicolon product followed by application of as in 4.2.11.
This fact simplifies the proofs involving nonlinear outer products.
In light of 4.2.12, this is now interpreted as a -outer product of the multi-vector and the multi-scalar .
3 Vanishing and Bounded Moments
In this work, we will especially focus on where each entry of has “typical size ” as . We formalize this “typical size ” criterion as follows.
We say a multi-tensor is entrywise moment-bounded, or just moment-bounded for short, if the following holds: for every integer
Unpacking the big-O notation, is moment-bounded iff, for every integer and every , we have
Intuitively, if one thinks of the entries as samples from a distribution , then is the (empirical) th moment of . Thus, moment-boundedness just means that has bounded empirical moments of every order (ignoring logarithmic factors), i.e., samples from has typical size .
First, one can note the following trivial property that is useful for simplifying proofs.
is moment-bounded iff each of its components is moment-bounded.
A related property holds for “components along ”:
Moment-boundedness is closed under applications of polynomially bounded functions: in short,
is moment-bounded if is, and
more generally, is moment-bounded if are.
By polynomially-boundedness of , for any , there are such that, for any , we have
as well. Since and are arbitrary in this argument, this shows is moment-bounded. ∎
3.2 Vanishing Multi-Tensors
A mentioned above, a notion of “vanishing” will play a central role in what follows:
We say a multi-tensors is entrywise vanishing, or just vanishing for short, if
Unpacking the big-O notation, is vanishing iff, for every ,
At first, using the same intuition as above, one may think of vanishing tensors as those whose entries have typical size .
But notice that “vanishing” is defined only via norm, while “moment-bounded” is defined via every norm. This is an important technical distinction. The primary purpose of this distinction is that when is an -vector and is an iid matrix with (for example) entries,
This is because of the well-known almost sure operator-norm bounds on such iid matrices . If we defined “vanishing” based on other norm as well, then we cannot make the same statement as it will be much more difficult to control the norm of .
We summarize these intuitions succinctly as follows (because they are important to understand sooner than later):
Like for moment-boundedness, the “vanishing” property is reducible to components, which makes proofs a bit simpler.
is vanishing iff each of its components is vanishing.
Let for Euclidean space . Whenever or else , we have
For clarity, we prove the claim for ; the generalization to follows from this case componentwise.
By norm inequalities, for all ,
When or 1 or when , we have , so that, for any sufficiently small ,
But since is vanishing, the RHS goes to 0 almost surely, and therefore so does . We thus have
The following yields a sufficient condition for vanishing that is often easier to show than directly showing vanishing itself. Roughly speaking, it says an -tensor is vanishing if every entry looks like as measured by every power mean expectation.
for all and , then is vanishing.
WLOG we assume , since the general case follows by unrolling into a (giant) vector.
3.3 Equivalence Modulo Vanishing Multi-Tensors
Let be multi-tensors of the same shape. We say is equivalent to , written , if is vanishing.
Since our writing convention suppresses , this notation may be ambiguous: To disambiguate, the equivalence is a notion between multi-tensors as sequences, i.e., it should be read as , NOT as a sequence of equivalences , one for each .
The here will all have -sized entries in our applications. By the discussion above regarding vanishing multi-tensors, just means that and have roughly the same entries. But note that, as vectors, matrices, or tensors, can definitely differ from nontrivially in norm, because e.g., a vanishing vector can have norm.
We first note a trivial but useful property.
iff , and .
Equivalence is preserved under most operations, as summarized below:
“smooth” mapping : (4.3.11 and 4.3.12)
For example, if are both moment-bounded, then . This holds more generally for “smooth” nonlinear outer products.
If , then
multiplication by operator-norm-bounded matrices: (4.3.14)
If are -vectors and is an -matrix that almost surely has bounded operator norm, then . This holds in particular for having iid, zero-mean entries of size .
Note that this holds for the semicolon product (i.e., when is identity and ): If we shorthand , then
so that, with ,
Then since are all vanishing, so is . Thus, we get .
By the definition of pseudo-Lipschitz, we have
By Holder’s inequality, for any such that , we have
For any , we shall choose (and consequently by the relation ) barely larger than 2 such that
from which follows as we wanted. Now, Eq. 4.3 holds for any and because is moment-bounded.
For Eq. 4.2, notice Here, the definition of “vanishing” in terms of L2 norm becomes critical, and if we were to define “vanishing” using general Lp norm, then the proof wouldn’t go through.
by standard norm inequality. We shall choose just slightly above so that . Then for some positive and hence
where the convergence to 0 is because is vanishing. ∎
While most nonlinearities we encounter will be pseudo-Lipschitz (globally), occasionally we need to work with the functions that are only locally Lipschitz around some point (for example, the matrix inverse function is locally Lipschitz around a nonsingular matrix). Equivalence to deterministic constant is preserved under locally Lipschitz mapping:
1) are both moment-bounded;
Note 1) follows easily from Jensen’s inequality. So we shall focus on 2) in the remainder.
Let denote the first indices. Then, by power-mean inequality, for every ,
where ranges over all . Then
where the almost sure convergence is because is vanishing. Thus we have is vanishing, as well. ∎
no matter how is correlated with and .
The first statement is trivial since the definition of “vanishing” only depends on norm. The second statement follows from well-known operator norm bounds on iid matrices with sub-Gaussian entries. ∎
3.4 Distributional Equivalence (aka Dequivalence)
We will also need the distributional version of equivalence. In the simplest case, we have the following definition.
For any multi-tensor of the same shape, we say and are distributionally equivalent, or dequivalent, written
Suppose we have two lists of multi-tensors and , such that and have the same shape for every , but their shapes can vary with . We say and are distributionally equivalent, written
This definition is especially necessary for reasoning about the Gaussian conditioning trick inside the induction proof of the Master Theorem.
Finally, we note that, while 4.3.16 seems to be strictly more general than 4.3.15, in fact they are logically equivalent:
For two multi-tensors of the same shape, thought of as sequences , we may form a new sequence of their Wasserstein distances , where ’s underlying metric for each is the scaled Euclidean distance and denote the measures of . Then,
Conditional dequivalence naturally inherits the basic properties of equivalence. Consider any conditional dequivalence named . In summary, conditional dequivalence is preserved under:
multiplication by operator-normed-bounded matrices: (4.3.20)
The formal statements are as follows. The proofs are all trivial given the corresponding statements in Section 4.3.3.
where is the multi-tensor with entries , and likewise for .
4 Getting Equivalence From Distributional Equivalence
Here we discuss several situations, in order of easy to hard, that allow us to “upgrade” dequivalence to equivalence. The most important result (Lemma 4.4.5) in this section reads roughly as follows: If is iid along the -dimensions, then \langle\phi(\bm{x};\bm{x}_{\beta_{1}};\cdots;\bm{x}_{\beta_{r}})\rangle_{{\bm{\beta}}}\equiv\langle\phi(\bm{x};\bm{x}_{\beta_{1}}^{\mathord{\ThisStyle{\LMpt\kern 1.0pt\LMpt\framebox{\SavedStyle 1}\kern 1.0pt\LMpt}}};\cdots;\bm{x}_{\beta_{r}}^{\mathord{\ThisStyle{\LMpt\kern 1.0pt\LMpt\framebox{\SavedStyle r}\kern 1.0pt\LMpt}}})\rangle_{{\bm{\beta}}} (where, recall, for each , \bm{x}^{\mathord{\ThisStyle{\LMpt\kern 1.0pt\LMpt\framebox{\SavedStyle i}\kern 1.0pt\LMpt}}} is an iid copy of , such that \bm{x},\bm{x}^{\mathord{\ThisStyle{\LMpt\kern 1.0pt\LMpt\framebox{\SavedStyle 1}\kern 1.0pt\LMpt}}},\ldots,\bm{x}^{\mathord{\ThisStyle{\LMpt\kern 1.0pt\LMpt\framebox{\SavedStyle r}\kern 1.0pt\LMpt}}} are mutually independent).
In other times, two objects formed from dequivalent ingredients are actually (absolutely) equivalent. This happens typically when we are averaging over many iid things, essentially because of the Law of Large Numbers. The most basic example is:
For example, we will frequently use the following corollary of this:
where the expectation is taken over .
Then for any , has mean zero (over the randomness of ). Let
Notationally, we have usually written when we really mean , the th element of as sequence of tensors. This is not ambiguous typically, but here we do want to talk about both semantics. Therefore, in this proof, we will be explicit: for emphasis, we write for the sequence interpretation and still write just “” for the th element of it (with dependence on suppressed as usual).
Now, we will prove is vanishing by showing that, with probability 1 on the distribution of , is vanishing conditioned on .
By Lemma 4.1.3 applied to with fixed (using the independence of from ), we have
Because is moment-bounded, so is , so that, for every ,
Thus, for almost every sequence ,
for some constant dependent on the whole sequence . Then
satisfying 4.3.8, implying is vanishing conditioned on . Since this argument holds for every and every , we have the desired result. ∎
In the most advanced case, we need Eq. 4.5 to hold even when the and are strongly correlated. This will turn out to be the most important case, since it forms the induction base for our main theorem.
We in fact don’t need to assume is deterministic, but doing so simplifies the proof.
Likewise for \langle\psi(\bm{x};\bm{x}_{\beta_{1}}^{\mathord{\ThisStyle{\LMpt\kern 1.0pt\LMpt\framebox{\SavedStyle 1}\kern 1.0pt\LMpt}}};\cdots;\bm{x}_{\beta_{r}}^{\mathord{\ThisStyle{\LMpt\kern 1.0pt\LMpt\framebox{\SavedStyle r}\kern 1.0pt\LMpt}}};\mathring{\bm{c}})\rangle_{{\bm{\beta}}}.
Intuitively, when all the are distinct, then are roughly independent as well, but this is obviously not the case when are not distinct. However, among all possible values of the tuple , the nondistinct ones constitute a minority, vanishing with . Therefore, we hope to say that they contribute vanishingly to the sum Eq. 4.7 so as to establish Eq. 4.6.
In the same scenario as Lemma 4.4.5, if , then
(with the expectation taken over \bm{X}^{\mathord{\ThisStyle{\LMpt\kern 1.0pt\LMpt\framebox{\SavedStyle 1}\kern 1.0pt\LMpt}}};\cdots;\bm{X}^{\mathord{\ThisStyle{\LMpt\kern 1.0pt\LMpt\framebox{\SavedStyle r}\kern 1.0pt\LMpt}}}).
4.1 Proof of Lemma 4.4.5
We assume in the proof that , as the general case is a straightforward modification.
So we can assume WLOG and furthermore just absorb it into since is deterministic. It remains to show
Note the following properties of :
By 4.3.8, we just need to show there exist constants for all integers such that
Fix and . Below, we shall bound each individually. By symmetry in , we WLOG fix . Let be the largest multiple of smaller than .
We succinctly overview the core insight here, with more explanation below. There are 3 steps of reasoning:
1. For large , is dominated by the subset sum where consists of all that do not contain repeating indices (i.e., are all distinct). (Note such does not contain either since by assumption).
2. But by Ordered Baranyai’s Theorem (4.1.6), there is a partition of into perfect matchings i.e., such that each consists of multi-indices and partition (i.e., each appear in exactly one of ). For example, if and , then . This is partitioned into the perfect matchings along with their mirror images. Back to the general case, we thus have
3. But, conditioned on , each is a sum of independent, mean-zero random variables by 4.4.7. Therefore it has typical size which is just because is constant. As a result, the whole sum Eq. 4.9 is of order so that
Of the 3 steps above, only 1 and 3 need further explanation. We do so below.
Let be the set of that contains at least one of . Let be the set of that contains repeating indices. Then the complement of in is a subset of .
Thus, after multiplying by , we get
where (by Lemma 4.1.1). Thus, to show Eq. 4.8, it suffices to show
(for a different set of constants ).
Let denote average over . Recall that, by Ordered Baranyai’s Theorem, we have partitioned into where each consists of multi-indices such that partition . Consequently, for each , is mutually independent conditioned on . We first deduce
5 Matrix Pseudo-Inverse
Apply 4.3.12 to being the matrix pseudo-inverse function, which is locally Lipschitz at any full rank matrix. ∎
Note that is the correct scaling with so that this matrix has sized entries (it is elucidating to consider the example when and is just an -vector).
Therefore, since equivalence is preserved under matrix multiplication (which is certainly pseudo-Lipschitz; see 4.3.11), we have
where the first equivalence follows from Eq. 4.11 and 4.3.11, and the last equivalence follows from Lemma 4.4.2. ∎
6 Uniformized Tensor Programs
Here, we “uniformize” different variations of Tensor Programs, in the sense that we squash all the different instructions into a single step. This allows us to streamline the induction in our proofs.
Here each is a chosen scalar function with arguments and is an matrix. Each matrix equals to either some matrix of the program or its transpose . The matrices for different can possibly be the same. Thus each program is entirely determined by the data along with the correspondence between and or .
This type of program is obviously a subset of () but it’s also easy to see that they have the same expressive power.
6.2 Uniformized Ne⊗or⊤limit-fromtensor-productNeortop\textsc{Ne}{\otimes}\textsc{or}\top
Here we are tying together the tensor order of with the iteration index , to simplify the formulation. But note that can always ignore all but the first block of inputs, for example, to replicate Eq. 4.13. By the same reasoning as Section 4.6.1, this formulation of is equivalent to 2.6.1.
6.3 Setup and Constructions
Every entry of every is sampled iid from .
Every entry of every initial vector is sampled iid from .
All nonlinearities are pseudo-Lipschitz.
In addition, since both uniformized and uniformized are subsets of the language, the construction of kets in 2.6.5 make sense for both of them. Finally, in the context of , we think of the program’s objects as sequences in , i.e., , , .
7 Netsor⊤limit-fromNetsortop\textsc{Netsor}\top Master Theorem, Vectorwise Convergence
Consider a program in 4.6.1. Consider any collection of vectors in the program. Then they are moment-bounded and
In other words, is distributed like iid copies of , modulo vanishing vectors. This is a stronger result than , at the cost of assuming faster convergence of initial scalars in 4.6.1.
Let us comment that, in this proof, we do not use the property that equivalence is preserved under iid matrix multiplication 4.3.14 (this property is a crucial reason underlying the definition of “vanishing”), because of ’s rank stability property. This however will be crucial in Section 4.8 to prove the analogous result for .
We recall some terminology from prior works.
A vector is called a G-var if it is an initial vector or generated by MatMul.
We will nontrivially leverage parts of the Master Theorem proof in . Our notation differs from there (hopefully improved for first time readers), but a mapping is provided in Table 4.1. By 4.3.18, it suffices to show this for all G-vars of the program, since other vectors are pseudo-Lipschitz images of G-vars. We furthermore WLOG assume the formulation in Eq. 4.13 and proceed to show this for vectors (all G-vars in the program).
WLOG, we assume and are both full rank.
Indeed, [44, sec L.5] says that (resp. ) is singular iff there are linear dependencies (with constant coefficients) between s (resp. s), which we can get rid of by rewriting the program in the obvious way.Rank stability is a highly nontrivial but technical result of . While seemingly small, it allows us to drastically simplify the proof because we do not have to think about “corner cases” where the rank of a matrix drops suddenly in the limit, which can lead to all kinds of pathological behaviors. Readers interested in full rigor should consult for the proof of this result.
We induct on , starting from the base case .
This holds by 4.6.1 that the initial vectors are sampled iid.
as well as their moment-boundedness and we shall show
and their moment-boundedness, where the conditional dequivalence can be unpacked into
For brevity, write g\mathrel{\raisebox{-1.29167pt}{\mathbin{\overset{\text{{def}}}{=}}}}g^{i+1},x\mathrel{\raisebox{-1.29167pt}{\mathbin{\overset{\text{{def}}}{=}}}}x^{i+1},W\mathrel{\raisebox{-1.29167pt}{\mathbin{\overset{\text{{def}}}{=}}}}W^{i+1} so that in this notation, by Eq. 4.13, .
We apply Gaussian conditioning trick to obtain
7.2 Proof Plan
Below, we will give the exact formulas for and we will show that
These claims already imply that is moment-bounded. Furthermore, applying Eq. 4.17 and 4.3.18 to Eq. 4.19, the above claims imply
7.3 Exact Formulas
Let (resp. ) be the set of indices such that (resp. ), so that (resp. ) by construction.
Then, by the same calculations as in , have the following exact formulas:
Now we further define to be the matrix with column vectors for all ; likewise we define . By induction hypothesis (Eq. 4.17), we have
because of 4.3.18 (as this relation is a pseudo-Lipschitz image of Eq. 4.17).
by Eq. 4.23 and Lemma 4.4.3, where the RHS is a deterministic object independent of . Likewise,
But both and are principal submatrices of by construction, so by Sylvester’s Criterion and 4.7.5,
The significance of this is that now we can use Lemma 4.5.3 on and .
7.4 Showing 3)
But is independent from (because is independent from by construction) and is distributed as , so the vanishes. In conclusion,
7.5 Showing 2)
Writing out the definition of (Eq. 4.21), we see
where the second line follows by Lemma 4.5.3, and the third line follows by Eq. 4.23 and Lemma 4.4.3.
Note that is deterministic. By 4.7.5, (because is a Schur complement of ). Then the square root function is locally Lipschitz around . So by 4.3.12, we get
7.6 Showing 1)
Finally, we can apply the same strategy to show is equivalent to a linear combination of and with deterministic coefficients, albeit with slightly more calculations.
Then the same deduction as before (involving Lemma 4.4.3 and Lemma 4.5.3) shows
Thus, , and thus are clearly equivalent to linear combinations of (the columns of) and . Consequently, is also a pseudo-Lipschitz image of because is. This proves 1).
8 Ne⊗or⊤limit-fromtensor-productNeortop\textsc{Ne}{\otimes}\textsc{or}\top Master Theorem, Vectorwise Convergence
Given an uniformized program (Eq. 4.14), we construct a parallel uniformized program , called the integrated program, as follows. ’s vectors will be denoted with an underline (which will turn out to be equivalent to their counterparts without underlines).
The initial matrices of and are identical and using the same symbols .
The initial vectors are the same as those of the original program .
Before we prove this, let us remark that Lemma 4.8.2 automatically tells us that identities of kets, such as [44, Lemma L.3], that hold for programs automatically hold for programs:
For any vectors and matrix in a program, the following identities hold.
We will induct on to show that . Note that, by 4.3.11, this implies , and by Lemma 4.3.13, this also implies .
The base case of is trivial since both programs share their initial vectors.
Assuming the induction hypothesis for (i.e., ), we shall prove it’s also true for : i.e., we need to show in addition.
For brevity, write , , . Let denote ; likewise for . Let denote and denote . Then since and by IH, we have by 4.3.11 that
9 Proof of Ne⊗or⊤limit-fromtensor-productNeortop\textsc{Ne}{\otimes}\textsc{or}\top Master Theorem 2.6.10
This will follow from the “uniformly locally Lipschitz” property of programs: For any scalar in a program, we can treat as a random function of initial scalars (with randomness coming from sampling of initial matrices and vectors) for any finite . Then for any , there is a neighborhood of and a constant such that is almost surely Lipschitz for all on that neighborhood with Lipschitz constant .
This property in particular implies that is equicontinuous over almost surely, and thus how fast or slow converges to does not affect the limit .
9.2 Proof of Non-Gaussian Ne⊗or⊤limit-fromtensor-productNeortop\textsc{Ne}{\otimes}\textsc{or}\top Master Theorem
The non-Gaussian Master Theorem () states that, under 2.6.4, the scalars of the program converge almost surely and in for every . Our goal here is to adapt its proof to the more general case.
The key technical insight enabling all of this is a bound on the moments of mixed derivatives of a non-Gaussian program’s scalars and vectors against the program’s matrices.
To obtain the non-Gaussian Master Theorem, the main task is to generalize this key technical insight, with which the interpolation trick carries over to our case easily. This is done in Lemmas 4.9.2 and LABEL:{lemma:dc_bound} below, which are useful in their own right beyond this context. The full proof of the non-Gaussian Master Theorem can be then be straightforwardly adapted from .
Consider 2.6.4, but allow the variances of matrix entries to differ from but still bounded above by for some common to all matrix entries.
Below, we invoke the notion of oblivious constants from [12, Defn I.1]. This is a technical notion needed to finish the proof of the the non-Gaussian Master Theorem, but the first time readers can ignore the comments on oblivious constants.
where constant in the big-O is -oblivious wrt and the program.
This generalizes [12, Lemma I.3] to .
In the original proof in [12, Sec I], replace with everywhere. As the original proof essentially factors through arguments about the “supremum” over all indices , it can be adapted straightforwardly to the “supremum” over all multi-indices . ∎
Consider a program in 4.9.1. Then for any , any nonempty multiset of the program’s matrix entries ,, and any scalar of the program,
Furthermore, the constant in the big-O is -oblivious wrt the program.
This generalizes [12, Lemma J.6] to .
Construct the backpropagation program (2.9.14), which is another program. Then proceed as in the proof of [12, Lemma J.6]. ∎
Chapter 5 Experiments
We perform numerical experiments to validate our theory. It is intractable to compute the exact infinite-width limits for general , since the expectations required to evaluate the infinite-width dynamics in both limits do not admit an analytical solution (even for the Neural Tangent Limit). We thus employ Monte Carlo simulations to approximate these expectations.
We approximate the infinite-width training dynamics by estimating the expectations in 2.4.4 and 2.7.3 using Monte Carlo simulations. As the initial loss derivatives are deterministic with zero outputs, the infinite-width dynamics can be estimated without actually constructing a network. To compare the finite and infinite width neural networks’ evolution, we assess the output on random inputs at each iteration. Our results are summarized in Fig. 5.1 and Fig. 5.2. As anticipated, the training dynamics converge to the infinite-width dynamics as the width increases.
Acknowledgements
In alphabetical order, we would like to thank Jeremy Bernstein, Nikhil Ghosh, Dror Ironi, Ariel Landau, Sadhika Malladi, Jamie Simon, and Josh Susskind for providing insightful comments and discussion.