Introduction
In probabilistic modeling, a goodness-of-fit test answers a fundamental question: Does the proposed model actually describe the distribution of the observed data? For modern, unnormalized models like energy-based models, the Kernel Stein Discrepancy (KSD) has become a go-to tool. KSD allows researchers to test these models without needing to compute intractable normalizing constants or sample from them.
However, KSD tests are highly sensitive to the choice of kernel—specifically its bandwidth. If the chosen bandwidth is too wide or too narrow, the test loses statistical "power," meaning it fails to reject a false model. Traditionally, researchers have relied on suboptimal heuristics (like the "median trick") or data splitting (using half the data to select a kernel and the other half to test it), which wastes valuable statistical power.
To solve this, researchers have introduced the KSD Aggregated Goodness-of-fit Test (KSDAGG), a new framework that automates kernel selection without sacrificing data or relying on arbitrary heuristics.
The KSDAGG Methodology
KSDAGG introduces an aggregation strategy that runs multiple KSD tests simultaneously across a collection of different kernels (e.g., varying bandwidths).
Aggregation and Level Correction
Instead of attempting to pick a single "best" kernel, KSDAGG evaluates a set of kernels. If any individual test within the set rejects the null hypothesis, the aggregated test rejects it. To prevent "p-hacking"—where testing multiple kernels artificially inflates the chance of a false positive—KSDAGG applies a non-asymptotic level correction to the test thresholds. This ensures the overall test strictly maintains the desired significance level (e.g., $\alpha = 0.05$).
Bootstrapping for Thresholds
The test employs two numerical methods to estimate these thresholds:
- Wild Bootstrap: A computationally efficient method that does not require sampling from the model.
- Parametric Bootstrap: A method unique to the goodness-of-fit setting, where samples are drawn directly from the model to simulate the null distribution. While computationally heavier, it provides highly robust results in high-dimensional settings, preventing false positives even when sample sizes are small relative to dimensionality.
Theoretical Guarantees
From a theoretical standpoint, KSDAGG is highly efficient. The authors prove that it achieves the "minimax optimal" separation rate. In practical terms, this means KSDAGG is as sensitive as theoretically possible at detecting differences between distributions, even when the underlying smoothness of those distributions is unknown. This adaptivity comes practically for "free," incurring only a negligible iterated logarithmic penalty in theoretical performance.
Experimental Validation
The researchers evaluated KSDAGG against several benchmarks, ranging from simple to highly complex:
- Gamma Distribution: A 1D test to verify foundational performance.
- Gaussian-Bernoulli Restricted Boltzmann Machine (RBM): A 50-dimensional graphical model with an intractable normalizing constant, representing an ideal use case for KSD.
- MNIST Normalizing Flow: A 784-dimensional experiment testing whether a generative model could distinguish between real MNIST digits and its own generated samples.
Key Results
- Maximized Data Utility: By eliminating data splitting, KSDAGG uses 100% of the dataset for the test itself, a critical advantage for small datasets.
- Superior High-Dimensional Power: In the 784-dimensional MNIST task, traditional split-data tests failed to gain power. In contrast, KSDAGG (and its robust variant, KSDAGG*) successfully scaled with sample size, reliably detecting when the model did not perfectly match the data.
- Matching "Cheating" Tests: KSDAGG frequently matched the performance of theoretical "cheating" tests that were granted extra data specifically to select the perfect kernel.
Limitations and Future Directions
While KSDAGG represents a significant step forward, it has a few limitations:
- Computational Complexity: Like standard KSD, the test scales quadratically with the number of samples ($O(N^2)$). Scaling to millions of data points will require approximations, such as incomplete U-statistics.
- Kernel Collection: Although KSDAGG automates bandwidth selection from a set, the user must still define the initial range of bandwidths.
- Theoretical Scope: The strongest theoretical guarantees currently apply to "restricted" Sobolev spaces (densities that do not solely differ at very low frequencies). Extending these proofs to unrestricted spaces remains an open challenge.
Summary updated