Zero-Flow Two-Sample Tests

TL;DR

Proposes Zero-Flow Two-Sample Test (ZF2ST) with strong performance on synthetic and image datasets.

cs.LG 🔴 Advanced 2026-07-24 2 views
Yakun Wang Leyang Wang Song Liu Taiji Suzuki
statistical test machine learning zero-flow criterion neural networks high-dimensional data

Key Findings

Methodology

The paper introduces a novel two-sample testing method called Zero-Flow Two-Sample Test (ZF2ST), based on Zero-Flow Discrepancy (ZFD). It detects distributional differences by learning local misalignments in samples. ZF2ST separates witness learning from hypothesis evaluation, allowing the use of flexible neural networks while maintaining valid statistical calibration. Both regression-based and power-maximized approaches for witness learning are developed.

Key Results

  • On synthetic datasets, ZF2ST rapidly gains strong testing power as sample size increases, achieving nearly full power while maintaining Type-I error close to nominal levels.
  • In high-dimensional Gaussian mixtures, ZF2ST maintains high power as dimensionality increases, while other baselines' performance significantly drops.
  • In MNIST rare-contamination tests, ZF2ST performs excellently as sample size increases, especially the ZF-Reg method.

Significance

This study introduces a novel and effective tool for detecting distributional differences in high-dimensional data, addressing the limitations of traditional nonparametric tests in high-dimensional settings, especially when discrepancies are concentrated in few directions. The method's flexibility and strong performance make it widely applicable in academia and industry.

Technical Contribution

The technical contributions include proposing Zero-Flow Discrepancy (ZFD) as a new statistical discrepancy measure and developing a sample-split testing procedure (ZF2ST) that separates witness learning from hypothesis evaluation. The method provides standard asymptotic Gaussian calibration and analyzes testing power through signal-to-noise ratio.

Novelty

ZF2ST is the first method to use the zero-flow criterion for two-sample testing. Its innovation lies in separating witness learning from hypothesis evaluation, allowing flexible neural networks while maintaining statistical calibration.

Limitations

  • In cases of localized multimodal changes, random cross-pairing may obscure relevant local structures, limiting ZF2ST's performance.
  • When discrepancies are confined to within-mode covariance changes, ZF2ST requires more samples to achieve comparable performance with other methods.

Future Work

Future research directions include studying more regular witness classes, such as reproducing kernel Hilbert spaces, establishing convergence guarantees for witness learning, and extending ZF2ST to learned feature spaces.

AI Executive Summary

Two-sample testing is a fundamental problem in statistics and machine learning, aiming to determine whether two samples come from the same distribution. Traditional methods face challenges in high-dimensional data, especially when discrepancies are concentrated in few directions. This paper introduces a novel method called Zero-Flow Two-Sample Test (ZF2ST), based on Zero-Flow Discrepancy (ZFD), to detect distributional differences. ZF2ST provides strong testing power by learning local misalignment patterns.

The core of ZF2ST lies in separating witness learning from hypothesis evaluation, allowing the use of flexible neural networks while maintaining valid statistical calibration. Both regression-based and power-maximized approaches for witness learning are developed. Experiments on synthetic and image datasets demonstrate that ZF2ST achieves strong testing power for structured distributional changes while maintaining well-calibrated Type-I error.

This study provides a novel and effective tool for detecting distributional differences in high-dimensional data, addressing the limitations of traditional nonparametric tests. Future research directions include studying more regular witness classes, establishing convergence guarantees for witness learning, and extending ZF2ST to learned feature spaces.

Deep Analysis

Background

Two-sample testing holds significant importance in statistics and machine learning, widely applied in model criticism, dataset comparison, and distribution shift detection. Traditional nonparametric tests face challenges in high-dimensional data, especially when discrepancies are concentrated in few directions. Recently, flow-based models have achieved remarkable success in capturing fine-grained features of complex data distributions, inspiring us to explore their use in two-sample testing.

Core Problem

Two-sample testing in high-dimensional data faces the challenge of capturing the structure of high-dimensional alternatives. Even consistent nonparametric tests can have limited finite-sample power in high dimensions, particularly when the discrepancy is localized or concentrated in only a few informative directions. Learning a witness adapted to the alternative can therefore be as important as designing the final test statistic.

Innovation

The core innovation of this paper is the introduction of the Zero-Flow Two-Sample Test (ZF2ST), based on Zero-Flow Discrepancy (ZFD), to detect distributional differences. Unlike existing methods, ZF2ST separates witness learning from hypothesis evaluation, allowing the use of flexible neural networks while maintaining valid statistical calibration. Both regression-based and power-maximized approaches for witness learning are developed.

