Even Faster Kernel Matrix Linear Algebra via Density Estimation

Rikhav Shah, Sandeep Silwal, Haike Xu

Introduction

Kernel methods are a cornerstone of machine learning, powering everything from classical Support Vector Machines and Gaussian Processes to modern attention mechanisms in Transformers. At the heart of these methods lies the kernel matrix $K$, an $n \times n$ matrix representing pairwise similarities between $n$ data points.

However, these methods suffer from a notorious "quadratic bottleneck." Simply initializing this matrix takes $O(n^2)$ time, which is prohibitive for large datasets. While researchers have developed sub-quadratic approximation algorithms using Kernel Density Estimation (KDE) data structures, previous state-of-the-art methods suffered from severe polynomial dependencies on the target error $\varepsilon$. This paper bridges that gap, introducing refined algorithms that are exceptionally fast in both the number of points ($n$) and the required precision ($1/\varepsilon$).

The Problem: The Precision Penalty

Prior sub-quadratic KDE methods (such as those introduced at ICML '21) successfully reduced the dependence on $n$, but introduced a steep penalty for high precision. If a practitioner required a highly accurate answer, the "fast" algorithm became painfully slow due to high polynomial dependencies on $1/\varepsilon$.

This paper significantly accelerates fundamental kernel matrix operations—such as matrix-vector products and spectral norm estimation—by treating the KDE data structure as a modular "black box" primitive and optimizing how it is queried.

Methodological Innovations

A standard KDE query takes a point $y$ and returns an approximation of the row sum $\sum_{i} K(y, x_i)$. To perform complex linear algebra more efficiently, the authors introduce three key technical innovations:

  1. Adaptive Error Bucketing for Matrix-Vector Products (MVPs): For non-negative MVPs, the authors abandon standard geometric bucketing. Instead, they utilize a coarser bucketing strategy combined with an adaptive choice of the KDE error parameter. By assigning different error tolerances to different "mass" buckets of the input vector, they eliminate a significant $1/\varepsilon$ overhead.
  2. Tighter Noisy Power Iteration Analysis: To find the top eigenvalue (spectral norm), the authors rely on the power method. Previous analyses assumed that achieving an $\varepsilon$-accurate eigenvalue required extremely precise (and thus slow) matrix-vector products. This paper proves a tighter relationship: an $O(\varepsilon)$-accurate MVP is sufficient to reach an $\varepsilon$-accurate eigenvalue, drastically reducing total runtime.
  3. Symmetric Sampling for Kernel Sums: To compute the sum of all entries in the matrix, the authors developed a multi-step sampling algorithm. This approach filters out "heavy" rows and columns, using KDE queries on a balanced, square sub-matrix to maintain efficiency.

Key Results and Theoretical Bounds

The paper provides massive theoretical and empirical speedups for the Gaussian kernel, specifically by slashing the complexity of the error parameter:

  • Spectral Norm (Top Eigenvalue): Improved the $1/\varepsilon$ dependence from roughly $1/\varepsilon^{7.7}$ to $1/\varepsilon^{3.2}$. For a target error of 0.01, this represents a monumental reduction in computational steps.
  • Matrix-Vector Product (MVP): Improved the $1/\varepsilon$ dependence from $\approx 3.3$ to $\approx 2.2$.
  • Kernel Sum: Achieved a runtime of $O(n^{0.58}/\varepsilon^4)$, which is faster in both $n$ and $\varepsilon$ than previous benchmarks.

The "Non-Negative" Advantage

A crucial insight from the paper is the fundamental divide in complexity based on the input vector's signs. If the input vector is non-negative, the problem is "easy" and can be solved in sub-quadratic time. However, using the Strong Exponential Time Hypothesis (SETH), the authors provide theoretical evidence that for general vectors with mixed signs, the problem is likely "hard" and may truly require $O(n^2)$ time.

Empirical Validation

The authors evaluated their algorithms on three real-world datasets frequently used in KDE literature: MNIST ($n=1,000$, $d=784$), Forest CoverType ($n=10,000$, $d=54$), and CLIP Embeddings of CIFAR-10 images ($n=500$, $d=512$). (Note: Subsets were used because calculating the exact ground truth for comparison requires $O(n^2)$ time).

Experiments confirmed that the error in the final eigenvalue estimate scales linearly with the error in the MVP. This validates their tighter theoretical analysis and demonstrates that their approach outperforms the Nyström method in high-precision regimes.

Limitations and Future Work

While the theoretical gains are substantial, the authors note several boundaries to their current approach:

  • Mixed-Sign Vectors: The current upper bounds apply only to non-negative input vectors. Finding ways to handle general vectors in specific practical cases remains an open question.
  • Beyond the Top Eigenvector: Extending these sub-quadratic techniques to find the second eigenvalue ($\lambda_2$) or a full low-rank approximation is significantly more difficult. The "non-negativity" property of the top eigenvector (guaranteed via the Perron-Frobenius theorem) does not apply to subsequent eigenvectors.
  • Hardware Optimization: Actual "wall-clock" speedups will depend heavily on hardware (CPU vs. GPU) and the specific implementation of the underlying KDE structure. Because the algorithms interact with KDE structures through a standard interface, any future breakthroughs in KDE data structures will automatically translate to even faster linear algebra tasks.

Summary updated

BibTeX
@inproceedings{shah2026even,
  author = {Rikhav Shah and Sandeep Silwal and Haike Xu},
  title = {{Even Faster Kernel Matrix Linear Algebra via Density Estimation}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=ueNIrBXz7R},
}
Figure