ConceptioArchivearXiv CS
arXiv CSopen access

Zero-Flow Two-Sample Tests

Unknown · 2026 · arxiv_cs
arXiv CS · Papers · License: Open Access · 2026
Open Source ↗Direct PDF ↓
machine learning, deep learning, neural networks

Zero-Flow Two-Sample Tests

Yakun Wang University of Bristol [email protected] Song Liu University of Bristol [email protected]

Leyang Wang RIKEN AIP [email protected] Taiji Suzuki University of Tokyo & RIKEN AIP [email protected]

arXiv:2607.21542v1 [cs.LG] 23 Jul 2026

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.

1

Introduction

Two-sample testing is a fundamental problem in statistics and machine learning: given observations from two unknown distributions, the goal is to determine whether they arise from the same population. It underlies applications including model criticism (Sutherland et al., 2016), dataset comparison (Gretton et al., 2012), and distribution-shift detection (Rabanser et al., 2019). Classical nonparametric tests compare expectations over a class of test functions. Kernel methods such as the maximum mean discrepancy compare mean embeddings in a reproducing kernel Hilbert space (Gretton et al., 2012), while more recent methods improve testing power by learning test locations, kernels, deep representations, or witness functions (Jitkrittum et al., 2016; Sutherland et al., 2016; Liu et al., 2020; Kübler et al., 2022). A central challenge in modern two-sample testing is to capture 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 (Ramdas et al., 2015; Jitkrittum et al., 2016). Learning a witness adapted to the alternative can therefore be as important as designing the final test statistic. Flow-based models have achieved remarkable success in capturing fine-grained features of complex data distributions (Lipman et al., 2023; Liu et al., 2022; Albergo et al., 2025). Their representational power has also been leveraged beyond sample generation for statistical tasks such as missing-data imputation (Yu et al., 2025) and mutual-information estimation (Butakov et al., 2025). Motivated by these developments, we explore their use in two-sample testing. Rather than using a flow model to synthesize additional observations, Preprint.

we use its learned vector field as a structured witness for describing and testing how two distributions differ. Our approach builds on the zero-flow criterion (Wang et al., 2026). We independently pair observations from the two distributions and consider the midpoint and displacement of each pair. Conditional on the midpoint, the average displacement defines a vector field that vanishes exactly when the two distributions are equal. A nonzero field therefore provides a vector-valued witness of distributional mismatch. Its magnitude indicates where the discrepancy is pronounced, while its direction describes how probability mass is locally misaligned. Directly estimating the squared magnitude of this field is not well suited to hypothesis testing. Under the null, finite-sample estimation error produces a nonzero learned field, and squaring it introduces a positive nuisance term with a generally nonstandard null distribution. We instead separate witness learning from hypothesis evaluation. A witness is learned on one data split and evaluated on an independent split through its alignment with held-out displacements. Conditional on the training data, the witness is fixed and the held-out alignment scores are centered under the null. Their studentized average consequently admits standard asymptotic Gaussian calibration. We call the resulting procedure the zero-flow two-sample test (ZF2ST). This sample-split construction decouples type-I error control from testing power. Under nondegeneracy conditions, the validity of the held-out calibration relies on the independence between witness learning and evaluation, rather than on the accuracy of the learned witness. An inaccurate or misspecified witness may reduce power but does not alter the null centering of the held-out statistic. For witness learning, we consider both regression toward the midpoint velocity and a power-oriented objective that directly maximizes the signal-to-noise ratio of the held-out statistic. The latter allows the model to focus on directions that provide stable evidence against the null rather than reconstructing the entire flow. Our contributions are summarized as follows: • We formulate the zero-flow midpoint velocity as a vector-valued population witness for two-sample testing and characterize its distributional and geometric meaning. • We propose ZF2ST, a sample-split test based on held-out witness alignment, and establish standard asymptotic null calibration for the final statistic. • We establish the power analysis of ZF2ST in terms of the signal-to-noise ratio and propose a corresponding power-optimized witness-learning scheme.

2

Background

