Skip to content
AIAI Wranglers

14 Optimal Transport and Sinkhorn Generative Modelling

Why Optimal Transport?

In Chapter 10 we replaced the Jensen–Shannon divergence with the Wasserstein-1 distance W1 and showed that it gives the generator a meaningful gradient even when the data and model distributions have disjoint support. The Kantorovich–Rubinstein dual let us estimate W1 with a Lipschitz-constrained critic, but we never actually computed the optimal transport plan, the map that tells us how to move mass from one distribution to the other.

This chapter fills that gap. We develop the theory of optimal transport from the ground up, derive an efficient algorithm, the Sinkhorn iteration, for computing an entropy-regularised transport plan, and show how it can be used as a drop-in loss for generative modelling.

Key Idea.

Optimal transport provides two things at once: a distance dc(p,q) between distributions (how hard is it to morph p into q?), and a transport plan π (which part of p should go where?). The distance measures quality; the plan provides geometric insight.

The Assignment Problem

We begin with the simplest version of the problem. Given two sets of n points, X={x1,,xn} and Y={y1,,yn}, and a cost function c:X×Y+, we seek a one-to-one pairing that minimises the total cost:

Definition 1 (Assignment Problem).

(Assignment)σ=arg minσ𝔖ni=1nc(xi,yσ(i)), where 𝔖n denotes the set of all permutations of {1,,n}.

A brute-force search considers all n! permutations, clearly intractable for any non-trivial n. The Hungarian algorithm [1] solves the assignment problem in O(n3) time.

A one-to-one assignment of red sources to blue targets. The new point xnew cannot be handled without re-solving the entire problem; the assignment formulation has no out-of-sample extension.

Remark 1 (Limitations of the Assignment Formulation).

The assignment problem has three key limitations that motivate the move to optimal transport:

  1. Equal cardinality: it requires |X|=|Y|.

  2. No out-of-sample extension: a new point xnew (Figure fig:sink:assignment) requires re-solving from scratch.

  3. Cubic complexity: O(n3) is prohibitive for the sample sizes (n104) common in generative modelling.

Historical Note.

The problem of transporting mass at minimum cost was first posed by Gaspard Monge in 1781, who asked how to move a pile of earth to fill a hole of the same volume at minimum effort. In 1942, Leonid Kantorovich reformulated the problem by relaxing Monge's deterministic map to a probabilistic coupling, enabling linear-programming techniques. Kuhn [1] developed the Hungarian algorithm for the discrete case in 1955, crediting the Hungarian mathematicians König and Egerváry. For a historical account, see [2]. The modern computational breakthrough came from Cuturi [3], who showed that adding an entropic penalty reduces the complexity to near-linear time.

The Kantorovich Formulation

Kantorovich's insight was to replace Monge's deterministic map with a probabilistic coupling: instead of sending all the mass at xi to a single destination, we allow it to be split across multiple destinations.

Transport Plans and Couplings

Definition 2 (Kantorovich Optimal Transport).

Let p+n and q+m be discrete probability vectors (so 𝟙p=𝟙q=1), and let C+n×m be a cost matrix with entry Cij=c(xi,yj). The coupling polytope is (Coupling)Π(p,q)={π+n×m:π𝟙m=p,π𝟙n=q}, and the optimal transport cost is (OT)dc(p,q)=minπΠ(p,q)C,π=minπΠ(p,q)i,jCijπij. Each πij represents the amount of mass moved from source i to destination j. The marginal constraints ensure that all mass is transported and all capacity is filled.

Proposition 1 (Existence of an Optimal Plan).

The coupling polytope Π(p,q) is a non-empty, convex, and compact subset of n×m. Consequently, the linear objective C,π attains its minimum on Π(p,q), and an optimal transport plan always exists.

Proof.

Non-empty: The product distribution π=pq satisfies both marginal constraints.

Convex: Π(p,q) is the intersection of the non-negative orthant (convex) with affine hyperplanes (the marginal constraints), hence convex.

Compact: Π(p,q)[0,1]n×m (since all entries are non-negative and each row and column sums to at most 1), so it is bounded. It is also closed (intersection of closed sets). Bounded and closed in nm implies compact.

Existence follows from the extreme value theorem: a continuous function on a compact set attains its minimum.

