Massively scalable Sinkhorn distances via the Nyström method

Jason Altschuler, Francis Bach, Alessandro Rudi, Jonathan Niles-Weed

Introduction

Optimal transport is a fundamental notion in probability theory and geometry (Villani, 2008), which has recently attracted a great deal of interest in the machine learning community as a tool for image recognition (Li et al., 2013; Rubner et al., 2000), domain adaptation (Courty et al., 2017, 2014), and generative modeling (Bousquet et al., 2017; Arjovsky et al., 2017; Genevay et al., 2016), among many other applications (see, e.g., Peyré and Cuturi, 2017; Kolouri et al., 2017).

The growth of this field has been fueled in part by computational advances, many of them stemming from an influential proposal of Cuturi (2013) to modify the definition of optimal transport to include an entropic penalty. The resulting quantity, which Cuturi (2013) called the Sinkhorn “distance”We use quotations since it is not technically a distance; see (Cuturi, 2013, Section 3.2) for details. The quotes are dropped henceforth. after Sinkhorn (1967), is significantly faster to compute than its unregularized counterpart. Though originally attractive purely for computational reasons, the Sinkhorn distance has since become an object of study in its own right because it appears to possess better statistical properties than the unregularized distance both in theory and in practice (Genevay et al., 2018; Montavon et al., 2016; Peyré and Cuturi, 2017; Schiebinger et al., 2019; Rigollet and Weed, 2018). Computing this distance as quickly as possible has therefore become an area of active study.

for a parameter η>0\eta>0. We stress that we use the squared Euclidean cost in our formulation of the Sinkhorn distance. This choice of cost—which in the unregularized case corresponds to what is called the 22-Wasserstein distance (Villani, 2008)—is essential to our results, and we do not consider other costs here. The squared Euclidean cost is among the most common in applications (Schiebinger et al., 2019; Genevay et al., 2018; Courty et al., 2017; Forrow et al., 2018; Bousquet et al., 2017).

Many algorithms to compute Wη(p,q)W_{\eta}(\mathbf{p},\mathbf{q}) are known. Cuturi (2013) showed that a simple iterative procedure known as Sinkhorn’s algorithm had very fast performance in practice, and later experimental work has shown that greedy and stochastic versions of Sinkhorn’s algorithm perform even better in certain settings (Genevay et al., 2016; Altschuler et al., 2017). These algorithms are notable for their versatility: they provably succeed for any bounded, nonnegative cost. On the other hand, these algorithms are based on matrix manipulations involving the n×nn\times n cost matrix CC, so their running times and memory requirements inevitably scale with n2n^{2}. In experiments, Cuturi (2013) and Genevay et al. (2016) showed that these algorithms could reliably be run on problems of size n≈104n\approx 10^{4}.

We show that a simple algorithm can be used to approximate Wη(p,q)W_{\eta}(\mathbf{p},\mathbf{q}) quickly on massive data sets. Our algorithm uses only known tools, but we give novel theoretical guarantees that allow us to show that the Nyström method combined with Sinkhorn scaling provably yields a valid approximation algorithm for the Sinkhorn distance at a fraction of the running time of other approaches.

We establish two theoretical results of independent interest: (i) New Nyström approximation results showing that instance-adaptive low-rank approximations to Gaussian kernel matrices can be found for data lying on a low-dimensional manifold (Section 3). (ii) New stability results about Sinkhorn projections, establishing that a sufficiently good approximation to the cost matrix can be used (Section 4).

2 Prior work

Computing the Sinkhorn distance efficiently is a well studied problem in a number of communities. The Sinkhorn distance is so named because, as was pointed out by Cuturi (2013), there is an extremely simple iterative algorithm due to Sinkhorn (1967) which converges quickly to a solution to (1). This algorithm, which we call Sinkhorn scaling, works very well in practice and can be implemented using only matrix-vector products, which makes it easily parallelizable. Sinkhorn scaling has been analyzed many times (Franklin and Lorenz, 1989; Linial et al., 1998; Kalantari et al., 2008; Altschuler et al., 2017; Dvurechensky et al., 2018), and forms the basis for the first algorithms for the unregularized optimal transport problem that run in time nearly linear in the size of the cost matrix (Altschuler et al., 2017; Dvurechensky et al., 2018). Greedy and stochastic algorithms related to Sinkhorn scaling with better empirical performance have also been explored (Genevay et al., 2016; Altschuler et al., 2017). Another influential technique, due to Solomon et al. (2015), exploits the fact that, when the distributions are supported on a grid, Sinkhorn scaling performs extremely quickly by decomposing the cost matrix along lower-dimensional slices.

Other algorithms have sought to solve (1) by bypassing Sinkhorn scaling entirely. Blanchet et al. (2018) proposed to solve (1) directly using second-order methods based on fast Laplacian solvers (Cohen et al., 2017; Allen-Zhu et al., 2017). Blanchet et al. (2018) and Quanrud (2019) have noted a connection to packing linear programs, which can also be exploited to yield near-linear time algorithms for unregularized transport distances.

Our main algorithm relies on constructing a low-rank approximation of a Gaussian kernel matrix from a small subset of its columns and rows. Computing such approximations is a problem with an extensive literature in machine learning, where it has been studied under many different names, e.g., Nyström method (Williams and Seeger, 2001), sparse greedy approximations (Smola and Schölkopf, 2000), incomplete Cholesky decomposition (Fine and Scheinberg, 2001), Gram-Schmidt orthonormalization (Shawe-Taylor and Cristianini, 2004) or CUR matrix decompositions (Mahoney and Drineas, 2009). The approximation properties of these algorithms are now well understood (Mahoney and Drineas, 2009; Gittens, 2011; Bach, 2013; Alaoui and Mahoney, 2015); however, in this work, we require significantly more accurate bounds than are available from existing results as well as adaptive bounds for low-dimensional data. To establish these guarantees, we follow an approach based on approximation theory (see, e.g., Rieger and Zwicknagl, 2010; Wendland, 2004; Belkin, 2018), which consists of analyzing interpolation operators for the reproducing kernel Hilbert space corresponding to the Gaussian kernel.

