Online Sinkhorn: Optimal Transport distances from sample streams

Arthur Mensch, Gabriel Peyré · DOI

Abstract

Optimal Transport (OT) distances are now routinely used as loss functions in ML tasks. Yet, computing OT distances between arbitrary (i.e. not necessarily discrete) probability distributions remains an open problem. This paper introduces a new online estimator of entropy-regularized OT distances between two such arbitrary distributions. It uses streams of samples from both distributions to iteratively enrich a non-parametric representation of the transportation plan. Compared to the classic Sinkhorn algorithm, our method leverages new samples at each iteration, which enables a consistent estimation of the true regularized OT distance. We provide a theoretical analysis of the convergence of the online Sinkhorn algorithm, showing a nearly-O(1/n) asymptotic sample complexity for the iterate sequence. We validate our method on synthetic 1D to 10D data and on real 3D shape data.

Introduction

Optimal Transport (OT) has emerged as a cornerstone in machine learning, providing a robust framework for comparing probability distributions in tasks ranging from generative modeling to domain adaptation. Despite its theoretical elegance, a significant gap remains between the continuous nature of probability distributions and the discrete algorithms used to compare them.

Traditionally, practitioners compute OT distances by drawing a fixed set of samples and solving a discrete linear program via the Sinkhorn algorithm. This approach faces two primary hurdles: statistical inefficiency in high-dimensional spaces (the "curse of dimensionality") and estimation bias. In many modern ML settings, data is not static; it arrives in streams or is resampled every iteration. Simply averaging discrete Sinkhorn distances over mini-batches results in a biased estimate that does not converge to the true distance between the underlying continuous distributions.

The Online Sinkhorn Algorithm

To bridge this gap, we introduce Online Sinkhorn, a method that treats entropy-regularized OT as a stochastic approximation (SA) task. Rather than balancing a fixed cost matrix, the algorithm maintains and refines a functional, non-parametric representation of the "dual potentials"—the mathematical functions that define the transport plan.

Key Methodological Components

  • Functional Representation: We represent the potentials using a non-parametric expansion of kernel functions. Crucially, Online Sinkhorn utilizes "natural kernels"—exponentials of the cost function—which are intrinsic to the OT problem. This allows the algorithm to capture the shape of the potentials accurately, even in regions where data is sparse.
  • Stochastic Updates: As new samples arrive from the data stream, the algorithm performs a Robbins-Monro style update. By using a learning rate ($\eta_t$), the algorithm blends new information with past iterates, ensuring a consistent global estimation of the distribution's structure.
  • Warmup Strategy: Online Sinkhorn can serve as a powerful "warmup" for large-scale discrete problems. While a system prepares the massive cost matrix required for a large dataset, Online Sinkhorn can begin sketching the potentials, providing a high-quality initialization that significantly accelerates final convergence.

Theoretical Insights

A major contribution of this work is the reinterpretation of the Sinkhorn algorithm as a non-convex stochastic mirror descent. This connection allows us to apply optimization theory to OT in new ways. We prove that while standard mini-batching (Randomized Sinkhorn) converges to a noisy stationary distribution, Online Sinkhorn converges almost surely to the true optimal potentials of the continuous distributions. Furthermore, we establish a nearly $O(1/n)$ asymptotic sample complexity, demonstrating the algorithm's efficiency for large-scale streaming data.

Experimental Results

We validated Online Sinkhorn across several benchmarks, ranging from synthetic models to complex 3D geometries.

  • Synthetic GMMs: In tests using Gaussian Mixture Models (1D to 10D), the algorithm demonstrated robust performance across varying dimensions. In 2D experiments, Online Sinkhorn produced significantly smoother and more accurate displacement fields compared to standard SGD-based kernel methods.
  • Computational Speedups: When utilized as a warmup for the standard discrete Sinkhorn algorithm, our method achieved remarkable efficiency gains:
  • 17x faster to reach target precision for 2D GMMs.
  • 5.3x faster for processing the Stanford 3D Dragon (a complex real-world 3D scan).
  • Consistency: The experiments confirmed that Online Sinkhorn effectively eliminates the estimation bias inherent in mini-batch approaches, providing a consistent estimate of the true regularized OT distance.

Limitations and Future Work

While Online Sinkhorn offers a significant advancement, it is not without challenges. In its basic form, memory requirements grow with the number of iterations as the algorithm stores previous sample positions. While specialized libraries like KeOps can mitigate this, it remains a factor for extremely long-running streams. Additionally, while our method outperforms standard Sinkhorn in low-to-medium dimensions, the performance gap narrows in very high-dimensional spaces (e.g., 10D) due to the inherent complexity of the space.

Future research will focus on adaptive potential estimations and refining complexity constants to further optimize the algorithm for extreme-scale machine learning applications.

Summary updated

Abstract

Optimal Transport (OT) distances are now routinely used as loss functions in ML tasks. Yet, computing OT distances between arbitrary (i.e. not necessarily discrete) probability distributions remains an open problem. This paper introduces a new online estimator of entropy-regularized OT distances between two such arbitrary distributions. It uses streams of samples from both distributions to iteratively enrich a non-parametric representation of the transportation plan. Compared to the classic Sinkhorn algorithm, our method leverages new samples at each iteration, which enables a consistent estimation of the true regularized OT distance. We provide a theoretical analysis of the convergence of the online Sinkhorn algorithm, showing a nearly-O(1/n) asymptotic sample complexity for the iterate sequence. We validate our method on synthetic 1D to 10D data and on real 3D shape data.
BibTeX
@inproceedings{mensch2020online,
  author = {Arthur Mensch and Gabriel Peyré},
  title = {{Online Sinkhorn: Optimal Transport distances from sample streams}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2020},
  url = {https://openreview.net/forum?id=najPIuQVPI},
}
Figure