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

Exponentially Consistent Kernel Two-Sample Tests

Shengyu Zhu, Biao Chen, Zhitang ChenarXiv 2018

Introduction

Two-sample testing is a cornerstone of statistical inference, addressing whether two sets of observations originate from the same underlying distribution ($P = Q$) or distinct ones ($P \neq Q$). In modern machine learning, kernel-based methods—specifically the Maximum Mean Discrepancy (MMD)—have emerged as preferred tools due to their computational efficiency and effectiveness in high-dimensional spaces. While the consistency of these tests was well-established, the exact rate of this convergence remained an open question. This paper provides the first exact characterization of the asymptotic performance for kernel-based two-sample tests, proving they are "exponentially consistent."

Theoretical Framework: Extended Sanov’s Theorem

The core contribution of this work is the derivation of the exact "error exponent" $D^*$ that governs the decay of the Type-II error (the probability of failing to detect a difference). To achieve this, the authors developed an Extended Sanov’s Theorem. While the classical Sanov’s theorem describes the large deviations of a single empirical distribution, this extension handles two independent sample sequences simultaneously.

Applying this tool to the biased quadratic-time MMD estimator, the authors demonstrated that the Type-II error $\beta_{n,m}$ vanishes at an exponential rate: $$\beta_{n,m} \approx O(e^{-(n+m)D^*})$$ where $n$ and $m$ are the respective sample sizes. As shown in empirical evaluations, this decay appears as a linear trend on a logarithmic scale.

Type-II error vanishes exponentially as sample size increases, shown on a logarithmic scale.

Information-Theoretic Optimality

Beyond establishing the rate, the authors proved that kernel MMD tests are statistically optimal. Using information-theoretic tools like Stein’s Lemma, they showed that no test can achieve a decay rate superior to $D^*$ under a fixed significance level (Type-I error constraint). This implies that kernel-based tests reach the fundamental theoretical "speed limit" for two-sample testing.

The Role of the Kernel

A striking finding of this research is that the choice of kernel does not influence the asymptotic exponential decay rate $D^*$, provided the kernel is characteristic and bounded. While kernel selection and bandwidth tuning are critical in the "finite sample regime" (small datasets), their impact is confined to sub-exponential terms. Asymptotically, the difficulty of the testing problem is determined solely by the distributions $P$ and $Q$.

Comparison of Type-II error for trained and fixed kernels. While training helps in small samples, the decay rates (slopes) converge asymptotically.

Empirical Validation and Applications

The theoretical results were validated using synthetic datasets, including 2D Gaussians and Gaussian mixtures. The experiments confirmed that as sample size increases, the error rates for different kernels eventually converge to the same steep downward slope on a log scale.

The authors further applied this theory to off-line change detection, where the goal is to identify a distribution shift in a time series. They proved that a kernel-based maximum partition strategy achieves the optimal detection rate, extending the utility of MMD beyond simple two-sample comparison.

Conclusion and Future Directions

This work establishes a rigorous foundation for understanding the power of kernel two-sample tests. By proving exponential consistency and optimality, it justifies the widespread use of MMD in practice. However, challenges remain: in real-world scenarios with limited data, kernel choice remains paramount. Future research may explore the transition point between the "training" regime and the "asymptotic" regime, as well as the performance of more computationally efficient linear-time kernel tests.

Summary updated

BibTeX
@misc{zhu2018exponentially,
  author = {Shengyu Zhu and Biao Chen and Zhitang Chen},
  title = {{Exponentially Consistent Kernel Two-Sample Tests}},
  year = {2018},
  eprint = {1802.08407},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1802.08407},
}
Figure