Finally, this paper adds to recent work proposing the use of low-rank approximation for Sinkhorn scaling (Altschuler et al., 2018; Tenetov et al., 2018). We improve upon those papers in several ways. First, although we also exploit the idea of a low-rank approximation to the kernel matrix, we do so in a more sophisticated way that allows for automatic adaptivity to data with low-dimensional structure. These new approximation results are the key to our adaptive algorithm, and this yields a significant improvement in practice. Second, the analyses of Altschuler et al. (2018) and Tenetov et al. (2018) only yield an approximation to Wη(p,q)W_{\eta}(\mathbf{p},\mathbf{q}) when η→∞\eta\to\infty. In the moderately regularized case when η=O(1)\eta=O(1), which is typically used in practice, neither the work of Altschuler et al. (2018) nor of Tenetov et al. (2018) yields a rigorous error guarantee.

3 Outline of paper

Section 2 recalls preliminaries, and then formally states our main result and gives pseudocode for our proposed algorithm. The core of our theoretical analysis is in Sections 3 and 4. Section 3 presents our new results for Nyström approximation of Gaussian kernel matrices and Section 4 presents our new stability results for Sinkhorn scaling. Section 5 then puts these results together to conclude a proof for our main result (Theorem 1). Finally, Section 6 contains experimental results showing that our proposed algorithm outperforms state-of-the-art methods. The appendix contains proofs of several lemmas that are deferred for brevity of the main text.

Main result

Our goal is to approximate the Sinkhorn distance with parameter η>0\eta>0:

to some additive accuracy ε>0\varepsilon>0. By strict convexity, this optimization problem has a unique minimizer, which we denote henceforth by PηP^{\eta}. For shorthand, in the sequel we write

Our approach is based on Sinkhorn scaling, an algorithm due to Sinkhorn (1967) and popularized for optimal transport by Cuturi (2013). We recall the following fundamental definition.

Since p\mathbf{p} and q\mathbf{q} remain fixed throughout, we abbreviate ΠM(p,q)S\Pi^{\mathcal{S}}_{\mathcal{M}(\mathbf{p},\mathbf{q})} by ΠS\Pi^{\mathcal{S}} except when we want to make the feasible set M(p,q)\mathcal{M}(\mathbf{p},\mathbf{q}) explicit.

Let KK have strictly positive entries, and let log⁡K\log K be the matrix defined by (log⁡K)ij:=log⁡(Kij)(\log K)_{ij}:=\log(K_{ij}). Then

Note that the strict convexity of −H(P)-H(P) and the compactness of M(p,q)\mathcal{M}(\mathbf{p},\mathbf{q}) implies that the minimizer exists and is unique.

This yields the following simple but key connection between Sinkhorn distances and Sinkhorn scaling.

where KK is defined by Kij=e−ηCijK_{ij}=e^{-\eta C_{ij}}.

Sinkhorn (1967) proposed to find ΠS(K)\Pi^{\mathcal{S}}(K) by alternately renormalizing the rows and columns of KK. This well known algorithm has excellent performance in practice, is simple to implement, and is easily parallelizable since it can be written entirely in terms of matrix-vector products (Peyré and Cuturi, 2017, Section 4.2). Pseudocode for the version of the algorithm we use can be found in Appendix A.1.

2 Main result and proposed algorithm

Pseudocode for our proposed algorithm is given in Algorithm 1. Nys-Sink (pronounced “nice sink”) computes a low-rank Nyström approximation of the kernel matrix via a column sampling procedure. While explicit low-rank approximations of Gaussian kernel matrices can also be obtained via Taylor explansion (Cotter et al., 2011), our approach automatically adapts to the properties of the data set, leading to much better performance in practice.

As noted in Section 1, the Nyström method constructs a low-rank approximation to a Gaussian kernel matrix K=e−ηCK=e^{-\eta C} based on a small number of its columns. In order to design an efficient algorithm, we aim to construct such an approximation with the smallest possible rank. The key quantity for understanding the error of this algorithm is the so-called effective dimension (also sometimes called the “degrees of freedom”) of the kernel KK (Friedman et al., 2001; Zhang, 2005; Musco and Musco, 2017).

Let λj(K)\lambda_{j}(K) denote the jjth largest eigenvalue of KK (with multiplicity). Then the effective dimension of KK at level τ>0\tau>0 is

where deff(⋅)d_{\textrm{eff}}(\cdot) is the effective rank for the kernel matrix K:=e−ηCK:=e^{-\eta C}.

We note also that although the present paper focuses specifically on the squared Euclidean cost c(xi,xj)=∥xi−xj∥22c(x_{i},x_{j})=\|x_{i}-x_{j}\|_{2}^{2} (corresponding to the 22-Wasserstein case of optimal transport pervasively used in applications; see intro), our algorithm Nys-Sink readily extends to other cases of optimal transport. Indeed, since the Nyström method works not only for Gaussian kernel matrices Kij=e−η∥xi−xj∥22K_{ij}=e^{-\eta\|x_{i}-x_{j}\|_{2}^{2}}, but in fact more generally for any PSD kernel matrix, our algorithm can be used on any optimal transport instance for which the corresponding kernel matrix Kij=e−ηc(xi,xj)K_{ij}=e^{-\eta c(x_{i},x_{j})} is PSD.

