---
title: Latent Quantile Matching in Dataset Condensation
url: https://www.emergentmind.com/topics/latent-quantile-matching-lqm
type: topic
---

# Latent Quantile Matching in Dataset Condensation

Latent Quantile Matching (LQM) is a distribution-matching framework designed to align latent feature distributions of synthetic and real datasets, primarily for dataset condensation (DC). Unlike Maximum Mean Discrepancy (MMD) approaches, which only align means in the latent space, LQM matches the entire quantile spectrum via a statistically principled quantile-based loss. This approach ensures control over all distributional moments, minimizes outlier risk, and is particularly effective for low-budget, privacy-sensitive, and continual learning scenarios. Empirical studies confirm that LQM consistently matches or outperforms MMD-based methods on both image and graph-structured data [2406.09860]. LQM is also grounded in the theoretical framework of $q$-quantile matching experiments, which uniquely characterize the set of all implementable distributions of posterior quantiles [2402.17142].

## 1. Problem Setting and Motivation

Dataset condensation aims to construct a compact synthetic dataset $S$, with $|S|\ll|T|$ for a real dataset $T$, such that training a model $\varphi$ on $S$ yields comparable test accuracy to training on $T$. Formally, with $\varphi^T$ and $\varphi^S$ as models trained on $T$ and $S$, the goal is:
\[
\min_{S} \; \mathbb{E}_{(x,y)\sim T} \left[ \|\ell(\varphi^T(x),y) - \ell(\varphi^S(x),y)\| \right]
\]
where $\ell$ is typically cross-entropy. 

Distribution-matching (DM) based DC sidesteps expensive bi-level optimization by aligning the latent distributions induced by a family of randomly initialized networks $\theta \sim P_{\theta_0}$. For a particular $\theta$, embeddings are extracted as:
\[
E_{\text{real}} = \{\varphi_\theta(x) : x \in T\} \qquad E_{\text{syn}} = \{\varphi_\theta(s) : s \in S\}
\]
The synthetic set $S$ is then optimized to minimize a distance metric $D(E_{\text{real}}, E_{\text{syn}})$. LQM proposes a quantile-based loss for $D$, strengthening the expressiveness and robustness of the match versus mean-based criteria.

## 2. Mathematical Formulation of Latent Quantile Matching

Each data point $x$ is mapped to a latent embedding $f(x) = \varphi_\theta(x) \in \mathbb{R}^F$. For latent coordinate $k$, define the empirical CDFs over $T$ and $S$:
\[
F_{\text{real}}(t) = \frac{1}{|T|} \#\{x \in T : f_k(x) \leq t\}, \qquad F_{\text{syn}}(t) = \frac{1}{|S|} \#\{s \in S : f_k(s) \leq t\}
\]
The corresponding quantile functions are
\[
Q_{\text{real}}(u) = \inf\{ t : F_{\text{real}}(t) \geq u \}, \qquad Q_{\text{syn}}(u) = \inf\{ t : F_{\text{syn}}(t) \geq u \}
\]
The canonical two-sample distributional distance is the Cramér–von Mises (CvM) statistic:
\[
T_{\text{CvM}}(F_{\text{real}}, F_{\text{syn}})
= \int_{-\infty}^\infty [F_{\text{real}}(t) - F_{\text{syn}}(t)]^2 dH(t)
\]
where $H = (F_{\text{real}} + F_{\text{syn}})/2$. Equivalently (by a variable change) the key LQM loss is:
\[
L_{\text{LQM}} = \int_0^1 [Q_{\text{real}}(u) - Q_{\text{syn}}(u)]^2 du
\]
With a budget of $k$ synthetic points per class, the integral is approximated using optimal quantile locations $u_i = \frac{2i-1}{2k},\; i=1,\ldots,k$, minimizing the CvM statistic error for discretization. The discrete LQM loss per feature is:
\[
L^{(k)} = \frac{1}{k} \sum_{i=1}^k [Q_{\text{real}}(u_i) - Q_{\text{syn}}(u_i)]^2
\]
Extending to $C$ classes and $F$ features, the aggregated LQM loss is:
\[
L_{\text{LQM}}(S) = \frac{1}{C} \sum_{c=1}^C \frac{1}{F} \sum_{d=1}^F \frac{1}{k} \sum_{i=1}^k \lVert Q_{\text{real}}^{(c,d)}(u_i) - Q_{\text{syn}}^{(c,d)}(u_i) \rVert^2
\]
This formulation ensures all moments, including tails and outliers, are aligned.

## 3. Comparison with Maximum Mean Discrepancy-Based Approaches

Maximum Mean Discrepancy (MMD) measures divergence by comparing first moments (means) of mapped features:
\[
\mathrm{MMD}^2 = \left\| \frac{1}{|T|}\sum_{x\in T} \psi(f(x)) - \frac{1}{|S|}\sum_{s\in S} \psi(f(s)) \right\|^2
\]
Typically, $\psi$ is the identity, limiting discrimination to mean-matching. This presents two main deficiencies:
- **Insensitivity to higher-order discrepancies**: Distributions with identical means may have arbitrary variance, skewness, kurtosis, or outliers.
- **Outlier exposure**: Synthetic samples may drift to extreme latent values to match the mean, thus generating harmful support violations.

