Optimal Transport in Statistics
How far apart are two distributions, when moving mass has a cost?
In 1781 Monge asks the Paris Academy which shovelful of earth should fill which hole so that the total carrying is least. On a line the monotone plan, leftmost earth to leftmost hole, is optimal for any convex cost, and in 1942 Kantorovich lets mass split, which makes the problem a linear program with a dual of shipping prices. The optimal cost is the Wasserstein distance: on a line the distance between two quantile functions, computed for the BMI of men and women in NHANES and split exactly into location, spread and shape. The part then asks how well it can be estimated: the empirical rate n^(-1/d) is the curse of dimensionality, entropic smoothing and Sinkhorn's scaling buy speed and a dimension-free rate at fixed regularization, and transport maps have minimax rates of their own. Averaging quantile functions gives barycenters of blood pressure by age, and optimal maps to a reference grid give center-outward ranks and a test that keeps its power on Cauchy data where Hotelling's has almost none. It ends with Langevin dynamics as the gradient flow of relative entropy, flow matching as transport, and the open problems.
What you need. Stage IV's measure-theoretic probability and empirical process theory; linear programming duality as in Part 21; the Wasserstein balls of Part 60.
- Hook
- Monge's earthworks, 1781
- Mathematics
- Kantorovich duality, Wasserstein geometry, empirical rates, entropic OT and Sinkhorn, map estimation, barycenters, multivariate ranks, Langevin as a gradient flow
- Built
- statkit.ot
What you will be able to do
Bachelor's
- Explain Monge's problem on a line and why the plan that keeps the order is optimal for a convex cost.
- Compute the Wasserstein distance between two samples of equal size by sorting them.
Master's
- Write the Kantorovich linear program and its dual, and check strong duality and complementary slackness on a small example.
- Derive the log-domain Sinkhorn updates as block maximization of the entropic dual.
PhD
- State the n^(-1/d) rate for empirical Wasserstein distances with its assumptions, and say what entropic regularization changes and what it does not.
- Explain in what sense Langevin dynamics is the Wasserstein gradient flow of relative entropy, and prove the exponential rate for a Gaussian target.
Practice
- Compare two empirical distributions by W1 and W2, split W2 squared into location, spread and shape, and report which empirical laws were compared.
- Run Sinkhorn with a convergence check on both marginals, and distinguish the raw plan cost from the regularized objective.
Contents
Each chapter has a home level. Choose a track to see what to read and watch: Bachelor's 6 min · Master's 20 min · PhD 52 min · Practice 20 min.
- 0Monge, 1781Bachelor's4 min
- 1Kantorovich dualityPhD5 min
- 2Wasserstein distancesPhD5 min
- 3Empirical ratesPhD5 min
- 4Entropic transportPractice5 min
- 5Estimating transport mapsPhD4 min
- 6BarycentersPractice4 min
- 7Multivariate ranksPhD5 min
- 8Gradient flowsPhD4 min
- 9Generative modelsPractice5 min
- 10Open problemsPhD4 min
- Recap, problems, and the road aheadAll tracks2 min
Also on this page: Lecture · Key results · Try it · Lab · Problems · Notes and sources · Build the film.
Lecture
The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film. A dashed box stands for a number the film computes when it is rendered (hover over it to see what is computed); the README's figures for each chapter, where it lists them, follow the chapter's text.
Monge, 1781Bachelor's4 min
In 1781 Gaspard Monge presented a memoir to the Paris Academy of Sciences on cuttings and fillings. Earth dug from one place must fill holes in another: which shovelful should go where, so that the total distance carried is as small as possible? It is a question about moving mass at least cost. Uncrossing motivates transport geometry. On a line, monotone pairing is optimal for a convex cost of displacement, but the optimum need not be unique for plain distance. Two centuries later, the same question became one of statistics' most useful ways of comparing probability distributions.
Monge's problem on a line. The blue pile of earth, mu, must fill the gold holes, nu, drawn below the axis. Cut the earth into forty equal shovelfuls. The monotone plan sends the leftmost shovelful to the leftmost hole, and so on in order: the ordering is preserved. With the squared distance as the cost, its root mean cost is . A crossing plan, which sends the leftmost earth to the rightmost hole, costs . With the plain distance as the cost, Monge's own choice, the two cost almost the same, and : when every shovelful moves right, any plan carries the same total distance. The cost function matters.
Monge's problem asks for a map: each shovelful goes to one place. That can be impossible, if a single point of earth must fill two holes. In 1942 Leonid Kantorovich relaxed it: let mass split, and look for a coupling, a joint distribution whose marginals are mu and nu. The cost is then linear in the coupling, and the problem is a linear program, Part twenty-one's subject. Kantorovich shared the 1975 economics Nobel prize with Tjalling Koopmans for the theory of optimal allocation that grew from it.
Why statistics cares. The optimal cost, with the cost a power of a distance, defines the Wasserstein distance between distributions: a metric that sees geometry, so two point masses a little apart are a little apart, where total variation calls them maximally different. Its optimal maps define multivariate ranks and quantiles, which the line had and the plane lacked. And its geometry makes sampling a form of optimization, and generative models a form of transport.
The plan. Chapters one and two: duality, the line's quantile solution, and the Wasserstein distances with their geodesics. Chapters three to five: the statistics of estimating them, the curse of dimensionality, entropic smoothing, and transport maps. Chapters six and seven: barycenters, and multivariate ranks with a distribution-free test. Chapters eight and nine: gradient flows, Langevin sampling and generative models.
Two promises come due. Part twenty-one solved linear programs and their duals; chapter one turns the transport program into a statistic. Part sixty used Wasserstein balls as uncertainty sets without studying the distance; chapters two to five study it, and ask how well it can be estimated from data.
1Kantorovich dualityPhD5 min
Kantorovich duality: the transport problem, its prices, and its solution on a line. For discrete distributions, with weights a on n source points and b on m target points, a coupling is a matrix P with nonnegative entries. Its rows sum to a: every source point sends all its mass. Its columns sum to b: every target receives what it needs. The cost of the plan is the sum of P i j times C i j, the cost of moving one unit from i to j. The set of couplings is a polytope, the transport polytope, and a linear function on it is minimized at a vertex.
A small example: six blue sources and seven gold targets in the plane, each sized by its mass, with squared distance as the cost. The linear program's optimal plan, drawn as green flows whose width is the mass moved. Its cost is . The same plan as a matrix: rows are sources, columns targets. Only of its forty-two entries are nonzero, exactly n plus m minus one: an optimal vertex of the polytope is sparse, and most sources send their mass to one or two places.
Every linear program has a dual. Here it assigns a number f i to each source and g j to each target, subject to f i plus g j being at most the cost C i j for every pair, and maximizes the total, a dot f plus b dot g. Strong duality: the two optima are equal. Here both are , and the largest violation of the constraint is ten to the minus fifteen. Complementary slackness: mass moves from i to j only where the constraint is tight, f i plus g j equal to C i j.
Luis Caffarelli's story, as Cédric Villani retells it, makes the dual a shipping company. You want to move your earth; a shipper offers to do it, charging f i to load at i and g j to unload at j. You accept only if no route would be cheaper to do yourself: f i plus g j at most C i j. The shipper, maximizing revenue under that constraint, earns exactly what the cheapest plan would cost you. In statistics, the potentials are the useful part: in continuous problems, the optimal map is read off the gradient of one of them.
Exact discrete transport has several algorithms, with different complexity guarantees. For uniform equal-size clouds an optimal permutation coupling exists by the transport polytope's structure. Other optimal couplings can be mixtures of permutations. Modern Hungarian implementations have cubic worst-case complexity for a dense square assignment problem; the original 1955 implementation was slower. Auction algorithms use price updates and require suitable precision or termination rules. General weighted transport can use network or linear-programming methods. Their costs are not all described by one universal cubic formula.
On the real line, the problem is solved in closed form. For any convex cost of the difference, the optimal coupling is the quantile coupling: draw one uniform U and set X to F inverse of U and Y to G inverse of U. So the Wasserstein distance is the L p distance between the two quantile functions. For p equal to one, it is also the area between the two distribution functions. For empirical samples of equal size, the plan pairs the order statistics: sort both, and match the i-th smallest with the i-th smallest.
In several dimensions, convex gradients replace scalar monotone rearrangement. For quadratic cost and laws with finite second moments, absolute continuity of the source ensures a unique optimal transport map almost everywhere, given by the gradient of a convex potential. Such gradients are monotone in the displayed inner-product sense and satisfy cyclic monotonicity. Monotonicity alone does not imply injectivity or an arbitrary no-crossing claim. For half squared-distance cost, the convex potential equals half the source norm squared minus a source Kantorovich potential.
2Wasserstein distancesPhD5 min
Wasserstein distances: a geometry on probability distributions. For p at least one, Wasserstein distance is the p-th root of the minimum p-power transport cost. It is a metric on laws with finite p-th moments. A gluing construction proves its triangle inequality. Convergence is equivalent to weak convergence together with convergence of p-th moments in Euclidean space. For such laws it can be finite across disjoint supports and quantify geometric separation. Total variation is also finite there, but does not measure that separation.
For p equal to one, duality takes a special form, from Kantorovich and Gennadii Rubinstein in 1958. W one is the largest difference in expectations over all functions that are one-Lipschitz. That makes it an integral probability metric, like Part sixty's maximum mean discrepancy, but with Lipschitz functions instead of a kernel's unit ball. Chapter nine's Wasserstein GAN trains a neural network to approximate the best such function.
These discrepancies answer different questions. Total variation and Hellinger reach their maximum for mutually singular probability laws, regardless of geometric separation. They remain finite. KL is infinite when the first law is not absolutely continuous with respect to the second; merely having different supports is not sufficient for infinity in both directions. MMD uses a kernel and has root-n empirical-error bounds for bounded fixed kernels, with kernel-dependent sensitivity. Wasserstein uses the ground distance, with sampling rates depending on dimension, moments, order and regularity.
Real data: the body-mass index of men and women in NHANES, as two cumulative distribution functions. Their means differ by less than one unit, against , but the women's distribution is more spread out. The green area between the curves is W one: units of body-mass index. It is the average distance each person's index would have to move, under the quantile matching, to turn one distribution into the other. W two, which weights large moves more heavily, is .
In one dimension, the squared W two splits into three parts. The squared difference in means: here . The squared difference in standard deviations: , the largest part. And a shape term, from how far the standardized quantile functions differ: , since their correlation is . The sum matches the squared distance, , using exact integration of the empirical step quantiles: these two extract distributions differ mostly in spread, not in centre or shape.
For Gaussians, the distance has a closed form. W two squared is the squared distance between the means, plus the Bures distance between the covariance matrices. For positive-definite covariances, the optimal map is affine with a symmetric positive linear part, the unique one that pushes the first covariance onto the second. For commuting covariances it is just the ratio of standard deviations along each axis; in general its principal axes need not match the axes of either covariance. Its symmetric positive linear part has no separate rotation factor.
The part's instrument, the transport flow. A Gaussian cloud of two hundred and seventy-two points, in blue, and Old Faithful's eruptions, standardized, in gold. The optimal assignment matches each blue point to one gold point; the grey segments show every third pair. The mean squared move is , against for a random matching. Now move every point along its segment at constant speed. Each intermediate cloud is a distribution in its own right, a point on the Wasserstein geodesic. The cloud travels and reshapes, splitting into Old Faithful's two clusters, where the straight mixture of the two laws would only fade one out and fade the other in.
Robert McCann's displacement interpolation, in 1997, gives the space of distributions a geometry. Its geodesics are the clouds in transit; the distance along one grows linearly in t. A functional that is convex along these paths, displacement convexity, can be non-convex in the usual sense: negative differential entropy is an example; interaction energies require appropriate convexity conditions. Felix Otto's calculus, in 2001, adds gradients and Hessians, and turns some partial differential equations into gradient flows: chapter eight.
3Empirical ratesPhD5 min
Empirical rates: how fast does a sample approach its law, in Wasserstein distance? Empirical Wasserstein error depends on the order, geometry and tails. Our main rate example concerns W one on bounded regular distributions. On a line, root-n expected W-one error needs a tail-integrability condition; finite first moment alone does not ensure it. For full-dimensional bounded regular laws in dimension at least three, the empirical W-one rate is n to the minus one over d. The critical dimension two has logarithmic effects. Fournier and Guillin give nonasymptotic moment-dependent bounds. Smooth density alone does not remove the empirical measure's quantization barrier, but these are not unconditional two-sided rates for every absolutely continuous law.
Two independent samples from the uniform distribution on the cube, matched exactly by the assignment algorithm, for n from twenty-five to sixteen hundred. On a line, the distance falls with slope on the log-log scale: one over root n. In the plane, , the root n rate with a logarithm. In three dimensions the slope is , in five , in ten : close to minus one over d. In ten dimensions, halving the error takes about a thousand times more data.
Why one over d? n points in a d-dimensional cube sit at typical distance n to the minus one over d from their nearest neighbours. Matching two independent samples moves each point at least to a near neighbour of the other sample, so the cost is at least of that order. The upper bound partitions the cube dyadically and matches mass level by level: a chaining argument, like Part forty-eight's.
Intrinsic geometry can improve empirical rates under precise covering and mass conditions, as studied by Weed and Bach. Exact low-dimensional support and noisy concentration near a manifold are different: fixed full-dimensional noise can change the eventual rate, even if smaller samples show a lower-dimensional regime. Smoothness can help suitably smoothed estimators, while the raw empirical measure still has discrete-support error. Lower-complexity adaptation for estimating a transport cost between distinct laws holds under specified cost and support assumptions. It is not a universal rule that the smaller raw dimension always governs every Wasserstein problem.
Sliced transport compares one-dimensional projections. For each direction, compute the projected Wasserstein distance by sorting, and integrate its p-th power over directions before taking the p-th root. Sorting costs n log n per direction. Dimension-independent rate exponents require tail and order assumptions; a root-n statement for a squared or powered discrepancy is not automatically a root-n rate for every sliced distance itself. Finite directions add integration error. Slicing can dilute differences concentrated in a few directions.
One-dimensional asymptotic distributions also need tail and smoothness conditions. Away from equality, squared-W-two estimates can have a nondegenerate normal limit under suitable quantile regularity. With independent samples of sizes n and m, the natural scale uses n m over n plus m, and the variance combines both samples. At equality, this effective size times squared W two can converge to a weighted squared-Brownian-bridge integral when the integral is finite. For one empirical sample against a known law, the scale is n instead. Bootstrap validity depends on the functional, centering and null regime; an off-null theorem should not be reused at equality without checking it.
These rates inform method choice. High-dimensional Wasserstein testing can have poor power for some alternatives, but a simple large mean shift can still be easy to detect. An empirical-centered DRO ball needs a radius calibrated for its order, tail assumptions, confidence and effective dimension. For the displayed regular high-dimensional regime, this includes an n-to-minus-one-over-d scale. Smoothing, slicing and projection are useful alternatives. Each changes the estimand or the detectable geometry and requires its own rate statement.
4Entropic transportPractice5 min
Entropic transport and Sinkhorn's algorithm: blur the plan, and everything gets easier. Entropic regularization smooths the finite transport optimization problem. Dense assignment has a cubic reference complexity, though exact transport has several algorithms. Our solver minimizes transport cost plus epsilon times KL of the plan relative to the product marginals. For fixed marginals this differs from cost minus epsilon entropy only by a constant, so the minimizer is the same. With positive marginals and finite costs the entropic minimizer is unique and is a row-and-column scaling of the Gibbs kernel. As epsilon vanishes it selects an optimal unregularized plan; as epsilon grows the plan tends to the independent coupling. We distinguish its raw transport cost from its regularized objective.
Chapter one's small problem again. The linear program's plan is sparse, twelve nonzero entries, cost . With epsilon equal to a tenth, the entropic plan has the same shape, slightly blurred, at cost . At one half, the blur spreads, cost ; at two, mass goes almost everywhere, cost . The entropy trades exactness for smoothness.
Finding the two scaling vectors is Richard Sinkhorn's matrix-scaling problem, from 1964. Alternate: rescale the rows to match a, then the columns to match b. Each step is a matrix-vector product, so an iteration costs n squared operations, and runs well on graphics processors. For small epsilon the numbers under- and overflow, so practice works with the logarithms, the dual potentials f and g, and log-sum-exp.
How fast does it converge? Sixty points to sixty points, stopping when the marginals are right to ten to the minus nine. With epsilon equal to one, the error falls geometrically: iterations. With a tenth, . With three hundredths, : the contraction rate degrades as epsilon shrinks, in a way that depends on costs, marginals and the stopping tolerance. Sharpness is paid for in iterations.
The graph shows the raw transport cost of the entropic plan, rather than the entropy-regularized objective. Its excess over the exact discrete optimum decreases as regularization shrinks, with numerical marginal residuals checked. Continuous small-epsilon expansions of the regularized value can have an epsilon-log-one-over-epsilon leading term. That coefficient is not a formula for this finite discrete raw-cost graph. Discrete gaps and continuous smoothness lead to different bias regimes.
This graph compares two independent empirical samples from the same five-dimensional Gaussian. The population discrepancy is zero. The finite-sample squared-W-two values show a dimension-dependent matching regime. The fixed-epsilon Sinkhorn divergence decreases more quickly over these five sizes and six replicates. Draws and Monte Carlo standard errors are saved; a fitted slope is not a proved asymptotic exponent. Root-n statistical bounds and central limit results exist for fixed regularization under suitable support or tail assumptions. Their constants depend on dimension, tails and epsilon; a zero-discrepancy null can be degenerate and have a different fluctuation scale.
The regularized objective need not vanish for a law against itself. Subtracting the two self-objectives gives the Sinkhorn divergence. Its positivity and separation properties require an appropriate cost and kernel, such as the finite-epsilon squared-Euclidean setup here. In our squared-distance convention, the zero-epsilon limit is squared W two. As epsilon grows without bound, the discrepancy tends to squared distance between means, which need not distinguish different laws. With ordinary distance cost the corresponding independent-coupling limit is an energy-distance expression. Thus cost and regularization convention both matter; finite epsilon controls the amount of smoothing.
Unbalanced transport relaxes mass conservation. Balanced couplings need equal total mass and can pay heavily for distant outliers. Generalized KL penalties for marginal mismatch allow mass creation or destruction, at a price. Adding an entropic plan penalty yields the regularized problem shown. Generalized Sinkhorn updates then raise the marginal rescaling to a power involving both the KL penalty and epsilon. The entropy term is needed for this update; it is not an algorithm for the unregularized expression with epsilon absent.
5Estimating transport mapsPhD4 min
Estimating transport maps: not just how far, but where each point should go. Often the map matters more than the distance. A cell biologist with snapshots of a tissue at two times models plausible couplings between snapshots, without identifying individual cell lineages from marginals alone; a survey statistician wants to adjust one population's covariates to look like another's. From n points of mu and n of nu, estimate the Brenier map T, the gradient of a convex function pushing mu onto nu. The loss is the mean squared error of the map under mu. Geoffrey Schiebinger and co-authors' Waddington-OT, in 2019, used growth-aware unbalanced transport to model developmental couplings; this is not direct observation of each cell trajectory.
Hutter and Rigollet derive minimax rates for a specified smooth transport-map class. Under bounded support and density, smoothness and Hessian conditions, squared-map risk has the displayed nonparametric term, together with a parametric one-over-n floor, up to logarithmic factors. Alpha describes map smoothness. The denominator differs from ordinary nonparametric regression because observations are unpaired marginals and the convex potential links them. This is not simply the usual regression formula with one extra derivative. Sufficient smoothness brings the rate near the parametric floor, under the theorem's remaining assumptions.
Rates need the true map to be smooth, so when is it? The potential solves a Monge–Ampère equation: the determinant of its Hessian equals the ratio of the two densities, composed with the map. Luis Caffarelli proved in the 1990s that if both densities are bounded above and below on convex sets, the map is Hölder continuous, and smoother if the densities are. Without convexity of the target's support, the map can be discontinuous: transporting a disc onto two separate discs must tear it somewhere.
We compare two finite-sample map estimators. The first matches two samples and extends each match by nearest source neighbor. It is one particular step-function extension. The entropic estimator uses the barycentric projection of the entropic plan and its target potential to define a smooth out-of-sample function. Statistical rates require specific smoothness and support conditions and a compatible epsilon schedule. They are not a blanket near-minimax guarantee for every smooth map. Our Gaussian simulation uses a heuristic half n-to-minus-one-third schedule and explicitly checks Sinkhorn convergence.
Between the continuous and the discrete lies the semi-discrete problem: a law with a density, transported onto n points. The dual has one number per target point, g j, and the map sends x to the target point that minimizes the cost minus g j. So space is cut into n convex cells, Laguerre cells, one per target, each holding exactly that target's mass. Finding the g j is a smooth concave maximization, solved by Newton's method: Quentin Mérigot's and Bruno Lévy's algorithms compute such maps in three dimensions with millions of cells.
A test where the truth is known: the standard Gaussian in the plane pushed to a correlated Gaussian, whose Brenier map is linear. The empirical map's squared error falls with slope . The entropic map, with epsilon shrinking like n to the minus a third, falls with slope , and has lower mean error at these tested sizes: against at eight hundred points. Smoothing pays, because the true map is smooth.
Where estimated maps are used. Single-cell biology: trajectories from snapshots, since a cell can be measured only once. Domain adaptation, as in Part sixty: map the source covariates onto the target's, and train there. Counterfactual and causal questions, by transporting a treated population onto a control one. And chapter seven: the map to a reference law is a multivariate rank.
6BarycentersPractice4 min
Barycenters: averaging distributions by moving them, not by mixing them. How should one average several distributions? The obvious answer, the mixture, averages the densities: it is the barycenter in the L two sense, and it is multimodal when the laws are shifted. Maurice Fréchet's definition of a mean in any metric space suggests another: the law minimizing the weighted sum of squared Wasserstein distances. Martial Agueh and Guillaume Carlier studied it in 2011. On the line it is explicit: average the quantile functions.
NHANES systolic pressure in three age groups, eighteen to thirty-nine, forty to fifty-nine, and sixty to eighty, with means , and . Their mixture, weighted by group size, in red: wide, with standard deviation , because it stacks three laws at three places. Their Wasserstein barycenter, in green, averages the quantiles instead: one law, at the average place, with the groups' typical spread, standard deviation . It is a mathematical summary of these empirical group distributions, not a model of a representative individual or a national population.
A one-dimensional barycenter averages quantiles. Consequently its mean is exactly the weighted average of the empirical group means; we now compute its moments by exact integration of the step quantiles. Its variance is the weighted sum of all pairwise covariances of the centered quantile functions. Its standard deviation equals the weighted average of group standard deviations only for a common standardized shape; in general it is at most that average. The mixture instead adds average within-group variance to variance of group means. The barycenter variance is not literally the mixture's within-group variance.
A barycenter of positive-definite Gaussian laws is Gaussian. Its covariance satisfies the displayed nonlinear matrix fixed-point equation. General noncommuting covariances do not give a simple closed-form solution. The Alvarez-Esteban iteration is one computational method; convergence and definiteness need checking. For the commuting diagonal example, standard deviations average along common axes, giving two point two five times the identity.
For general laws in several dimensions, barycenters are computed with chapter four's tools. Marco Cuturi and Arnaud Doucet's entropic barycenters, in 2014, iterate Sinkhorn scalings for all the laws at once, on a common grid. On free support, the barycenter can be represented by points that move, each step a weighted average of its transport partners. The entropy blurs the answer, so a debiased version, built like the Sinkhorn divergence, keeps it sharp.
The statistics of barycenters. If the k laws are themselves a random sample from a population of laws, the barycenter of the sample estimates a population Fréchet mean. Thibaut Le Gouic and Jean-Michel Loubes proved consistency in 2017. Rates depend on the curvature of Wasserstein space, which is nonnegative, unlike the spaces where Fréchet means behave best. On the line the space is flat, and the barycenter is just an average of quantile functions: a root-k rate when the random quantile function has a finite second moment in the relevant Hilbert space; the law of large numbers alone does not supply a root-k rate.
Where barycenters are used. Averaging growth curves, or brain images, after aligning them: Part twenty-nine's registration problem, solved by transport. Combining posteriors computed on separate shards of data, by averaging them in Wasserstein space. Fair prediction: mapping each group's score distribution onto the barycenter removes the group difference with the least change to the scores, Part sixty-three's subject. And Victor Panaretos and Yoav Zemel's book treats distributions themselves as data points, with barycenters as their means.
7Multivariate ranksPhD5 min
Multivariate ranks and quantiles: transport to a reference law. On a line, the rank of a point is its position in the order, and ranks make Part sixteen's tests distribution-free: under the null, every arrangement of ranks is equally likely, whatever the law. In the plane there is no order. Coordinatewise ranks depend on the axes; depth gives contours but they are always convex. The key fact on the line: the rank is F of x, and F is the monotone map pushing the law onto the uniform. So define the multivariate rank as the optimal transport map onto a fixed reference law.
Victor Chernozhukov, Alfred Galichon, Marc Hallin and Marc Henry, in 2017, and Hallin, Eustasio del Barrio, Juan Cuesta-Albertos and Carlos Matrán, in 2021, chose as reference the spherical uniform: uniform direction, uniform radius in the unit ball. The center-outward distribution function is the Brenier map from the law to that reference. Empirically, place n points on a regular grid of rings and rays in the unit disc, and solve the assignment from the data to the grid. A point's rank is the radius of its grid point; its sign is the direction. The quantile contour at level tau is the set of data mapped to the ring of radius tau.
Define population quantile regions as inverse images, or quantile-map images, of reference balls under the appropriate regularity assumptions. Their nesting follows from nested reference balls. The spherical reference has a uniform radius, so probability content is tau when the transport has the needed inverse and no boundary mass. This is not a statement about any smoothed polygon drawn through finite data. Empirical center-outward maps have consistency results under specified population regularity and on the domains in the theorem. A global supremum over arbitrary out-of-sample extensions is not automatic. Population regions can be nonconvex. Our joined, smoothed ring points illustrate this geometry rather than supplying exact finite-sample confidence contours.
Old Faithful again, standardized, with a grid of six rings and forty-five rays. The assignment maps each eruption to a grid point. Joining the eruptions mapped to each ring gives the center-outward quantile contours; three of them are drawn, smoothed along each ring, from the innermost in green to the outermost in gold. In red, the Mahalanobis ellipses with the same probability under a normal model. The contours bend to follow the two clusters and the gap between them; the ellipses, which see only a mean and a covariance, put their centre in the gap, where few eruptions are.
Transport ranks use a fixed reference grid and a sample-equivariant assignment rule. For IID observations with an almost surely unique assignment, exchangeability makes the assignment a uniform permutation of the fixed reference points. Randomized tie handling can preserve the symmetry when ties occur. Rank statistics then have a distribution-free null under these conditions; reference choice and sample sizes still determine that null. This extends the logic of scalar rank tests, with additional care about grid construction and ties.
Deb and Sen's rank energy test compares pooled transport ranks. Our reference is a fixed distinct Halton set, and we randomize pooled row order before assignment to avoid label-dependent resolution of ties. Compute energy distance between the two groups' assigned reference points. Pairwise reference distances are cached once. Under independent IID samples from the same law, exchangeability and the randomized assignment give a valid permutation test without moment assumptions. We use one hundred and ninety-nine permutations with a plus-one p-value and reject at p at most five percent; discreteness and ties can make the test conservative.
Size is half the story. Shift the second Cauchy sample by one unit in each coordinate. Hotelling's test detects it percent of the time; the sample means of Cauchy data are as variable as single observations. The rank energy test detects it percent of the time. Deb, Bhaswar Bhattacharya and Sen showed that suitably scored rank tests lose little efficiency against Hotelling's even for Gaussian data: the trade made by Wilcoxon, in many dimensions.
8Gradient flowsPhD4 min
Gradient flows: sampling as optimization over distributions. Part twenty-seven's Langevin dynamics moves a particle along the gradient of the log density, plus noise. Richard Jordan, David Kinderlehrer and Felix Otto showed in 1998 what the law of the particle is doing: steepest descent of the Kullback–Leibler divergence to the target, in the Wasserstein geometry. Their scheme makes it a sequence of optimization problems: each step minimizes the divergence plus a Wasserstein penalty for moving far, the proximal step of Part twenty-one in a space of measures. The Fokker–Planck equation is the limit as the step size goes to zero.
A Gaussian target with correlation eight tenths, its two-standard-deviation ellipse in gold. Six hundred particles start far away, in a tight cloud, and each runs Langevin dynamics independently. Watch the cloud: it slides toward the target and spreads to fill it. No particle knows about the others; the deterministic gradient flow lives in the law of the cloud.
For a Gaussian target and a Gaussian start, the flow stays Gaussian, with mean and covariance solving linear equations, so its Kullback–Leibler divergence is known exactly: the teal curve, from at the start. The particles' fitted Gaussian, in white, tracks it with discrepancies from both finite-particle noise and Euler bias. The exact discrete Gaussian law is also recorded; a finite atomic empirical measure itself has infinite KL to a continuous target. The grey line is the general guarantee: for a target with log-Sobolev constant C, the divergence falls at least like e to the minus two t over C. Here C is the largest variance, . The actual decay is faster at first, because the start is offset along the target's narrow direction, which contracts quickly.
The geometry gives the rates. If the target is strongly log-concave, the divergence is displacement convex, and the flow contracts in Wasserstein distance exponentially: the Bakry–Émery criterion. More generally, a log-Sobolev inequality is the Polyak–Łojasiewicz inequality of this space, and gives exponential decay of KL without convexity. Andre Wibisono, in 2018, made the dictionary explicit: Langevin is gradient descent, and its discretizations are familiar optimization schemes.
The same calculus covers more than one equation. The heat equation is the Wasserstein gradient flow of the entropy alone. Felix Otto showed in 2001 that the porous medium equation is the flow of a power of the density, and its rate of spreading follows from the geometry. Particles that attract or repel each other, McKean–Vlasov dynamics, follow the flow of an interaction energy: the same mathematics as the mean-field limits of neural networks below.
Euler discretization changes the continuous Langevin law. For a Gaussian target we can compute that discrete law exactly and separate its stationary bias from finite-particle noise. Under suitable strong convexity and smoothness, general Wasserstein discretization bounds have order root h with dimension-dependent constants; Gaussian bias can have a sharper order. Step-complexity bounds such as dimension over accuracy squared suppress condition numbers, initialization and logarithmic terms, and need stable step sizes and smoothness. A Metropolis correction restores the target invariant law under the usual conditions, rather than exact independent draws after finitely many steps. Hamiltonian methods offer different dynamics; calling all of them accelerated Wasserstein gradient descent would be too literal.
Related variational particle methods use different geometries. Stein variational gradient descent uses a kernel-restricted transport direction, including attraction and repulsion; it is not simply the ordinary Wasserstein flow with the Brownian term removed. Product-law variational inference restricts the family of distributions and introduces approximation error. Mean-field limits of suitable wide two-layer networks describe training as a Wasserstein gradient flow over neuron-parameter laws under the model's scaling and assumptions.
9Generative modelsPractice5 min
Generative models and transport: learning a map from noise to data. A generative model is a map that pushes a simple law, Gaussian noise, onto the data distribution: the transport problem, with the target known only through samples. Martin Arjovsky, Soumith Chintala and Léon Bottou's Wasserstein GAN, in 2017, trains the map to minimize W one to the data, using chapter two's Kantorovich–Rubinstein duality: a second network plays the one-Lipschitz witness. Unlike the original GAN's Jensen–Shannon divergence, W one gives useful gradients even when the model and the data do not overlap. But the critic is only roughly Lipschitz, and what is minimized is not quite W one, as Stanczuk and co-authors later argued.
Practical WGAN critics approximate a constrained optimization problem. Weight clipping is a crude constraint on network parameters. For a differentiable optimal one-Lipschitz critic, saturated transport segments motivate a unit-gradient condition. Penalizing gradients on random interpolations between arbitrary real and generated points is a heuristic: these are generally not optimal transport partners, and the penalty does not enforce a global Lipschitz bound. Spectral normalization controls layer operator norms; a network bound must also account for activations, architecture and numerical norm estimation.
Modern image and audio generators use flows instead. Pair each noise point x zero with a data point x one, and join them by a straight line: x t equals one minus t times x zero plus t times x one. Along each line the velocity is x one minus x zero. Train a network v of x and t to predict it, by least squares: flow matching, from Yaron Lipman and co-authors, and rectified flow, from Xingchao Liu and co-authors, both in 2023. To sample, draw noise and integrate the learned velocity from time zero to one. The regression's answer, the conditional mean of the velocity, transports the interpolation marginals when the conditional-mean field and continuity equation have the required integrability, existence and uniqueness properties. A fitted field and finitely many Euler steps introduce further errors.
Pairing affects the regression problem used to learn a flow. Independent endpoint pairs can yield a curved conditional-mean velocity flow, so a one-step Euler approximation can be poor. Neither curvature nor integration difficulty is universal. Minibatch transport pairing often shortens paths and reduces conflicts. Its coupling is not the population optimal map. The ideal population quadratic-optimal coupling gives straight displacement interpolation under regularity. Finite batches, kernel smoothing, network error and numerical integration need not preserve this exactly. The next picture measures one toy implementation.
A toy version, on Old Faithful, with the velocity learned by kernel regression instead of a network. Fresh Gaussian noise, pushed by a single Euler step of each learned flow. With independent pairs, one step sends every point toward the average of the data: the samples collapse into a smear between the two clusters, at W two distance from the data, worse than the noise itself at . With optimal-transport pairs, the same single step lands the samples on both clusters, at distance .
The same comparison over the number of steps, averaged over five fresh-noise draws conditional on one fitted velocity field. The distance is to the training empirical law, not a held-out population distribution; the saved Monte Carlo errors only describe these noise draws. The grey line is the noise. The independent flow improves from at one step to at twenty: it needs the steps, because it curves. The transport flow is at from the first step and stays there. Measured directly, the ratio of each particle's displacement to its path length is for the independent flow and for the transport flow: nearly straight in this toy fitted field. This is not a population-optimal-transport theorem for arbitrary learned flows.
What statistics can say about these models is just beginning. Diffusion models, a stochastic cousin of flow matching, estimate the score of the noised data; Kazusato Oko, Shunta Akiyama and Taiji Suzuki, and Sitan Chen, Sinho Chewi and co-authors, showed in 2023 that the score can be estimated at minimax rates for smooth densities, and that with a well-estimated score the samples are close to the data law. The transport view explains why straight, non-crossing paths are cheaper to integrate. The deep-learning side of this story, with the networks themselves, is *AI, Built* Part twenty-one; Part sixty-four returns to what such models mean for statistics.
10Open problemsPhD4 min
Open problems in optimal transport for statistics. The part in one table. The Wasserstein distance by its plug-in, cursed at n to the minus one over d. The entropic cost by Sinkhorn, at the parametric rate with a constant that explodes as epsilon shrinks. The Brenier map, at the rate of nonparametric regression. Barycenters, explicit on the line and for Gaussians. Ranks and quantiles, with exactly distribution-free tests. Sampling, as a gradient flow of the divergence. And generation, by flows made straight by transport.
Problem one: what to estimate instead. The curse can be escaped by smoothing, entropic or kernel; by slicing, averaging one-dimensional distances over random directions; or by projecting onto the few directions where the laws differ most. Jonathan Niles-Weed and Philippe Rigollet's spiked transport model, in 2022, showed that a low-dimensional difference can be estimated fast in principle, and gave evidence that no efficient algorithm achieves it. Which surrogate keeps the geometry that matters, with rates and algorithms that match, is open.
Inference depends on the transport functional and model. One-dimensional and fixed-regularization central limit theorems give intervals under their regularity assumptions. Finite-support transport also has limit theory, sometimes nondifferentiable and nonnormal. For some smooth multidimensional unregularized quadratic-cost problems, a central limit theorem centered at the estimator's expectation does not remove its bias relative to the population cost. Dimension and regularity determine whether bias dominates. This is not a universal dimension-five threshold for every cost and law. Broadly applicable, adaptive confidence sets for distances and maps remain active research questions, alongside existing results for specified classes.
Problem three: ranks at scale, and beyond testing. The exact assignment costs n cubed; entropic ranks are faster but lose exact distribution-freeness. Vector quantile regression, from Guillaume Carlier, Victor Chernozhukov and Alfred Galichon, extends conditional quantiles to vector outcomes, with open questions about estimation rates and inference. A full multivariate rank-based toolkit, with efficient tests, regression and confidence regions that scale to large n, is open.
Problem four: the complexity of sampling. For strongly log-concave targets, upper bounds on the number of gradient queries are sharp in some regimes; Sinho Chewi and co-authors proved the first matching lower bounds in low dimension. For general targets, with several modes, sampling can be exponentially hard, and the useful middle ground is not mapped. The query complexity of sampling, as complete as that of convex optimization, is open: see Chewi's book on log-concave sampling.
Problem five: the statistics of generative models. A flow fitted perfectly to the training sample reproduces the training points: the empirical law is the minimizer. Nicholas Carlini and co-authors extracted near copies of training images from a diffusion model in 2023. Yet trained models also generalize, producing new, plausible samples. When a learned flow generalizes rather than memorizes, and how to measure the distance between its samples and the true law in high dimension, are open, and are Part sixty-four's questions.
Five open problems. The right surrogate for the Wasserstein distance. Confidence statements for distances and maps in several dimensions. Multivariate ranks at scale. The query complexity of sampling. And when generative models generalize.
Recap, problems, and the road aheadAll tracks2 min
Part sixty-one in twelve lines. Monge asked how to move earth at least cost, and Kantorovich made it a linear program. Its dual is a system of prices. On the line, the solution sorts and pairs. The Wasserstein distance is a geometry on distributions; in NHANES, men's and women's body-mass index differ by one and a quarter units, mostly in spread. Geodesics are clouds in transit. The plug-in is cursed, at n to the minus one over d. Fixed-epsilon entropic estimation has parametric bounds under stated conditions. Entropic maps improve the illustrated Gaussian fit. Barycenters average positions, not heights. Transport ranks give exactly distribution-free tests. And sampling and generation are flows in the space of distributions.
A promise for the next part. Transport moves one population's distribution onto another's. It assumed nothing about why they differ. Part sixty-two asks when a causal effect learned in one population can be carried to another, and what can be identified when the textbook assumptions fail.
Where it comes back. Part sixty-two's transport of causal effects across populations. Part sixty-three's fair scores, by mapping groups onto their barycenter. Part sixty-four's generative models and the question of whether they generalize. And the dissertation's comparisons of distributions.
Six problems, with full solutions in the README. W one as the area between distribution functions; the sparsity of the transport polytope's vertices; W two between normal laws; Sinkhorn's updates as dual coordinate ascent; the barycenter of a location-scale family; and the decay of the divergence along the Langevin flow. Pause here if you want to try them.
The books behind this part: Villani's Optimal Transport, Old and New; Peyré and Cuturi on computation; Panaretos and Zemel on statistics in Wasserstein space; and Chewi, Niles-Weed and Rigollet's Statistical Optimal Transport; with the papers from Monge to Deb and Sen.
Sixty-one parts of sixty-five. Monge's earthworks led to transport geometry; two centuries later transport pairing became a useful tool for learning generative flows. Next, Part sixty-two: frontiers of causal inference.
Where it goes next. Transport returns as carrying a causal effect to a new population in Part 62, as barycenter score adjustment in Part 63, as the generalization of generative models in Part 64, and as a way of comparing distributions in the dissertation of Part 65.
Key results
The part's results in one place, for revision.
Try it
Lab 61 · Transport on a line: quantiles, areas, a linear program and Sinkhorn
Draw two samples on a line and compute W1 by the quantile formula, as the area between the two CDFs and as a Kantorovich linear program with its dual; then check W2 against the normal closed form and watch the entropic plan's cost fall to the exact one as the regularization shrinks.
python -m videos.stats.labs 61
needs numpy, scipy, matplotlib · download lab61.py ·
source on GitHubW1 by the quantile formula 1.622717
W1 as the area between the CDFs 1.622717
W1 by pairing the sorted samples 1.622717
Kantorovich LP: primal, dual 1.622717, 1.622717 (largest f_i + g_j - C_ij: 4.0e-15)
positive entries of the optimal plan 60 (at most n + m - 1 = 119)
W2, two samples of 20,000 1.7028 (closed form sqrt(1.5^2 + 0.8^2) = 1.7000)
Sinkhorn plan cost at eps = 2, 0.5, 0.12 1.9206, 1.6902, 1.6294 (exact 1.6227)
Sinkhorn iterations at eps = 2, 0.5, 0.12 7, 22, 54
On a line every route to W1 gives the same number, and the dual prices certify it; smoothing the plan with entropy costs extra transport that vanishes with eps, at the price of more iterations.
The code (82 lines; it asserts its own result)
"""Lab 61: compute one Wasserstein distance four ways, and watch Sinkhorn's cost approach it."""
import numpy as np
from videos.coursekit import labs
from explainer.stats.kit import ot
TITLE = "Transport on a line: quantiles, areas, a linear program and Sinkhorn"
GOAL = ("Draw two samples on a line and compute W1 by the quantile formula, as the area between the two CDFs and "
"as a Kantorovich linear program with its dual; then check W2 against the normal closed form and watch "
"the entropic plan's cost fall to the exact one as the regularization shrinks.")
TASKS = [
"Change the cost to the squared distance (p = 2) in the linear program. Which potentials change, and does the "
"sorted pairing stay optimal?",
"Give the two samples different sizes (60 and 45) and unequal weights. How many entries of the optimal plan "
"are positive, against the bound n + m - 1?",
"Move to the plane: use ot.empirical_rate with d = 1, 2, 4 and fit the slope of log W1 against log n.",
]
def run(seed=0):
rng = np.random.default_rng(seed)
n, m1, s1, m2, s2 = 60, 0.0, 1.0, 1.5, 1.8
x, y = m1 + s1 * rng.standard_normal(n), m2 + s2 * rng.standard_normal(n)
a = np.full(n, 1 / n)
lab = labs.Lab()
# W1 four ways: quantiles, CDF area, sorted pairing, the linear program and its dual
w_quant, w_area = ot.wasserstein_1d(x, y, 1), ot.w1_cdf_area(x, y)
w_sort = float(np.mean(np.abs(np.sort(x) - np.sort(y))))
C = ot.cost_matrix(x[:, None], y[:, None], 1)
lp = ot.kantorovich_lp(a, a, C)
dual = float(a @ lp["f"] + a @ lp["g"])
slack = float(np.max(lp["f"][:, None] + lp["g"][None, :] - C))
lab.row("W1 by the quantile formula", f"{w_quant:.6f}")
lab.row("W1 as the area between the CDFs", f"{w_area:.6f}")
lab.row("W1 by pairing the sorted samples", f"{w_sort:.6f}")
lab.row("Kantorovich LP: primal, dual", f"{lp['cost']:.6f}, {dual:.6f} (largest f_i + g_j - C_ij: {slack:.1e})")
assert abs(w_quant - w_area) < 1e-9 and abs(w_quant - w_sort) < 1e-9, "three formulas for W1 on a line agree"
assert abs(lp["cost"] - w_quant) < 1e-7, "the linear program finds the monotone plan's cost"
assert abs(dual - lp["cost"]) < 1e-7 and slack < 1e-7, "strong duality with a feasible dual"
positive = int(np.sum(lp["P"] > 1e-12))
lab.row("positive entries of the optimal plan", f"{positive} (at most n + m - 1 = {2 * n - 1})")
assert positive <= 2 * n - 1
# W2 between large samples against the normal closed form
big = 20000
xb, yb = m1 + s1 * rng.standard_normal(big), m2 + s2 * rng.standard_normal(big)
w2_emp, w2_true = ot.wasserstein_1d(xb, yb, 2), ot.gaussian_w2(m1, s1 ** 2, m2, s2 ** 2)
lab.row("W2, two samples of 20,000", f"{w2_emp:.4f} (closed form sqrt(1.5^2 + 0.8^2) = {w2_true:.4f})")
assert abs(w2_true - np.hypot(m2 - m1, s2 - s1)) < 1e-12 and abs(w2_emp - w2_true) < 0.06
# Sinkhorn: the entropic plan's transport cost decreases to the LP's as eps shrinks
eps = np.array([2.0, 1.0, 0.5, 0.25, 0.12])
sk = [ot.sinkhorn(a, a, C, e, iters=40000, tol=1e-7) for e in eps]
costs = np.array([s["cost"] for s in sk])
lab.row("Sinkhorn plan cost at eps = 2, 0.5, 0.12", f"{costs[0]:.4f}, {costs[2]:.4f}, {costs[-1]:.4f} (exact {lp['cost']:.4f})")
lab.row("Sinkhorn iterations at eps = 2, 0.5, 0.12", f"{sk[0]['iters']}, {sk[2]['iters']}, {sk[-1]['iters']}")
assert all(s["errs"][-1] < 1e-7 for s in sk), "Sinkhorn converged at every eps"
assert np.all(costs >= lp["cost"] - 1e-9) and np.all(np.diff(costs) < 0), "cost falls monotonically to the LP's"
assert costs[-1] - lp["cost"] < 0.05 * lp["cost"] and sk[-1]["iters"] > sk[0]["iters"]
lab.note = ("On a line every route to W1 gives the same number, and the dual prices certify it; smoothing the "
"plan with entropy costs extra transport that vanishes with eps, at the price of more iterations.")
fig, ax = labs.figure(2, size=(11, 4.2))
z = np.sort(np.r_[x, y])
F = np.searchsorted(np.sort(x), z, side="right") / n
G = np.searchsorted(np.sort(y), z, side="right") / n
ax[0].step(z, F, where="post", color=labs.BLUE, label="CDF of the first sample")
ax[0].step(z, G, where="post", color=labs.GOLD, label="CDF of the second sample")
ax[0].fill_between(z, F, G, step="post", color=labs.GREEN, alpha=0.3, label=f"area between them = W1 = {w_quant:.3f}")
ax[0].set(title="W1 is the area between two CDFs", xlabel="x", ylabel="cumulative probability")
ax[0].legend(loc="lower right")
ax[1].plot(eps, costs, "o-", color=labs.BLUE, label="transport cost of the Sinkhorn plan")
ax[1].axhline(lp["cost"], color=labs.GOLD, ls="--", label="exact cost (linear program)")
ax[1].set(xscale="log", title="Entropic smoothing: the cost of the plan against eps",
xlabel="regularization eps (log scale)", ylabel="sum of P_ij C_ij")
ax[1].set_xticks(eps, [f"{e:g}" for e in eps])
ax[1].minorticks_off()
ax[1].legend()
lab.fig = fig
return lab
Now change it
- Change the cost to the squared distance (p = 2) in the linear program. Which potentials change, and does the sorted pairing stay optimal?
- Give the two samples different sizes (60 and 45) and unequal weights. How many entries of the optimal plan are positive, against the bound n + m - 1?
- Move to the plane: use ot.empirical_rate with d = 1, 2, 4 and fit the slope of log W1 against log n.
Problems, with solutions
Try each problem before opening its solution.
-
W₁ as an area. Show that in one dimension \(W_1(\mu, \nu) = \int |F(x) - G(x)|\,dx\).
Solution
- W₁ = ∫₀¹ |F⁻¹(u) − G⁻¹(u)| du is the area between the two quantile curves.
- Swapping the roles of the axes, it is the area between the graphs of F and G, which is ∫ |F(x) − G(x)| dx.
- Equivalently, by Kantorovich–Rubinstein, sup over 1-Lipschitz f of ∫ f d(μ − ν) = ∫ f′(x)(G(x) − F(x)) dx is maximized by f′ = sign(G − F).
-
Sparse vertices. Show that a vertex of the transport polytope \(\Pi(a, b)\) has at most \(n + m - 1\) nonzero entries.
Solution
- The transport polytope has n + m equality constraints, of which n + m − 1 are independent (both sets of marginals sum to one).
- A vertex of a polytope {P ≥ 0 : AP = r} has at most rank(A) = n + m − 1 positive coordinates.
-
Normal laws. Show that \(W_2^2\big(N(m_1, \sigma_1^2), N(m_2, \sigma_2^2)\big) = (m_1 - m_2)^2 + (\sigma_1 - \sigma_2)^2\).
Solution
- The monotone coupling of N(m₁, σ₁²) and N(m₂, σ₂²) is Y = m₂ + (σ₂/σ₁)(X − m₁).
- So E(X − Y)² = (m₁ − m₂)² + E(Z(σ₁ − σ₂))² = (m₁ − m₂)² + (σ₁ − σ₂)².
-
Sinkhorn as dual ascent. Derive Sinkhorn's updates as exact maximization of the entropic dual in \(f\), then in \(g\).
Solution
- The dual of the entropic problem is max over f, g of a′f + b′g − ε Σᵢⱼ aᵢbⱼ e^{(fᵢ + gⱼ − Cᵢⱼ)/ε} + ε.
- Setting its derivative in fᵢ to zero gives fᵢ = −ε log Σⱼ bⱼ e^{(gⱼ − Cᵢⱼ)/ε}, and the same in gⱼ: these are the log-domain Sinkhorn updates.
- Each is an exact block maximization of a concave function, so the dual objective increases monotonically.
-
Location-scale barycenter. Show the 1D barycenter of a location-scale family has mean \(\sum w_k m_k\) and sd \(\sum w_k \sigma_k\).
Solution
- If F_k⁻¹(u) = m_k + σ_k Q(u) for a fixed quantile function Q, then Σ w_k F_k⁻¹(u) = Σ w_k m_k + (Σ w_k σ_k) Q(u).
- This is the same family, with mean Σ w_k m_k and scale Σ w_k σ_k.
- The mixture instead has variance Σ w_k(σ_k² + m_k²) − (Σ w_k m_k)², which includes the spread of the means.
-
Langevin's rate. For \(\pi = N(0, \Sigma)\) and Langevin from \(N(m_0, \Sigma)\), show \(\mathrm{KL}_t \le e^{-2t/\lambda_{\max}(\Sigma)}\mathrm{KL}_0\).
Solution
- With S₀ = Σ, the covariance stays Σ and the mean is m(t) = e^{−Σ⁻¹t}m₀, so KL_t = ½ m(t)′Σ⁻¹m(t).
- In Σ's eigenbasis, each coordinate decays like e^{−t/λᵢ} and contributes e^{−2t/λᵢ} times its initial share.
- Every factor is at most e^{−2t/λ_max}, so KL_t ≤ e^{−2t/λ_max}KL₀.
Notes and sources
Where it comes back
Part 62 discusses transporting causal effects, Part 63 barycenter score adjustment, Part 64 generative-model generalization, and Part 65 research comparisons of distributions.
Sources
- History. G. Monge, Mémoire sur la théorie des déblais et des remblais (1781); L. Kantorovich, Dokl. Akad. Nauk SSSR 37 (1942); L. Kantorovich & G. Rubinstein (1958); L. Vaserstein (1969).
- Duality and maps.
- Y. Brenier, CPAM 44 (1991); R. McCann, Adv. Math. 128 (1997);
- L. Caffarelli, JAMS 5 (1992); F. Otto, Comm. PDE 26 (2001);
- H. Kuhn, Naval Res. Logist. Q. 2 (1955); D. Bertsekas (1979);
- C. Villani, Optimal Transport: Old and New (2009).
- Rates.
- R. Dudley, Ann. Math. Stat. 40 (1969); N. Fournier & A. Guillin, PTRF 162 (2015);
- J. Weed & F. Bach, Bernoulli 25 (2019); J. Niles-Weed & Q. Berthet, Ann. Stat. 50 (2022);
- E. del Barrio, E. Giné & C. Matrán, Ann. Prob. 27 (1999); E. del Barrio & J.-M. Loubes, Ann. Prob. 47 (2019);
- S. Hundrieser, T. Staudt & A. Munk (2024);
- J. Rabin et al. (2011); N. Bonneel et al., JMIV 51 (2015); K. Nadjahi et al., NeurIPS (2020).
- Entropic transport.
- R. Sinkhorn, Ann. Math. Stat. 35 (1964); M. Cuturi, NeurIPS (2013);
- A. Genevay, L. Chizat, F. Bach, M. Cuturi & G. Peyré, AISTATS (2019);
- G. Mena & J. Niles-Weed, NeurIPS (2019); J. Feydy et al., AISTATS (2019);
- L. Chizat, G. Peyré, B. Schmitzer & F.-X. Vialard, Math. Comp. 87 (2018);
- E. del Barrio, A. González-Sanz, J.-M. Loubes & J. Niles-Weed, SIMODS (2023).
- Maps.
- J.-C. Hütter & P. Rigollet, Ann. Stat. 49 (2021); A.-A. Pooladian & J. Niles-Weed (2021);
- G. Schiebinger et al., Cell 176 (2019); Q. Mérigot (2011); B. Lévy (2015).
- Barycenters.
- M. Agueh & G. Carlier, SIAM J. Math. Anal. 43 (2011);
- P. Álvarez-Esteban, E. del Barrio, J. Cuesta-Albertos & C. Matrán, J. Math. Anal. Appl. 441 (2016);
- M. Cuturi & A. Doucet, ICML (2014); J.-D. Benamou et al., SIAM J. Sci. Comput. 37 (2015);
- T. Le Gouic & J.-M. Loubes, PTRF 168 (2017); A. Ahidar-Coutrix, T. Le Gouic & Q. Paris, PTRF 177 (2020);
- V. Panaretos & Y. Zemel, An Invitation to Statistics in Wasserstein Space (2020).
- Ranks.
- V. Chernozhukov, A. Galichon, M. Hallin & M. Henry, Ann. Stat. 45 (2017);
- M. Hallin, E. del Barrio, J. Cuesta-Albertos & C. Matrán, Ann. Stat. 49 (2021);
- N. Deb & B. Sen, JASA 118 (2023); G. Carlier, V. Chernozhukov & A. Galichon, Ann. Stat. 44 (2016).
- Flows and sampling.
- R. Jordan, D. Kinderlehrer & F. Otto, SIAM J. Math. Anal. 29 (1998);
- D. Bakry & M. Émery (1985); A. Wibisono, COLT (2018);
- A. Dalalyan, JRSS B 79 (2017); A. Durmus & É. Moulines, Ann. Appl. Prob. 27 (2017);
- Q. Liu & D. Wang, NeurIPS (2016); S. Mei, A. Montanari & P.-M. Nguyen, PNAS 115 (2018);
- L. Chizat & F. Bach, NeurIPS (2018); S. Chewi, Log-Concave Sampling.
- Generative models.
- M. Arjovsky, S. Chintala & L. Bottou, ICML (2017); I. Gulrajani et al., NeurIPS (2017); T. Miyato et al., ICLR (2018);
- Y. Lipman et al., ICLR (2023); X. Liu, C. Gong & Q. Liu, ICLR (2023);
- A. Tong et al., TMLR (2024); A.-A. Pooladian et al., ICML (2023);
- K. Oko, S. Akiyama & T. Suzuki, ICML (2023); S. Chen, S. Chewi et al., ICLR (2023);
- N. Carlini et al., USENIX Security (2023); J. Niles-Weed & P. Rigollet, Bernoulli 28 (2022).
- Books. Villani (2009); G. Peyré & M. Cuturi, Computational Optimal Transport (2019); Panaretos & Zemel (2020); S. Chewi, J. Niles-Weed & P. Rigollet, Statistical Optimal Transport (2025).
- Data. NHANES (CDC); A. Azzalini & A. Bowman, Appl. Stat. 39 (1990).
About this partfrom its README
Part 61 of the 65-part course, covering Kantorovich duality, Wasserstein geometry, empirical rates, Sinkhorn, transport maps, barycenters, multivariate ranks, gradient flows and generative models.
Monge's 1781 earthworks motivate the hook. Monotone pairing is optimal for convex displacement costs on a line; plain-distance optima need not be unique. A general no-crossing slogan does not replace cyclic monotonicity or its assumptions. For uniform equal-size discrete laws an optimal permutation plan exists, but other optima may be mixtures.
What is computed and builtChecked computation and example scope
Audited local kernels are used by this part; statkit.ot retains its educational implementations. The instrument is TransportFlow.
- LP: check solver success, both marginals, dual feasibility and gap. The 6-by-7 example has 12 positive entries; a general transport vertex has at most n+m-1.
- Quantiles: integrate exact empirical step quantiles for W distances, the location/spread/shape decomposition and barycenter moments. Linear interpolation of sample quantiles is a different empirical law. KDE displays use a finite quantile grid only for illustration.
- Sinkhorn: distinguish raw plan cost from the regularized objective cost + epsilon KL(P || a tensor b). Log scaling checks both marginal residuals and fails on exhaustion. An initial map fit exhausted 50,000 iterations at residual 9.96e-8 rather than the requested 1e-8. Map fitting now uses log scaling plus a line-searched reduced-dual Newton refinement, with marginal tolerance 1e-10; primal/dual differences are recorded. This is the same entropic optimization problem, not an altered statistical target. Scalar convergence iteration counts in the Sinkhorn chapter still use unaccelerated log scaling.
- Sinkhorn divergence: with squared-Euclidean cost the small-epsilon limit is W2 squared, and the large-epsilon limit is squared distance between means. It need not separate laws in that limit. Ordinary-distance cost yields a different energy-distance limit. Continuous regularized-value expansions are not a bias formula for the finite discrete raw-cost plot.
- Rates: record replicate draws and empirical standard errors. Dimension-independent fixed-epsilon exponents do not imply dimension-independent constants or uniformity as epsilon tends to zero. Tail, order, support and null-versus-alternative assumptions matter.
- Maps: the Gaussian simulation uses one specific nearest-neighbor extension versus the entropic barycentric extension, with heuristic epsilon=.5 n^(-1/3), four training datasets and a shared 500-point Monte Carlo integration sample. It does not validate the compact-support minimax theorem or prove universal dominance. Hutter–Rigollet's stated-model squared-risk rate includes a parametric 1/n floor. Pooladian–Niles-Weed's original entropic bound is generally slower than that minimax rate.
- Ranks: the testing reference is a fixed distinct Halton set; pooled row order is randomized before assignment to keep tie resolution independent of sample labels. Pairwise rank distances are cached. Use plus-one permutation p-values and reject at p<=.05. Population center-outward regions and smoothed finite-data ring polygons are different objects; the polygons are not exact finite-sample confidence regions.
- Flows: record exact continuous Gaussian Langevin and exact discrete Gaussian Euler laws separately. Only 300 of 600 simulated particles are drawn. KL of a fitted Gaussian is not KL of the atomic empirical measure, which is infinite relative to a continuous target. Euler bias and sampling noise both affect comparisons.
- Generation: show every generated point without coordinate clamping. Five fresh-noise draws are conditional on one fitted kernel velocity field; errors are distances to the training empirical law, not held-out generalization estimates. Population endpoint and straight-path theorems need regularity and do not automatically hold for a finite fitted field or one Euler step.
What is computed and builtFixed empirical datasets and results
NHANES results concern the same unweighted empirical complete-case extract used in Part 60, not a national survey-weighted distribution; age is top-coded at 80. CDC field verification and Old Faithful's independent R-package comparison are retained in the data receipt. Historical originals of Old Faithful were not separately retrieved.
| Example | Revised result |
|---|---|
| NHANES BMI, men versus women | W1=1.25007, W2=1.85902 |
| Exact W2-squared decomposition | location 0.68185 + spread 2.60262 + shape 0.17148 = 3.45594; residual -3.6e-15 |
| Empirical age-group SBP barycenter | exact mean 126.18670, SD 17.37092; mixture SD 19.90141 |
| Gaussian map error at n=800, four fits | empirical 0.12689 (empirical SE 0.01192); entropic 0.07694 (SE 0.01434) |
| Cauchy null, 1,000 datasets, nominal 5% | Hotelling 1.6% (MC SE 0.40 points); rank energy 6.3% (SE 0.77) |
| Cauchy location shift (1,1), 300 datasets | Hotelling power 5.3%; rank energy 84.7% |
A barycenter variance is a weighted sum of pairwise covariances of quantile functions. Its SD equals the weighted average group SD only in a common location-scale family; in general it is at most that average. It is not literally the mixture's within-group variance. General Gaussian barycenters solve an implicit matrix fixed point; only special commuting cases have a simple explicit covariance formula.
Companion material in this repository
The syllabus's plan for this partfrom SYLLABUS.md, the plan of record
- Hook: Monge's earthworks (1781); Kantorovich (1942).
- Kantorovich duality. Couplings; the 1D quantile solution; c-concavity.
- Wasserstein distances. Metrics on laws; geodesics and displacement interpolation (
TransportFlow). - Empirical rates. n^{−1/d} (Dudley 1969; Fournier & Guillin 2015; Weed & Bach 2019).
- Entropic OT and Sinkhorn (Cuturi 2013). Convergence; dimension-free sample complexity (Genevay et al. 2019; Mena & Niles-Weed 2019).
- Estimating transport maps. Minimax rates (Hütter & Rigollet 2021).
- Barycenters and Fréchet means (Agueh & Carlier 2011).
- Multivariate ranks and quantiles. Center-outward ranks (Chernozhukov et al. 2017; Hallin et al. 2021); rank tests (Deb & Sen 2023).
- Gradient flows. Langevin as the Wasserstein gradient flow of KL (Jordan, Kinderlehrer & Otto 1998); sampling as optimization (Part 27).
- Generative models and OT. Wasserstein GANs; flow matching (cross-reference AI, Built Part 21).
- Open problems.
Built: statkit.ot. Books: Villani; Peyré & Cuturi; Panaretos & Zemel; Chewi, Niles-Weed & Rigollet.
Build the film
python -m videos.stats.stats61.compute # the part's numbers, into .cache/stats61
python tools/build.py stats61 # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py stats61 Hook # one chapter, silent, with a contact sheet
Scenes: videos/stats/stats61. Setup: see the course page. Source of these notes: the README and the scenes' narration.
Build it
OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 python -m videos.stats.stats61.compute --force
pytest -q tests/test_stats61_checked.py tests/test_stats_kit_ot.py
python tools/build.py stats61 -q l
python tools/lecture_length.py stats61 --floor 50
All 13 numerical inputs regenerated. Seventeen checks cover audited kernels and legacy behavior. Narration/list bookmarks match their rows; estimated English narration is 52.5 minutes. Scientific QA evidence. The recorded English sampled visual checkpoint is complete; Chinese narration/caption tables, continuous listening/playback and final narrated masters remain open. This is not bilingual production approval.