We note that, while our algorithm is randomized, we obtain a deterministic guarantee that P^\hat{P} is a good solution. We also note that runtime dependence on the radius RR—which governs the scale of the problem—is inevitable since we seek an additive guarantee.

Crucially, we show in Section 3 that r∗r^{*}—which controls the running time of the algorithm with high probability by (3d)—adapts to the intrinsic dimension of the data. This adaptivity is crucial in applications, where data can have much lower dimension than the ambient space. We informally summarize this behavior in the following theorem.

For any kk-dimensional manifold Ω\Omega satisfying certain technical conditions and η>0\eta>0, there exists a constant cΩ,ηc_{\Omega,\eta} such that for any nn points lying on Ω\Omega,

The formal versions of these bounds appear in Section 3. The second bound is significantly better than the first when k≪dk\ll d, and clearly shows the benefits of an adaptive procedure.

Combining Theorems 1 and 2 yields the following time and space complexity for our algorithm.

Moreover, if XX lies on a kk-dimensional manifold Ω\Omega, then with high probability Algorithm 1 requires

Altschuler et al. (2017) noted that an approximation to the unregularized optimal transport cost is obtained by taking η=Θ(ε−1log⁡n)\eta=\Theta\left(\varepsilon^{-1}\log n\right). Thus it follows that Algorithm 1 computes an additive ε\varepsilon approximation to the unregularized transport distance in O(n(ε−1R2log⁡n)O(d))O\left(n\left(\varepsilon^{-1}R^{2}\log n\right)^{O(d)}\right) time with high probability. However, a theoretically better running time for that problem can be obtained by a simple but impractical algorithm based on rounding the input distributions to an ε\varepsilon-net and then running Sinkhorn scaling on the resulting instance.We are indebted to Piotr Indyk for inspiring this remark.

Kernel approximation via the Nyström method

In this section, we describe the algorithm AdaptiveNyström used in line 4 of Algorithm 1 and bound its runtime complexity, space complexity, and error. We first establish basic properties of Nyström approximation and give pseudocode for AdaptiveNyström (Sections 3.1 and 3.2) before stating and proving formal versions of the bounds appearing in Theorem 2 (Sections 3.3 and 3.4).

We now turn to understanding the approximation error of this method. In this paper we will sample the set XrX_{r} via approximate leverage-score sampling. In particular, we do this via Algorithm 2 of Musco and Musco (2017). The following lemma shows that taking the rank rr to be on the order of the effective dimension deff(τ)d_{\textrm{eff}}(\tau) (see Definition 3) is sufficient to guarantee that K~\widetilde{K} approximates KK to within error τ\tau in operator norm.

Let τ,δ>0\tau,\delta>0. Consider sampling XrX_{r} from XX according to Algorithm 2 of Musco and Musco (2017), for some positive integer r⩾400deff(τ)log⁡3nδ.r\geqslant 400d_{\textrm{eff}}(\tau)\log\tfrac{3n}{\delta}. Then:

The result follows directly from Theorem 7 of Musco and Musco (2017) and the fact that deff(τ)⩽rank(K)⩽nd_{\textrm{eff}}(\tau)\leqslant\textrm{rank}(K)\leqslant n for any τ⩾0\tau\geqslant 0. ∎

2 Adaptive Nyström with doubling trick

Below, line 6 in Algorithm 2 denotes the approximate leverage-score sampling scheme of Musco and Musco (2017, Algorithm 2) when applied to the Gaussian kernel matrix Kij:=e−η∥xi−xj∥2K_{ij}:=e^{-\eta\|x_{i}-x_{j}\|^{2}}. We note that the BLESS algorithm of Rudi et al. (2018) allows for re-using previously sampled points when doubling the sampling rank. Although this does not affect the asymptotic runtime, it may lead to speedups in practice.

The algorithm used O(nr)O(nr) space and terminated in O(nr2)O(nr^{2}) time.

There exists a universal constant cc such that simultaneously for every δ>0\delta>0,

3 General results: data points lie in a ball

For each τ∈(0,1]\tau\in(0,1], deff(τ)⩽3(6+41dηR2+3dlog⁡1τ)dd_{\textrm{eff}}(\tau)\leqslant 3\left(6+\frac{41}{d}\eta R^{2}+\frac{3}{d}\log\frac{1}{\tau}\right)^{d}.

On the other hand, by the Eckart-Young-Mirsky Theorem,

Therefore by combining the above two displays, we conclude that

Proofs of the two claims follow by bounding this quantity. Details are in Appendix B.5.

Theorem 3 characterizes the eigenvalue decay and effective dimension of Gaussian kernel matrices in terms of the dimensionality of the space, with explicit constants and explicit dependence on the width parameter η\eta and the radius RR of the ball (see Belkin, 2018, for asymptotic results). This yields the following bound on the optimal rank for approximating Gaussian kernel matrices of data lying in a Euclidean ball.

Directly from the explicit bound of Theorem 3 and the definition of r∗(X,η,ε′)r^{*}(X,\eta,\varepsilon^{\prime}). ∎

4 Adaptivity: data points lie on a low dimensional manifold

Let hX,Ω=sup⁡x′∈Ωinf⁡x∈X∥x−x′∥h_{X,\Omega}=\sup_{x^{\prime}\in\Omega}\inf_{x\in X}\|x-x^{\prime}\|. Let H\mathcal{H} be the RKHS associated to the Gaussian kernel of a given width. There exist c,h>0c,h>0 not depending on X,nX,n, such that, when hX,Ω⩽hh_{X,\Omega}\leqslant h the following holds

Let KK be the Gaussian kernel matrix associated to XX. Then there exists a constant cc not depending on XX or nn, for which

