NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Leverage Score Sampling for Tensor Product Matrices in Input Sparsity Time

David P. Woodruff, Amir Zandieh

Introduction

In modern machine learning, kernel methods such as Kernel Ridge Regression and Principal Component Analysis (PCA) are indispensable for capturing non-linear relationships. However, these methods often rely on the computation of a Gram matrix $\Phi^\top \Phi$. When the feature matrix $\Phi$ is constructed as a $q$-fold tensor product—$\Phi = X^{(1)} \otimes X^{(2)} \otimes \dots \otimes X^{(q)}$—the dimensionality $d^q$ grows exponentially with the degree $q$. This "curse of dimensionality" makes direct computation and storage of the Gram matrix impossible for even modest values of $d$ and $q$.

Presented at ICML 2022, this research introduces a novel algorithm for approximating these massive tensor product matrices. The breakthrough lies in achieving "input sparsity time" complexity, where the runtime is proportional to the number of non-zero entries in the original input data, effectively decoupling the computational cost from the tensor degree $q$.

The Computational Bottleneck

To handle large-scale kernel matrices, researchers typically use Leverage Score Sampling. This technique involves selecting a small, representative subset of rows from $\Phi$ to form a sketch that approximates the full matrix's properties. The challenge has historically been the cost of calculating these leverage scores. Previous state-of-the-art algorithms suffered from one of two flaws: they either scaled poorly with the degree $q$ or exhibited a quadratic dependence on the number of data points $n$. For massive datasets, $O(n^2)$ complexity is a significant barrier to practical application.

The Proposed Framework: Recursive Sampling in Input Sparsity Time

The authors propose a recursive leverage score sampling framework designed to operate within the time constraints of the input's sparsity. This is achieved through three primary technical innovations:

1. Correlated SRHT Sketches

The Subsampled Randomized Hadamard Transform (SRHT) is a standard tool for dimensionality reduction. The authors introduce a variant where sketches share random signs across different tensor factors. This partial correlation is a strategic departure from the usual goal of total independence. By sharing signs, the algorithm can apply the sketch to the input dataset $X$ in a manner that is independent of the tensor degree $q$, while still providing the unbiased estimates of row norms necessary for accurate sampling.

2. Specialized Data Structures

To facilitate rapid sampling, the authors developed a data structure capable of quickly answering queries regarding the Frobenius norms of tensor product matrices. This structure can be built in time proportional to the number of non-zeros in the input data. Once constructed, it allows for the near-instantaneous estimation of leverage scores, which are then used to sample the most informative rows of the tensor product.

3. Decoupling the Tensor Degree

The most significant theoretical contribution is the reduction of the leading term in the runtime complexity. By ensuring the primary computational load depends only on the input size and the statistical dimension ($s_\lambda$), the algorithm makes high-degree polynomial kernels ($q \gg 2$) computationally feasible for the first time in large-scale settings.

Broadening the Scope: GPK and NTK

While the framework is initially described for polynomial kernels, the authors extend its utility to Generalized Polynomial Kernels (GPK). By treating non-polynomial kernels—such as the Gaussian kernel and the Neural Tangent Kernel (NTK)—as weighted sums of Taylor expansions, the algorithm can approximate these complex kernels with the same input-sparsity efficiency. This extension is particularly relevant for modern deep learning theory, where the NTK is used to characterize the behavior of overparameterized neural networks.

Experimental Results

The algorithm was rigorously tested against existing methods like PolySketch and Adaptive Sampling on two real-world datasets: MNIST ($n=60,000, d=784$) and a CT slice location dataset ($n=53,500, d=384$).

  • Accuracy: On the MNIST dataset using an NTK, the proposed method achieved a classification error of 5.44%, notably better than PolySketch (5.92%) and Adaptive Sampling (5.87%) when using the same number of samples.
  • Efficiency: The method demonstrated a superior trade-off between accuracy and memory. By reducing the memory requirement from $O(n^2)$ to $O(n \cdot s_\lambda)$, where $s_\lambda$ is the statistical dimension, the algorithm allows for higher-fidelity sketches within the same hardware constraints.
  • Speed: Theoretical analysis confirms that for Gaussian kernels, this approach is strictly faster than previous benchmarks (e.g., Song et al., 2021), especially in scenarios where the dataset radius is small relative to the number of points.

Conclusion and Future Directions

This work provides a robust solution to the scalability issues of tensor product kernels. By achieving input sparsity time, it opens the door for using high-degree polynomial and neural tangent kernels on datasets that were previously too large to process.

However, some limitations remain. The runtime still depends quadratically on the statistical dimension ($s_\lambda^2$), which may become a bottleneck for datasets that do not exhibit low-rank structures in the feature space. Future research may explore whether other sparse sketching techniques, such as CountSketch, can further optimize these results or if the dependence on the statistical dimension can be further reduced.

Summary updated

BibTeX
@inproceedings{woodruff2022leverage,
  author = {David P. Woodruff and Amir Zandieh},
  title = {{Leverage Score Sampling for Tensor Product Matrices in Input Sparsity Time}},
  booktitle = {International Conference on Machine Learning},
  year = {2022},
}
Figure