Abstract
Optimal Transport (OT) is a popular distance metric for measuring similarity between distributions. Exact algorithms for computing Optimal Transport can be slow, which has motivated the development of approximate numerical solvers such as the Sinkhorn method. We introduce a new and very simple combinatorial approach to find an $\varepsilon$-approximation of the OT distance. Our algorithm achieves a near-optimal execution time of $O(n^2/\varepsilon^2)$ for computing OT distance and, for the special case of the assignment problem, the execution time improves to $O(n^2/\varepsilon)$. Our algorithm is based on the push-relabel framework for min-cost flow problems. Unlike previous combinatorial approaches which lack fast parallel implementations, our algorithm has a parallel execution time of $O(\log n/\varepsilon^2)$. Interestingly, unlike the Sinkhorn algorithm, our method also readily provides a compact transport plan as well as a solution to an approximate version of the dual formulation of the OT problem. Experiments suggest that our algorithm is faster than the Sinkhorn algorithm in both CPU and GPU implementations, especially when computing matchings with high accuracy.
Introduction
Optimal Transport (OT), often referred to as the Earth Mover's Distance, provides a powerful framework for measuring the distance between two probability distributions. By calculating the minimum cost required to transform one distribution into another, OT has become a cornerstone in machine learning for tasks ranging from generative modeling (GANs) to domain adaptation and image retrieval.
However, the computational cost of OT remains a significant barrier. Exact solvers typically scale at $O(n^3)$, which is prohibitive for modern large-scale datasets. This has led to the widespread adoption of the Sinkhorn algorithm, which uses entropy regularization to approximate the OT distance. While efficient, Sinkhorn suffers from numerical instability when high precision is required, as the exponential functions involved can lead to overflow. Furthermore, existing combinatorial alternatives have historically been difficult to parallelize, limiting their utility on modern GPU hardware. This paper presents a new combinatorial approach based on the push-relabel framework that addresses these limitations.
The Push-Relabel Framework for OT
The proposed algorithm adapts the classic push-relabel framework—traditionally used for max-flow and min-cost flow problems—to the context of Optimal Transport. Instead of smooth numerical optimization, the algorithm operates directly on a graph representing supply and demand points.
The algorithm maintains a transport plan (matching) and a set of dual weights (prices) for each point. It proceeds through iterative phases, each consisting of three primary steps:
- Greedy Step: The algorithm identifies a "maximal matching" among points where the transport cost is currently "admissible" based on the dual weights.
- Push Step: The current transport plan is updated using the newly identified matching.
- Relabel Step: Dual weights are adjusted to make more edges admissible for the subsequent round.
To ensure efficiency, the algorithm employs $\varepsilon$-scaling. By allowing a controlled margin of error ($\varepsilon$) in the dual feasibility conditions, the algorithm can converge significantly faster while guaranteeing that the final cost remains within a known distance of the true optimum.
Theoretical Advantages
Parallelism and Complexity
A major contribution of this work is the parallelization of combinatorial OT. Previous combinatorial methods, such as the Gabow-Tarjan algorithm, are inherently sequential. In contrast, the push-relabel steps described here can be executed in $O(\log n / \varepsilon^2)$ parallel time. This makes the algorithm highly suitable for GPU acceleration. The overall sequential complexity is $O(n^2/\varepsilon^2)$ for general OT and $O(n^2/\varepsilon)$ for the assignment problem (where all weights are equal).
Numerical Stability
Unlike the Sinkhorn method, which relies on exponential kernels, the push-relabel approach is purely combinatorial. It avoids the numerical "blow-ups" associated with high-precision requirements, making it robust for applications where a very accurate transport plan is necessary.
Dual Solutions and Transport Plans
Many downstream machine learning tasks require more than just the scalar distance value; they require the transport plan itself or the dual solution. Our method naturally produces a compact transport plan and an approximate dual solution, providing a more complete set of outputs than many existing approximate solvers.
Experimental Results
The algorithm was evaluated against the standard Python Optimal Transport (POT) library using two primary benchmarks: synthetic 2D point sets (Euclidean distance) and the MNIST dataset ($L_1$ distance between pixel intensities).
Performance and Accuracy
Experiments demonstrated that the push-relabel algorithm consistently outperforms the Sinkhorn algorithm on both CPU and GPU architectures. This performance gap becomes particularly pronounced as the required accuracy increases (i.e., as $\varepsilon$ decreases). In MNIST benchmarks, as $\varepsilon$ was reduced from 0.75 to 0.05, the Sinkhorn algorithm's execution time increased exponentially due to convergence difficulties at high precision. In contrast, the push-relabel algorithm's runtime scaled gracefully, maintaining high performance even at high accuracy levels.
Conclusion
This push-relabel approach offers a faster, more stable, and highly parallelizable alternative to the Sinkhorn algorithm for computing Optimal Transport. By bridging the gap between combinatorial optimization and modern parallel computing, this method provides a robust tool for high-accuracy OT tasks. Future work includes optimizing the GPU implementation for general discrete distributions beyond the assignment problem and further refining the maximal matching step for even greater performance gains.
Summary updated