Let τ∈(0,1]\tau\in(0,1]. Let KK be the Gaussian kernel matrix associated to XX and deff(τ)d_{\textrm{eff}}(\tau) the effective dimension computed on KK. There exists c1,c2c_{1},c_{2} not depending on XX, nn, or τ\tau, for which

and the space of Wpm(B)W^{m}_{p}(B) as Wpm(B)=C∞(B)‾∥⋅∥Wpm(B)W^{m}_{p}(B)=\overline{C^{\infty}(B)}^{\|\cdot\|_{W^{m}_{p}(B)}}.

For any j∈[T]j\in[T], u∈Hu\in\mathcal{H} we have the following. By O, we have that there exists a constant Cd,k,R,rjC_{d,k,R,r_{j}} such that for any q⩾kq\geqslant k,

Now note that by Theorem 7.5 of Rieger and Zwicknagl (2010) we have that there exists a constant CηC_{\eta} such that

Then, since qm⩽mm(1+m)qq^{m}\leqslant m^{m}(1+m)^{q}, for any q⩾1q\geqslant 1, we have

for a suitable constant Cd,k,R,rj,Q,ηC_{d,k,R,r_{j},Q,\eta} depending on Cd,k,R,rj,QC_{d,k,R,r_{j},Q}, CηC_{\eta} and (d+1)/2(d+1)/2.

In particular we want to study ∥u∥L∞(Ω)\|u\|_{L^{\infty}(\Omega)}, for u=f−f^Xu=f-\widehat{f}_{X}. We have

Now for j∈[T]j\in[T], denote by ZjZ_{j} the set Zj={Ψj(x)∣x∈X∩Uj}Z_{j}=\{\Psi_{j}(x)|x\in X\cap U_{j}\}. By construction of u=f−f^Xu=f-\widehat{f}_{X}, we have

Define hZj,Brjk=sup⁡z∈Brjkinf⁡z′∈Zj∥z−z′∥h_{Z_{j},B^{k}_{r_{j}}}=\sup_{z\in B^{k}_{r_{j}}}\inf_{z^{\prime}\in Z_{j}}\|z-z^{\prime}\|. We have established that there exists C>0C>0, such that ∥u∘Ψj−1∥W2q(Brjk)⩽Cqq32q∥u∥H\|u\circ\Psi_{j}^{-1}\|_{W^{q}_{2}(B^{k}_{r_{j}})}\leqslant C^{q}q^{\frac{3}{2}q}\|u\|_{\mathcal{H}}, and by construction (u∘Ψj)∣Zj=0(u\circ\Psi_{j})|_{Z_{j}}=0. We can therefore apply Theorem 3.5 of Rieger and Zwicknagl (2010) to obtain that there exists a cj,hj>0c_{j},h_{j}>0, for which, when hZj,Brjk⩽hjh_{Z_{j},B^{k}_{r_{j}}}\leqslant h_{j}, then

Now, denote by hˉS,U=sup⁡x′∈Uinf⁡x∈Sd(x,x′)\bar{h}_{S,U}=\sup_{x^{\prime}\in U}\inf_{x\in S}d(x,x^{\prime}) with dd the geodesic distance over the manifold Ω\Omega. By applying Theorem 8 of Fuselier and Wright (2012), we have that there exist CC and h0h_{0} not depending on XX or nn such that, when hˉX,Ω⩽h0\bar{h}_{X,\Omega}\leqslant h_{0}, the inequality hˉXj∩Uj,Uj⩽ChˉX,Ω\bar{h}_{X_{j}\cap U_{j},U_{j}}\leqslant C\bar{h}_{X,\Omega} holds for any j∈[T]j\in[T]. Moreover, since by Theorem 6 of the same paper ∥x−x′∥⩽d(x,x′)⩽C1∥x−x′∥\|x-x^{\prime}\|\leqslant d(x,x^{\prime})\leqslant C_{1}\|x-x^{\prime}\|, for C1>1C_{1}>1 and x,x′∈Ωx,x^{\prime}\in\Omega, then

Finally, defining c1=c(2max⁡jCj)−2/5,h=C1−1min⁡(h0,C−1min⁡jhj)c_{1}=c(2\max_{j}C_{j})^{-2/5},h=C_{1}^{-1}\min(h_{0},C^{-1}\min_{j}h_{j}), when hX,Ω⩽hh_{X,\Omega}\leqslant h,

The proof of Points 2 and 3 now proceeds as in Theorem 3. Details are deferred to Appendix B.5. ∎

Point 1 of the result above is new, to our knowledge, and extends interpolation results on manifolds (Wendland, 2004; Fuselier and Wright, 2012; Hangelbroek et al., 2010), from polynomial to exponential decay, generalizing a technique of Rieger and Zwicknagl (2010) to a subset of real analytic manifolds. Points 2 and 3 are a generalization of Theorem 3 to the case of manifolds. In particular, the crucial point is that now the eigenvalue decay and the effective dimension depend on the dimension of the manifold kk and not the ambient dimension d≫kd\gg k. We think that the factor 5/25/2 in the exponent of the eigenvalues and effective dimension is a result of the specific proof technique used and could be removed with a refined analysis, which is out of the scope of this paper.

We finally conclude the desired bound on the optimal rank in the manifold case.

By the definition of r∗(X,η,ε′)r^{*}(X,\eta,\varepsilon^{\prime}) and the bound of Theorem 4, we have

Since log⁡2nε′⩾1\log\tfrac{2n}{\varepsilon^{\prime}}\geqslant 1, we may set cΩ,η=max⁡{(8c1ηR2)5k/2,c2}c_{\Omega,\eta}=\max\left\{(8c_{1}\eta R^{2})^{5k/2},c_{2}\right\} to obtain the claim. ∎

