---
title: Kernel Quantile Discrepancies
url: https://www.emergentmind.com/topics/kernel-quantile-discrepancies
type: topic
---

# Kernel Quantile Discrepancies

Kernel Quantile Discrepancies (KQDs) are a family of kernel-based probability metrics built from **kernel quantile embeddings** (KQEs), rather than from kernel mean embeddings alone. In the RKHS formulation introduced in "Kernel Quantile Embeddings and Associated Probability Metrics" [2505.20433], a distribution is represented through directional quantiles of the canonical feature map, and discrepancies are obtained by aggregating quantile differences across quantile levels and RKHS directions. This construction extends the mean-based logic of the maximum mean discrepancy (MMD), yields probability metrics under weaker kernel assumptions than MMD, recovers kernelised sliced Wasserstein distances when quantile levels are uniformly weighted, and admits near-linear estimators that were shown to be competitive in two-sample testing [2505.20433].

## 1. RKHS quantiles and kernel quantile embeddings

Let $X$ be a Borel space, let $k:X\times X\to\mathbb R$ be a measurable positive definite kernel, and let $(\mathcal H,\langle\cdot,\cdot\rangle_{\mathcal H})$ be its RKHS with unit sphere $S_{\mathcal H}=\{u\in\mathcal H:\|u\|_{\mathcal H}=1\}$. Writing the canonical feature map as $\psi(x)=k(x,\cdot)$, each direction $u\in S_{\mathcal H}$ induces an RKHS linear functional
$$
\phi_u(h)=\langle u,h\rangle_{\mathcal H}.
$$
For a probability measure $P$, the pushforward $u_\#P:=\phi_u{}_\#(\psi_\#P)$ is therefore the one-dimensional distribution of $u(X)$ when $X\sim P$ [2505.20433].

