# Minimax Optimal Kernel Two-sample Testing in Sub-quadratic Time

*Ikjun Choi, Shourya Pandey, Purnamrita Sarkar*

[NeurIPS page](https://neurips.cc/virtual/2026/poster/149505) · [OpenReview](https://openreview.net/forum?id=pe7A1xPNan) · [Open on the map](../papers.html#p149505)

Category: [Causality, Privacy & Learning Theory](../pcat/11.md) › [Conformal Prediction and Risk Control](../pgroup/659.md) · Type: new method · Keywords: kernel two-sample test, MMD, subquadratic time, minimax optimal, Fenwick tree, characteristic kernel

Areas: [Optimization & Algorithms](../areas/optimization.md) › Optimal Transport and Sampling › Clustering and Diversity Algorithms

## Summary
The paper proposes a sub-quadratic time approximation for the Maximum Mean Discrepancy (MMD) two-sample test that achieves minimax rate-optimal power with minimal distributional assumptions.

## Explained to a 5-year-old
People sometimes want to compare two groups of data to see if they are different. A common way to do this needs to look at many pairs of points, which can take a long time. The new idea makes this comparison faster by using a clever trick that still checks the data well. It works for many kinds of data and keeps the results accurate. This helps researchers handle big datasets more easily.

## Explained to a 5-year-old, longer
When scientists want to know if two sets of measurements are the same or different, they often use a method called a kernel two-sample test. The usual version of this test looks at every possible pair of points from the two sets, which can be a lot of work when there are many points. To make the test faster, the authors found a way to do most of the calculations using a special data structure called a Fenwick tree, which quickly adds up many numbers. This trick reduces the time needed from growing like the square of the number of points to something much slower, while still giving accurate results. The new method works well for many common types of data, such as simple measurements, smooth curves, and even complex patterns. It also stays fast when the data has many dimensions, as long as the important information lives in a lower-dimensional space. By using this faster approach, researchers can apply kernel two-sample tests to larger datasets without losing the reliability of the conclusions.

## For a technical reader
The work addresses the O(N²) cost of classic MMD two-sample testing by approximating the kernel sum with Fenwick-tree prefix queries, achieving sub-quadratic time. Theoretical analysis shows the approximation error is bounded so the test retains minimax-optimal power. The method supports common characteristic kernels and scales sub-quadratically for dimensions d=o(log N/log log N). It can be combined with dimensionality-reduction pipelines, offering a drop-in efficiency upgrade for existing kernel-based hypothesis tests.

## Problem
The standard MMD test requires evaluating Θ(N²) kernel pairs, which becomes computationally prohibitive for large samples. Existing sub-quadratic approximations either lose statistical power or need extra distributional assumptions, leaving a gap between efficiency and optimality.

## Method
The approach builds on fast kernel density estimation and an exponentially convergent trapezoidal rule, reducing all-pairs kernel summation to fast Fenwick-tree prefix-sum queries, which yields sub-quadratic algorithms for common characteristic kernels.

## Contributions
It introduces a sub-quadratic approximation that attains minimax-optimal power with minimal assumptions, works for several characteristic kernels, maintains sub-quadratic scaling for dimensions d=o(log N/log log N), and can be combined with dimensionality-reduction techniques.

## Limitations and assumptions
The sub-quadratic scaling holds for fixed dimension or when the signal is low-dimensional (d=o(log N/log log N)), and the approach relies on characteristic kernels.

## Practical relevance
It enables scalable kernel two-sample testing on large datasets without sacrificing statistical power, making hypothesis testing feasible for big data scenarios.

This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. [Suggest a correction](../feedback/?on=p/149505)