Sinkhorn scaling an approximate kernel matrix

The running time bound in Theorem 5 for the time required to produce D1D_{1} and D2D_{2} follows directly from prior work which has shown that Sinkhorn scaling can produce an approximation to the Sinkhorn projection of a positive matrix in time nearly independent of the dimension nn.

The remainder of the section is devoted to proving the error bounds in Theorem 5. Subsection 4.1 proves stability bounds for using an approximate kernel matrix, Subsection 4.2 proves stability bounds for using an approximate Sinkhorn projection, and then Subsection 4.3 combines these results to prove the error bounds in Theorem 5.

In words, Proposition 2 establishes that the Sinkhorn projection operator is Lipschitz on the “logarithmic scale.” By contrast, we show in Appendix C that the Sinkhorn projection does not satisfy a Lipschitz property in the standard sense for any choice of matrix norm.

2 Using an approximate Sinkhorn projection

Here we present the second ingredient for the proof of Theorem 5: that the objective function VC(⋅)V_{C}(\cdot) for Sinkhorn distances in (1) is stable with respect to the target row and column sums p\mathbf{p} and q\mathbf{q} of the outputted matrix.

3 Proof of Theorem 5

Proof of Theorem 1

In this section, we combine the results of the preceding three sections to prove Theorem 1.

Next, we prove (3b). By Proposition 1, Pη=argmin⁡P∈M(p,q)VC(P)P^{\eta}=\operatorname*{argmin}_{P\in\mathcal{M}(\mathbf{p},\mathbf{q})}V_{C}(P). Thus

where above the first inequality is by (7), the equality is by Lemma F, and the final inequality is by first-order KKT conditions which give ∇VC(Pη)(P^−Pη)⩾0\nabla V_{C}(P^{\eta})(\hat{P}-P^{\eta})\geqslant 0. After rearranging, we conclude that KL(P^∥Pη)⩽ηε\mathsf{KL}(\hat{P}\|P^{\eta})\leqslant\eta\varepsilon, proving (3b).

Experimental results

In this section we empirically validate our theoretical results. To run our experiments, we used a desktop with 32GB ram and 16 cores Xeon E5-2623 3GHz. The code is optimized in terms of matrix-matrix and matrix-vector products using BLAS-LAPACK primitives.

Fig. 1 plots the time-accuracy tradeoff for Nys-Sink, compared to the standard Sinkhorn algorithm. This experiment is run on random point clouds of size n≈20000n\approx 20000, which corresponds to cost matrices of dimension approximately 20000×2000020000\times 20000. Fig. 1 shows that Nys-Sink is consistently orders of magnitude faster to obtain the same accuracy.

Next, we investigate Nys-Sink’s dependence on the intrinsic dimension and ambient dimension of the input. This is done by running Nys-Sink on distributions supported on 11-dimensional curves embedded in higher dimensions, illustrated in Fig. 2, left. Fig. 2, right, indicates that an approximation rank of r=300r=300 is sufficient to achieve an error smaller than 10−410^{-4} for any ambient dimension 5⩽d⩽1005\leqslant d\leqslant 100. This empirically validates the result in 4, namely that the approximation rank – and consequently the computational complexity of Nys-Sink – is independent of the ambient dimension.

Finally, we evaluate the performance of our algorithm on a benchmark dataset used in computer graphics: we measure Wasserstein distance between 3D cloud points from “The Stanford 3D Scanning Repository”http://graphics.stanford.edu/data/3Dscanrep/. In the first experiment, we measure the distance between armadillo (n=1.7×105n=1.7\times 10^{5} points) and dragon (at resolution 2, n=1.0×105n=1.0\times 10^{5} points), and in the second experiment we measure the distance between armadillo and xyz-dragon which has more points (n=3.6×106n=3.6\times 10^{6} points). The point clouds are centered and normalized in the unit cube. The regularization parameter is set to η=15\eta=15, reflecting the moderate regularization regime typically used in practice.

We compare our algorithm (Nys-Sink)—run with approximation rank r=2000r=2000 for T=20T=20 iterations on a GPU—against two algorithms implemented in the library GeomLosshttp://www.kernel-operations.io/geomloss/. These algorithms are both highly optimized and implemented for GPUs. They are: (a) an algorithm based on an annealing heuristic for η\eta (controlled by the parameter α\alpha, such that at each iteration ηt=αηt−1\eta_{t}=\alpha\eta_{t-1}, see Kosowsky and Yuille, 1994b) and (b) a multiresolution algorithm based on coarse-to-fine clustering of the dataset together with the annealing heuristic (Schmitzer, 2019). Table 1 reports the results, which demonstrate that our method is comparable in terms of precision, and has computational time that is orders of magnitude smaller than the competitors. We note the parameters rr and TT for Nys-Sink are chosen by hand to balance precision and time complexity.

We note that in these experiments, instead of using Algorithm 2 to choose the rank adaptively, we simply run experiments with a small fixed choice of rr. As our experiments demonstrate, Nys-Sink achieves good empirical performance even when the rank rr is smaller than our theoretical analysis requires. Investigating this empirical success further is an interesting topic for future study.

Appendix A Pseudocode for subroutines

Moreover, the matrices log⁡(D1)\log(D_{1}) and log⁡(D2)\log(D_{2}) can each be formed in O(n)O(n) time, so computing W^\hat{W} takes time O(\textscT\textscmult+n)O(\textsc{T}_{\textsc{mult}}+n), as claimed. ∎

A.2 Pseudocode for rounding algorithm

For completeness, here we briefly recall the rounding algorithm Round from (Altschuler et al., 2017) and prove a slight variant of their Lemma 7 that we need for our purposes.

