Manuscript Offprint

arXiv:2610.01472

Zero Flux: Flow-Based Comparison of High-Dimensional Discrete Distributions

Leyang Wang, Yakun Wang, Song Liu, Taiji Suzuki

ABSTRACT

Comparing two high-dimensional discrete distributions has always been a challenging task due to the exponentially growing state space and complex changes in interactions. A recent work suggests comparing distributions through a vector field trained using flow matching between two continuous distributions. The resulting vector field at mid-point vanishes if and only if two distributions identical. However, such a flow-based criterion does not naturally apply to discrete distributions. We extend this principle to the discrete domain and introduce the Zero Flux criterion, a discrepancy based on local probability fluxes. Under independent coupling, we show that all local probability fluxes vanish at the midpoint if and only if two distributions are the same. This discrepancy decomposes the joint distributional difference into smaller, local contributions and can be efficiently estimated from samples. We establish finite sample error bounds for our estimator. Experiments on synthetic and real categorical data demonstrate reliable recovery of sparse dependence signals and stable tracking of distribution shifts in high dimensions.

1 INTRODUCTION

Comparing two distributions from samples is a fundamental problem in statistics and machine learning. For high-dimensional discrete data, the state space grows exponentially and distributional differences may arise through changes in complex joint dependence (Meel et al., 2025). Existing approaches use kernel distances (Székely and Rizzo, 2013; Gretton et al., 2012), discriminative models (Lopez-Paz and Oquab, 2017; Kim et al., 2021), likelihood-based models (Usman et al., 2020), or discrete statistical operators (Yang et al., 2018; Meng et al., 2022; Amin et al., 2023). Each represents distributional differences through a particular kernel, geometry, or statistical model. Their performance can therefore be sensitive to how the discrete structure is modelled.

Flow-based models (Liu et al., 2023; Lipman et al., 2023) learn velocity fields that transform simple reference distributions into complex data distributions. Beyond data generation, Zero Flow methods (Wang et al., 2026a;b; Shlenskii et al., 2026) uses dynamics learned from endpoint samples to compare distributions, with the midpoint velocity field vanishing under independent coupling if and only if the two distributions are identical. Extending this idea to discrete data through a continuous embedding may be suboptimal: although an embedding can assign points in Euclidean space to discrete states, the induced dynamics generally pass through points outside of the embedded discrete set, whose geometry is not associated with the original discrete space. This motivates comparison directly through a discrete analogue of the zero flow criterion.

In this work, we extend the Zero Flow criterion to the discrete domain and introduce Zero Flux. Unlike continuous Flow Matching, which uses a velocity field, Discrete Flow Matching (Gat et al., 2024; Campbell et al., 2024) describes distributional evolution on a discrete state space through detecting changes in individual coordinates. We characterize the change using local probability fluxes, which measure the net probability mass transferred when one coordinate changes. We prove that, at the midpoint t=0.5t = 0.5, all local fluxes vanish if and only if the endpoint distributions are identical. We then combine these local fluxes into an overall discrepancy that quantifies the differences between the two distributions and can be estimated from samples.

A key feature of Zero Flux is its locality. Beyond an overall discrepancy, it decomposes joint changes into local and more interpretable contributions. The signed flux shows how the direction and strength of a local difference depend on the surrounding coordinates. For example, two text corpora may have similar marginal word frequencies but different word co-occurrence patterns. These local contributions enable us to inspect changes in word associations, not just marginals. This helps understand how language use differs between the corpora, rather than merely detecting a difference.

Contributions. We introduce Zero Flux, a discrete extension of Zero Flow. We characterize the dynamics of a discrete bridge through local probability fluxes, which describe how probability mass moves between states differing in one coordinate. Under independent coupling, we show that two joint distributions are identical if and only if all local probability fluxes of an independent coupling process vanish at the midpoint. We derive a neural estimator with finite sample bounds that separate sampling and posterior estimation errors. Experiments on synthetic and real categorical data demonstrate reliable tracking of structured distribution shifts in high dimensions and decomposition of the overall discrepancy into interpretable coordinate contributions.

