NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Learning Wasserstein Embeddings

Nicolas Courty, Rémi Flamary, Mélanie Ducoffe

Introduction

The Wasserstein distance is a powerful "geometrically aware" metric for comparing probability distributions, such as images or word embeddings. Unlike the standard Euclidean ($L_2$) distance, which is "blind" to geometry and heavily penalizes slight spatial shifts (like moving an image by one pixel), the Wasserstein distance (or Earth Mover’s Distance) measures the minimum "work" required to transform one distribution into another.

While mathematically superior for capturing semantic similarity, exact Wasserstein solvers scale cubically with the number of samples. This makes them computationally prohibitive for large datasets or real-time applications. To address this, the authors introduce Deep Wasserstein Embeddings (DWE), a framework that learns to map distributions into a Euclidean space where simple $L_2$ distances approximate complex Wasserstein metrics. This approach enables massive speedups—up to 500,000x—for downstream tasks.

The Deep Wasserstein Embedding Architecture

To "break" the computational complexity of exact solvers, the authors propose a neural network architecture that effectively linearizes the Wasserstein space. The DWE framework consists of two main components trained jointly:

  1. Siamese Encoder ($\phi$): A convolutional neural network projects input distributions (e.g., images) into a lower-dimensional Euclidean space. During training, the network processes pairs of images, and the loss function forces the squared Euclidean distance between their embeddings to match their pre-computed squared $W_2$ Wasserstein distance.
  2. Decoder Network ($\psi$): To ensure the embedding retains vital structural information, a decoder attempts to reconstruct the original distribution from the embedding. This reconstruction loss acts as a crucial regularizer, forcing the embedding to capture the "essence" of the data rather than just memorizing distances.
DWE Architecture

By combining these components, complex operations in the Wasserstein space can be approximated efficiently. For instance, finding a Wasserstein Barycenter (the "average" of multiple distributions) becomes as simple as calculating a Euclidean mean in the embedding space and passing that mean through the decoder.

Experiments and Key Results

The method was evaluated on image-based datasets treated as 2D histograms, including MNIST and Google QuickDraw (specifically noisy, high-variance categories like "Cat," "Crab," and "Face").

Massive Speedups and High Precision On a GPU, DWE can compute over 10 million pairwise distances per second, representing a 500,000x speedup compared to state-of-the-art exact solvers (like LP network flow). Despite this speed, the approximation remains highly accurate; on MNIST, the model achieved a 0.995 correlation between true and predicted Wasserstein distances with a relative mean squared error of only 0.003.

Semantic Manifolds and Better Barycenters Because the embedding mimics the Wasserstein distance, the resulting Euclidean space captures true semantic transformations. Moving along a straight line in the embedding space corresponds to a "geodesic" in the original space (e.g., a digit smoothly rotating). Standard $L_2$ distance often fails at this, producing blurry "ghosting" effects when averaging images. DWE, however, preserves the topological structure of the data. Computing a barycenter for 1,000 samples takes only 20ms, enabling real-time, structurally sound distributional averaging.

Interpolation Comparison

Improved Retrieval In nearest-neighbor searches, DWE avoids the "outlier trap" of $L_2$ distance. While $L_2$ often retrieves noisy or black-filled images as "close," DWE consistently finds images with similar semantic structures, such as finding other "cats" with similar head tilts in the QuickDraw dataset.

Limitations and Future Work

  • Training Overhead: While inference is exceptionally fast, training requires pre-computing a massive number of exact Wasserstein distances (e.g., 1 million pairs for the experiments), which is computationally heavy upfront.
  • Architecture Sensitivity: There are currently no theoretical guarantees regarding the network complexity required to find an optimal embedding for a given dataset; it remains an empirical choice.
  • Domain Specificity: Embeddings learned on one domain (like MNIST) do not naturally generalize to vastly different domains (like Google Doodles). Future work may explore domain adaptation to create more versatile embeddings.

Summary updated

BibTeX
@inproceedings{courty2018learning,
  author = {Nicolas Courty and Rémi Flamary and Mélanie Ducoffe},
  title = {{Learning Wasserstein Embeddings}},
  booktitle = {International Conference on Learning Representations},
  year = {2018},
  url = {https://openreview.net/forum?id=SJyEH91A-},
}
Figure