Moreover, the algorithm only uses O(1)O(1) matrix-vector products with FF and O(n)O(n) additional processing time.

The runtime claim is clear. Next, let Δ:=∥F∥1−∥F′′∥1=∑i=1n(ri(F)−pi)++∑j=1n(cj(F′)−qj)+\Delta:=\|F\|_{1}-\|F^{\prime\prime}\|_{1}=\sum_{i=1}^{n}(r_{i}(F)-\mathbf{p}_{i})_{+}+\sum_{j=1}^{n}(c_{j}(F^{\prime})-\mathbf{q}_{j})_{+} denote the amount of mass removed from FF to create F′′F^{\prime\prime}. Observe that ∑i=1n(ri(F)−pi)+=12⁡∥r(F)−p∥1\sum_{i=1}^{n}(r_{i}(F)-\mathbf{p}_{i})_{+}=\operatorname{\frac{1}{2}}\|r(F)-\mathbf{p}\|_{1}. Since F′⩽FF^{\prime}\leqslant F entrywise, we also have ∑j=1n(cj(F′)−qj)+⩽∑j=1n(cj(F)−qj)+=12⁡∥c(F)−q∥1\sum_{j=1}^{n}(c_{j}(F^{\prime})-\mathbf{q}_{j})_{+}\leqslant\sum_{j=1}^{n}(c_{j}(F)-\mathbf{q}_{j})_{+}=\operatorname{\frac{1}{2}}\|c(F)-\mathbf{q}\|_{1}. Thus Δ⩽12⁡(∥r(F)−p∥1+∥c(F)−q∥1)\Delta\leqslant\operatorname{\frac{1}{2}}(\|r(F)-\mathbf{p}\|_{1}+\|c(F)-q\|_{1}). The proof is complete since ∥F−G∥1⩽∥F−F′′∥1+∥F′′−G∥1=2Δ\|F-G\|_{1}\leqslant\|F-F^{\prime\prime}\|_{1}+\|F^{\prime\prime}-G\|_{1}=2\Delta. ∎

Appendix B Omitted proofs

Let P,Q∈Δn×nP,Q\in\Delta_{n\times n}. If ∥P−Q∥1⩽δ⩽1\|P-Q\|_{1}\leqslant\delta\leqslant 1, then

By Ho and Yeung (2010, Theorem 6), |H(P)-H(Q)|\leqslant\frac{\delta}{2}\log(n^{2}-1)+h\big{(}\frac{\delta}{2}\big{)}, where hh is the binary entropy function. If δ⩽1\delta\leqslant 1, then h(δ2)⩽δlog⁡2δh(\frac{\delta}{2})\leqslant\delta\log\frac{2}{\delta}, which yields the claim. ∎

B.2 Bregman divergence of Sinkhorn distances

The remainder in the first-order Taylor expansion of VC(⋅)V_{C}(\cdot) between any two joint distributions is exactly the KL-divergence between them.

Observing that ∇VC(P)\nabla V_{C}(P) has ijijth entry Cij+η−1(1+log⁡Pij)C_{ij}+\eta^{-1}(1+\log P_{ij}), we expand the right hand side as [⟨C,P⟩+η−1∑ijPijlog⁡Pij]+[⟨C,Q−P⟩+η−1∑ij(Qij−Pij)log⁡Pij⟩]+[η−1∑ijQijlog⁡QijPij]=⟨C,Q⟩+η−1∑ijQijlog⁡Qij=VC(Q)[\langle C,P\rangle+\eta^{-1}\sum_{ij}P_{ij}\log P_{ij}]+[\langle C,Q-P\rangle+\eta^{-1}\sum_{ij}(Q_{ij}-P_{ij})\log P_{ij}\rangle]+[\eta^{-1}\sum_{ij}Q_{ij}\log\frac{Q_{ij}}{P_{ij}}]=\langle C,Q\rangle+\eta^{-1}\sum_{ij}Q_{ij}\log Q_{ij}=V_{C}(Q). ∎

B.3 Hausdorff distance between transport polytopes

where dH(A,B)d_{H}(A,B) is the Hausdorff distance between AA and BB with respect to ∥⋅∥\|\cdot\|.

Interchanging the role of AA and BB yields the claim. ∎

B.4 Miscellaneous helpful lemmas

where ∥⋅∥∗\|\cdot\|_{*} denotes the dual norm to ∥⋅∥\|\cdot\|.

which implies the claim via the definition of the dual norm. ∎

Without loss of generality, assume a⩾ba\geqslant b. Then log⁡a−log⁡b=log⁡ab⩽ab−1=a−bmin⁡{a,b} ,\log a-\log b=\log\tfrac{a}{b}\leqslant\tfrac{a}{b}-1=\tfrac{a-b}{\min\{a,b\}}\,, as claimed. ∎

Since ∥xi∥2⩽R\|x_{i}\|_{2}\leqslant R for all i∈[n]i\in[n], the matrix KK satisfies Kij=e−η∥xi−xj∥22⩾e−4ηR2K_{ij}=e^{-\eta\|x_{i}-x_{j}\|_{2}^{2}}\geqslant e^{-4\eta R^{2}} for all i,j∈[n]i,j\in[n]. Hence K~ij⩾ε′2e−4ηR2\widetilde{K}_{ij}\geqslant\tfrac{\varepsilon^{\prime}}{2}e^{-4\eta R^{2}} for all i,j∈[n]i,j\in[n] and thus by Lemma K,

and bound the three terms separately. First, the assumptions imply that ηε⩽n\eta\varepsilon\leqslant n and 2∥C∥∞+3η−1⩽5∥C∥∞2\|C\|_{\infty}+3\eta^{-1}\leqslant 5\|C\|_{\infty}. We therefore have

