Lably
Skip to content

Neural tangent kernel

  • 11 min read
  • 4 chapters

Related on Lably

Through Neural network (machine learning), Deep learning and Machine learning

In general, a kernel is a positive-semidefinite symmetric function of two inputs which represents some notion of similarity between the two inputs. The NTK is a specific kernel derived from a given neural network; in general, when the neural network parameters change during training, the NTK evolves as well. However, in the limit of large layer width the NTK becomes constant, revealing a duality between training the wide neural network and kernel methods: gradient descent in the infinite-width limit is fully equivalent to kernel gradient descent with the NTK. As a result, using gradient descent to minimize least-square loss for neural networks yields the same mean estimator as ridgeless kernel regression with the NTK. This duality enables simple closed form equations describing the training dynamics, generalization, and predictions of wide neural networks.

The NTK was introduced in 2018 by Arthur Jacot, Franck Gabriel and Clément Hongler, who used it to study the convergence and generalization properties of fully connected neural networks. Later works extended the NTK results to other neural network architectures. In fact, the phenomenon behind NTK is not specific to neural networks and can be observed in generic nonlinear models, usually by a suitable scaling.

Main results (informal)

Let f(x;θ) denote the scalar function computed by a given neural network with parameters θ on input x. Then the neural tangent kernel is defined asΘ(x,x′;θ)=∇θf(x;θ)⋅∇θf(x′;θ).Since it is written as a dot product between mapped inputs (with the gradient of the neural network function serving as the feature map), we are guaranteed that the NTK is symmetric and positive semi-definite. The NTK is thus a valid kernel function.

Consider a fully connected neural network whose parameters are chosen i.i.d. according to any mean-zero distribution. This random initialization of θ induces a distribution over f(x;θ) whose statistics we will analyze, both at initialization and throughout training (gradient descent on a specified dataset). We can visualize this distribution via a neural network ensemble which is constructed by drawing many times from the initial distribution over f(x;θ) and training each draw according to the same training procedure.

The number of neurons in each layer is called the layer’s width. Consider taking the width of every hidden layer to infinity and training the neural network with gradient descent (with a suitably small learning rate). In this infinite-width limit, several nice properties emerge:

  • At initialization (before training), the neural network ensemble is a zero-mean Gaussian process (GP). This means that distribution of functions is the maximum-entropy distribution with mean Eθ[f(x;θ)]=0 and covariance Eθ[f(x;θ)f(x′;θ)]=Σ(x,x′), where the GP covariance Σ(x,x′) can be computed from the network architecture. In other words, the distribution of neural network functions at initialization has no structure other than its first and second moments (mean and covariance). This follows from the central limit theorem.
  • The NTK is deterministic. In other words, the NTK is independent of the random parameter initialization.
  • The NTK does not change during training.
  • Each parameter changes negligibly throughout training. As Lee et al. note, "although individual parameters move by a vanishingly small amount, they collectively conspire to provide a finite change in the final output of the network, as is necessary for training."
  • During training, the neural network is linearized, i.e., its parameter dependence can be captured by its first-order Taylor expansion: f(x;θ0+Δθ)=f(x;θ0)+Δθ⋅∇θf(x;θ0), where θ0 are the initial parameters. This follows from the fact that each parameter changes negligibly during training. (The neural network remains nonlinear with respect to the inputs.)
  • The training dynamics are equivalent to kernel gradient descent using the NTK as the kernel. If the loss function is mean-squared error, the final distribution over f(x;θ) is still a Gaussian process, but with a new mean and covariance. In particular, the mean converges to the same estimator yielded by kernel regression with the NTK as kernel and zero ridge regularization, and the covariance is expressible in terms of the NTK and the initial GP covariance. It can be shown that the ensemble variance vanishes at the training points (in other words, the neural network always interpolates the training data, regardless of initialization).

From a physics point of view, the NTK can be understood as a type of Hamiltonian, since it generates the time-evolution of observables when the neural network is trained by gradient descent with infinitesimally small steps (the continuum limit).

Sign in to keep reading

3 more chapters are free with a Lably account.

More in Robotics