Massively scalable Sinkhorn distances via the Nyström method

Jason M. Altschuler, Francis R. Bach, Alessandro Rudi, Jonathan Niles-Weed

Optimal Transport (OT) is a powerful mathematical framework for measuring the distance between probability distributions. While highly effective in machine learning and statistical inference, it is notoriously expensive to compute. The introduction of the "Sinkhorn distance"—which adds an entropic penalty to the OT problem—was a major breakthrough, allowing for much faster computation using simple matrix-vector products.

However, even the standard Sinkhorn distance suffers from a severe bottleneck: it requires storing and manipulating an $n \times n$ cost matrix, where $n$ is the number of data points. For a dataset with just 100,000 points, this matrix contains 10 billion entries, quickly exhausting the RAM of modern machines. This quadratic $O(n^2)$ scaling makes standard Sinkhorn distances prohibitively expensive for "big data" applications in machine learning and genomics.

To solve this, researchers have introduced NYS-SINK, an algorithm that scales entropic optimal transport to datasets with millions of points. By combining the Nyström method for low-rank matrix approximation with Sinkhorn scaling, the authors reduce the computational complexity from quadratic to linear ($O(n)$), enabling the calculation of distances on data sets hundreds of times larger than previously possible.

The NYS-SINK Algorithm

The proposed NYS-SINK approach relies on three main pillars to achieve its massive scalability:

  1. The Nyström Method: Instead of computing the full $n \times n$ kernel matrix $K$ (where $K_{ij} = e^{-\eta \|x_i - x_j\|^2}$), the algorithm constructs a low-rank approximation using a small subset of the matrix's columns. This reduces the memory footprint from $O(n^2)$ to $O(nr)$, where $r$ is the approximation rank.
  2. Adaptive Rank Selection: The algorithm employs a "doubling trick" (the ADAPTIVENYSTRÖM procedure) to automatically find the smallest rank $r$ needed to achieve a target accuracy, removing the need for users to guess the optimal rank.
  3. Stability Analysis: The authors provide a new theoretical proof showing that Sinkhorn scaling is "stable." This guarantees that if you use a slightly inaccurate (Nyström-approximated) kernel, the resulting Sinkhorn distance remains a provably good approximation of the true distance.

Crucially, NYS-SINK never explicitly forms the large matrix. It performs all operations using low-rank factorizations, keeping the complexity strictly linear with respect to the number of points $n$.

Key Insights

A major theoretical insight from this work is that the required rank $r$ for a good approximation depends on the intrinsic dimension of the data (e.g., the dimension of the manifold the data sits on), rather than the ambient dimension of the space. If your data is a 2D surface embedded in a 100D space, NYS-SINK scales according to the 2D structure.

Furthermore, the authors demonstrate the "surprising ease" of circumventing the OT bottleneck. While many complex methods have been proposed to speed up OT, the combination of two well-known techniques (Nyström and Sinkhorn) is remarkably effective and theoretically sound. Because the Sinkhorn projection is robust to perturbations in the kernel matrix, small errors in the matrix approximation do not "explode" during the iterative Sinkhorn process.

Empirical Results

The paper evaluates the algorithm using synthetic manifolds embedded in high-dimensional spaces (up to $d=100$) and large-scale 3D point clouds from the Stanford 3D Scanning Repository (containing up to $3.8 \times 10^6$ points).

Time complexity of NYS-SINK vs standard Sinkhorn across different dimensions.

Empirical tests confirmed that the running time of NYS-SINK grows linearly ($\Theta(n)$), whereas the standard Sinkhorn algorithm grows quadratically ($\Theta(n^2)$) and quickly hits memory saturation. NYS-SINK successfully computed Sinkhorn distances for $n \approx 3.8 \times 10^6$ points in about 6 seconds. For comparison, standard Sinkhorn algorithms typically saturate the RAM of a standard machine at just $n \approx 10^4$.

Excess error vs. time for NYS-SINK at various approximation ranks compared to standard Sinkhorn.

On benchmark datasets, NYS-SINK was consistently orders of magnitude faster than optimized baselines while maintaining comparable precision. By tuning the approximation rank $r$, NYS-SINK achieves a highly favorable tradeoff between excess error and computation time compared to the exact Sinkhorn approach.

Limitations and Future Work

While highly effective, NYS-SINK has a few limitations:

  • Squared Euclidean Cost: The theoretical guarantees and the efficiency of the Nyström method in this paper rely specifically on the squared Euclidean distance (the 2-Wasserstein distance). The results do not immediately extend to other cost functions (like $L_1$ or cosine distance) unless their corresponding kernels are Positive Semi-Definite (PSD).
  • Parameter Tuning: While the rank $r$ is chosen adaptively, the regularization parameter $\eta$ and the number of iterations $T$ were chosen manually in some experiments to balance precision and speed.

Despite these limitations, the authors note that the algorithm often performs even better in practice than their theoretical bounds suggest, indicating that tighter analyses may be possible for specific data distributions in future work.

Summary updated

BibTeX
@inproceedings{altschuler2019massively,
  author = {Jason M. Altschuler and Francis R. Bach and Alessandro Rudi and Jonathan Niles-Weed},
  title = {{Massively scalable Sinkhorn distances via the Nyström method}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2019},
  url = {https://openreview.net/forum?id=JATc6dIsKEm},
}
Figure