Since ∥C∥∞η⩾1\|C\|_{\infty}\eta\geqslant 1, we likewise obtain

Finally, the fact that η−1δε⩽150\tfrac{\eta^{-1}\delta}{\varepsilon}\leqslant\tfrac{1}{50} and xlog⁡1x⩽110x\log\frac{1}{x}\leqslant\tfrac{1}{10} for x⩽150x\leqslant\tfrac{1}{50} yields

B.5 Supplemental results for Section 3

By the Eckart-Young-Mirsky Theorem, we have

Therefore by combining the above two displays, we conclude that

Let TτT_{\tau} be such that ε(Tτ)⩽τ\varepsilon(T_{\tau})\leqslant\tau. We can then bound ε(T)/(ε(T)+τ)\varepsilon(T)/(\varepsilon(T)+\tau) above by 11 for T⩽Tτ−1T\leqslant T_{\tau}-1 and by ε(T)/τ\varepsilon(T)/\tau for T⩾TτT\geqslant T_{\tau}, obtaining

In particular, we can choose Tτ=d+2e2ηR2+log⁡(1/τ)T_{\tau}=d+2e^{2}\eta R^{2}+\log(1/\tau). Since log⁡Tτ2eηR2>1\log\frac{T_{\tau}}{2e\eta R^{2}}>1, for any T⩾TτT\geqslant T_{\tau}, then ε(T)⩽e−Tlog⁡T2eηR2⩽e−T\varepsilon(T)\leqslant e^{-T\log\frac{T}{2e\eta R^{2}}}\leqslant e^{-T}. Moreover since MT+1−MT=dMT/(T+1)M_{T+1}-M_{T}=dM_{T}/(T+1), and MT⩽ed(1+T/d)dM_{T}\leqslant e^{d}(1+T/d)^{d}, we have

Finally, by changing variables, x=u+Tτx=u+T_{\tau} and u=(d+Tτ)zu=(d+T_{\tau})z,

where for the last equality we used the characterization of the incomplete gamma function Γ(a,z)=z−ae−z∫0∞(1+t)a−1e−ztdt\Gamma(a,z)=z^{-a}e^{-z}\int_{0}^{\infty}(1+t)^{a-1}e^{-zt}dt (see Eq. 8.6.5 of Olver et al., 2010). To complete the proof note that by P we have Γ(a,z)⩽z/(z−a)za−1e−z\Gamma(a,z)\leqslant z/(z-a)z^{a-1}e^{-z}, for any z>a>0z>a>0. Since log⁡(1/τ)⩾0\log(1/\tau)\geqslant 0 for τ∈(0,1]\tau\in(0,1], we have (d+Tτ)/(Tτ−1)⩽2(d+T_{\tau})/(T_{\tau}-1)\leqslant 2 and (de−Tτ)/(τTτ)⩽1(de^{-T_{\tau}})/(\tau T_{\tau})\leqslant 1, so

B.5.2 Full proof of Theorem 4

The proof of Points 2 and 3 here is completely analogous to the proof of Points 1 and 2, respectively, in Theorem 3.

Since BB is of rank pp, the the Eckart-Young-Mirsky Theorem again implies λp+1(K)⩽ne−cε−2/5\lambda_{p+1}(K)\leqslant ne^{-c\varepsilon^{-2/5}}. We conclude by recalling that ε⩽(p/C0)−1/k\varepsilon\leqslant(p/C_{0})^{-1/k}.

Let MτM_{\tau} be such that λMτ+1⩽nτ\lambda_{M_{\tau}+1}\leqslant n\tau. By Point 2, this holds if we take Mτ=(c0log⁡1τ)5k/2M_{\tau}=(c_{0}\log\tfrac{1}{\tau})^{5k/2} for a sufficiently large constant cc. By definition of deff(τ)d_{\textrm{eff}}(\tau) and the fact that x/(x+λ)⩽min⁡(1,x/λ)x/(x+\lambda)\leqslant\min(1,x/\lambda) for any x⩾0,λ>0x\geqslant 0,\lambda>0, we have

Denoting β:=25k\beta:=\tfrac{2}{5k} for shorthand, we can upper bound the sum as follows:

where above the second step was by the change of variables u:=cxβu:=cx^{\beta}, the third step was by Cauchy-Schwartz with respect to the inner product ⟨f,g⟩:=∫0∞f(u)g(u)e−udu\langle f,g\rangle:=\int_{0}^{\infty}f(u)g(u)e^{-u}du, and the final line was for some constant ckc_{k} only depending on kk, whenever c0c_{0} is taken to be at least 2c\tfrac{2}{c}. This proves the claim. ∎

B.5.3 Additional bounds

Now note that by the properties of lj,kjl_{j},k_{j}, we have that ∣ν∣=∣∑j∣kj∣lj∣=∑j∣kj∣∣lj∣,|\nu|=|\sum_{j}|k_{j}|l_{j}|=\sum_{j}|k_{j}||l_{j}|, then

To conclude, denote by SknS^{n}_{k} the Stirling numbers of the second kind. By Constantine and Savits (1996, Corollary 2.9) and Rennie and Dobson (1969) we have

First note that ∥⋅∥L∞(BRd)⩽Cd,R∥⋅∥W2(d+1)/2(BRd)\|\cdot\|_{L^{\infty}(B^{d}_{R})}\leqslant C_{d,R}\|\cdot\|_{W^{(d+1)/2}_{2}(B^{d}_{R})} (Adams and Fournier, 2003) for a constant Cd,RC_{d,R} depending only on dd and RR. Therefore