Optimal transport allows mass splitting: source a4 sends mass to both b1 and b3. Box sizes indicate mass; arrow thickness indicates flow. Conservation of mass ensures jπij=ai (sources empty) and iπij=bj (destinations fill).

Example 1 (Wasserstein-1 as Optimal Transport).

When X,Yd and c(x,y)=xy, the optimal transport cost becomes the Wasserstein-1 distance: W1(p,q)=minπΠ(p,q)i,jxiyjπij. This is exactly the distance used in the WGAN objective (Chapter 10), providing the bridge between the GAN training loss and the transport-theoretic framework developed here.

OT as a Linear Program

Definition 3 (OT as Linear Program).

The Kantorovich problem is a linear program (LP) with nm non-negative variables and n+m equality constraints: (LP)minπ0C,πs.t.π𝟙m=p,π𝟙n=q. Standard LP solvers (simplex, interior point) have worst-case complexity O(nm(n+m)log(n+m)), roughly cubic in n when n=m.

Kantorovich Duality

The LP has a dual that provides a powerful computational and theoretical tool.

Theorem 1 (Kantorovich Duality).

The optimal transport cost satisfies the strong duality relation (DUAL)dc(p,q)=max𝒇,𝒈𝒇,p+𝒈,qs.t.fi+gjCiji,j, where 𝒇n and 𝒈m are the dual variables (also called Kantorovich potentials).

Proof.

Equation is an LP in standard form. The primal is feasible (the product coupling pqΠ(p,q)) and bounded below (all costs are non-negative). LP strong duality then gives . For full details, see any LP text [4].

Remark 2 (Connection to the KR Dual).

When c(x,y)=xy and both distributions are continuous, the constraint fi+gjxiyj reduces to f being 1-Lipschitz (with g=f), recovering the Kantorovich–Rubinstein representation W1(p,q)=supfL1𝔼p[f]𝔼q[f] used in Chapter 10. The Sinkhorn approach developed below solves the primal instead.

Entropic Regularisation

The cubic complexity of LP solvers makes direct computation of dc(p,q) impractical for the sample sizes common in machine learning (n104). Cuturi [3] observed that adding a small entropy penalty to the objective yields a problem that can be solved in near-linear time.

Definition 4 (Entropy-Regularised OT).

For a regularisation parameter ϵ>0, the entropy-regularised optimal transport cost is (Entot)dcϵ(p,q)=minπΠ(p,q)C,πϵH(π), where H(π)=i,jπijlogπij is the (discrete) entropy of the plan.

Proposition 2 (Unique Optimal Plan).

The objective in is ϵ-strongly convex, so the entropy-regularised problem has a unique minimiser πϵΠ(p,q).

Proof.

The linear term C,π is convex (linear). The negative entropy H(π)=i,jπijlogπij has Hessian 2(H)πij2=1πij>0 on the interior of Π(p,q). Since πij(0,1), we have 1πij>1, so H is 1-strongly convex with respect to the 1 norm. Scaling by ϵ gives ϵ-strong convexity of the full objective. A strongly convex function on a compact convex set has a unique minimiser.

Proposition 3 (Limiting Behaviour).

  1. As ϵ0+, dcϵ(p,q)dc(p,q) and πϵ converges to the maximum-entropy optimal plan.

  2. As ϵ, πϵpq (the product coupling), and dcϵ(p,q)C,pqϵH(pq).

Proof.

Part (i): As ϵ0, the entropy penalty vanishes, so any minimiser of must also minimise C,π on Π(p,q). Among the (possibly multiple) LP optima, the limit selects the one with maximum entropy (a consequence of Γ-convergence of the regularised objective to the unregularised one).

Part (ii): As ϵ, the objective is dominated by ϵH(π), so the minimiser maximises entropy. Among all couplings with marginals p and q, the maximum-entropy coupling is the independent coupling pq (by the product rule for entropy: H(pq)=H(p)+H(q)H(π) for any πΠ(p,q), with equality iff π=pq).

Reformulation as KL Projection

Define the Gibbs kernel (Gibbs)Kij=eCij/ϵ,K=KZϵ,Zϵ=i,jKij, so that K is a probability distribution on {1,,n}×{1,,m}. We now show that the entropy-regularised problem reduces to a KL projection.

