Random Features for the Neural Tangent Kernel

Insu Han, Haim Avron, Neta Shoham, Chaewon Kim, Jinwoo ShinarXiv 2021

Abstract: The Neural Tangent Kernel (NTK) has established a profound connection between deep neural networks and kernel methods, offering insights into optimization and generalization. While NTK often outperforms standard neural network training on small-scale datasets, its application to large-scale settings has been hindered by the $O(n^3)$ time and $O(n^2)$ space complexity inherent to kernel methods. In this work, we propose an efficient feature map construction for the NTK of fully-connected ReLU networks. By combining random features of arc-cosine kernels with a sketching-based algorithm, we achieve a construction that runs in linear time relative to both the number of data points and input dimensions. Our method yields feature dimensions significantly smaller than existing baselines while maintaining comparable error bounds. Furthermore, we utilize leverage score-based sampling to improve bounds and provide a spectral approximation guarantee for the NTK matrix. Benchmarks across various machine learning tasks demonstrate that our algorithm can run orders of magnitude faster than exact kernel methods without performance loss.

Introduction

The Neural Tangent Kernel (NTK) represents a theoretical milestone in deep learning, describing the evolution of infinite-width neural networks during gradient descent as a linear model with a fixed kernel. This transformation allows complex optimization problems to be viewed through the lens of kernel regression. However, a significant practical gap remains: exact NTK computation is prohibitively expensive for large datasets. For instance, a dataset with 500,000 points would require terabytes of RAM just to store the kernel matrix.

Previous attempts to approximate the NTK using "random features" encountered a "dimension explosion." As the depth of the network increases, the number of features required to maintain accuracy grows exponentially. This paper introduces a compact feature map that bypasses these computational bottlenecks, enabling the application of NTK to large-scale datasets where exact computation was previously impossible.

Methodology: Sketching and Sampling

The proposed approach addresses the scalability of NTK through two primary algorithmic innovations: TensorSketch for depth management and Modified Leverage Score Sampling for spectral accuracy.

1. TensorSketch for Deep Networks

In deep architectures, the NTK is computed recursively, involving tensor products that lead to exponential feature growth. To counter this, the authors employ TensorSketch, a dimensionality reduction technique leveraging Fast Fourier Transforms (FFTs). By utilizing the convolution property of FFTs, the method "compresses" tensor products at each layer. This keeps the resulting feature dimension polynomial rather than exponential relative to the network depth, preserving the kernel's inner product while drastically reducing memory overhead.

2. Spectral Approximation via Leverage Scores

Standard random feature methods often rely on uniform sampling, which can be inefficient. This work focuses on spectral approximation, ensuring the entire approximated kernel matrix behaves like the original, rather than just approximating pointwise values. To achieve this, the authors use a modified distribution based on leverage scores.

Because calculating exact leverage scores is as computationally expensive as the original kernel problem, the authors implement a Gibbs Sampling routine. This allows them to sample from a distribution that approximates the ideal leverage scores at a fraction of the cost, providing tighter theoretical guarantees and better downstream performance in tasks like Ridge Regression.

Experimental Evaluation

The researchers benchmarked the proposed scheme across a diverse array of tasks to validate its speed and accuracy.

  • Scalability: On the Protein dataset, the random feature approach was 17 times faster than exact NTK methods. On the MillionSongs dataset ($n \approx 467,000$), exact methods failed due to out-of-memory errors, whereas the proposed sketching method completed successfully.
  • Classification Accuracy: Across 90 datasets from the UCI Machine Learning Repository, the NTK random features performed on par with the exact NTK. Notably, they significantly outperformed standard Radial Basis Function (RBF) kernels and traditional Random Fourier Features (RFF).
  • Image Classification: Using features extracted from a pretrained ResNet-18, the method was applied to fine-grained datasets including CIFAR-10/100 and Caltech-101, demonstrating its utility as a robust head for transfer learning.
  • Active Learning: The authors showed that these features could be used to greedily select informative data points for labeling, outperforming random selection strategies on the MNIST dataset.

Discussion and Limitations

While this work significantly advances the practicality of NTK, several avenues for future research remain. The current implementation is optimized for fully-connected ReLU networks. Extending this sketching framework to Convolutional Neural Networks (CNNs) or Transformers—which involve more complex structural kernels—is a non-trivial challenge.

Additionally, the theoretical proof for spectral approximation in networks deeper than two layers is currently constrained by the lack of a specific "monotone property" in the arc-cosine kernel. Finally, like many sketching-based methods, performance is sensitive to the choice of the sketch dimension ($m_{cs}$), requiring careful tuning to balance the trade-off between computational speed and approximation accuracy.

Conclusion

By integrating TensorSketch with leverage score-based sampling, this work provides a scalable path for the Neural Tangent Kernel. The ability to achieve linear time complexity and spectral guarantees allows researchers to leverage the theoretical strengths of NTK on massive, real-world datasets, effectively bridging the gap between deep learning theory and large-scale practice.

Summary updated

BibTeX
@misc{han2021random,
  author = {Insu Han and Haim Avron and Neta Shoham and Chaewon Kim and Jinwoo Shin},
  title = {{Random Features for the Neural Tangent Kernel}},
  year = {2021},
  eprint = {2104.01351},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2104.01351},
}
Figure