Moreover note that ∥Dαf∥W2(d+1)/2(BRd)⩽∥f∥W2∣α∣+(d+1)/2(BRd)\|D^{\alpha}f\|_{W^{(d+1)/2}_{2}(B^{d}_{R})}\leqslant\|f\|_{W^{|\alpha|+(d+1)/2}_{2}(B^{d}_{R})}. By N we have that

By definition of Sobolev space W2q(Brjk)W^{q}_{2}(B^{k}_{r_{j}}), we have

where Cq:=∑∣α∣⩽q(2∣α∣dQ)∣α∣C_{q}:=\sum_{|\alpha|\leqslant q}(2|\alpha|dQ)^{|\alpha|}. Then,

The final result is obtained via the bound Cq⩽(2qdQ)q(k+qk)⩽(2ek)k(2qdQ)qqkC_{q}\leqslant(2qdQ)^{q}\binom{k+q}{k}\leqslant(2ek)^{k}(2qdQ)^{q}q^{k} for q⩾kq\geqslant k. ∎

Denote by Γ(a,x)\Gamma(a,x) the function defined as

In particular Γ(a,x)⩽2xa−1e−x,\Gamma(a,x)\leqslant 2x^{a-1}e^{-x}, for x⩾2(a−1)+ ∧ x>0x\geqslant 2(a-1)_{+}~{}\wedge~{}x>0.

Assume x>0x>0. When a⩽1a\leqslant 1, the function za−1e−zz^{a-1}e^{-z} is decreasing and in particular za−1e−z⩽xa−1e−zz^{a-1}e^{-z}\leqslant x^{a-1}e^{-z} for z⩾xz\geqslant x, so when z⩾xz\geqslant x we have

When a>1a>1, for any τ∈(0,1)\tau\in(0,1), we have

Now note that the maximum of za−1e−τzz^{a-1}e^{-\tau z} is reached when z=(a−1)/τz=(a-1)/\tau. When x⩾a−1x\geqslant a-1, we can set τ=(a−1)/x\tau=(a-1)/x, so the maximum of za−1e−τzz^{a-1}e^{-\tau z} is exactly in z=xz=x. In that case sup⁡z⩾x(za−1e−τz)=xa−1e−τx\sup_{z\geqslant x}(z^{a-1}e^{-\tau z})=x^{a-1}e^{-\tau x} and

The final result is obtained by gathering the cases a⩽1a\leqslant 1 and a>0a>0 in the same expression. ∎

By the change of variable x=(u/q2)1/bx=(u/q_{2})^{1/b} we have

Appendix C Lipschitz properties of the Sinkhorn projection

We give a simple construction illustrating that the Sinkhorn projection operator is not Lipschitz in the standard sense. This stands in contrast with Proposition 2, which illustrates that this projection is Lipschitz on the logarithmic scale.

This non-Lipschitz result holds even for the following simple rescaling of the 2×22\times 2 Birkhoff polyope:

By the equivalence of finite-dimensional norms, it suffices to prove this for ∥⋅∥1\|\cdot\|_{1}, for which we will show

For ε,δ∈(0,1)\varepsilon,\delta\in(0,1), define the matrix

and let Pε,δ:=ΠMS(Kε,δ)P_{\varepsilon,\delta}:=\Pi_{\mathcal{M}}^{\mathcal{S}}(K_{\varepsilon,\delta}) denote the Sinkhorn projection of Kε,δK_{\varepsilon,\delta} onto M\mathcal{M}. The polytope M\mathcal{M} is parameterizable by a single scalar as follows:

By definition, Pε,δP_{\varepsilon,\delta} is the unique matrix in M\mathcal{M} of the form D1Kε,δD2D_{1}K_{\varepsilon,\delta}D_{2} for positive diagonal matrices D1D_{1} and D2D_{2}. Taking

for βε,δ=2(δ(1−ε)+ε(1−δ))\beta_{\varepsilon,\delta}=2(\sqrt{\delta(1-\varepsilon)}+\sqrt{\varepsilon(1-\delta)}), we verify D1Kε,δD2=Maε,δD_{1}K_{\varepsilon,\delta}D_{2}=M_{a_{\varepsilon,\delta}}, where aε,δ:=δ(1−ε)βε,δa_{\varepsilon,\delta}:=\frac{\sqrt{\delta(1-\varepsilon)}}{\beta_{\varepsilon,\delta}}. Therefore Pε,δ=Maε,δP_{\varepsilon,\delta}=M_{a_{\varepsilon,\delta}} for ε,δ∈(0,1)\varepsilon,\delta\in(0,1).

Now parameterize ε:=cδ\varepsilon:=c\delta for some fixed constant c∈(0,∞)c\in(0,\infty) and consider taking δ→0+\delta\to 0^{+}. Then acδ,δ=1−cδ2[c(1−δ)+1−cδ]a_{c\delta,\delta}=\frac{\sqrt{1-c\delta}}{2\left[\sqrt{c(1-\delta)}+\sqrt{1-c\delta}\right]}, which for fixed cc becomes arbitrarily close to

as δ\delta approaches . Thus ∥Pcδ,δ−Mg(c)∥1=oδ(1)\|P_{c\delta,\delta}-M_{g(c)}\|_{1}=o_{\delta}(1) and similarly ∥Pδ/c,δ−Mg(1/c)∥1=oδ(1)\|P_{\delta/c,\delta}-M_{g(1/c)}\|_{1}=o_{\delta}(1). We therefore conclude that for any constant c∈(0,∞)∖{1}c\in(0,\infty)\setminus\{1\}, although

vanishes as δ→0+\delta\to 0^{+}, the quantity

does not vanish. Therefore combining the above two displays and taking, e.g., c=2c=2 proves (9). ∎

References