LQM addresses these by aligning the full quantile sequence, enforcing tighter support and penalizing extremal synthetic points, thereby controlling all distributional moments and mitigating outlier risks [2406.09860].

## 4. Algorithmic Implementation and Optimization

Optimization proceeds by stochastic gradient descent on the synthetic samples themselves. A high-level procedure:
- For each class $c$ and feature $d$, precompute sorted real embeddings.
- At each epoch:
  - Draw $\theta \sim P_{\theta_0}$ afresh.
  - For each class (parallelizable):
    1. Extract $E_{\text{real}}$, $E_{\text{syn}}$ via the current feature extractor.
    2. For each latent $d$:
      - Sort $E_{\text{syn}}[:,d]$.
      - Compute target quantiles at $u_i$ from $E_{\text{real}}[:,d]$.
      - Compute loss as average squared deviations between sorted $E_{\text{syn}}$ and target quantiles.
    3. Backpropagate the per-class average loss to update $S_c$.

During backpropagation, the permutation from sorting is treated as fixed, similar to quantile regression backpropagation routines.

| Step                    | Operation                            | Purpose                                 |
|-------------------------|--------------------------------------|-----------------------------------------|
| Feature extraction      | $\varphi_\theta(x), \varphi_\theta(s)$ | Project data to latent space             |
| Sorting                 | Ascending for each per-class, per-feature | Define empirical quantile structure      |
| Quantile alignment      | Match $E_{\text{syn}}$ to $Q_{\text{real}}(u_i)$ | Enforce quantile-by-quantile correspondence |
| Gradient update         | Optimize $S$ via $\nabla_{S} L_{\text{LQM}}$ | Refine synthetic samples                |

## 5. Experimental Validation

On image classification (e.g., CIFAR-10/100, TinyImageNet), LQM using an IDM backbone surpasses MMD-based IDM by 2–3% test accuracy on CIFAR-10/100 at low data budgets (1, 10, 50 images/class). For TinyImageNet, these gains persist, especially under stricter (lower) budgets. Empirical CvM distances between synthetic and real latent distributions also decrease significantly under LQM, indicating stronger latent alignment.

On graph classification (e.g., CoraFull, Arxiv, Reddit, Products) with a CaT backbone, LQM outperforms baseline CaT by approximately 3% average accuracy on CoraFull and Arxiv in the one-task setting, and yields +2.0% (CoraFull) and +1.4% (Arxiv) in class-incremental continual graph learning (CGL). Backward transfer is maintained or slightly improved. The improvement diminishes for larger data budgets but LQM always matches or exceeds the previous state of the art [2406.09860].

## 6. Hyperparameters, Computational Complexity, and Privacy

LQM inherits learning rate, epoch count, and batch sizes from standard DC backbones (IDM, CaT). The sole replacement is the distance metric (LQM for MMD). Per step, computational cost increases from $O(k)$ (MMD) to $O(kF \log k)$ (due to sorting and quantile computations over $F$ features), yet remains practical as $k$ is typically very small ($\leq 50$).

LQM optimizes for privacy and memory-efficiency:
- **Privacy**: Synthetic samples do not reveal real data and exhibit robustness to membership inference attacks.
- **Memory**: LQM’s quantile-wise control yields superior performance especially under stringent memory (small $k$), making it suitable for continual learning and federated replay settings.

## 7. Theoretical Foundations: Quantile Matching Experiments

LQM is underpinned by recent theoretical results in quantile matching experiments. For any quantile $q\in(0,1)$, Kolotilin and Wolitzky [2402.17142] show that all implementable distributions over posterior $q$-quantiles are realized by a single $q$-quantile matching experiment. This experiment—pooling data states across the $q$-quantile with positive assortativity and precise allocation of $q$ and $1-q$ weights—yields a universal construction $\tau^*$ encoding all feasible target distributions for the posterior quantile. The main implications include:
- **Implementability**: Every distribution within sandwich bounds set by Markov inequalities is attainable via $\tau^*$.
- **Uniqueness**: $\tau^*$ is the only experiment implementing all $q$-quantile distributions.
- **Optimization**: For any continuous functional, pointwise maximization over quantile-intervals from $\tau^*$ yields the optimal induced distribution.

This theoretical foundation validates LQM’s use of quantile alignment, not just as a practical algorithm, but as a statistically and decision-theoretically principled solution for latent distribution matching in DC.

---

Latent Quantile Matching achieves high-fidelity distribution matching via statistical quantile alignment, robustly controls all aspects of latent distributional shape, and meets the rigorous demands of modern dataset condensation, continual, and federated learning tasks [2406.09860][2402.17142].

Source: https://www.emergentmind.com/topics/latent-quantile-matching-lqm