Tensor Programs II: Neural Tangent Kernel for Any Architecture

Greg YangarXiv 2020

Abstract

We prove that a randomly initialized neural network of any architecture has its Tangent Kernel (NTK) converge to a deterministic limit, as the network widths tend to infinity. We demonstrate how to calculate this limit. In prior literature, the heuristic study of neural network gradients often assumes every weight matrix used in forward propagation is independent from its transpose used in backpropagation (Schoenholz et al. 2017). This is known as the gradient independence assumption (GIA). We identify a commonly satisfied condition, which we call Simple GIA Check, such that the NTK limit calculation based on GIA is correct. Conversely, when Simple GIA Check fails, we show GIA can result in wrong answers. Our material here presents the NTK results of Yang (2019a) in a friendly manner and showcases the tensor programs technique for understanding wide neural networks. We provide reference implementations of infinite-width NTKs of recurrent neural network, transformer, and batch normalization at https://github.com/thegregyang/NTK4A.

Introduction

The discovery of the Neural Tangent Kernel (NTK) revolutionized deep learning theory by showing that infinitely wide neural networks trained with gradient descent behave like linear models governed by a fixed kernel. This insight transformed the complex "black box" of neural network training into a mathematically solvable framework. However, early NTK proofs were limited to simple Multi-Layer Perceptrons (MLPs). Modern deep learning relies on sophisticated architectures—Transformers, RNNs, CNNs, and ResNets—incorporating weight sharing, skip connections, and normalization. This paper bridges the gap between theory and practice by proving that the NTK phenomenon is a universal property of virtually all standard architectures.

The Tensor Programs Framework

To address the diversity of modern architectures without writing bespoke proofs for each, the author introduces Tensor Programs (NETSOR and NETSOR+). This framework acts as a theoretical programming language for deep learning. By expressing the forward and backward passes of a network as a sequence of matrix multiplications and non-linearities within a NETSOR program, researchers can apply a Master Theorem to automatically derive the infinite-width limit. This mechanization allows for the rigorous study of complex layers like Multi-Head Attention and Batch Normalization that were previously mathematically intractable.

The Gradient Independence Assumption (GIA)

A common heuristic in gradient analysis is the "Gradient Independence Assumption" (GIA), which assumes weight matrices in the forward pass are independent of their transposes in the backward pass. While mathematically suspect, GIA often yields correct results in practice.

This paper identifies Condition 1 (Simple GIA Check) to justify this assumption: if the network's final output layer is randomly initialized, has zero mean, and is not reused elsewhere, the GIA is rigorously justified. The independent output layer effectively "zeroes out" correlation pathways. If this condition is violated—for example, by tying output weights to a hidden layer—GIA-based calculations fail, leading to incorrect theoretical predictions.

Key Results and Empirical Validation

The primary contribution is the rigorous proof that the NTK converges almost surely to a deterministic limit for any architecture expressible in NETSOR. Beyond the proof, the author provides explicit algorithms to compute these limits for modern components like Batch Normalization and Transformers.

Empirical convergence of finite-width NTKs to the infinite-width limit for various architectures.

Empirical tests validate these theoretical findings. By scaling network widths from $2^6$ to $2^{13}$, the researchers observed that the empirical NTKs of RNNs, Transformers, and Batch-Normalized networks tightly converge to the predicted theoretical limits. As shown in the figure above, the relative Frobenius norm deviation follows a consistent $width^{-1/2}$ scaling across different model types, confirming the universality of the NTK limit.

Limitations and Future Work

The current Master Theorem requires the network to be "Backpropagation-like," typically necessitating the fulfillment of the Simple GIA Check. If an architecture violates this, the current framework cannot guarantee the NTK limit. Furthermore, this work focuses on NTKINIT—the state of the kernel at initialization. Future work in the Tensor Programs series addresses NTKTRAIN, proving that the network continues to evolve according to this fixed kernel throughout the training process for any architecture.

Summary updated

BibTeX
@misc{yang2020tensor,
  author = {Greg Yang},
  title = {{Tensor Programs II: Neural Tangent Kernel for Any Architecture}},
  year = {2020},
  eprint = {2006.14548},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2006.14548},
}
Figure