References (100)

  • A kernelized stein discrepancy for biological sequences
  • Mmd-fuse: Learning and combining kernels for two-sample testing without data splitting
  • Importance weighted autoencoders (opens arXiv in a new tab)
  • Generative flows on discrete state-spaces: Enabling multimodal flows with applications to protein co-design
  • Discrete flow matching
  • Minimax optimal testing by classification
  • A kernel two-sample test
  • Democracy fund+ ucla nationscape methodology and representativeness assessment
  • f-divergence estimation and two-sample homogeneity test under semiparametric density-ratio models
  • UCI machine learning repository
  • A comparative analysis of the attitudes toward the us-mexico border policy: Evaluating perspectives on border security and building a wall in the rio grande valley, national hispanic and general us populations
  • Classification accuracy as a proxy for two-sample testing
  • Auto-Encoding Variational Bayes
  • Gradient-based learning applied to document recognition
  • Flow matching for generative modeling
  • Learning deep kernels for non-parametric two-sample tests
  • Flow straight and fast: Learning to generate and transfer data with rectified flow
  • Revisiting classifier two-sample tests
  • Distance estimation for high-dimensional discrete distributions
  • Concrete score matching: Generalized score matching for discrete data
  • Midpoint generative models (opens arXiv in a new tab)
  • The bitter end: The 2020 presidential campaign and the challenge to American democracy
  • Energy statistics: A class of statistics based on distances
  • Democracy Fund + UCLA Nationscape Project, July 18, 2019–January 18, 2021 (version 20211215)
  • Log-likelihood ratio minimizing flows: Towards robust and quantifiable neural distribution alignment
  • Zero-flow encoders
  • Zero-flow two-sample tests (opens arXiv in a new tab)
  • Goodness-of-fit testing for discrete distributions via stein discrepancy
  • We describe the coordinatewise linear bridge used here
  • Its conditional distribution and the resulting marginal path are
  • The coordinate choices are independent conditional on the complete endpoint pair; averaging over that pair allows $p_t$ to carry dependence among coordinates
  • A coordinate with distinct endpoint values makes a single jump
  • The endpoint posterior and the corresponding marginal jump rate are, for $0 < t < 1$ and $p_t(\mathbf{x}) > 0$
  • For $t \sim \text{Unif}(0,1)$, its cross-entropy objective is
  • when $X_0^i = v$ and $X_t^i = x_i$, coordinate $i$ was copied from $X_1^i = x_i$, an event with factor $t$
  • for each coordinate $j \in [d]$
  • By the product rule
  • The subset $T$ records the coordinates whose factors contribute the $\mathbf{X}_1$-term
  • For $T = A$, the corresponding term is
  • For $T = \emptyset$, the corresponding term is
  • By Lemma C.2, this implies that all product moments of $P_0$ and $P_1$ agree
  • Complementing every midpoint mask bit leaves the midpoint unchanged and does not change the mask distribution
  • Every squared normalized flux then vanishes on the support of $p_{0.5}$, and hence $\mathcal{F}_{0.5,i} = p_{0.5}F_i^*$ vanishes there
  • Let $d = 1$, let $\mathcal{V} = \{0, 1, 2\}$, and let $X_0$ be uniform on $\mathcal{V}$
  • However, conditional on $Z = z$, the endpoint pairs
  • Taking twice their difference yields
  • Their joint law and midpoint bridge are invariant under exchanging the endpoints, so their coordinate posteriors conditional on $\mathbf{Z}_{S^c}$ agree
  • Substituting the field identities into the discrepancy gives
  • The population discrepancy is
  • The two datasets are independent, and each is i.i.d
  • Because a realized endpoint value sampled from a discrete law has positive probability under that law, the midpoint produced by any realized endpoint pair and mask has population probability at least $P_0(\mathbf{x}_0)P_1(\mathbf{x}_1)2^{-d} > 0$
  • By the definition of the fluxes, this vector is twice the difference between the corresponding error vectors of the two heads
  • Averaging over the independent midpoint mask therefore gives the population midpoint law
  • Taking the outer expectation and then using (46) gives
  • Using (48) and minimizing the resulting quadratic exponent over $\lambda$ gives
  • Adding the two tail probabilities and choosing $t = R_{n,m}(\delta)$ yields, with probability at least $1 - \delta$
  • Substituting both bounds gives (19)
  • The plug-in inequality is deterministic once the samples and heads are fixed
  • Each midpoint coordinate copies either endpoint with probability one half
  • Evaluation uses fresh endpoint pairings and midpoint masks from the same pools
  • For the endpoint family in Section 7.1, we use $\eta = 0.8$ and dimensions 8, 24, 48, 64, 128, and 256
  • Zero Flux uses two categorical endpoint heads
  • Coord CE uses the same midpoint representation with two categorical heads and loss (50) evaluated at $M_c$
  • The training budgets are 5,000 steps at dimensions 8, 24, and 48; 20,000 at dimension 64; 40,000 at dimension 128; and 80,000 at dimension 256
  • We express all predictions on the discrete log density-ratio gradient scale used in Section 7.1
  • Let $\widehat{C}_i(\mathbf{z})$ be the predicted velocity projected onto the one-hot displacement of that flip for Coord MSE, or twice the difference between the endpoint probabilities of the flipped value for Coord CE, with the second endpoint minus the first
  • The recovery metrics are
  • Cosine similarity uses all evaluated states and coordinates
  • Each displayed edge value is half the difference between the two directed predictions, averaged over these configurations
  • The displayed edge values are averaged over the remaining coordinates $\mathbf{w}$
  • We compare the reference distribution P with
  • Each score is compared with the 50 null runs at $\varepsilon=0$ in the same setting
  • Contamination is applied to complete observations
  • We use dimensions 8, 64, and 128
  • Training uses 1,000 epochs and batch size 256; evaluation uses 30,000 midpoints
  • The first and third rows show AUROC; the second and fourth show FPR@95% TPR. Metrics compare 50 runs at each positive contamination level with 50 uncontaminated runs
  • For their average kernel k and two endpoint samples of size n, the biased estimator is
  • The feature encoder f is a one-dimensional CNN on Markov and HMM data and a two-dimensional CNN on MNIST, with hidden width 64 and output width 32
  • The division by 32 gives the mean squared feature distance
  • Dropout is 0.1 for dimension-8 Markov data and zero otherwise
  • Early stopping monitors cross-entropy on the training pools every five epochs, with a required improvement of $10^{-4}$
  • For each contamination level and seed, we fit one shared VAE on the pooled samples and one private VAE per endpoint
  • Writing $\mathrm{ELBO}_r$ for the private model fitted to $P_r$, the score in nats is
  • Each fit minimizes the average negative log likelihood $-\mathbb{E}\log p(\mathbf{X})$ on its training samples
  • MNIST uses causal Transformers with width 128, 4 layers, 8 attention heads, and feed-forward width 512
  • We use the eleven categorical datasets below, with seeds 0 through 4
  • Audiology combines its 200 and 26 rows and excludes the identifier column
  • Intermediate levels use successively increasing numbers of separated features closest to these targets, with ties resolved in favor of fewer separated features
  • Datasets with fewer than 8,000 observations use 25,000 steps, batch size 512, and learning rate $10^{-4}$
  • Writing $V_{ij}$ for the corrected association between features i and j, the discrepancy is
  • The same index quadruples are reused across levels within a seed, and the signed estimate is retained
  • These metrics measure ordering, linear association with severity, and successive downward violations, respectively
  • We use 77 regular weekly waves of the Democracy Fund–UCLA Nationscape survey, spanning 18 July 2019 to 12 January 2021
  • We encode opposition, support, and uncertainty as 0, 1, and 2
  • Their median effective sample sizes are approximately 1,036 and 941
  • We train for 500 epochs with 89 updates per epoch
  • Mixture MMD averages five kernels with bandwidths 0.125, 0.25, 0.5, 1, and 2, fixed across months
  • The average uses 200,000 independently sampled quadruplets per month, evaluated in batches of 4,096
  • All methods use seeds 0, 1, and 2
  • The two distributions agree on every marginal of order below $k$, while

Couldn't load all references. Reload the page to try again.