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

Using Perturbation to Improve Goodness-of-Fit Tests based on Kernelized Stein Discrepancy

Xing Liu, Andrew B. Duncan, Axel Gandy

This paper, presented at ICML 2023, addresses a significant "blind spot" in modern statistical testing. While Kernelized Stein Discrepancy (KSD) has become a favorite tool for evaluating complex models, it turns out it can be surprisingly easy to fool. The authors propose a clever "perturbation" strategy to fix this vulnerability.

TL;DR

Standard Kernelized Stein Discrepancy (KSD) tests often fail to detect differences between distributions that share the same modes but have different mixing weights—a problem known as "blindness to isolated components." By perturbing samples using target-invariant Markov kernels (specifically inter-modal jumps), the authors create a new test (pKSD) that dramatically increases detection power in multi-modal scenarios.

What Problem Does This Paper Address?

Goodness-of-Fit (GOF) tests ask a fundamental question: "Does my observed data $Q$ actually come from the target distribution $P$?" In many modern applications (like Bayesian inference), we only know the target $P$ up to an intractable normalization constant. KSD is popular in these scenarios because it only requires the score function (the gradient of the log-density), which bypasses the need for that missing constant.

However, KSD has a critical weakness. If $P$ and $Q$ have well-separated modes (e.g., two Gaussian humps far apart) but differ only in how much mass is in each hump, KSD often fails to see the difference. Because the "score" (the slope of the density) is nearly identical in the high-probability regions of both humps, and the space between them has near-zero probability, the discrepancy statistic remains near zero. The authors prove that as modes move further apart, the power of a standard KSD test drops to the level of a random guess.

Methods: Perturbed Kernelized Stein Discrepancy (pKSD)

To overcome this, the authors introduce the Perturbed Kernelized Stein Discrepancy (pKSD). The core idea is to transform the data before testing it.

  1. Target-Invariant Perturbation: They apply a Markov transition kernel $K$ to the observed samples. Crucially, this kernel is designed to be $P$-invariant, meaning if the data truly came from $P$, the perturbation wouldn't change the underlying distribution ($KP = P$).
  2. Inter-modal Jumps: To solve the "blindness" issue, they design a specific jump proposal. This proposal identifies the modes of the target $P$ and attempts to "shuffle" points between them. If $Q$ has the wrong mixing weights, these jumps will move points from a "too-heavy" mode in $Q$ to a "too-light" mode, creating a local discrepancy that KSD can easily detect.
  3. Test Variants:
    • spKSD (sum-pKSD): Combines the standard KSD with several perturbed versions using different jump scales.
  4. ospKSD (optimized pKSD): Uses a small portion of the data to "tune" the perturbation to maximize the test's power.
  5. Mode Estimation: Since the method requires knowing where the modes are, they use the BFGS optimization algorithm to find local maxima and Hessians of the target density.

Key Insights

  • Non-Irreducibility is a Feature: In MCMC sampling, we want "irreducible" kernels that can eventually reach any point. Here, the authors argue that non-irreducible kernels are actually better. By only jumping between specific modes, they "aggregate" the density discrepancies into high-probability regions, making them much easier for the kernel to pick up.
  • Exponential Sample Requirements: The paper provides a formal proof that for standard KSD to detect weight differences in well-separated mixtures, the required sample size grows exponentially with the distance between modes.
  • Score Difference Shuffling: The "aha moment" is realizing that perturbation effectively shuffles the score differences. By moving a point from mode A to mode B, you are comparing the density of $Q$ at A with the density of $P$ at B.

Key Results

The authors evaluated their method on several synthetic and complex benchmarks, demonstrating significant improvements over standard KSD.

Rejection rate vs mode distance and method overview
  • Massive Power Boost: In a 1D bimodal Gaussian experiment, as the distance between modes ($\Delta$) increased beyond 6, the rejection rate of standard KSD dropped to 0.05 (the significance level). In contrast, ospKSD and spKSD maintained a rejection rate of nearly 1.0 (perfect power).
  • Robustness in High Dimensions: Even in 50 dimensions with complex "banana" shapes, the perturbation methods significantly outperformed existing state-of-the-art variants like KSDAGG and FSSD.
Sensor Network Localisation posterior samples
  • Detecting MCMC Failure: In a Bayesian Sensor Network Localisation task, the goal is to infer sensor locations from noisy distance data. Standard KSD failed to reject samples from an MCMC chain that missed modes. The proposed ospKSD correctly rejected these samples, identifying that the sampler had failed to capture the full posterior.

Limitations and Future Work

  • Mode Dependency: The current jump proposal relies on accurately finding the modes and Hessians of the target. In extremely high-dimensional or "manifold-like" distributions where modes are not point-like, this estimation becomes difficult and computationally expensive.
  • Geometry Specificity: The jump proposal is currently tailored for mixtures of elliptic distributions. Targets with more complex, non-convex geometries might require more sophisticated perturbation operators.
  • Hyperparameter Sensitivity: While ospKSD helps, the choice of the set of perturbations still requires careful consideration to balance computational cost and test power.

The authors suggest that future work could involve finding perturbation operators that scale better with dimensionality or automatically adapt to more complex topological structures in the data.

Summary updated

BibTeX
@inproceedings{liu2023using,
  author = {Xing Liu and Andrew B. Duncan and Axel Gandy},
  title = {{Using Perturbation to Improve Goodness-of-Fit Tests based on Kernelized Stein Discrepancy}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=92tf5kOykr},
}
Figure