Reader question: Suppose two financial scenario distributions place probability mass in different places. How can an algorithm measure the least-cost way to move one distribution into the other—and do so fast enough that the calculation can sit inside a larger calibration or robustness workflow?
Optimal transport represents the answer as a coupling matrix: how much probability mass moves from each source scenario to each target scenario. Classical optimal transport solves a linear program. Sinkhorn algorithms add an entropy term that makes the problem smooth and turns the coupling into repeated row/column scaling.
This article owns one precise computational job: entropy-regularised optimal transport and Sinkhorn matrix scaling for comparing or reweighting financial scenario distributions. It does not own portfolio advice, generic Monte Carlo simulation, distributionally robust optimization in full, or scenario generation in general.
This is public mathematical and computational education. It is not personalized financial advice or a recommendation to allocate capital according to any transport result.
1. Discrete probability distributions
Let the source distribution have masses:
a = (a1,…,an),
and the target distribution:
b = (b1,…,bm),
with nonnegative entries summing to one.
Each source point xi and target point yj is connected by a cost:
Cij = c(xi,yj).
For Euclidean scenario vectors, a common cost is:
Cij = ||xi−yj||².
The choice of cost matrix defines what “far apart” means.
2. The coupling matrix
A transport plan P has entries:
Pij ≥ 0,
where Pij is mass moved from source i to target j.
The marginal constraints are:
P1 = a,
PT1 = b.
The feasible set of all such matrices is the transport polytope:
U(a,b).
3. Classical optimal transport
The unregularised discrete Kantorovich problem is:
minP∈U(a,b) <P,C>,
where:
<P,C> = ΣijPijCij.
This is a linear program. It gives a sparse, often sharp transport plan, but large dense problems can be computationally expensive.
4. Entropic regularisation
Sinkhorn-style optimal transport adds entropy:
minP∈U(a,b) <P,C> + ε ΣijPij(log Pij−1).
Equivalent sign conventions write:
<P,C> − εH(P).
ε>0 is the regularisation strength.
The entropy term discourages a transport plan from becoming too concentrated and makes the optimization strictly convex under standard conditions.
5. The Gibbs kernel
Define:
Kij = exp(−Cij/ε).
The regularised optimal coupling has the scaling form:
P = diag(u) K diag(v),
for positive scaling vectors u and v chosen so the marginals match a and b.
This structure is the computational breakthrough.
6. Sinkhorn iterations
Given v, enforce the row marginal:
u = a ./ (Kv).
Given u, enforce the column marginal:
v = b ./ (KTu).
Repeat until:
P1≈a
and:
PT1≈b.
The notation ./ means elementwise division.
7. Why alternating scaling works
Each scaling step enforces one marginal while disturbing the other, then the next step corrects the second marginal. The process converges under standard positivity conditions.
This is closely connected to matrix balancing, iterative proportional fitting and Bregman/KL projections onto affine marginal constraints.
The algorithm is simple enough to express in a few lines, but numerical stability is the real implementation challenge.
8. The role of epsilon
ε controls the computational-statistical geometry.
Large ε:
- smoother, more diffuse couplings;
- faster/stabler iterations;
- greater bias away from classical optimal transport.
Small ε:
- sharper couplings closer to unregularised OT;
- more extreme kernel entries;
- slower convergence;
- greater numerical underflow risk.
There is no universally correct ε.
9. Epsilon bias
Regularised transport is not the same numerical object as unregularised Wasserstein transport.
As ε decreases, the regularised solution approaches classical transport under appropriate conditions, but finite ε introduces smoothing bias.
Falsifier: compute the transport value over an ε grid. If conclusions change materially before numerical instability appears, the result is regularisation-sensitive.
10. Entropic self-bias and Sinkhorn divergence
Entropy regularisation can give a nonzero regularised transport cost between a distribution and itself.
Sinkhorn divergences correct this by subtracting self-cost terms:
Sε(a,b) = OTε(a,b) − ½OTε(a,a) − ½OTε(b,b).
This creates an interpolating quantity with improved debiasing properties.
11. Why underflow occurs
If Cij/ε is large, then:
exp(−Cij/ε)
can underflow to zero in floating-point arithmetic.
Entire rows or columns can then appear numerically disconnected even when the mathematical kernel is positive.
This is one of the most important small-ε failure modes.
12. Log-domain stabilisation
Instead of storing extreme u and v directly, stable implementations work with dual potentials or logarithms.
If:
u=exp(f/ε), v=exp(g/ε),
matrix-vector products can be evaluated with log-sum-exp identities.
This avoids multiplying enormous scaling factors by tiny kernel entries.
13. Epsilon scaling
A practical continuation strategy starts with a large, numerically easy ε, solves the problem, then gradually lowers ε while warm-starting from previous dual variables.
This is known as ε-scaling.
Schmitzer’s stabilized algorithms combine log-domain scaling, ε-scaling and sparse/coarse-to-fine ideas to make small-regularisation problems more practical.
14. Marginal residuals are direct diagnostics
At iteration k, compute:
ra = ||P1−a||,
rb = ||PT1−b||.
A transport plan should not be considered converged merely because u and v stop changing. The marginals themselves are the contract.
Falsifier: if reported distance is stable while marginal residuals remain large, the iteration has not solved the constrained problem.
15. The cost matrix is part of the model
Suppose financial scenarios contain equity return, rate shift and volatility shock.
A raw Euclidean distance can be dominated by whichever variable has the largest units.
Possible preprocessing includes:
- standardisation;
- Mahalanobis scaling;
- economically motivated feature weights;
- bounded or robust costs;
- time-dependent transport costs.
Changing C changes the transport geometry and therefore the answer.
16. Financial scenario reweighting interpretation
Imagine a baseline scenario distribution a and a stress/reference distribution b.
The coupling P shows how probability mass from baseline scenarios can be associated with target scenarios at minimum regularised transport cost.
This can be useful educationally for:
- distribution comparison;
- scenario matching;
- stress-set alignment;
- distributional shift measurement;
- building Wasserstein ambiguity sets.
The coupling does not say that one market scenario “causes” another.
17. Wasserstein ambiguity sets
Distributionally robust optimization often defines a set:
Uδ(P̂) = {Q : W(Q,P̂) ≤ δ},
containing distributions within Wasserstein radius δ of an empirical distribution P̂.
Mohajerin Esfahani and Kuhn showed that broad classes of Wasserstein-robust optimization problems admit tractable finite-dimensional reformulations and finite-sample guarantees.
Sinkhorn algorithms can provide computationally smoothed transport quantities, but regularised OT and an exact Wasserstein ball are not interchangeable unless the formulation explicitly accounts for regularisation.
18. Sample complexity and dimensionality
Empirical Wasserstein distances suffer from dimensionality: convergence of raw empirical OT can become slow as dimension grows.
Entropy regularisation improves computational and statistical behaviour, trading geometric sharpness for smoothing.
Genevay and co-authors study how Sinkhorn divergence sample complexity interpolates between OT-like and kernel/MMD-like regimes as regularisation changes.
19. Inputs and outputs
Inputs can include:
- source support xi;
- target support yj;
- source masses a;
- target masses b;
- cost function/matrix C;
- regularisation ε;
- stopping tolerance;
- maximum iterations;
- log-domain/stabilisation mode;
- ε-scaling schedule;
- precision type;
- optional sparse kernel threshold.
Outputs can include:
- transport coupling P;
- regularised transport cost;
- Sinkhorn divergence;
- dual potentials;
- row/column residuals;
- iteration count;
- ε-sensitivity curve;
- coupling entropy;
- sparsity/underflow diagnostics;
- scenario-flow summaries.
20. Evidence polarity
Evidence for confidence includes:
- marginal residuals converge below tolerance;
- results are stable across nearby ε values;
- small problems agree with an exact linear-program OT solver;
- log-domain and ordinary implementations agree where both are numerically safe;
- transport cost behaves sensibly under known synthetic shifts;
- self-comparison gives near-zero Sinkhorn divergence;
- scenario conclusions survive reasonable feature scaling choices;
- ε-scaling converges to the same final solution as direct stable solves.
Evidence against confidence includes:
- marginal errors stall;
- kernel underflow creates zero rows/columns;
- results change strongly with arbitrary units;
- small-ε answers differ between float32 and float64;
- regularised and exact OT rankings disagree materially;
- one feature dominates C unintentionally;
- iterations reach a cap without convergence;
- scenario mapping is interpreted causally without evidence.
21. Counterexample: wrong feature scaling
Suppose one scenario coordinate is an interest-rate change measured in basis points around 100, while another is an equity return around 0.02.
Raw Euclidean distance makes the rate coordinate dominate.
Falsifier: rescale features and inspect coupling changes. If conclusions reverse under unit conversion alone, the cost matrix is not economically normalized.
22. Counterexample: epsilon too large
With very large ε, K becomes relatively flat and the coupling spreads mass broadly.
Distinct distributions can look artificially similar.
Falsifier: reduce ε and compare transport geometry. If sharp scenario distinctions emerge only at smaller ε, the large-ε solution was oversmoothed.
23. Counterexample: epsilon too small
With very small ε, K contains entries close to zero and scaling vectors become extreme.
A naive implementation can produce NaNs or fake convergence.
Falsifier: rerun in log domain and higher precision. If the solution changes, the earlier result was numerical rather than mathematical.
24. Counterexample: supports have unequal total mass
Balanced Sinkhorn transport assumes:
Σa = Σb.
If one distribution has missing probability mass or intentionally different total mass, the balanced problem is infeasible or conceptually wrong.
Unbalanced optimal transport relaxes exact marginal preservation with additional divergence penalties.
25. Counterexample: dense cost matrix does not scale
Even though Sinkhorn avoids a generic linear program, storing an n×m dense kernel can dominate memory.
For n=m=100,000, a dense matrix is impossible.
Falsifier: include memory complexity in the performance audit. Consider structure, batching, low-rank kernels, sparsification or multiscale methods.
26. Counterexample: distance is mistaken for probability
A transport cost is not a probability, confidence level or expected loss.
Two distributions can be close in Wasserstein distance yet differ strongly in a specific tail statistic.
Falsifier: always pair transport metrics with domain-specific diagnostics such as tail quantiles, means, covariance or calibration metrics relevant to the actual question.
27. Sinkhorn versus importance sampling
Importance-sampling algorithms intentionally change a sampling distribution and correct expectations with likelihood weights.
Sinkhorn computes a transport coupling between probability distributions. It can inform scenario alignment, but it is not itself an importance-sampling estimator.
28. Sinkhorn versus correlation-matrix repair
Correlation-matrix repair projects an invalid dependence matrix toward the PSD cone or a nearest valid matrix.
Optimal transport compares distributions through mass movement. Matrix repair and transport projection solve different geometries.
29. Sinkhorn versus graphical lasso
Graphical-lasso algorithms estimate sparse conditional-dependence structure through a penalized precision matrix.
Sinkhorn uses a cost matrix and marginal constraints to compare or align whole distributions.
30. Sinkhorn and model drift
Model-drift algorithms own the monitoring decision: whether a model’s population, calibration or performance has changed enough to require action.
Transport distance can be one distribution-shift feature inside that process, but it does not by itself decide whether a model must be recalibrated.
31. Weak links
- cost matrix poorly scaled;
- ε chosen without sensitivity analysis;
- kernel underflow;
- marginal residuals not checked;
- stopping based only on scaling-vector change;
- balanced transport used for unequal mass;
- dense matrix memory ignored;
- float precision insufficient;
- regularised cost reported as exact Wasserstein distance;
- transport geometry interpreted as causality.
32. What would falsify confidence?
Confidence should be withdrawn if exact small-problem benchmarks disagree; if marginal residuals remain material; if ε, scaling or precision choices change conclusions; if transport cost fails known synthetic tests; or if the result is dominated by arbitrary units rather than meaningful scenario geometry.
33. Verification and update triggers
Preserve the support data, masses, feature transforms, cost definition, ε, solver mode, precision, ε-scaling schedule, tolerance, iteration cap and all marginal residuals.
Revalidate when:
- scenario features change;
- units/scaling change;
- support size grows materially;
- new stress regimes are added;
- ε changes;
- GPU/precision implementation changes;
- the transport result is used in a new downstream decision;
- distributional shift becomes more tail-driven than location-driven.
34. Primary and high-quality references
- Marco Cuturi, Sinkhorn Distances: Lightspeed Computation of Optimal Transport, NeurIPS 2013.
- Gabriel Peyré and Marco Cuturi, Computational Optimal Transport, Foundations and Trends in Machine Learning.
- Bernhard Schmitzer, Stabilized Sparse Scaling Algorithms for Entropy Regularized Transport Problems, SIAM Journal on Scientific Computing.
- Aude Genevay, Lénaïc Chizat, Francis Bach, Marco Cuturi and Gabriel Peyré, Sample Complexity of Sinkhorn Divergences, AISTATS 2019.
- Peyman Mohajerin Esfahani and Daniel Kuhn, Data-driven Distributionally Robust Optimization Using the Wasserstein Metric, Mathematical Programming.
- Federal Reserve, Supervisory Guidance on Model Risk Management, for validation and monitoring principles.
Educational boundary: Sinkhorn algorithms make entropy-regularised transport computationally practical. They do not remove the modelling choice embedded in the cost matrix, the regularisation parameter or the financial meaning assigned to distributional distance.