The **directional kernel quantile embedding** at quantile level $\alpha\in[0,1]$ is
$$
\rho_P^{\alpha,u}:=\rho_{u_\#P}^{\alpha}\,u\in\mathcal H,
$$
where $\rho_{u_\#P}^{\alpha}$ is the univariate $\alpha$-quantile of the real-valued law $u_\#P$. Hence KQEs are obtained by first projecting $\psi(X)$ onto a one-dimensional RKHS direction, then taking an ordinary univariate quantile, and finally re-embedding that scalar quantile along the same direction. The family
$$
\{\rho_P^{\alpha,u}:\alpha\in[0,1],\ u\in S_{\mathcal H}\}
$$
is the KQE of $P$.

A centered variant is also defined. If $\mu_P(x):=\mathbb E_{X\sim P}[k(X,x)]$ denotes the kernel mean embedding, then
$$
\tilde\rho_P^{\alpha,u}:=\big(\rho_{u_\#P}^{\alpha}-\langle u,\mu_P\rangle_{\mathcal H}\big)u+\mu_P.
$$
Centering restores location equivariance for quantiles of $\psi(X)=k(X,\cdot)$. For discrepancies between two distributions, however, the location non-equivariance of the uncentered KQE cancels, so the uncentered form is typically used [2505.20433].

These objects are generalized quantiles in a precise sense. They are standard univariate quantiles computed after projection in $\mathcal H$. In finite-dimensional $\mathcal H$, they coincide with multivariate directional quantiles of the feature vector. This places KQEs alongside projection-based multivariate quantile constructions, but specifically in RKHS geometry.

## 2. Discrepancy families and their relation to MMD and sliced Wasserstein

Given $p\ge 1$, a measure $\nu$ on $[0,1]$, and a direction $u\in S_{\mathcal H}$, the directional discrepancy is
$$
\tau_p(P,Q;\nu,u):=
\left(
\int_0^1
\|\rho_P^{\alpha,u}-\rho_Q^{\alpha,u}\|_{\mathcal H}^p
\,\nu(d\alpha)
\right)^{1/p}.
$$
Because both embeddings are scalar multiples of $u$, the RKHS norm simplifies to
$$
\|\rho_P^{\alpha,u}-\rho_Q^{\alpha,u}\|_{\mathcal H}
=
|\rho_{u_\#P}^{\alpha}-\rho_{u_\#Q}^{\alpha}|.
$$
KQDs arise by aggregating these one-dimensional discrepancies over directions [2505.20433].

| Object | Definition | Role |
|---|---|---|
| $e$-KQD$_p$ | $\left(\mathbb E_{u\sim\gamma}[\tau_p^p(P,Q;\nu,u)]\right)^{1/p}$ | Expected discrepancy over directions |
| sup-KQD$_p$ | $\left(\sup_{u\in S_{\mathcal H}}\tau_p^p(P,Q;\nu,u)\right)^{1/p}$ | Maximal directional discrepancy |
| Centered variants | Replace $\rho_P^{\alpha,u}$ by $\tilde\rho_P^{\alpha,u}$ | Adds an MMD-related mean term |

The weighting measure $\nu$ determines how quantile levels are emphasized. The default choice is Lebesgue measure $\mu$ on $[0,1]$, but alternative densities can up- or down-weight tails. With $\nu=\mu$, the directional discrepancy becomes exactly a one-dimensional Wasserstein distance:
$$
\tau_p(P,Q;\mu,u)=W_p(u_\#P,u_\#Q).
$$
Consequently,
$$
e\text{-}KQD_p(P,Q;\mu,\gamma)
=
\left(\mathbb E_{u\sim\gamma}[W_p^p(u_\#P,u_\#Q)]\right)^{1/p},
$$
and
$$
\mathrm{sup}\text{-}KQD_p(P,Q;\mu)
=
\left(\sup_{u\in S_{\mathcal H}}W_p^p(u_\#P,u_\#Q)\right)^{1/p}.
$$
These are kernelised analogues of expected sliced Wasserstein and max-sliced Wasserstein. When $X\subset\mathbb R^d$, $k(x,y)=x^\top y$, and $\gamma$ is uniform on the Euclidean unit sphere, they recover standard expected sliced Wasserstein and max-sliced Wasserstein [2505.20433].

The comparison with MMD is structural. The squared MMD is
$$
\mathrm{MMD}^2(P,Q)
=
\mathbb E_{X,X'\sim P}[k(X,X')]
-
2\mathbb E_{X\sim P,Y\sim Q}[k(X,Y)]
+
\mathbb E_{Y,Y'\sim Q}[k(Y,Y')],
$$
so MMD compares **means** in RKHS, whereas KQDs compare **directional quantiles**. For $p=2$ and $\nu=\mu$, the centered expected KQD satisfies
$$
\widetilde{e\text{-}KQD}_2(P,Q;\mu,\gamma)^2
=
e\text{-}KQD_2(P,Q;\mu,\gamma)^2
+
\mathrm{MMD}^2(P,Q)
-
\mathbb E_{u\sim\gamma}
\big[
(\mathbb E_P[u(X)]-\mathbb E_Q[u(Y)])^2
\big],
$$
with an analogous identity for sup-KQD. The accompanying thesis describes the centered construction as a “mid-point” interpolant between MMD and sliced-Wasserstein-type terms, in a sense analogous to Sinkhorn divergences, though with flexible kernel choice rather than an entropic regularization scheme tied to the energy distance [2602.21846].

## 3. Identifiability and probability-metric structure

The central theoretical claim is that KQEs determine distributions under weaker conditions than those usually required for MMD. The relevant assumptions are:

- $X$ is Hausdorff, separable, and $\sigma$-compact;
- $k$ is continuous and separating on $X$, meaning $k(x,\cdot)\neq k(y,\cdot)$ for $x\neq y$.

Under these assumptions, the paper proves an RKHS analogue of the Cramér–Wold theorem: the map
$$
P\mapsto\{\rho_P^{\alpha,u}:\alpha\in[0,1],\ u\in S_{\mathcal H}\}
$$
is injective, and the kernel is therefore **quantile-characteristic** [2505.20433].

A further theorem establishes that every mean-characteristic kernel is quantile-characteristic, but not conversely. The converse fails; bounded-degree polynomial kernels are given as examples of kernels that are not mean-characteristic but are quantile-characteristic under the RKHS Cramér–Wold theorem. The immediate consequence is that KQDs can separate distributions in settings where MMD cannot. Whenever $\mathrm{MMD}(P,Q)>0$, an injective KQD also yields $\mathrm{KQD}(P,Q)>0$, but the reverse implication need not hold.

The metric statements follow from the injectivity result together with full-support conditions on the aggregation measures. If $\nu$ has full support on $[0,1]$, then sup-KQD$_p$ is a distance. If, in addition, $\gamma$ has full support on $S_{\mathcal H}$, then $e$-KQD$_p$ is a distance. A concrete example of such a direction law is the pushforward to $S_{\mathcal H}$ of a centered Gaussian measure on $\mathcal H$ with non-degenerate covariance operator [2505.20433].

This weaker dependence on kernel assumptions is one of the main distinctions from MMD. MMD is a probability metric only when the kernel is characteristic. KQDs, by contrast, are probability metrics under continuous, separating kernels together with support assumptions on $\nu$ and $\gamma$. This suggests that the quantile representation is not merely an alternative parameterization of the same information carried by the RKHS mean; it is strictly richer in separation power for some non-characteristic kernels.

## 4. Estimation, computational schemes, and statistical guarantees

For samples $x_{1:n}\sim P$ and a fixed direction $u\in S_{\mathcal H}$, the empirical KQE is based on order statistics of the projected values $u(x_i)$. Denoting by $[u(x_{1:n})]_{\lceil \alpha n\rceil}$ the $\lceil \alpha n\rceil$-th order statistic,
$$
\rho_{P_n}^{\alpha,u}
=
\rho_{u_\#P_n}^{\alpha}u,
\qquad
\rho_{P_n}^{\alpha,u}(x)
=
[u(x_{1:n})]_{\lceil \alpha n\rceil}u(x).
$$
Thus empirical KQEs require projection and sorting rather than pairwise kernel summation [2505.20433].

For the expected discrepancy, a Monte Carlo estimator draws directions $u_1,\dots,u_l\sim\gamma$ and computes
$$
e\text{-}KQD_p^p(P_n,Q_n;\nu,\gamma_l)
=
\frac{1}{ln}
\sum_{i=1}^l
\sum_{j=1}^n
\left(
[u_i(x_{1:n})]_j-[u_i(y_{1:n})]_j
\right)^p
f_\nu(j/n),
$$
where $f_\nu$ is the density of $\nu$. When $\nu=\mu$, $f_\nu\equiv 1$.

A practical sampling scheme for directions uses a centered Gaussian measure $\gamma'=N(0,C)$ on $\mathcal H$ with covariance operator
$$
C[f](x)=\int_X k(x,y)f(y)\,\xi(dy),
$$
for a reference measure $\xi$ with full support. With reference points $z_{1:m}\sim\xi$ and $\lambda\sim N(0,I_m)$, one forms
$$
f(x)=\frac{1}{\sqrt m}\sum_{j=1}^m \lambda_j k(z_j,x),
$$
normalizes $u=f/\|f\|_{\mathcal H}$, projects the data along $u$, sorts the projected values, and averages the resulting directional discrepancies. Per direction, the cost is $O(nm)$ for evaluations, $O(m^2)$ for $\|f\|_{\mathcal H}$ via $K_{zz}$, and $O(n\log n)$ for sorting. The total cost is
$$
O\!\big(l\cdot\max\{nm,m^2,n\log n\}\big),
$$
and taking $l=m=\lceil\log n\rceil$ yields an overall $O(n\log^2 n)$ estimator [2505.20433].

Statistically, the empirical KQE has the classical $n^{-1/2}$ rate for fixed $\alpha$ and $u$ when the density of $u_\#P$ is bounded away from zero. For $e$-KQD$_1$, if $\nu$ has a density and $\mathbb E_{X\sim P}\sqrt{k(X,X)}<\infty$ and $\mathbb E_{Y\sim Q}\sqrt{k(Y,Y)}<\infty$, then with probability at least $1-\delta$,
$$
\big|
e\text{-}KQD_1(P_n,Q_n;\nu,\gamma_l)
-
e\text{-}KQD_1(P,Q;\nu,\gamma)
\big|
\le
C(\delta)\big(l^{-1/2}+n^{-1/2}\big),
$$
with $C(\delta)=O(\sqrt{\log(1/\delta)})$. For $p>1$, the same $n^{-1/2}$ rate is attainable under integrability conditions on $J_p(u_\#P)$ and $J_p(u_\#Q)$ [2505.20433].

For two-sample testing, the statistic is typically calibrated by permutation. The pooled sample is relabeled $B$ times, with the paper using values such as $B=300$, and the empirical $(1-\alpha)$-quantile is used to control Type I error at level $\alpha$, such as $0.05$. The reported experiments show that near-linear $e$-KQD often outperforms near-linear MMD approximations, while quadratic centered $e$-KQD performs similarly to quadratic MMD statistics [2505.20433].

## 5. Empirical behavior and practical deployment

The empirical study includes several benchmark regimes. In a power-decay experiment with $P=N(0,I_d)$ and $Q=N(0,\mathrm{diag}(4,4,4,1,\dots,1))$, sample size $n=200$, and dimension ranging from $32$ to $512$, near-linear $e$-KQD exhibited the slowest power decay among the reported methods, outperforming near-linear MMD-Multi and remaining competitive with quadratic-time MMD. In a one-dimensional Laplace-versus-Gaussian experiment with polynomial kernel degree $3$, MMD failed because matched moments yielded identical KMEs, whereas KQDs gained power with sample size and detected the difference. On Galaxy MNIST and CIFAR-10 versus CIFAR-10.1, near-linear KQDs were reported to outperform near-linear MMD-Multi, while quadratic centered $e$-KQD and quadratic MMD showed similar power. Runtime measurements aligned with the $O(n\log^2 n)$ analysis, and Type I error was controlled at the nominal level under permutation calibration [2505.20433].

Practical guidance in the paper and thesis is correspondingly explicit. Any continuous, separating kernel suffices for KQD to be a metric; characteristicness is not required. RBF and Laplacian kernels are presented as good defaults, with the median heuristic for RBF bandwidth. Polynomial kernels are also admissible and are especially useful for demonstrating the gap between mean-characteristicness and quantile-characteristicness [2602.21846].

The choice of $\nu$ controls sensitivity across the distribution. Uniform $\nu=\mu$ recovers kernelised sliced Wasserstein. Non-uniform $f_\nu$ can emphasize tails or central mass. The direction distribution $\gamma$ requires special care because there is no uniform measure on the sphere of an infinite-dimensional RKHS; the Gaussian construction on $\mathcal H$ addresses this directly. A practical reference measure is the balanced empirical mixture $\xi=(P_n+Q_n)/2$, though Gaussian or uniform reference distributions scaled by the data interquartile range are also proposed [2505.20433].

The papers further recommend $l\approx m\approx\lceil\log n\rceil$ for near-linear computation, increasing $l$ when lower Monte Carlo variance is desired. With respect to $p$, the stated guidance is that $p=1$ is more robust to outliers, while $p=2$ is often a good practical trade-off and aligns with one-dimensional $W_2$. In practice, $e$-KQD is described as simpler and stable, whereas exact optimization of sup-KQD is costly and NP-hard in general [2505.20433].

A common misconception is that KQDs are simply MMD with a different estimator. The construction and theorems do not support that interpretation. KQDs replace mean comparison by a directional-quantile representation and can separate distributions under strictly weaker kernel assumptions than MMD. Another misconception is that the expected discrepancy depends on a canonical “uniform” distribution over RKHS directions; in infinite-dimensional $\mathcal H$, such a uniform measure does not exist, which is why the Gaussian pushforward construction is central.

## 6. Related quantile-based kernel constructions, limitations, and open directions

KQDs sit within a broader landscape of quantile-based kernel methods, but adjacent constructions are not identical. On the one-dimensional real line, the MMD with the negative distance kernel $K(x,y)=-|x-y|$ coincides with the energy distance up to an additive constant. In "Wasserstein Gradient Flows of MMD Functionals with Distance Kernel and Cauchy Problems on Quantile Functions" [2408.07498], this discrepancy is recast in quantile space via an isometric embedding of $\mathcal P_2(\mathbb R)$ into the cone of quantile functions in $L_2(0,1)$. That work provides an explicit convex functional on quantiles, a subdifferential characterized through the target CDF, existence and uniqueness of the associated gradient flow, invariant sets, instantaneous smoothing for certain targets, and efficient implicit Euler updates by bisection. The relation is conceptual rather than definitional: it shows that some kernel discrepancies admit especially transparent quantile-space formulations in one dimension, whereas KQDs as introduced in [2505.20433] are RKHS directional-quantile metrics for general Borel spaces.

A separate line of work uses similar language in a regression setting. In "fastkqr: A Fast Algorithm for Kernel Quantile Regression" [2408.05393], the phrase “kernel quantile discrepancy principle” refers to fitting conditional quantile functions by minimizing the pinball loss with RKHS regularization, together with exact finite-smoothing algorithms and spectral acceleration. That object concerns conditional prediction and asymmetric residuals, not unconditional probability metrics between distributions. The distinction matters because the KQD literature addresses two-sample comparison, identifiability, and probability-metric structure, whereas kernel quantile regression addresses estimation of conditional quantiles.

The principal limitations of KQDs are also explicit in the source material. Sorting is required in every sampled direction, so the method trades quadratic pairwise kernel summation for repeated projection-and-order-statistic computations. Monte Carlo variance depends on the number of sampled directions $l$. Exact sup-KQD optimization is expensive. For $p>1$, retaining $n^{-1/2}$ rates requires additional regularity conditions involving $J_p$. The choices of $\gamma$ and $\xi$ introduce hyperparameters, and the topology induced by KQD, including its relation to weak convergence, remains an open problem in the thesis summary [2602.21846].

Open directions stated in the papers include improved KQE and KQD estimators, adaptive or learned direction sampling, better quadrature over $\alpha$, kernel selection for test power, conditional quantile embeddings in RKHS, stronger finite-sample guarantees for $p>1$, and more principled optimization procedures for approximating sup-KQD. Taken together, these indicate that KQDs are best understood as a new RKHS representation of probability measures based on directional quantiles: one that strictly generalizes mean embeddings in separation power for some kernels, connects naturally to sliced Wasserstein geometry, and preserves scalable nonparametric estimation [2505.20433].

Source: https://www.emergentmind.com/topics/kernel-quantile-discrepancies