Nyström Kernel Stein Discrepancy

Florian Kalinke, Zoltán Szabó, Bharath Sriperumbudur

Abstract

Kernel methods underpin many of the most successful approaches in data science and statistics, allowing probability measures to be represented as elements of a reproducing kernel Hilbert space (RKHS) without loss of information. Recently, the Kernel Stein Discrepancy (KSD), which combines Stein's method with the flexibility of kernel techniques, has gained considerable attention. Through the Stein operator, KSD enables the construction of powerful goodness-of-fit tests where it is sufficient to know the target distribution up to a multiplicative constant. However, typical U- and V-statistic-based KSD estimators suffer from a quadratic runtime complexity, $O(n^2)$, which hinders their application in large-scale settings. In this work, we propose a Nyström-based KSD acceleration—with runtime $O(mn + m^3)$ for $n$ samples and $m \ll n$ Nyström points. We demonstrate its $\sqrt{n}$-consistency under a classical sub-Gaussian assumption and show its applicability for goodness-of-fit testing across a suite of benchmarks. We also establish the $\sqrt{n}$-consistency of the quadratic-time KSD estimator.

Introduction

Goodness-of-Fit (GoF) testing is a fundamental statistical task: determining whether an observed dataset $Q$ originates from a specific target distribution $P$. While straightforward when $P$ is fully specified, modern machine learning often involves target distributions known only up to a multiplicative constant. This is common in evaluating Markov Chain Monte Carlo (MCMC) samplers or deep generative models, where the normalizing constant (partition function) is computationally intractable.

Kernel Stein Discrepancy (KSD) has emerged as a premier solution for this problem. By utilizing the "Stein identity," KSD requires only the score function—the derivative of the log-density—of the target distribution. This makes it agnostic to the normalization constant. However, the computational cost of standard KSD estimators scales quadratically with the number of samples ($O(n^2)$). For large-scale datasets, this complexity is prohibitive. While previous attempts like linear-time KSD or Random Fourier Features (RFF) have sought to address this, they often suffer from a significant loss in statistical power. This paper introduces Nyström-KSD (N-KSD), a method that achieves near-linear runtime while preserving the high statistical power of the quadratic estimator.

The Nyström-KSD Estimator

The core innovation of N-KSD is the application of Nyström subspace projection to the Stein feature map. Instead of computing the full $n \times n$ kernel matrix, the method projects the data onto a lower-dimensional subspace spanned by $m$ randomly selected "Nyström points," where $m$ is much smaller than $n$.

This projection results in a closed-form expression for the squared KSD that can be computed in $O(mn + m^3)$ time. To facilitate hypothesis testing, the authors also developed an accelerated Nyström Wild Bootstrap. This allows for the rapid calculation of p-values by approximating the null distribution within the Nyström framework, ensuring the entire testing pipeline remains efficient.

Theoretical Breakthrough: Handling Unbounded Kernels

A significant contribution of this work is the theoretical analysis of Nyström approximations for unbounded kernels. Most existing Nyström theory assumes that kernels are bounded. However, the Stein kernels used in GoF testing (such as the Gaussian or Inverse Multi-Quadric (IMQ) kernels combined with the Stein operator) are frequently unbounded on Euclidean space.

The authors prove that N-KSD achieves $\sqrt{n}$-consistency by introducing a sub-Gaussian assumption on the feature maps. This theoretical extension demonstrates that even if the kernel itself is unbounded, the Nyström approximation remains stable and convergent if the feature map behaves like a sub-Gaussian random variable. This provides a rigorous foundation for using N-KSD in a wide variety of practical scenarios.

Experimental Evaluation

The performance of N-KSD was evaluated against several standard goodness-of-fit benchmarks, including Laplace vs. Standard Normal tests, Student-t heavy-tail tests, and high-dimensional Restricted Boltzmann Machines (RBM).

Statistical Power and Efficiency

In experiments with $n=5000$ samples, N-KSD demonstrated competitive runtimes with existing linear-time methods like Finite Set Stein Discrepancy (FSSD) while maintaining significantly higher statistical power. In the RBM experiment—a high-dimensional physics-inspired model—N-KSD using the IMQ kernel nearly matched the performance of the full $O(n^2)$ quadratic KSD while requiring only a fraction of the computational time.

Robustness in High Dimensions

In high-dimensional Laplace tests, N-KSD significantly outperformed other accelerated methods. Methods like RFF and FSSD often saw their statistical power vanish as the dimensionality of the problem increased. In contrast, N-KSD remained robust, effectively hitting a "sweet spot" where choosing $m \approx \sqrt{n}$ yields the same statistical convergence rate as the quadratic estimator with massive speedups.

Conclusion

Nyström Kernel Stein Discrepancy provides a scalable and theoretically grounded framework for goodness-of-fit testing. By reducing the computational bottleneck from quadratic to near-linear, it enables the application of KSD to large-scale datasets without the prohibitive power loss seen in previous acceleration techniques. While the sub-Gaussian assumption and kernel hyperparameter tuning remain important considerations, N-KSD represents a substantial step forward in making kernel-based statistical tests practical for modern, high-dimensional data science.

Summary updated

BibTeX
@inproceedings{kalinke2025nystrom,
  author = {Florian Kalinke and Zoltán Szabó and Bharath Sriperumbudur},
  title = {{Nyström Kernel Stein Discrepancy}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2025},
  url = {https://openreview.net/forum?id=iLM3CeY2zb},
}
Figure