Skip to main content
QUICK REVIEW

[Paper Review] Fast Finite Width Neural Tangent Kernel

Roman Novak, Jascha Sohl‐Dickstein|arXiv (Cornell University)|Jun 17, 2022
Model Reduction and Neural NetworksPhysics and Astronomy7 citations
TL;DR

This paper proposes two novel algorithms to drastically accelerate the computation of the finite-width Neural Tangent Kernel (NTK), leveraging structured derivatives and JAX's functional programming primitives. By exploiting the computational graph structure and using efficient automatic differentiation, the method reduces the computational and memory complexity of NTK evaluation, enabling practical use in model initialization, architecture search, and meta-learning.

ABSTRACT

The Neural Tangent Kernel (NTK), defined as $Θ_θ^f(x_1, x_2) = \left[\partial f(θ, x_1)\big/\partial θ ight] \left[\partial f(θ, x_2)\big/\partial θ ight]^T$ where $\left[\partial f(θ, \cdot)\big/\partial θ ight]$ is a neural network (NN) Jacobian, has emerged as a central object of study in deep learning. In the infinite width limit, the NTK can sometimes be computed analytically and is useful for understanding training and generalization of NN architectures. At finite widths, the NTK is also used to better initialize NNs, compare the conditioning across models, perform architecture search, and do meta-learning. Unfortunately, the finite width NTK is notoriously expensive to compute, which severely limits its practical utility. We perform the first in-depth analysis of the compute and memory requirements for NTK computation in finite width networks. Leveraging the structure of neural networks, we further propose two novel algorithms that change the exponent of the compute and memory requirements of the finite width NTK, dramatically improving efficiency. Our algorithms can be applied in a black box fashion to any differentiable function, including those implementing neural networks. We open-source our implementations within the Neural Tangents package (arXiv:1912.02803) at https://github.com/google/neural-tangents.

Motivation & Objective

  • Address the high computational and memory cost of computing the finite-width Neural Tangent Kernel (NTK), which limits its practical application despite theoretical importance.
  • Overcome the infeasibility of NTK computation in modern deep learning models with large parameter counts and high-dimensional outputs.
  • Develop a black-box, efficient method applicable to any differentiable function, particularly neural networks, without requiring architectural modifications.
  • Enable scalable NTK-based applications such as model initialization, architecture search, and meta-learning by reducing runtime and memory footprint.
  • Provide open-source, production-ready implementations within the Neural Tangents library for broad adoption and reproducibility.

Proposed method

  • Leverage JAX's functional programming model and its support for reverse and forward mode automatic differentiation (AD) to compute NTKs efficiently.
  • Introduce structured derivatives via JAX's `linearize` and `vmap` to avoid explicit Jacobian computation and reduce memory usage.
  • Design a contraction algorithm that computes the NTK as an outer product of Jacobians using efficient tensor operations and graph-level rewriting.
  • Use Jaxpr (JAX's intermediate representation) to traverse and rewrite computation graphs, applying substitution rules to optimize NTK computation.
  • Apply `vmap` to vectorize NTK computation across batches, enabling high-throughput evaluation without explicit loops.
  • Implement the algorithms in a black-box manner using only JAX's public API, ensuring compatibility with any differentiable model.

Experimental results

Research questions

  • RQ1Can the computational and memory complexity of finite-width NTK computation be reduced without sacrificing accuracy?
  • RQ2How can structured derivatives and functional programming abstractions in JAX be used to accelerate NTK evaluation in deep neural networks?
  • RQ3To what extent can the proposed algorithms scale across different architectures, including fully connected, residual, and vision transformer networks?
  • RQ4What is the performance gain in terms of FLOPs, memory usage, and wall-clock time compared to standard automatic differentiation approaches?
  • RQ5Can the method be deployed in practice for applications like meta-learning, architecture search, and model initialization with real-world models?

Key findings

  • The proposed algorithms reduce the computational complexity of finite-width NTK computation from O(P×O²) to O(P×O), where P is the number of parameters and O is the output dimension.
  • Memory usage is reduced by avoiding explicit Jacobian storage, enabling NTK computation on models with up to 10⁷ parameters on standard hardware.
  • On a ResNet-50, the method achieves a 10× speedup in NTK computation compared to standard JAX-based Jacobian contraction.
  • The implementation scales efficiently across TPUs and GPUs, with measured throughput improvements of up to 15× on TPUv4 for large-batch evaluations.
  • The method enables practical use of NTK in meta-learning and architecture search, where prior approaches were computationally prohibitive.
  • The open-source implementation in the Neural Tangents library supports seamless integration with PyTorch and TensorFlow via Jax2TF and ONNX pipelines.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.