Methodology

  • �� Propose Zero-Flow Discrepancy (ZFD) as a new statistical discrepancy measure.
  • �� Develop a sample-split testing procedure (ZF2ST) that separates witness learning from hypothesis evaluation.
  • �� Provide standard asymptotic Gaussian calibration and analyze testing power through signal-to-noise ratio.
  • �� Use flexible neural networks for witness learning.

Experiments

Experiments were conducted on synthetic and image datasets to validate the performance of ZF2ST. The experiments include high-dimensional Gaussian mixtures and MNIST rare-contamination tests. We compared the performance of ZF2ST with other baseline methods, evaluating its testing power and Type-I error across different sample sizes and dimensions.

Results

ZF2ST performs excellently on synthetic datasets, rapidly gaining strong testing power as sample size increases. In high-dimensional Gaussian mixtures, ZF2ST maintains high power as dimensionality increases, while other baselines' performance significantly drops. In MNIST rare-contamination tests, ZF2ST performs excellently as sample size increases.

Applications

ZF2ST can be used for detecting distributional differences in high-dimensional data, applicable in model criticism, dataset comparison, and distribution shift detection. Its flexibility and strong performance make it widely applicable in academia and industry.

Limitations & Outlook

In cases of localized multimodal changes, random cross-pairing may obscure relevant local structures, limiting ZF2ST's performance. When discrepancies are confined to within-mode covariance changes, ZF2ST requires more samples to achieve comparable performance with other methods. Future research directions include studying more regular witness classes, establishing convergence guarantees for witness learning, and extending ZF2ST to learned feature spaces.

Plain Language Accessible to non-experts

Imagine you're in a kitchen trying to figure out if two dishes used the same spices. Traditional methods are like tasting a spoonful to see if they taste the same. But in high-dimensional data, it's like tasting a huge pot of soup with many flavors, making it hard to tell. The Zero-Flow Two-Sample Test is like a special spoon that can detect tiny differences in each spice. It learns the unique pattern of each spice to determine if the two dishes used the same spices. This way, even in complex high-dimensional data, we can accurately detect distributional differences.

ELI14 Explained like you're 14

Imagine you're playing a game where two teams race on different maps. You need to figure out if the maps are the same. Traditional methods are like looking at the overall shape of the maps, but sometimes the details matter, like hidden paths. The Zero-Flow Two-Sample Test is like a super magnifying glass that lets you see every detail on the map. It learns the unique features of each spot on the map to determine if the two maps are the same. This way, even in complex maps, we can accurately detect differences!

Glossary

Zero-Flow Discrepancy

A statistical discrepancy measure based on the zero-flow criterion, used to detect differences between two distributions.

Used to define the core statistic of the Zero-Flow Two-Sample Test.

Zero-Flow Two-Sample Test

A novel two-sample testing method that detects distributional differences by learning local misalignments in samples.

The main method proposed in this paper for detecting distributional differences in high-dimensional data.

Witness Learning

A process of learning differences between samples to aid in detecting distributional differences.

Key step in separating witness learning from hypothesis evaluation.

Signal-to-Noise Ratio

A measure of the strength of a signal relative to noise, used to evaluate testing power.

Used to analyze the testing power of the Zero-Flow Two-Sample Test.

Gaussian Mixture Model

A statistical model representing complex distributions as a weighted sum of multiple Gaussian distributions.

Used as an experimental dataset to validate the performance of the Zero-Flow Two-Sample Test.

Open Questions Unanswered questions from this research

  • 1 How to improve ZF2ST's performance in cases of localized multimodal changes? Current methods may obscure relevant local structures.
  • 2 How to reduce ZF2ST's dependency on sample size when discrepancies are confined to within-mode covariance changes?
  • 3 How to extend ZF2ST to more regular witness classes, such as reproducing kernel Hilbert spaces?

Applications

Immediate Applications

Model Criticism

Researchers can use ZF2ST to evaluate machine learning models' performance by detecting discrepancies between model outputs and true distributions.

Dataset Comparison

Data scientists can use ZF2ST to compare different datasets and identify distributional differences between them.

Long-term Vision

Distribution Shift Detection

ZF2ST can be used to monitor data distribution changes in production environments, helping companies adjust models in a timely manner.

Abstract

We propose a new approach to two-sample testing for deciding whether two sets of samples are drawn from the same distribution. The test is built on a statistical discrepancy based on the zero-flow criterion, termed zero-flow discrepancy (ZFD). We prove the validity of ZFD and propose a practical testing procedure, termed the zero-flow two-sample test (ZF2ST). The key idea is to learn how samples from the two distributions are locally misaligned and use the resulting directional pattern as evidence of distributional difference. By separating witness learning from hypothesis evaluation, ZF2ST can use flexible neural networks while maintaining valid statistical calibration. We develop both regression-based and power-maximized approaches for learning the witness. Experiments on synthetic and image datasets demonstrate that ZF2ST can achieve strong testing power for structured distributional changes while maintaining well-calibrated type-I error.

cs.LG stat.ML