Two-sample testing. Let P and Q be Borel probability measures on Rd . We observe two independent i.i.d. i.i.d. samples SX = {xi }ni=1 ∼ P and SY = {yj }m j=1 ∼ Q. The goal of two-sample testing is to determine whether the two samples are drawn from the same distribution, formalized as testing the null hypothesis H0 : P = Q against the alternative H1 : P ̸= Q at a prescribed significance level α ∈ (0, 1). A two-sample test typically proceeds in three steps. First, one computes a test statistic Zb = b X , SY ), where larger values indicate stronger evidence against H0 . Second, one calibrates Z(S b for example by bootstrap, permutation, or asymptotic theory (Efron and the null distribution of Z, Tibshirani, 1985; Good, 2013; Gretton et al., 2012). Let Z0 denote a random variable following b the null distribution of the statistic. The right-tail p-value is then defined as pval = PrH0 (Z0 ≥ Z). Finally, the test rejects H0 at significance level α whenever pval ≤ α. Flow matching and midpoint conditional velocity. Flow Matching (FM; Lipman et al., 2023; Liu et al., 2022) learns a velocity field along a linear interpolation between two independent random variables. Given X ∼ P and Y ∼ Q, define Xt = (1 − t)X + tY for t ∈ [0, 1]. FM fits a 2

time-dependent velocity field by solving v := arg min Et,X,Y ∥Y − X − u(Xt ; t)∥2 ,

equivalently,

u

v(z; t) = E[Y − X | Xt = z]

At the midpoint t = 1/2, this becomes v(z; 1/2) = E[Y − X | (X + Y )/2 = z], a conditional expectation of the displacement given the midpoint. Zero-flow criterion. Recently, a key property of the population FM velocity at the midpoint was established by Wang et al. (2026): the midpoint velocity vanishes if and only if the two endpoint distributions coincide. Thus, a nonzero midpoint velocity witnesses a distributional mismatch. Proposition 2.1 (Zero-flow condition; Theorem 3.1 in Wang et al. (2026)). Let X ∼ P and Y ∼ Q be independent random variables with finite second moments. Then v(z; 1/2) = 0, ∀z if and only if P = Q.

3

Zero-Flow Discrepancy

3.1

Definition and basic properties

We first turn the zero-flow criterion in Proposition 2.1 into a valid statistical discrepancy. Throughout the paper, let X ∼ P and Y ∼ Q be independent random vectors taking values in Rd . We denote by D := Y − X and M := (X + Y )/2 the displacement and midpoint between X and Y , respectively. The midpoint velocity is denoted by v(m) := E[D | M = m]; we suppress its argument when no b Var, d and u b , denote empirical or data-dependent quantities, while confusion arises. Hats, as in E, superscripts tr and te denote the training and evaluation splits, respectively. Definition 3.1 (Zero-Flow Discrepancy). Let X ∼ P and Y ∼ Q be independent random variables on Rd with finite second moments. Define the population midpoint velocity by v(m) := E[D | M = m]. The Zero-Flow Discrepancy between P and Q is h i 2 ZFD(P, Q) := E ∥v(M )∥ . (1) Unlike FM, which learns a full time-dependent velocity field, ZFD only uses the midpoint conditional velocity v(m) = E[D | M = m]. This conditional form naturally leads to a regression-based estimator and can be parameterized by flexible function classes, such as neural networks or an RKHS. The midpoint velocity also reflects a local cancellation effect: conditional on a fixed midpoint m, opposite displacement directions cancel when P = Q, yielding E[D | M = m] = 0. Therefore, a nonzero value of v(m) indicates a directional imbalance between P and Q at that midpoint. ZFD aggregates this imbalance by averaging the squared magnitude of the midpoint velocity over the midpoint distribution. Proposition 3.1 (Basic Properties of ZFD). Let P and Q be probability distributions on Rd with finite second moments. The Zero-Flow Discrepancy satisfies the following properties: 1. (Non-negativity and identification) ZFD(P, Q) ≥ 0, with equality if and only if P = Q. 2. (Symmetry) ZFD(P, Q) = ZFD(Q, P ). A proof can be found in Appendix A.1.

4

Zero-Flow Two-Sample Test

Since Proposition 3.1 shows that ZFD is a valid population discrepancy, a natural approach is to use its X+Y 2 b [ empirical estimation ZFD(P, Q) := E[||v̂( 2 )|| ] as a test statistic. However, this empirical form is a quadratic plug-in statistic in terms of an estimated velocity v̂, which is statistically inconvenient b does not under the null. When H0 : P = Q, the population midpoint velocity satisfies v ≡ 0, but v 3

vanish exactly due to finite-sample estimation error. Squaring the estimated field therefore creates a positive nuisance contribution under H0 , leading to a biased and nonstandard null distribution. We further discuss the potential pitfalls of using empirical ZFD in Appendix B. To alleviate this problem, we propose a scale-invariant dual form of ZFD, which shifts the ZFD signal from the magnitude of a fitted velocity field v̂ to its direction. This follows the same principle as MMD, where the discrepancy is obtained by optimizing witness alignment over the RKHS unit ball (Gretton et al., 2012). 4.1

A scale-invariant dual form of ZFD

Let PM denote the distribution of the midpoint M , and let L2 (PM ; Rd ) := {u : Rd → Rd : 2 E[∥u(M )∥ ] < ∞} be the space of square-integrable vector fields on the midpoint space. Proposition 4.1 (Scale-invariant dual representation of ZFD). Let X ∼ P and Y ∼ Q be independent random variables on Rd with finite second moments. Then 2

ZFD(P, Q) =

(E ⟨u(M ), D⟩) h i . 2 2 2 d u∈L (PM ;R );E[∥u(M )∥ ]>0 E ∥u(M )∥ sup

(2)

The supremum is attained by any nonzero rescaling of the midpoint velocity, u = cv with c ̸= 0, whenever ZFD(P, Q) > 0. When ZFD(P, Q) = 0, every admissible u attains value zero. The proof is deferred to Appendix A.2. This representation gives a directional interpretation of ZFD: the dual objective evaluates the alignment between a vector field u and the midpoint velocity v, while being invariant to the scale of u. Thus, for testing, the relevant quantity is not the magnitude of a fitted field but its alignment signal E⟨u(M ), D⟩, whose impact on power is analyzed in Section 4.3. 4.2

Zero-Flow Two-Sample Test (ZF2ST)

Let u ∈ L2 (PM ; Rd ) be a fixed witness field. We define the signed zero-flow alignment as the unsquared term appearing in the numerator of the dual objective (2) T (P, Q; u) := E [⟨u(M ), D⟩] = E [⟨u(M ), v(M )⟩] ,

(3)

where the second equality follows from Lemma A.1. Thus the witness u specifies a probing direction, and T (P, Q; u) measures the signed expected alignment between u and the true midpoint velocity v. Note that, when the witness field equals the true midpoint velocity, the alignment recovers the ZFD T (P, Q; v) = ZFD(P, Q). Construction of the test statistic. The zero-flow alignment (3) naturally suggests a sample-splitting witness-learning testing scheme: we first learn u on one split, then evaluate and studentize T (P, Q; u) on an independent split (Kübler et al., 2022). Let SX = {xi }ni=1 and SY = {yi }m i=1 be two independent samples from P and Q, respectively. We split both samples into training and testing tr te folds, SX = SX ∪ SX and SY = SYtr ∪ SYte . Throughout the paper, we will assume n = m. tr On the training folds, we learn a witness direction utr using only (SX , SYtr ). Details on how to tr learn the witness field u are provided in Section 4.4. With the learned witness utr , we evaluate the test statistic on an independent held-out split. Let Nte be the number of evaluation pairs, and define Mite = (Xite + Yite )/2 and Dite = Yite − Xite for i = 1, . . . , Nte . Denote by Tbte (utr ) the 2 empirical mean of the held-out alignment scores tte (utr ), and by σ bte (utr ) their sample variance. The 2 corresponding population variance is σte (utr ) := Var(tte (utr )): 1 Nte 1 X Tbte := tte , Nte i=1 i

tr te te tte i := ⟨u (Mi ), Di ⟩,

2 σ bte :=

Nte  2 X 1 b tte . i − Tte Nte − 1 i=1

1 For brevity, we omit the explicit dependence on utr when no confusion arises.

4

(4)

The final ZF2ST statistic is the studentized empirical mean on the test fold: √ Nte Tbte b ZZF := . σ bte

(5)

We summarize the ZF2ST procedure in Algorithm 1. 4.3

Asymptotic distributions and testing power

We next study the null calibration and testing power of the ZF2ST statistic ZbZF . Our analysis follows the sample-splitting framework of Kübler et al. (2022): conditional on the training split, the learned witness is fixed, and the held-out statistic is an empirical mean of scalar alignment scores. Therefore, its null distribution and power can be derived from the same empirical-mean CLT argument (Serfling, 2009, Sec. 1.9). Theorem 4.1 (Asymptotic distribution of ZF2ST). For a learned field utr ∈ L2 (PM ; Rd ), let 2 σte := Var(tte ) be the variance of the held-out score tte conditioned on utr in (4) such that 2 2 < ∞. Let σ bte be the corresponding sample variance. Then, as Nte → ∞, 0 < σte o n √ Nte Tbte − T (P, Q; utr ) d − → N (0, 1). σ bte A proof can be found in Appendix A.3. Consequently, for a fixed learned field utr and sufficiently large Nte , the test threshold and asymptotic power of ZF2ST can be characterized through the normal bZF . approximation of Z Motivated by the signed alignment in (3), we use a one-sided test. Under the alternative, the desired T (P, Q; utr ) corresponds to positive alignment between the learned field utr and the true midpoint velocity v. A two-sided test would discard this directional information by allocating rejection probability to both tails, and can therefore suffer from a loss of power. For sufficiently large Nte , Theorem 4.1 gives the asymptotic right-tail p-value pval = 1 − Φ(ZbZF ), where Φ is the standard normal cumulative distribution function. The level-α ZF2ST rejects H0 whenever pval ≤ α. For finite-sample calibration, our experiments instead use the paired sign-flip randomization procedure described in Section C.2. This calibration exploits the antisymmetry of the held-out alignment scores under the exchange of paired testing samples and reuses the pre-computed witness scores without additional witness evaluations. A test is said to be consistent if its power converges to one as the sample size increases. The asymptotic distribution of ZF2ST motivates the following power approximation and yields a consistency result under the alternative H1 : P ̸= Q, both characterized by the signal-to-noise ratio of the held-out alignment statistic. Proposition 4.2 (Power approximation and test consistency). Let z1−α := Φ−1 (1 − α). For a fixed 2 learned witness utr , define σte := Var(tte ) as the variance of the held-out score tte conditioned on 2 utr in (4) such that 0 < σte < ∞. The population signal-to-noise ratio of the fixed learned witness utr is T (P, Q; utr ) SNR(utr ) := . (6) σte For sufficiently large Nte , a Gaussian approximation to the power of the one-sided level-α ZF2ST satisfies     p Pr ZbZF > z1−α ≈ 1 − Φ z1−α − Nte SNR(utr ) . (7) In particular, under any fixed alternative H1 for which T (P, Q; utr ) = c′ > 0, the power converges to one as Nte → ∞. 5

Algorithm 1 ZF2ST Require: Samples SX , SY , training epochs E, number of randomizations B, level α tr te 1: SX = SX ∪ SX , SY = SYtr ∪ SYte tr b tr ← T RAINING W ITH DYNAMIC PAIRING(SX 2: u , SYtr , E) te 3: pval ← S IGN F LIP C ALIBRATION(b utr , SX , SYte , B) 4: return reject H0 if pval ≤ α

▷ Algorithm 3 ▷ Algorithm 4

A proof can be found in Appendix A.4. The result implies that ZF2ST is consistent whenever the learned field utr has positive average alignment with the true midpoint velocity v, and the held2 out alignment scores tte i have finite, nonzero variance σte . Moreover, √ the approximated rejection probability is monotone increasing in the effective signal strength Nte SNR(utr ). 4.4

Approaches to learning the witness

The power analysis shows that ZF2ST benefits from a learned field utr that has positive alignment with the true midpoint velocity v. Since sample splitting allows flexible witness learning without compromising held-out calibration (Kübler et al., 2022), we consider two practical ways to learn a direction in a prescribed function class u ∈ F. Both objectives can be combined with the dynamic pairing strategy introduced in Appendix C.1. Least-square regression. A natural choice for learning witness is to directly estimate the population tr midpoint velocity v(m) = E[D | M = m]. Given training split SX , SYtr , we solve a regression h i 2 b b tr u . (8) reg := arg min Etr ∥u(M ) − D∥ u∈F

This regression witness targets the optimal midpoint velocity itself, and is therefore the most direct implementation of the zero-flow signal. Maximize the SNR. Since the test only requires a direction that has large positive alignment with the zero-flow signal, we may instead learn a witness by maximizing a regularized empirical signalto-noise ratio. This follows the same principle as power-optimized kernel two-sample tests (Kübler et al., 2022; Liu et al., 2020; Sutherland et al., 2016), where the witness or kernel is trained to improve testing power while the final calibration is performed on held-out data. Motivated by the scale-invariant dual form in (2) and the power approximation in Proposition 4.2, we consider b tr u λ :=

b tr ⟨u(M ), D⟩ E i1/2 .  btr ∥u(M )∥2 >0 d u∈F ;E b tr ∥u(M )∥2 Vartr ⟨u(M ), D⟩ + λE arg max

h

(9)

where λ > 0 controls the magnitude of regularization. Unlike the regression objective, this criterion directly searches for a direction with large testing signal relative to its variability. Training complexity. Treating the data dimension and network architecture as fixed, let Cu denote the cost of evaluating and backpropagating through the witness network for one midpoint. Each ZF2ST witness training update on a mini-batch of size b costs O(bCu ) since pairing construction and loss computation involve only linear-time elementwise operations. Dynamic pairing additionally requires a linear-time permutation once per epoch. Importantly, ZF2ST does not require constructing a pairwise Gram matrix. However, this lower per-update complexity does not necessarily imply a uniformly lower total training cost: learning a complex vector-valued witness may require more optimization updates. A detailed complexity comparison is provided in Section C.3.

5

Experiments

We instantiate the witness class F using deep neural networks and evaluate two variants of ZF2ST. ZF-Reg, defined in (8), learns a vector-valued witness by regressing the midpoint displacement, whereas ZF-SNR, defined in (9), directly maximizes a regularized empirical signal-to-noise ratio on the training split. 6

Figure 1: Results on the HDGM benchmark for α = 0.05 (black line). Left: average test power (a) and type-I error (b) as the number of samples per distribution n increases, with d = 10. Right: average test power (c) and type-I error (d) as the dimension d increases, with n = 3000. Shaded regions show one standard error across independent training trials.

(a) Blob benchmarks.

(b) MNIST rare-contamination benchmark.

Figure 2: Results on the Blob and MNIST benchmarks for α = 0.05 (black line). Left: average test power on Blob-D and type-I error on Blob-S as the number of samples per blob varies. Right: average test power under MNIST 6-to-9 contamination and type-I error under P = Q = µ6 as the number of samples per distribution varies. Shaded regions denote one standard error across independent training trials.

As baselines, we include MMD-D (Liu et al., 2020), a deep-kernel MMD test with a learned feature map, and C2ST, a classifier two-sample test. For C2ST, we report both the standard label-based statistic, denoted C2ST-S (Lopez-Paz and Oquab, 2016), and the logits-based statistic, denoted C2ST-L (Cheng and Cloninger, 2022). We also include MMD-O (Sutherland et al., 2016), which optimizes the bandwidth of a standard kernel using an empirical power criterion and serves as a strong non-neural baseline. All learned components are trained only on the training samples and then frozen before evaluation on held-out samples. Configuration details, benchmark details and evaluation protocols are provided in Appendix D. High-Dimensional Gaussian Mixtures (HDGM, Liu et al., 2020). We consider bimodal Gaussian mixtures of increasing dimension. We vary either the sample size n with d = 10, or the dimension d with n = 3000. As shown in Figure 1, both ZF2ST variants gain power rapidly as the sample size increases and reach nearly full power by n = 2000. ZF-Reg is particularly effective in the smaller-sample regime. When the dimension increases, ZF-Reg and ZF-SNR retain power close to one, whereas the power of the kernel and classifier baselines decreases substantially. Across both experiments, the empirical type-I errors remain broadly close to the nominal level. These results suggest that the vector-valued midpoint witness is well suited to this alternative, where the distributional difference has a coherent directional structure across the mixture components. Blob datasets (Liu et al., 2020). We consider the 3 × 3 Gaussian-mixture benchmarks. Blob-D preserves the mode locations and mixture weights but introduces mode-dependent covariance changes, resulting in a highly local and multimodal alternative. As shown in Figure 2a, all methods exhibit type-I error close to the nominal level on Blob-S. On Blob-D, the kernel and classifier baselines are more powerful in the small-sample regime. ZF-SNR improves rapidly with sample size and reaches near-full power from approximately 70 samples per blob, whereas ZF-Reg requires more observations to attain comparable performance. This benchmark therefore highlights a limitation of ZF2ST: when the discrepancy is confined to subtle within-mode covariance changes, random cross-pairing can dilute the relevant local structure before it is represented by the midpoint witness. 7

MNIST mixture. We next consider the MNIST dataset (LeCun et al., 1998). Let µ6 and µ9 denote the empirical MNIST distributions of digits 6 and 9, respectively. We test P = µ6 and Q = (1 − π)µ6 + πµ9 with contamination level π = 0.1. Thus, Q contains a small fraction of digit 9 images, whereas P contains only digit 6 images. As shown in Figure 2b, ZF-Reg achieves the highest power throughout the considered sample-size range, with the gap widening as n increases. ZF-SNR also outperforms most learned baselines, although MMD-O becomes comparable at the largest sample sizes. The empirical type-I errors of all methods remain broadly close to the nominal level. One possible explanation is that the digit-6-to-digit-9 pairs induce a coordinated high-dimensional displacement pattern that can be retained by the vector-valued witness before aggregation into the final scalar alignment statistic.

6

Related Work

Kernel and Classifier-based two-sample tests. Kernel two-sample tests compare distributions through expectations over a function class. A central example is the maximum mean discrepancy (MMD), which searches for the largest scalar mean contrast over the unit ball of an RKHS (Gretton et al., 2012). A substantial line of work improves finite-sample power by adapting the statistic to the observed alternative, including optimized test locations and frequencies (Jitkrittum et al., 2016), power-optimized kernels (Sutherland et al., 2016), and learned deep kernels (Liu et al., 2020). Classifier two-sample tests instead train a discriminator and use classification accuracy, logits, or related scores as evidence of distributional difference (Lopez-Paz and Oquab, 2016; Cheng and Cloninger, 2022). These methods primarily extract scalar discriminative evidence from individual endpoint observations. Learned-witness tests. ZF2ST is closely related to the witness two-sample test (WiTS) (Kübler et al., 2022). WiTS learns a scalar witness on a training split and evaluates its empirical mean difference on an independent test split. Conditional on the training data, the witness is fixed, so its estimation affects testing power without invalidating the held-out null calibration. ZF2ST adopts the same sample-splitting principle but replaces the single-observation scalar witness with a pairwise vector-valued field. Each held-out pair contributes a scalar alignment between the learned midpoint field and the corresponding displacement. Under the null, the zero-flow criterion centers this alignment for any fixed witness. ZF2ST may therefore be viewed as a midpoint– displacement analogue of WiTS, replacing an endpoint contrast with directional alignment. Zero-flow and midpoint generative models. Wang et al. (2026) introduced the zero-flow criterion, showing that under independent coupling the midpoint flow-matching velocity vanishes everywhere if and only if the two endpoint distributions coincide. That work used the criterion to characterize conditional independence and construct representation-learning objectives. A subsequent related development, Midpoint Generative Models (Shlenskii et al., 2026), uses the same midpoint symmetry to define a closely related midpoint-field discrepancy and derive objectives for one-step generative modeling. ZF2ST instead focuses on statistical inference: it formulates the midpoint velocity as a vector-valued two-sample witness, derives a scale-invariant dual representation, and evaluates the learned witness through a studentized held-out alignment statistic. It further provides a signal-tonoise-ratio characterization of testing power and a finite-sample paired sign-flip calibration.

7

Conclusion

Building on the midpoint zero-flow characterization, we introduced ZF2ST, a two-sample test based on a learned vector-valued midpoint witness. By learning the witness on a training split and evaluating its studentized linear alignment with displacements on an independent evaluation split, ZF2ST avoids the positive null bias of a direct plug-in estimator of ZFD while retaining valid statistical calibration. We developed both regression-based and power-oriented max-SNR objectives for witness learning, and characterized the asymptotic null distribution and testing power through the signal-to-noise ratio of the held-out alignment scores. 8

Our experiments indicate that zero-flow witnesses can be effective when distributional differences induce structured and predictable midpoint–displacement patterns, including high-dimensional mixture alternatives and rare semantic contamination. They also reveal that highly localized multimodal changes can be more challenging, as random cross-pairing may obscure the relevant local structure. Promising directions for future work 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.

Acknowledgements TS was partially supported by JSPS KAKENHI (24K02905) and JST CREST (PMJCR2015). This research is supported by the National Research Foundation, Singapore and the Ministry of Digital Development and Information under the AI Visiting Professorship Programme (award number AIVP2024-004). Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not reflect the views of National Research Foundation, Singapore and the Ministry of Digital Development and Information.

References Albergo, M., Boffi, N. M., and Vanden-Eijnden, E. (2025). Stochastic interpolants: A unifying framework for flows and diffusions. Journal of Machine Learning Research, 26(209):1–80. Butakov, I., Semenenko, A., Kirova, V., Frolov, A., and Oseledets, I. (2025). Fmmi: Flow matching mutual information estimation. arXiv preprint arXiv:2511.08552. Cheng, X. and Cloninger, A. (2022). Classification logit two-sample testing by neural networks for differentiating near manifold densities. IEEE Transactions on Information Theory, 68(10):6631– 6662. Efron, B. and Tibshirani, R. (1985). The bootstrap method for assessing statistical accuracy. Behaviormetrika, 12(17):1–35. Good, P. (2013). Permutation tests: a practical guide to resampling methods for testing hypotheses. Springer Science & Business Media. Gretton, A., Borgwardt, K. M., Rasch, M. J., Schölkopf, B., and Smola, A. (2012). A kernel two-sample test. The journal of machine learning research, 13(1):723–773. Hemerik, J. and Goeman, J. (2018). Exact testing with random permutations. Test, 27(4):811–825. Jitkrittum, W., Szabó, Z., Chwialkowski, K. P., and Gretton, A. (2016). Interpretable distribution features with maximum testing power. Advances in Neural Information Processing Systems, 29. Kübler, J. M., Jitkrittum, W., Schölkopf, B., and Muandet, K. (2022). A witness two-sample test. In International Conference on Artificial Intelligence and Statistics, pages 1403–1419. PMLR. LeCun, Y., Bottou, L., Bengio, Y., and Haffner, P. (1998). Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324. Lipman, Y., Chen, R. T., Ben-Hamu, H., Nickel, M., and Le, M. (2023). Flow matching for generative modeling. In International Conference on Learning Representations. Liu, F., Xu, W., Lu, J., Zhang, G., Gretton, A., and Sutherland, D. J. (2020). Learning deep kernels for non-parametric two-sample tests. In International conference on machine learning, pages 6316–6326. PMLR. Liu, X., Gong, C., and Liu, Q. (2022). Flow straight and fast: Learning to generate and transfer data with rectified flow. arXiv preprint arXiv:2209.03003. Lopez-Paz, D. and Oquab, M. (2016). Revisiting classifier two-sample tests. arXiv preprint arXiv:1610.06545. 9

Phipson, B. and Smyth, G. K. (2016). Permutation p-values should never be zero: calculating exact p-values when permutations are randomly drawn. arXiv preprint arXiv:1603.05766. Rabanser, S., Günnemann, S., and Lipton, Z. (2019). Failing loudly: An empirical study of methods for detecting dataset shift. Advances in Neural Information Processing Systems, 32. Ramdas, A., Reddi, S. J., Póczos, B., Singh, A., and Wasserman, L. (2015). On the decreasing power of kernel and distance based nonparametric hypothesis tests in high dimensions. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 29. Serfling, R. J. (2009). Approximation theorems of mathematical statistics. John Wiley & Sons. Shlenskii, D., Gushchin, N., Novitskiy, L., Dylov, D. V., and Korotin, A. (2026). Midpoint generative models. arXiv preprint arXiv:2605.29920. Sutherland, D. J., Tung, H.-Y., Strathmann, H., De, S., Ramdas, A., Smola, A., and Gretton, A. (2016). Generative models and model criticism via optimized maximum mean discrepancy. arXiv preprint arXiv:1611.04488. Wang, Y., Wang, L., Liu, S., and Suzuki, T. (2026). arXiv:2602.00797.

Zero-flow encoders.

arXiv preprint

Yu, J., Ying, Q., Wang, L., Jiang, Z., and Liu, S. (2025). Missing data imputation by reducing mutual information with rectified flows. Advances in Neural Information Processing Systems, 38:80324–80352.

A

Proofs

A.1

Proof of Proposition 3.1

Proof. Let X ∼ P and Y ∼ Q be independent, and define M = (X + Y )/2 and D = Y − X. By Definition 3.1, 2 ZFD(P, Q) = E ∥E[D | M ]∥ . Therefore ZFD(P, Q) ≥ 0. Moreover, ZFD(P, Q) = 0 if and only if E[D | M ] = 0

a.e.

By Proposition 2.1, this is equivalent to P = Q. This proves non-negativity and identification. It remains to prove symmetry. For the reversed pair, let Y ∼ Q and X ∼ P be independent and define Y +X M′ = = M, D′ = X − Y = −D. 2 The corresponding midpoint velocity is vQ,P (m) = E[D′ | M ′ = m] = E[−D | M = m] = −vP,Q (m). Since the midpoint distribution is unchanged under swapping X and Y , we obtain 2

2

2

ZFD(Q, P ) = E ∥vQ,P (M ′ )∥ = E ∥−vP,Q (M )∥ = E ∥vP,Q (M )∥ = ZFD(P, Q). This completes the proof. A.2

Proof of Proposition 4.1

Lemma A.1 (Tower identity). For any measurable u : Rd → Rd with finite moments, E [⟨u(M ), D⟩] = E [⟨u(M ), v(M )⟩] . 10

(10)

Proof. By the tower property, E[⟨u(M ), D⟩] = E E[⟨u(M ), D⟩ | M ] = E⟨u(M ), E[D | M ]⟩ = E⟨u(M ), v(M )⟩.

Proof of Proposition 4.1. By Lemma A.1, for any u ∈ L2 (PM ; Rd ), E⟨u(M ), D⟩ = E⟨u(M ), v(M )⟩. By the Cauchy-Schwarz inequality in L2 (PM ; Rd ), 2

2

2

(E⟨u(M ), v(M )⟩) ≤ E ∥u(M )∥ E ∥v(M )∥ . Hence, together with Lemma A.1, for every admissible u, (E⟨u(M ), D⟩)

2

2

E ∥u(M )∥

2

≤ E ∥v(M )∥ = ZFD(P, Q).

If ZFD(P, Q) > 0, equality is attained by taking u = cv with c ̸= 0. If ZFD(P, Q) = 0, then v(M ) = 0 a.e. By Lemma A.1, the numerator E⟨u(M ), v(M )⟩ ≡ 0 for every admissible u. Therefore the quotient is identically zero, and the supremum is also zero. Thus, ZFD(P, Q) =

(E⟨u(M ), D⟩)

sup u∈L2 (PM ;Rd );E∥u(M )∥2 >0

A.3

2

E ∥u(M )∥

2

.

Proof of Theorem 4.1

tr Proof. Conditional on the training fold (SX , SYtr ), the learned witness field utr is fixed and independent of the evaluation folds. Therefore, the held-out alignment scores tr te te tte , i = u (Mi ), Di

i = 1, . . . , Nte ,

are independent and identically distributed scalar random variables. Their mean is     E tte = E utr (M te ), Dte = T (P, Q; utr ), i where the last equality uses the fact that utr is fixed in terms of testing fold. Their variance is   2 σte = Var tte = Var utr (M te ), Dte , 2 which is assumed to satisfy 0 < σte < ∞.

By the classical central limit theorem (Serfling, 2009) applied conditionally on the training folds, n o √ Nte Tbte − T (P, Q; utr ) d − → N (0, 1), σte where Nte 1 X Tbte = tte . Nte i=1 i

Moreover, since tte i have finite second moment, the empirical variance 2 σ bte =

is consistent:

Nte  2 X 1 b tte i − Tte Nte − 1 i=1 p

2 2 σ bte − → σte .

11

2 Since σte > 0, we also have

σ bte p − → 1. σte Slutsky’s theorem then gives n o √ Nte Tbte − T (P, Q; utr ) σ bte

√ =

n o Nte Tbte − T (P, Q; utr ) σte d · − → N (0, 1). σte σ bte

This proves the asserted studentized asymptotic distribution. It remains to identify the centering under the null. If H0 : P = Q, Proposition 2.1 implies v(m) = E[D | M = m] ≡ 0. Hence, for any fixed square-integrable witness field u, by Lemma A.1 T (P, Q; u) = E⟨u(M ), D⟩ = E [⟨u(M ), v(M )⟩] = 0. Applying this identity to the fixed learned witness u = utr , we obtain T (P, Q; utr ) = 0 under H0 . Therefore,

√ bZF = Z

Nte Tbte d − → N (0, 1) σ bte

under the null. This completes the proof. A.4

Proof of Proposition 4.2

Proof. Condition on the training split throughout, so that the learned witness utr is fixed. For brevity, write N := Nte , T := T (P, Q; utr ), σ := σte . The ZF2ST statistic admits the decomposition √ N Tbte ZbZF = σ bte  √  N Tbte − T √ T = + N . σ bte σ bte By Theorem 4.1,

  N Tbte − T σ bte

d

−→ N (0, 1),

(11)

p

and σ bte −→ σ. For sufficiently large N , combining (11) with the plug-in replacement σ bte ≈ σ in the signal term gives √ T √ ZbZF ≈ Z + N = Z + N SNR(utr ), Z ∼ N (0, 1). σ Therefore, the rejection probability is approximated by     √ bZF > z1−α ≈ Pr Z + N SNR(utr ) > z1−α Pr Z   √ = 1 − Φ z1−α − N SNR(utr ) , which gives the stated Gaussian power approximation. 12

We next prove consistency directly, without relying on this approximation. Suppose that T (P, Q; utr ) > 0. Since 0 < σ 2 < ∞, this is equivalent to SNR(utr ) > 0. The centered term (11) is Op (1) by Theorem 4.1. Meanwhile, √ N

√ T σ T = N σ bte σσ bte √ σ p −→ +∞, = N SNR(utr ) σ bte

p

because σ/b σte −→ 1 and SNR(utr ) > 0 is fixed. Hence, p ZbZF −→ +∞.

Since z1−α is fixed,   bZF > z1−α −→ 1. Pr Z Thus, conditional on the training split, any fixed learned witness with positive population alignment yields a consistent ZF2ST as Nte → ∞.

B

Discussion: Pitfalls of Empirical ZFD

A natural estimator of the population ZFD is the empirical version n 1X [ ZFD(P, Q) = ∥b v(Mi )∥2 , n i=1

b is a learned estimator of the population midpoint velocity where v v(m) = E[D | M = m]. Although this estimator is natural for estimating the population energy E∥v(M )∥2 , it is less suitable as a test statistic. The reason is that the statistic squares the learned witness and therefore converts estimation error into a positive null contribution. To see this, write b = v + e, v where e denotes the witness estimation error. Then, up to the empirical evaluation error, b v(M )∥2 − E∥v(M b b b E∥b )∥2 = 2E⟨v(M ), e(M )⟩ + E∥e(M )∥2 . Under a fixed alternative, the first-order term may contribute because v ̸= 0. However, under the null hypothesis H0 : P = Q, the zero-flow criterion gives v ≡ 0. Hence b v(M )∥2 = E∥e(M b [ ZFD(P, Q) = E∥b )∥2 so the statistic is driven entirely by the squared estimation noise of the learned velocity. Its null distribution therefore depends on the regressor class, optimization procedure, regularization, output dimension, and sample size. This makes the empirical ZFD difficult to calibrate without resampling or problem-specific analysis. Even when permutation calibration is used, the positive estimation-noise contribution is included in the null distribution, which can inflate the critical value and reduce power. ZF2ST avoids this self-interaction by evaluating the learned witness linearly on an independent held-out split. Given a witness utr learned from the training split, we compute Tbte . Conditional on the training split, utr is fixed and independent of the evaluation samples. Under H0 , v ≡ 0, so for any learned witness utr , T (P, Q; utr ) ≡ 0. Thus the population alignment is zero, and the held-out empirical alignment Tbte is null-centered conditional on the training split. The witness quality affects the power through its alignment with the population velocity, but not the null centering. This is the main reason we use the sample-split linear ZF2ST statistic instead of the empirical ZFD estimator. 13

Figure 3: Fixed and dynamic pairing ablation on the Blob benchmarks. Left: average test power on Blob-D as the number of samples per blob varies. Right: average type-I error on Blob-S, with the horizontal line indicating the nominal level α = 0.05. Solid curves denote dynamic pairing, dashed curves denote fixed pairing, and shaded regions show one standard error across independent training trials.

C

ZF2ST Additional Details

C.1

Training Details: Dynamic pairing

tr Given the training folds SX and SYtr , a fixed one-to-one pairing produces only one collection of midpoint–displacement tuples,

Xtr + Ytr , Dtr = Ytr − Xtr , 2 tr tr tr tr where Xtr = (xtr 1 , . . . , xNtr ) and Y = (y1 , . . . , yNtr ). This construction repeatedly exposes the witness to the same Ntr cross-pairs and may therefore provide limited supervision; see Algorithm 2. Mtr =

We therefore use dynamic random pairing as a lightweight training-time augmentation. At the beginning of epoch e, we draw a random permutation π e of {1, . . . , Ntr } and construct Xtr + Yπtre tr tr , Dtr e = Yπ e − X . 2 By refreshing the pairing across epochs, the witness observes a more diverse collection of cross-paired tuples from the empirical product coupling, rather than being restricted to a single fixed matching. The procedure is summarized in Algorithm 3. Mtr e =

As shown in Figure 3, dynamic pairing substantially improves power on Blob-D for both witnesslearning objectives, particularly ZF-SNR. At 100 samples per blob, the dynamically paired variants achieve power close to one, whereas their fixed-pair counterparts remain below 0.2. Meanwhile, all variants exhibit comparable type-I error on Blob-S and remain close to the nominal level. These results suggest that the power gain arises from more effective witness learning and improved generalization to unseen evaluation pairs, rather than from inflated false-positive rates. Note that the dynamic pairing is used only during training. On the evaluation split, we form one-to-one fixed pairs and compute Xite + Yite , Dite = Yite − Xite , i = 1, . . . , Nte . 2 Conditionally on the learned witness, these held-out scores are independent, so the final testing statistic admits the CLT calibration in Theorem 4.1. Using all evaluation cross-pairs would instead introduce dependence and lead to a two-sample U/V-statistic-type variance structure (Serfling, 2009, Ch. 5). Thus, cross-pairing serves only as a training augmentation, while ZF2ST retains fixed one-to-one pairing during testing. tr te te tte , i = u (Mi ), Di

Mite =

14

Algorithm 2 Training with Fixed Pairing

Algorithm 3 Training with Dynamic Pairing

tr Require: SX , SYtr , epochs E tr Xtr +Y tr 1: M ← , Dtr ← Ytr − Xtr 2 2: for e = 1, . . . , E do tr 3: for each mini-batch (Mtr B , DB ) do tr 4: Update u using (8) or (9) 5: end for 6: end for 7: return utr

tr Require: SX , SYtr , epochs E 1: for e = 1, . . . , E do 2: πe ← Permute{1, . . . , Ntr }

C.2

Xtr +Y tr

πe tr tr Mtr , Dtr e ← e ← Yπe − X 2 tr tr 4: for each mini-batch (Me,B , De,B ) do 5: Update utr using (8) or (9) 6: end for 7: end for 8: return utr

3:

Testing Details: Sign-Flip Calibration

The asymptotic result in Theorem 4.1 permits Gaussian calibration when the evaluation sample is sufficiently large. In the experiments, we instead use a paired sign-flip randomization test. Although sign flipping is a classical finite-group randomization procedure (Hemerik and Goeman, 2018), it is particularly efficient for ZF2ST because the held-out alignment scores are antisymmetric under within-pair exchange. Unlike the classic pooled-label calibration, which generally changes the evaluation pairs after each relabeling, sign flipping reuses the pre-computed witness scores. Sign-flip statistic. Condition on the training split, so that the learned witness utr is fixed. For the fixed evaluation pairs, define tr te te tte , i = u (Mi ), Di

The observed statistic is

√ ZbZF =

where

Nte 1 X Tbte = tte , Nte i=1 i

i = 1, . . . , Nte .

Nte Tbte , σ bte

2 σ bte =

Nte  2 X 1 b tte . i − Tte Nte − 1 i=1

For the b-th randomization, draw a Rademacher vector  ε(b) ∼ Unif {−1, +1}Nte , and construct the sign-flipped score vector tte,(b) = ε(b) ⊙ tte ,  te

where tte = tte 1 , . . . , tNte . The randomized statistic is √ (b) Nte Tbte (b) b ZZF = , (b) σ bte where

Nte 1 X (b) te,(b) Tbte = t , Nte i=1 i



(b)

σ bte

2

=

(12)

Nte  2 X 1 te,(b) (b) ti − Tbte . Nte − 1 i=1

Using B random sign configurations, the one-sided p-value is n o PB (b) 1 + b=1 1 ZbZF ≥ ZbZF psf , val = B+1

(13)

and H0 is rejected whenever psf val ≤ α (Phipson and Smyth, 2016). We summarize the proposed calibration into Algorithm 4. The following proposition guarantees the validity of the sign-flip calibration. 15

Algorithm 4 Sign-Flip Calibration for ZF2ST te Require: Trained witness utr , SX , SYte , number of randomizations B te tr 1: Compute t by evaluating u using (4) ▷ One witness-evaluation pass bZF by studentizing tte 2: Compute Z 3: for b = 1, . . . , B do  4: Draw ε(b) ∼ Unif {−1, +1}Nte 5: tte,(b) ← ε(b) ⊙ tte ▷ No additional witness evaluations b(b) by studentizing tte,(b) 6: Compute Z ZF 7: end for sf 8: Compute pval using (13) 9: return psf val

Proposition C.1 (Finite-sample validity of sign-flip calibration). Suppose that utr is fixed and iid te iid SX ∼ P , SYte ∼ Q are independent. Under H0 : P = Q, the exhaustive sign-flip test (Algorithm 4) based on ZbZF controls the finite-sample type-I error at level α. The same conclusion holds for the corrected Monte Carlo p-value. Proof. For ε ∈ {−1, +1}, define the pairwise transformation  (X, Y ), ε = +1 swapε (X, Y ) = (Y, X), ε = −1 For a sign vector ε ∈ {−1, +1}Nte , let swapε apply swapεi independently to the i-th evaluation pair. Under H0 : P = Q, each pair (Xite , Yite ) is exchangeable. Since the evaluation pairs are independent, for every ε ∈ {−1, +1}Nte ,   d te te Nte te swapε {(Xite , Yite )}N i=1 = {(Xi , Yi )}i=1 . For each transformed pair,

Mite 7→ Mite ,

Dite 7→ εi Dite ,

and therefore

tr te te tte 7→ εi tte i = u (Mi ), Di i . Thus, applying swapε to the evaluation data is exactly equivalent to replacing the score vector by

tte 7→ ε ⊙ tte , The sign-flip procedure is therefore the finite-group randomization test induced by independent within-pair swaps. Finite-sample validity of the exhaustive test follows from Hemerik and Goeman (2018, Theorem 1). When only B sign vectors are sampled and the observed configuration is included through the corrected Monte Carlo p-value, level control follows from Hemerik and Goeman (2018, Theorem 2).

C.3

Complexity comparison

Let b denote the mini-batch size, Nte the number of testing samples per distribution, and B the number of randomizations. Let Cu , Cϕ , and Cf denote the per-sample costs of processing the ZF2ST witness, the MMD-D feature map, and the C2ST classifier, respectively, and let Ck denote the cost of evaluating one kernel interaction. We suppress the fixed data dimension and constant factors. Training complexity. For ZF2ST, an update on b midpoint-displacement pairs requires one evaluation and backpropagation through the witness and only elementwise pairing and loss computations. Its cost is therefore O(bCu ). Dynamic pairing additionally generates one random permutation and reconstructs the paired tuples once per epoch, requiring O(Ntr ) operations and leaving the overall training order unchanged. 16

Table 1: Leading-order computational costs for a mini-batch of size b, n evaluation samples per distribution, and B randomizations. The table describes the standard full-kernel MMD implementations considered in our experiments. Method

Training per update

Test and randomization calibration

ZF2ST (Proposed) MMD-O (Sutherland et al., 2016) MMD-D (Liu et al., 2020) C2ST (Lopez-Paz and Oquab, 2016)

O(bCu ) O(b2 Ck ) O(bCϕ + b2 Ck ) O(bCf )

O(Nte Cu + BNte ) 2 2 O(Nte Ck + BNte ) 2 2 O(Nte Cϕ + Nte Ck + BNte ) O(Nte Cf + BNte )

The full-kernel MMD-O objective evaluates O(b2 ) pairwise kernel terms per update, giving O(b2 Ck ). For MMD-D, each update additionally computes the learned feature representation, resulting in O(bCϕ + b2 Ck ). C2ST uses ordinary mini-batch classification and has per-update cost O(bCf ). For U optimization updates, each of these costs is multiplied by U . Calibration complexity. ZF2ST evaluates the witness once to obtain the Nte held-out alignment scores. Paired sign-flip calibration then requires only signed reductions, giving O(Nte Cu + BNte ). By comparison, a direct pooled-label implementation for ZF2ST generally changes the evaluation pairs and their midpoints after each relabeling, requiring O(B[Nte + Nte Cu ]). For the standard full-kernel MMD implementations, constructing the evaluation Gram matrix requires 2 O(Nte Ck ) operations, and each of the B pooled-label randomizations aggregates quadratic kernel 2 2 interactions. The resulting calibration costs are O(Nte Ck + BNte ) for MMD-O and O(Nte Cϕ + 2 2 Nte Ck + BNte ) for MMD-D. C2ST evaluates the classifier once and reuses the resulting predictions or logits across label randomizations, giving O(Nte Cf + BNte ). The leading-order costs are summarized in Table 1. Gaussian calibration further reduces the ZF2ST testing cost to O(Nte Cu + Nte ) by removing the randomization term.

D

Experiment Details

D.1

Evaluation Protocol

We compare ZF-Reg, ZF-SNR, MMD-O, MMD-D, C2ST-S, and C2ST-L. For synthetic benchmarks, each repetition uses an independently generated training sample and fresh evaluation samples. For MNIST, models are fitted using the official training split and evaluated using the official test split. All learned components are fitted exclusively on the training data and frozen before testing. We use K = 10 independent training repetitions and evaluate each fitted model on R = 100 testing sets. Tests are conducted at level α = 0.05 using B = 200 permutations. We report empirical power under H1 and type-I error under H0 . ZF2ST is calibrated using the paired sign-flip procedure in Section C.2. MMD-O and MMD-D use pooled-label permutations. C2ST-S and C2ST-L share the same cross-entropy-trained classifier and differ only in their held-out statistics; their classifier outputs are computed once and reused during pooled-label calibration. All Monte Carlo p-values use the add-one correction Phipson and Smyth (2016). D.2

Architectures and Optimization

All neural methods use multilayer perceptrons with four hidden affine layers and a final feature layer. MMD-D uses the feature output directly, C2ST appends a two-class classification head, and ZF2ST appends a vector-field head whose output dimension equals the input dimension. C2ST-S and 17

Table 2: Neural architectures used in the three benchmarks. Benchmark Blob Blob HDGM MNIST

Methods ZF-Reg, ZF-SNR MMD-D, C2ST all neural methods all neural methods

din 2 2 d 784

h = hf 100 50 3d 60

Activation SiLU Softplus Softplus Softplus

Table 3: Optimization hyperparameters. Here nb is the nominal number of observations per Blob component, and b = min(2nb , 128). Benchmark Blob Blob Blob Blob Blob HDGM HDGM HDGM HDGM HDGM MNIST MNIST MNIST MNIST MNIST

Method ZF-Reg ZF-SNR MMD-O MMD-D C2ST-S/L ZF-Reg ZF-SNR MMD-O MMD-D C2ST-S/L ZF-Reg ZF-SNR MMD-O MMD-D C2ST-S/L

Epochs 15,000 15,000 3,000 1,000 ⌊500(18nb )/b⌋ 1,000 1,000 2,000 1,000 1,000 1,500 1,500 1,500 1,500 1,500

Batch size full full full full b full full full full min(N tr , 128) full full full full 100

Learning rate 10−3 10−3 5 × 10−4 5 × 10−4 10−3 10−3 10−3 10−3 5 × 10−5 10−3 5 × 10−3 5 × 10−4 5 × 10−4 5 × 10−4 10−3

Other – λ = 10−3 – – shared classifier – λ = 10−3 – – shared classifier – λ = 10−3 – – shared classifier

C2ST-L share the same fitted classifier within each trial. Architectures and optimization settings are summarized in Tables 2 and 3. All neural models are optimized using Adam without a learning-rate scheduler or explicit weight decay. ZF2ST uses dynamic random pairing during training and fixed one-to-one pairing during evaluation. MMD-O uses the Gaussian kernel ∥x − y∥2 k(x, y) = exp − σ0 



and optimizes σ0 . MMD-D uses     ∥fθ (x) − fθ (y)∥2 ∥x − y∥2 ∥x − y∥2 kθ (x, y) = (1 − ϵ) exp − + ϵ exp − , − σ0 σ σ and optimizes σ0 , σ and ϵ. We follow the dataset-specific initialization and optimization settings of the released MMD-D implementation. D.3

Benchmarks

We visualize synthetic datasets in Figure 4. Blob-S/D. The Blob distributions are two-dimensional mixtures centered on the 3×3 grid {0, 1, 2}2 . We use nb ∈ {10, 30, 50, 70, 90, 100}, Ntr = Nte = 9nb observations per distribution, where component labels are sampled independently and uniformly. Under Blob-S, both distributions have covariance 0.03I2 in every component. Under Blob-D, P retains this covariance, whereas the covariance of Q at component j is   0.03 cj Σj = , cj 0.03 18

Figure 4: Visualization of synthetic datasets. Left: Blob-S/D; Right: The first two dimensions of HDGM-S/D with

(cj )9j=1 = (−.020, −.022, −.024, −.026, 0, .020, .022, .024, .026), where the grid points are ordered row by row. HDGM-S/D.

HDGM is an equally weighted two-component Gaussian mixture with means µ1 = 0.5 × 1d .

µ0 = 0,

Distribution P has identity covariance in both components. Under HDGM-D, the covariances of Q equal Id except for (Σ1 )12 = (Σ1 )21 = −0.5.

(Σ0 )12 = (Σ0 )21 = 0.5, Under HDGM-S, Q = P .

For the sample-size experiment, we fix d = 10 and use Ntr = Nte ∈ {500, 1000, 2000, 4000} observations per distribution. For the dimension experiment, we fix Ntr = Nte = 3000 and use d ∈ {5, 10, 15, 20}. MNIST mixture. MNIST images are divided by 255 and flattened into R784 . Models are trained only on the official MNIST training split, while all hypothesis tests use the official test split. For Ntr = Nte ∈ {60, 100, 140, 180, 220, 260}, P contains N digit-6 images. Under the alternative, Q = 0.9µ6 + 0.1µ9 , whereas under the null Q = µ6 . D.4

Aggregation and Uncertainty

Let Hjkr ∈ {0, 1} denote the rejection indicator at experimental setting j, training repetition k, and evaluation repetition r. For each fitted model, we first compute R

π bjk =

1 X Hjkr . R r=1

The reported rejection rate is the average of π bjk over the K independent training repetitions. Figure bands show one standard error across training repetitions: SE(b πj ) =

sd(b πj1 , . . . , π bjK ) √ . K

19

Record · ID 394396 · SHA-256 fd89f8d6f07c3e48
Retrieved via Conceptio — every document is proof-bundled with source, license, and retrieval metadata.