Proposition 4 (Entropic OT as KL Minimisation).

(KL)arg minπΠ(p,q)C,πϵH(π)=arg minπΠ(p,q)𝖣KL(πK).

Proof.

Expanding the KL divergence: 𝖣KL(πK)=i,jπijlogπijKij=i,jπijlogπiji,jπijlogKij=H(π)i,jπij(CijϵlogZϵ)=H(π)+1ϵC,π+logZϵ. Since logZϵ is independent of π, minimising 𝖣KL(πK) over Π(p,q) is equivalent to minimising 1ϵC,πH(π), which is 1ϵ times the objective in .

The Sinkhorn Algorithm

The KL reformulation reveals that the entropy-regularised problem is a projection of K onto the intersection of two affine sets: the row-marginal constraint Π(p)={π:π𝟙m=p} and the column-marginal constraint Π(q)={π:π𝟙n=q}, so that Π(p,q)=Π(p)Π(q). This is precisely the setting of alternating Bregman projections.

Alternating KL Projections

Definition 5 (Marginal Constraint Sets).

(PIP)Π(p)={π+n×m:π𝟙m=p},Π(q)={π+n×m:π𝟙n=q}. Both are affine subsets of n×m.

The alternating projection scheme initialises π(0)=K and iterates: (Altproj)π(+1)={arg minπΠ(p)𝖣KL(ππ()) even (row projection),arg minπΠ(q)𝖣KL(ππ()) odd (column projection).

Closed-Form Projections

Proposition 5 (Row Projection).

The KL projection onto Π(p) is (Rowproj)πij(2)=pikπik(21)πij(21). In matrix form: π(2)=diag(p(π(21)𝟙m))π(21), where denotes element-wise division.

Proof.

We minimise 𝖣KL(ππ(21)) subject to π𝟙m=p. Introducing Lagrange multipliers 𝒇n: (π,𝒇)=i,jπijlogπijπij(21)+ifi(pijπij). Setting πij=0: 1+logπijlogπij(21)fi=0πij=efi1πij(21). Summing over j and using the constraint jπij=pi: pi=efi1jπij(21)efi1=pijπij(21). Substituting back gives .

By an identical argument with roles of rows and columns swapped:

Proposition 6 (Column Projection).

The KL projection onto Π(q) is (Colproj)πij(2+1)=qjkπkj(2)πij(2). In matrix form: π(2+1)=π(2)diag(q(π(2)𝟙n)).

Matrix Scaling Form

The alternating projections suggest a diagonal scaling structure.

Theorem 2 (Sinkhorn Factorisation).

The entropy-regularised optimal plan has the form (Factor)πϵ=diag(𝒖)Kdiag(𝒗), for unique vectors 𝒖>0n, 𝒗>0m, where Kij=eCij/ϵ.

Proof.

Consider the full Lagrangian of with dual variables 𝒇n (row marginals) and 𝒈m (column marginals): (π,𝒇,𝒈)=i,jCijπij+ϵi,jπijlogπij+ifi(pijπij)+jgj(qjiπij). Setting πij=0: Cij+ϵ(1+logπij)figj=0,logπij=fiϵ12+gjϵ12Cijϵ,πij=efi/ϵ1/2uieCij/ϵKijegj/ϵ1/2vj. Defining ui=efi/ϵ1/2 and vj=egj/ϵ1/2, we obtain πij=uiKijvj, which in matrix form is π=diag(𝒖)Kdiag(𝒗). The vectors 𝒖,𝒗 are strictly positive since the exponential function is positive. Uniqueness (up to a common scalar) follows from the strict convexity of the objective.

Theorem 3 (Sinkhorn Iterations).

Initialise 𝒗(0)=𝟙m. The iterations (Iterations)𝒖(+1)=p(K𝒗()),𝒗(+1)=q(K𝒖(+1)), converge to the unique (𝒖,𝒗) satisfying πϵ=diag(𝒖)Kdiag(𝒗). The resulting sequence of plans π()=diag(𝒖())Kdiag(𝒗()) recovers the alternating projections .

Proof.

We show by induction that the dual iterates (𝒖(),𝒗()) produce the same plans as the primal alternating projections. Write π~()=diag(𝒖())Kdiag(𝒗()).

Row update. Starting from π~(21)=diag(𝒖())Kdiag(𝒗()), the row projection gives: π~(2)=diag(p(π~(21)𝟙m))π~(21)=diag(p(diag(𝒖())K𝒗()))diag(𝒖())Kdiag(𝒗())=diag(𝒖(+1))Kdiag(𝒗()), where 𝒖(+1)=p(K𝒗()).

Column update. Similarly, the column projection gives π~(2+1)=diag(𝒖(+1))Kdiag(𝒗(+1)) with 𝒗(+1)=q(K𝒖(+1)).

Convergence follows from the general theory of alternating Bregman projections onto affine sets [5]: the iterates converge to the unique point in Π(p)Π(q) that is closest to K in KL divergence.

Algorithm 1 (Sinkhorn Algorithm).

Input: cost matrix C+n×m, marginals p+n, q+m, regularisation ϵ>0, iterations L. Output: approximate transport plan πn×m.

  1. Compute the Gibbs kernel: KijeCij/ϵ.

  2. Initialise 𝒗𝟙m.

  3. For =1,,L: enumerate

  4. 𝒖p(K𝒗) (row normalisation)

  5. 𝒗q(K𝒖) (column normalisation) enumerate

  6. Return πdiag(𝒖)Kdiag(𝒗).

Each iteration costs O(nm) (two matrix–vector products), so the total complexity is O(Lnm), near-linear when L is a small constant.

Proposition 7 (Linear Convergence).

The Sinkhorn iterates converge linearly: there exists a contraction rate ρ(0,1), depending on ϵ and the cost matrix C, such that 𝒖()𝒖=O(ρ),𝒗()𝒗=O(ρ). In practice, L=50100 iterations suffice for high accuracy. As ϵ0, the rate ρ1 and more iterations are needed; as ϵ, ρ0 (instant convergence to the product coupling).

Example 2 (Worked 3×3 Example).

Let p=(13,13,13), q=(12,14,14), ϵ=1, and C=(012101210),K=eC/ϵ=(1e1e2e11e1e2e11)(10.3680.1350.36810.3680.1350.3681). Starting from 𝒗(0)=(1,1,1):

  • 𝒖(1)=p(K𝒗(0))=13(1/1.503,1/1.736,1/1.503)(0.222,0.192,0.222).

  • 𝒗(1)=q(K𝒖(1)), and so on.

After L=20 iterations the marginal violation is about 2×1011, so the plan π(L) reproduces p and q to roughly eleven decimal places. True machine precision in double arithmetic (around 1016) takes about L=30 here. The gap between those two figures is a useful calibration: convergence is linear, so each additional handful of iterations buys several more digits, and ϵ=1 is large relative to the costs 0,1,2 in this instance, which makes the contraction unusually fast. Harder instances with smaller ϵ need the L=50 to 100 quoted in Proposition Proposition 7.

Sinkhorn Divergence

The entropy-regularised cost dcϵ(p,q) has a subtle defect: it does not vanish when p=q. Two separate effects are at work, and it is worth keeping them apart.

First, the entropy term rewards spreading, so the optimal plan is no longer the identity coupling even when the two distributions are the same, and the transport bill C,πϵ is therefore strictly positive where the unregularised optimum was zero. Second, the objective subtracts ϵH(π), and since H0 this pushes the reported value down: with p=q=(12,12), C=(0110) and ϵ=1, the optimum has C,πϵ=0.2689 and H=1.2753, giving dcϵ(p,p)=1.0064.

So dcϵ(p,p)0, which is all the defect requires, but the sign depends on which term dominates and is not in general positive. This is why the repair below subtracts the two self-comparison terms rather than simply shifting by a constant.

Definition 6 (Sinkhorn Divergence).

The Sinkhorn divergence [6] is the debiased quantity (Divergence)Sϵ(p,q)=dcϵ(p,q)12dcϵ(p,p)12dcϵ(q,q).

Proposition 8 (Properties of the Sinkhorn Divergence).

The Sinkhorn divergence satisfies:

  1. Non-negativity: Sϵ(p,q)0.

  2. Identity of indiscernibles: Sϵ(p,q)=0 if and only if p=q.

  3. Metrisation of weak convergence: Sϵ(pn,q)0 if and only if pnq weakly.

  4. Interpolation: as ϵ0, Sϵdc (unregularised OT); as ϵ, SϵMMDk2 (the maximum mean discrepancy with kernel k=c) [7].

Insight.

The unregularised Wasserstein distance W1 suffers from a curse of dimensionality: estimating it from n samples in d has error O(n1/d), which is catastrophically slow for images (d104). For the Sinkhorn divergence Sϵ the situation is far better: the error decays at the dimension-free rate O(n1/2), so the exponent no longer degrades as d grows. This is why entropic OT is the practical choice for generative modelling.

Be precise about what is and is not dimension-free here. It is the rate in n. The constant is not: the bound of Genevay et al. [8] carries a factor eκ/ϵ(1+ϵd/2), which grows with the dimension and blows up as ϵ0. So ϵ is not a free parameter that can be sent to zero to recover unregularised OT while keeping the good rate; shrinking it trades the constant away. This is the statistical counterpart of the numerical tension described below, and it is why ϵ is tuned rather than minimised.

Caution.

The regularisation parameter ϵ requires careful tuning:

  • Too small (ϵ0): the Gibbs kernel K=eC/ϵ has entries near 0 or 1, causing numerical underflow and slow convergence.

  • Too large (ϵ): the optimal plan approaches the independent coupling pq, losing all geometric information about the cost.

In practice, ϵ is set to a small fraction of the median pairwise cost.

Sinkhorn Generative Modelling

We now show how the Sinkhorn algorithm provides a differentiable loss function for training a generative model.

Architecture and Loss

Let Gθ:kd be a generator network with parameters θ. Given a mini-batch of real samples {y1,,yn}pdata and generated samples {x1,,xm} with xi=Gθ(zi), ziNormal(0,Ik), we compute the pairwise cost matrix Cij=c(xi,yj), run L Sinkhorn iterations to obtain (𝒖L,𝒗L), and define the loss:

Definition 7 (Sinkhorn Generative Loss).

(Genloss)E^L(θ)=(CK)𝒗L,𝒖L, where denotes the Hadamard (element-wise) product, and 𝒖L,𝒗L are the Sinkhorn scaling vectors after L iterations.

Key Idea.

The Sinkhorn iterations are a sequence of differentiable operations (matrix–vector products, element-wise divisions). Therefore, E^L(θ) is differentiable with respect to θ, and we can backpropagate through all L iterations to update the generator via gradient descent. No adversarial discriminator is needed; the Sinkhorn loss is a direct, critic-free measure of distributional distance.

Sinkhorn generative modelling architecture. The generator transforms latent samples into {xi}; the Sinkhorn algorithm computes the transport loss between generated and real samples; gradients flow back through the Sinkhorn iterations to update θ.

Algorithm 2 (Sinkhorn Generative Modelling).

Input: training data {y(i)}i=1N, prior p𝒛=Normal(0,I), regularisation ϵ, Sinkhorn iterations L, learning rate η, epochs T. Output: trained generator parameters θ.

  1. Initialise θ randomly.

  2. For t=1,,T: enumerate

  3. Sample mini-batch {y1,,yn} from training data.

  4. Sample {z1,,zm}p𝒛 and compute xi=Gθ(zi).

  5. Compute cost matrix: Cij=xiyj2.

  6. Compute Gibbs kernel: Kij=eCij/ϵ.

  7. Run L Sinkhorn iterations (Algorithm Algorithm 1) to obtain 𝒖L,𝒗L.

  8. Compute loss: E^L(θ)=(CK)𝒗L,𝒖L.

  9. Update: θθηθE^L(θ). enumerate

Remark 3 (Comparison with WGAN).

WGANSinkhorn
DistanceW1 (KR dual)dcϵ (primal)
EstimationCritic network fwDirect matrix computation
TrainingMin-max gameSingle minimisation
GradientThrough criticThrough Sinkhorn iters
ScalabilityAny batch sizeO(Lnm) per batch
StabilityLipschitz enforcementϵ tuning
The key advantage of Sinkhorn is the absence of adversarial training: there is no discriminator/critic to train, eliminating mode collapse from the discriminator side. The disadvantage is the O(nm) cost of the kernel matrix, which limits batch sizes.

Computational Aspects and Extensions

Log-Domain Sinkhorn

Remark 4 (Numerical Stability).

When ϵ is small, the Gibbs kernel entries Kij=eCij/ϵ can underflow to zero, causing division-by-zero in the Sinkhorn iterations. The log-domain formulation works entirely in (logu,logv) space: (U)logui(+1)=logpilogsumexpj(logvj()Cij/ϵ),logvj(+1)=logqjlogsumexpi(logui(+1)Cij/ϵ), where logsumexp prevents over/underflow by working in log space throughout. This is essential for small ϵ.

Mini-Batch Optimal Transport

In practice, the cost matrix Cn×m is computed from mini-batches of size n,m64512. The mini-batch Sinkhorn loss approximates the population-level Sinkhorn divergence: Sϵ(pdata,pθ)Sϵ(p^n,p^m), where p^n=1ni=1nδyi and p^m=1mi=1mδxi. Using the debiased Sinkhorn divergence instead of the raw entropic cost is critical here, as it eliminates the bias that would otherwise accumulate across mini-batches.

Extensions

Remark 5 (Unbalanced Optimal Transport).

When the total masses of p and q differ (e.g., in point cloud registration or partial matching), the marginal constraints are relaxed using KL penalties: minπ0C,πϵH(π)+τ1𝖣KL(π𝟙p)+τ2𝖣KL(π𝟙q), where τ1,τ2>0 control how strictly the marginals are enforced. The Sinkhorn-like iterations for unbalanced OT involve an additional softmax damping step.

Remark 6 (Connection to Schrödinger Bridges).

The entropy-regularised OT problem is equivalent to the Schrödinger bridge problem: find the most likely stochastic process connecting distribution p at time 0 to distribution q at time 1, given a reference Brownian motion. The Sinkhorn iterations correspond to the iterative proportional fitting (IPF) algorithm for Schrödinger bridges. This connection has recently inspired diffusion Schrödinger bridges, linking optimal transport to score-based diffusion models.

MethodComplexityRegularised?Differentiable?
Hungarian algorithmO(n3)NoNo
LP (simplex)O(n3logn)NoNo
Auction algorithmO(n2logn)NoNo
SinkhornO(Ln2)Yes (ϵ)Yes
Log-domain SinkhornO(Ln2)YesYes (stable)

Historical Note.

The Sinkhorn algorithm predates its use in machine learning by decades. Richard Sinkhorn proved in 1964 that alternating row and column normalisation of a positive matrix converges to a doubly stochastic matrix. Cuturi [3] connected this to optimal transport in 2013, showing that the Sinkhorn iteration solves the entropy-regularised OT problem and scales to thousands of points. Genevay et al. [6] introduced the debiased Sinkhorn divergence and demonstrated its use as a loss function for generative models. Feydy et al. [7] showed that Sinkhorn divergences interpolate between OT distances and kernel MMD, unifying two major families of distributional distances.

Exercises

Exercise 1 (Transport Plan Constraints).

Let p=(13,13,13) and q=(12,14,14) on three points with cost matrix C=(012101210). Write down all constraints that πΠ(p,q) must satisfy. How many free variables does π have after the marginal constraints? Find the optimal transport plan by inspection or by solving the LP.

Exercise 2 (Compactness of the Coupling Polytope).

Prove that Π(p,q)={π0:π𝟙m=p,𝟙nπ=q} is convex and compact. Use this to prove that the OT problem always has a solution. Hint: Π(p,q) is a bounded, closed subset of nm.

Exercise 3 (Entropy Limit Behaviour).

Show that as ϵ, the entropy-regularised optimal plan πϵ converges to the product coupling pq. Hint: the product coupling uniquely maximises H(π) over Π(p,q). What does dcϵ(p,q) converge to?

Exercise 4 (Sinkhorn Marginal Satisfaction).

Starting from 𝒖(0)=𝟙n and 𝒗(0)=𝟙m, show that after the first row update 𝒖(1)=p(K𝒗(0)), the plan π(1)=diag(𝒖(1))Kdiag(𝒗(0)) satisfies π(1)𝟙m=p exactly. Does it satisfy (π(1))𝟙n=q?

Exercise 5 (Birkhoff–von Neumann and OT).

A doubly stochastic matrix has all row and column sums equal to 1. The Birkhoff–von Neumann theorem states that the set of n×n doubly stochastic matrices is the convex hull of permutation matrices. Show that when p=q=1n𝟙n, the coupling polytope Π(p,q)=1nn where n is the Birkhoff polytope. What does the unregularised optimal plan correspond to in this case?

Exercise 6 (Backpropagation Through Sinkhorn).

In Sinkhorn generative modelling, the loss E^L(θ)=(CK)𝒗L,𝒖L depends on θ through the cost matrix Cij=c(Gθ(zi),yj). Argue that each Sinkhorn iteration (element-wise division, matrix–vector product) is composed of differentiable operations, so θE^L(θ) can be computed by automatic differentiation through all L iterations. What is the memory cost of storing all intermediate 𝒖(),𝒗() for backpropagation?

Exercise 7 (WGAN vs. Sinkhorn).

Compare WGAN and Sinkhorn-based generative models along these axes:

  1. How does each estimate the Wasserstein distance?

  2. Which requires adversarial training, and why?

  3. What are the computational bottlenecks of each?

  4. In what regime (small n vs. large n) is each preferred?

Exercise 8 (Log-Domain Stability).

For ϵ=0.01 and Cij[0,10], show that the Gibbs kernel entry Kij=eCij/ϵ can be as small as e100010434, which underflows in double-precision floating point (minimum 10308). Verify that the log-domain update avoids this issue.

Exercise 9 (Sinkhorn Divergence Debiasing).

Compute dcϵ(p,p) for p=(12,12) with cost C=(0110) and ϵ=1. Verify that dcϵ(p,p)0, confirming the bias of the raw entropic cost. Compute the debiased Sinkhorn divergence Sϵ(p,p) and verify it equals zero.

Exercise 10 (Kantorovich Duality Verification).

For p=(12,12), q=(1) (a single point), and c(xi,y1)=|xiy1| with x1=0, x2=1, y1=0.5:

  1. Solve the primal OT problem directly (there is only one feasible plan).

  2. Find dual potentials (f1,f2,g1) satisfying complementary slackness and verify strong duality.

Exercise 11 (Convergence Rate and ϵ).

Run the Sinkhorn algorithm for the 3×3 example of Example Example 2 with ϵ{0.01,0.1,1,10}. For each ϵ, record the number of iterations L needed to achieve π(L)𝟙p<106. Verify empirically that L increases as ϵ0. What happens to the optimal plan as ϵ0?

Exercise 12 (Sample Complexity).

The unregularised W1 distance has sample complexity O(n1/d) in dimension d. Explain why this is prohibitively slow for images (d104). The Sinkhorn divergence Sϵ has sample complexity O(n1/2), independent of d. Explain intuitively why the entropic regularisation “smooths out” the curse of dimensionality. Hint: the Gibbs kernel K=eC/ϵ acts like a soft nearest-neighbour kernel.

References

  1. The Hungarian method for the assignment problem

    H. W. Kuhn

    Naval Research Logistics Quarterly, vol. 2, no. 1-2, pp. 83-97 · 1955

    BibTeX
    @article{kuhn1955,
    author = {Kuhn, H. W.},
    title = {The Hungarian method for the assignment problem},
    journal = {Naval Research Logistics Quarterly},
    volume = {2},
    number = {1-2},
    pages = {83-97},
    doi = {https://doi.org/10.1002/nav.3800020109},
    url = {https://onlinelibrary.wiley.com/doi/abs/10.1002/nav.3800020109},
    eprint = {https://onlinelibrary.wiley.com/doi/pdf/10.1002/nav.3800020109},
    abstract = {Abstract Assuming that numerical scores are available for the performance of each of n persons on each of n jobs, the “assignment problem” is the quest for an assignment of persons to jobs so that the sum of the n scores so obtained is as large as possible. It is shown that ideas latent in the work of two Hungarian mathematicians may be exploited to yield a new method of solving this problem.},
    year = {1955}
    }

    Journal article

  2. A tale of three eras: The discovery and rediscovery of the Hungarian Method

    Harold W. Kuhn

    European Journal of Operational Research, vol. 219, no. 3, pp. 641-651 · 2012

    BibTeX
    @article{KUHN2012641,
    title = {A tale of three eras: The discovery and rediscovery of the Hungarian Method},
    journal = {European Journal of Operational Research},
    volume = {219},
    number = {3},
    pages = {641-651},
    year = {2012},
    note = {Feature Clusters},
    issn = {0377-2217},
    doi = {https://doi.org/10.1016/j.ejor.2011.11.008},
    url = {https://www.sciencedirect.com/science/article/pii/S0377221711009957},
    author = {Harold W. Kuhn},
    keywords = {Assignment, Combinatorial optimization, Graph theory, Linear programing, Hungarian Method}
    }

    Journal article

  3. Sinkhorn Distances: Lightspeed Computation of Optimal Transport

    Marco Cuturi

    Advances in Neural Information Processing Systems · 2013

    BibTeX
    @inproceedings{cuturi2013sinkhorn,
      title={Sinkhorn Distances: Lightspeed Computation of Optimal Transport},
      author={Cuturi, Marco},
      booktitle={Advances in Neural Information Processing Systems},
      year={2013}
    }

    Conference paper

  4. Linear Programming: Foundations and Extensions

    Robert J. Vanderbei

    Kluwer Academic Publishers · 1998

    BibTeX
    @book{vanderbei1998,
      title={Linear Programming: Foundations and Extensions},
      author={Vanderbei, Robert J.},
      publisher={Kluwer Academic Publishers},
      year={1998},
      address={Boston, MA}
    }

    Book

  5. Proximity Maps for Convex Sets

    Ward Cheney, Allen A. Goldstein

    Proceedings of the American Mathematical Society, vol. 10, no. 3, pp. 448-450 · 1959

    BibTeX
    @article{Cheney1959ProximityMF,
      title={Proximity Maps for Convex Sets},
      author={Cheney, Ward and Goldstein, Allen A.},
      journal={Proceedings of the American Mathematical Society},
      volume={10},
      number={3},
      pages={448--450},
      year={1959},
      publisher={American Mathematical Society}
    }

    Journal article

  6. Learning Generative Models with Sinkhorn Divergences

    Aude Genevay, Gabriel Peyre, Marco Cuturi

    Proceedings of the International Conference on Artificial Intelligence and Statistics (AISTATS) · 2018

    BibTeX
    @inproceedings{genevay2018learning,
      title={Learning Generative Models with Sinkhorn Divergences},
      author={Genevay, Aude and Peyr{\'e}, Gabriel and Cuturi, Marco},
      booktitle={Proceedings of the International Conference on Artificial
                 Intelligence and Statistics (AISTATS)},
      year={2018}
    }

    Conference paper

  7. Interpolating between Optimal Transport and MMD using Sinkhorn Divergences

    Jean Feydy, Thibault Sejourne, Francois-Xavier Vialard, Shun-ichi Amari, Alain Trouve, Gabriel Peyre

    Proceedings of the International Conference on Artificial Intelligence and Statistics (AISTATS) · 2019

    BibTeX
    @inproceedings{feydy2019interpolating,
      title={Interpolating between Optimal Transport and {MMD} using
             Sinkhorn Divergences},
      author={Feydy, Jean and S{\'e}journ{\'e}, Thibault and
              Vialard, Fran{\c{c}}ois-Xavier and Amari, Shun-ichi and
              Trouv{\'e}, Alain and Peyr{\'e}, Gabriel},
      booktitle={Proceedings of the International Conference on Artificial
                 Intelligence and Statistics (AISTATS)},
      year={2019}
    }

    Conference paper

  8. Sample Complexity of Sinkhorn Divergences

    Aude Genevay, Lenaic Chizat, Francis Bach, Marco Cuturi, Gabriel Peyre

    Proceedings of the International Conference on Artificial Intelligence and Statistics (AISTATS) · 2019

    BibTeX
    @inproceedings{genevay2019sample,
      title={Sample Complexity of {S}inkhorn Divergences},
      author={Genevay, Aude and Chizat, L{\'e}na{\"i}c and Bach, Francis and
              Cuturi, Marco and Peyr{\'e}, Gabriel},
      booktitle={Proceedings of the International Conference on Artificial
                 Intelligence and Statistics (AISTATS)},
      year={2019}
    }

    Conference paper