Measuring Differences between Conditional Distributions using Kernel Embeddings

Peter Moskvichev, Siu Lun Chau, Dino SejdinovicarXiv 2026

TL;DR

This paper unifies the fragmented literature on comparing conditional distributions into a single, coherent framework called Conditional Maximum Mean Discrepancy (CMMD). By defining a hierarchy of metrics ("levels") based on different Reproducing Kernel Hilbert Space (RKHS) embeddings, the authors clarify how these metrics relate via operator-based smoothing and introduce a novel, doubly robust estimator that remains consistent even under model misspecification.

What Problem Does This Paper Address?

Determining whether two conditional distributions are equal (i.e., whether $P_{Y|X} = Q_{Z|X}$) is a core challenge in statistics and machine learning. It underpins critical tasks like evaluating treatment effects in causal inference, detecting covariate shifts in deployment environments, and quantifying uncertainty via model calibration.

While Maximum Mean Discrepancy (MMD) is widely used to compare marginal distributions, extending it to conditional distributions is notoriously difficult because we rarely observe multiple outcomes for the exact same covariate value. Over the years, researchers have proposed various kernel-based methods to tackle this, but the literature has remained fragmented. Different papers used different types of embeddings in isolation, obscuring the mathematical connections between them and leaving practitioners without a clear guide on which method to choose.

Methods

The authors introduce a unified framework that categorizes conditional kernel discrepancies into distinct levels, depending on how the conditional distribution is embedded into an RKHS:

  • $\text{CMMD}_0$ (Conditional Mean Operators): Treats the conditional relationship as an operator mapping from one RKHS to another. It is independent of the covariate distribution.
  • $\text{CMMD}_1$ (Conditional Mean Embeddings): Computes the MMD between conditional distributions at each covariate value and averages the squared distance over the covariate space.
  • $\text{CMMD}_2$ (Joint Mean Embeddings): Measures the standard MMD between the joint distributions, assuming a shared marginal distribution for the covariates.
Illustration of the three levels of CMMD using different types of RKHS embedding.

The authors prove that these levels are deeply connected: higher levels correspond to greater amounts of smoothing via the covariate's covariance operator ($C_{XX}$). This insight allows them to define a generalized level-$s$ CMMD for any fractional power $s \ge 0$.

The Doubly Robust Estimator

A major practical contribution of the paper is a novel doubly robust (DR) estimator for CMMD. Standard kernel ridge regression estimators can fail if the chosen kernel is misspecified (i.e., not rich enough to capture the true conditional relationship). The proposed DR estimator combines a model for the conditional mean embeddings with a propensity score model. It guarantees consistency as long as at least one of these underlying models is correctly specified.

Datasets

The framework was evaluated using both synthetic and real-world data:

  1. Synthetic Benchmarks: Toy datasets generated with nonlinear relationships (e.g., sine waves and exponentials) where parameters like covariate mean ($\theta$) and dimensionality ($D$) were systematically varied to test statistical power and the effects of smoothing.
  2. MNIST Digit Classification: Used to simulate a real-world covariate shift. The digit labels acted as covariates ($X$), and the pixel values acted as outcomes ($Y$). The authors simulated a shift by biasing the sampling of digits in one distribution towards lower numbers, testing the algorithms' ability to maintain Type I error control and discern conditional differences (image brightness) under shift.

Key Insights and Ideas

  • The Smoothing Hierarchy: The paper establishes a clear geometric hierarchy: $\text{CMMD}_2 \le \text{CMMD}_1 \le \text{CMMD}_0$ (assuming a normalized kernel). Higher levels down-weight discrepancies in directions poorly supported by the covariate distribution.
  • No "Best" Metric: There is a fundamental trade-off between the levels. $\text{CMMD}_0$ is highly stable because it is independent of covariate density, but it suffers severely from the curse of dimensionality. Conversely, $\text{CMMD}_2$ handles high-dimensional data better but can completely miss differences that occur in low-density regions of the covariate space.
  • Power of Pseudo-Outcomes: The doubly robust estimator succeeds because it directly fits the difference between the conditional distributions using "pseudo-outcomes" across the entire dataset, rather than trying to perfectly model each complex conditional distribution individually.

Key Results

  • Dimensionality vs. Power: In synthetic testing, as the data dimensionality ($D$) increased, the statistical power of all metrics decayed due to noise. However, $\text{CMMD}_2$ decayed the slowest, proving much more robust to high dimensions than $\text{CMMD}_0$.
  • Robustness to Misspecification: When tested with a misspecified polynomial kernel, the standard naive estimator failed to capture the true distribution differences. The proposed DR estimator successfully converged to the ground truth and achieved significantly higher test power.
Doubly robust estimator performance compared to the standard estimator under kernel misspecification.
  • Real-World Validity: On the MNIST dataset, all three CMMD metrics successfully controlled Type I error under the null hypothesis ($P_{Y|X} = Q_{Z|X}$) and saw their statistical power converge to 1 as sample sizes grew under the alternative hypothesis.

Limitations and Future Work

The primary limitation of the proposed estimators is their computational complexity. Because they rely on kernel ridge regression and matrix inversions, the naive implementation scales at $\mathcal{O}(n^3)$, making them expensive for very large datasets. While the authors suggest mitigation strategies like Cholesky low-rank approximations or primal-form estimation for finite RKHSs, scaling these methods efficiently remains an open challenge.

Future research directions proposed include exploring more complex kernel constructions (such as deep kernels or neural representations) and developing automated ways to determine the optimal level of smoothing ($s$) for a given problem.

Summary updated

BibTeX
@misc{moskvichev2026measuring,
  author = {Peter Moskvichev and Siu Lun Chau and Dino Sejdinovic},
  title = {{Measuring Differences between Conditional Distributions using Kernel Embeddings}},
  year = {2026},
  eprint = {2605.02260},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.02260},
}
Figure