Embedding Empirical Distributions for Computing Optimal Transport Maps

Mingchen Jiang, Peng Xu, Xichen Ye, Yun Yang, Yifan Chen · DOI

Introduction

Optimal Transport (OT) provides a robust mathematical framework for transforming one probability distribution into another. Its applications are vast, ranging from domain adaptation and generative modeling to color transfer in computer vision. However, the computational cost of finding the "optimal" map—the transformation that minimizes the cost of moving mass—remains a significant barrier. Traditional neural OT solvers are typically "one-to-one": they must be trained from scratch for every new pair of distributions. If a researcher has $n$ different source distributions to map to a reference target, standard approaches require training $2n$ separate neural networks, a process that does not scale and offers no generalization to unseen data.

In this paper, the authors introduce HOTET (Hypernetworks for Optimal Transport with Embedding Transformers). HOTET shifts the paradigm from individual optimization to amortized optimal transport, enabling the model to predict transport maps for new distributions instantly after an initial training phase.

The HOTET Framework

The core innovation of HOTET lies in its three-stage pipeline designed to process empirical distributions (sets of samples) and output functional transport maps.

  1. Distribution Embedding via Transformers: Empirical distributions are represented as sets of points. To process these, the authors utilize a Transformer architecture. By omitting positional encodings, the Transformer acts as a permutation-invariant set encoder. This allows the model to map a set of samples of arbitrary size into a fixed-dimensional "context vector" that captures the essential geometry of the distribution.
  2. Hypernetworks for Parameter Generation: The context vector is passed to a Hypernetwork. Instead of performing a task directly, the Hypernetwork generates the weights for another neural network. This allows the system to "specialize" a map for a specific input distribution on the fly.
  3. Input Convex Neural Networks (ICNNs): The weights generated by the Hypernetwork are used to parameterize an ICNN. According to Brenier’s theorem, the gradient of a convex potential function defines the optimal transport map under the squared Euclidean distance. By predicting the parameters of these potentials, HOTET directly outputs a valid transport map.

Key Innovations

Beyond the architecture, HOTET introduces several conceptual shifts that improve the efficiency of OT computation:

  • Amortization: By learning the mapping from distribution space to parameter space, the model avoids the need for repetitive training cycles. Once the Hypernetwork is trained, generating a new map is a simple forward pass.
  • In-Context Learning for OT: The model demonstrates capabilities similar to Large Language Models. Once trained on a variety of distributions, it can predict maps for unseen distributions with high accuracy or adapt to them with minimal "warm-up" fine-tuning.
  • Efficient Initialization: Previous ICNN methods required a computationally expensive pre-training step to initialize the network as an identity map. HOTET bypasses this by using a specific small-variance weight initialization in the Hypernetwork, achieving an identity-like starting point instantly.

Experimental Evaluation

The authors validated HOTET across several diverse benchmarks to test accuracy, generalization, and representation quality:

  • Wasserstein-2 Benchmark (W2B): In high-dimensional Gaussian mixture tasks, HOTET achieved performance comparable to direct solvers (which are optimized for a single pair) while significantly outperforming MetaOT, the previous state-of-the-art for generalized OT. It maintained a high cosine similarity (up to 0.91) with ground truth maps even for distributions it had never seen during training.
  • MNIST: To validate the embedding module, the authors mapped digit images to a latent space. The results showed that HOTET’s embeddings naturally cluster by digit class, proving the Transformer captures meaningful distributional signals. Removing this module caused the error rate ($L^2$-UVP) to jump from ~29% to over 80%.
  • WikiArt: In color transfer experiments, the model successfully learned to map the color distribution of one painting onto another, demonstrating practical utility in image processing tasks.

Conclusion and Future Work

HOTET represents a significant step toward scalable Optimal Transport. By leveraging the representational power of Transformers and the flexibility of Hypernetworks, it transforms OT from a slow optimization problem into a fast inference task. While currently optimized for "many-to-one" scenarios (mapping multiple sources to a single target), the authors suggest that future research into cross-attention mechanisms may extend this efficiency to "many-to-many" transport problems where both source and target distributions vary.

Summary updated

BibTeX
@misc{jiang2025embedding,
  author = {Mingchen Jiang and Peng Xu and Xichen Ye and Yun Yang and Yifan Chen},
  title = {{Embedding Empirical Distributions for Computing Optimal Transport Maps}},
  year = {2025},
  eprint = {2504.17740},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.17740},
}
Figure