FlashSinkhorn: IO-Aware Entropic Optimal Transport on GPU
Felix X.-f. Ye (University of Albany), Xingjie Li, An Yu, Ming-Ching Chang, Linsong Chu, Davis Wertheimer
Overview
Optimal transport (OT) computes the cheapest way to transform one probability distribution into another, yielding the Wasserstein distance. While foundational across modern machine learning—powering generative models, domain adaptation, and dataset comparisons—solving exact optimal transport requires formulating a linear programming problem that scales poorly and resists parallelization on modern hardware. To address this, practitioners rely on entropic regularization, introduced by Marco Cuturi, which converts the problem into a strictly convex formulation solvable via Sinkhorn iterations (or matrix scaling). However, standard implementations face a severe bottleneck: every iteration requires evaluating and updating across all $m \times m$ pairwise points.

Key moments
- 0:00 Introduction to FlashSinkhorn and optimal transport problems
- 1:33 Challenges with existing solvers: memory bound vs launch bound
- 2:46 The core unlock: connecting Sinkhorn updates to Softmax attention
- 4:24 Adapting the Flash Attention playbook and hardware utilization
- 5:57 Forward pass, gradient, and Hessian-vector product integration
- 6:50 Performance benchmarks and speedup results
- 7:51 Real-world applications: dataset distance and saddle escape
- 9:18 Conclusion, takeaway points, and code availability
- 9:42 Audience Q&A: Limitations on cost functions like L1 loss
FlashSinkhorn: IO-Aware Entropic Optimal Transport on GPU
Speakers: Felix X.-f. Ye (University of Albany); Xingjie Li; An Yu; Ming-Ching Chang; Linsong Chu; Davis Wertheimer
Conference: ICML
YouTube: https://slideslive.com/39083760
Overview
Optimal transport (OT) computes the cheapest way to transform one probability distribution into another, yielding the Wasserstein distance. While foundational across modern machine learning—powering generative models, domain adaptation, and dataset comparisons—solving exact optimal transport requires formulating a linear programming problem that scales poorly and resists parallelization on modern hardware. To address this, practitioners rely on entropic regularization, introduced by Marco Cuturi, which converts the problem into a strictly convex formulation solvable via Sinkhorn iterations (or matrix scaling). However, standard implementations face a severe bottleneck: every iteration requires evaluating and updating across all $m \times m$ pairwise points.
In this talk, Felix X.-f. Ye presents FlashSinkhorn, an IO-aware solver for entropic optimal transport that bridges the mathematical structure of Sinkhorn updates with the hardware-conscious engineering of FlashAttention. By reformulating the quadratic cost matrix operations into localized kernel primitives, FlashSinkhorn bypasses the $O(m^2)$ memory footprint that has historically plagued large-scale OT problems. The resulting framework achieves dramatic speedups—up to 161x end-to-end—while dropping memory consumption to linear scales, finally making first- and second-order optimal transport tractable for large, high-dimensional datasets.
Background
▶ Watch: Introduction to FlashSinkhorn and optimal transport problems (0:00)
In the machine learning and systems optimization literature, computing distances between continuous or discrete distributions is ubiquitous. The discrete optimal transport problem calculates the minimum cost transport plan between two weighted point clouds. Solving this exactly yields a sparse transport plan that presents immense theoretical elegance but is notoriously slow and difficult to parallelize efficiently on Graphics Processing Units (GPUs).
Adding an entropic regularization term changes the landscape by smoothing the transport plan, yielding a dense matrix that can be computed iteratively via matrix scaling (Sinkhorn iterations). Yet, these iterations expose a fundamental systems dilemma when mapping to GPU architectures:
- Tensorized Solvers (e.g., GeomLoss / GM-Loss): Storing the explicit $m \times m$ cost matrix in memory leads to quadratic $O(m^2)$ space complexity. For routine problem sizes—such as 40,000 points in 512 dimensions—these solvers quickly trigger Out-Of-Memory (OOM) errors.
- Recomputation Solvers (e.g., KeOps): To avoid storing the massive matrix, these frameworks recompute every point pair on the fly during each iteration. While memory usage drops, the computational work shatters into hundreds of tiny kernels, resulting in single-digit tensor core occupancies and severe launch-bound bottlenecks.
Both approaches choke on the exact same structural artifact: the dense $m \times m$ pairwise interaction matrix. Consequently, existing frameworks operate roughly 15 times below the theoretical compute capacity of modern hardware because they are fundamentally not IO-aware.
Key Findings
▶ Watch: The core unlock: connecting Sinkhorn updates to Softmax attention (2:46)
The central discovery behind FlashSinkhorn is that a standard Sinkhorn update step is mathematically identical to a Softmax attention operation. By inspecting the squared Euclidean cost function, the authors demonstrate that the distance can be algebraically expanded into two independent per-point terms plus a dot product between the source and target points.
- Attention Isomorphism: Treating source points as queries, target points as keys and values, and the dual potentials as biases reveals that every optimal transport object possesses a direct attention counterpart.
- Hardware-Aware Elimination of Materialized Matrices: By leveraging the FlashAttention playbook, FlashSinkhorn computes normalization statistics entirely within on-chip SRAM via tiling, ensuring the massive $m \times m$ score matrix is never instantiated or stored in High Bandwidth Memory (HBM).
- Unified Streaming Primitives: The framework introduces fused kernels implemented in Triton that handle the forward pass, gradient computation, and Hessian-vector products (HVP) within a single unified streaming design.
- Dramatic Performance Gains: Benchmarked across varying problem sizes ($n$ and $d$), FlashSinkhorn delivers up to a 32x speedup for the forward pass, up to a 161x speedup end-to-end, and a 17x speedup for Hessian-vector products, all while maintaining strictly linear memory scaling.
Technical Deep Dive
▶ Watch: Forward pass, gradient, and Hessian-vector product integration (5:57)
The architectural breakthrough of FlashSinkhorn relies on a precise algebraic transformation of the squared Euclidean cost. Consider the standard Sinkhorn update: it alternates between updating dual potentials $f$ and $g$ by sweeping across target and source points, respectively. Each update involves a reduction step over the pairwise cost matrix.
The per-point pieces ($||x||^2$ and $||y||^2$) do not couple the source $x$ and target $y$ coordinates, allowing them to be folded directly into the dual potentials as biases. The remaining coupled term is simply the inner product between $x$ and $y$. When substituted into the Sinkhorn update equations, the resulting operation becomes a log-sum-exp over dot-product scores with biases—precisely the definition of Softmax attention.
This realization opens the door to the FlashAttention memory-tiling hierarchy. Instead of reading and writing quadratic matrices to HBM, FlashSinkhorn executes updates through custom-engineered Triton kernels:
- Forward Pass Kernel: Iterates through block tiles in on-chip SRAM, accumulating normalization statistics and writing out only the updated potentials (one write per block).
- Gradient Computation: At convergence, gradients are evaluated via a closed-form plan-apply primitive that pushes the transport plan through vectors tile-by-tile without materializing the plan tensor.
- Hessian-Vector Products (HVP): Solves the Hessian system using Conjugate Gradient (CG) methods. Every inner product inside the CG loop is executed via streaming plan-applies, bypassing explicit Hessian formation entirely.
This design enables first-order and second-order optimal transport to scale identically in linear memory.
Experimental Setup & Results
▶ Watch: Real-world applications: dataset distance and saddle escape (7:51)
The evaluation spans exhaustive sweeps across varying point counts ($n$) and dimensionalities ($d$), comparing FlashSinkhorn against baseline frameworks such as KeOps.
- Memory Efficiency: While baseline methods quickly run out of memory or plateau due to launch overheads, FlashSinkhorn maintains a sub-1-gigabyte memory footprint even when scaling to massive dataset distance workloads (e.g., comparing MNIST and Fashion-MNIST in deep feature space).
- Wall-Clock Speedups: The method achieves up to 161x end-to-end speedups over tensorized and recomputation baselines. The performance delta stems entirely from data movement reduction (kernel fusion) rather than floating-point operation pruning; FlashSinkhorn performs the exact same mathematical computations while keeping tensor cores continuously engaged.
- Second-Order Optimization Unlock: By reducing the cost of Hessian-vector products by 17x, the framework enables second-order optimal transport for large-scale saddle-point escape problems. In ridge regression fittings where first-order optimizers like Adam stall on flat plateaus, FlashSinkhorn rapidly monitors smallest Hessian eigenvalues, detects negative curvature, and successfully triggers Newton's method steps to drop off optimization plateaus.
Practical Implications
▶ Watch: Audience Q&A: Limitations on cost functions like L1 loss (9:42)
For machine learning practitioners, infrastructure engineers, and model deployers, FlashSinkhorn transforms entropic optimal transport from an intractable theoretical tool into an out-of-the-box systems primitive.
- Ease of Integration: The entire library is available via PyPI (
pip install flashsinkhorn), requiring minimal code integration to replace legacy quadratic-memory loss functions. - Broader Applicability & Limitations: The underlying mathematical mapping is strictly tied to cost functions that can be decomposed into per-point terms plus an inner product. Consequently, while squared Euclidean distances and cosine similarities map cleanly to this framework, alternative metrics such as $L_1$ loss cannot be formulated this way, representing a fundamental boundary of the approach.
- Infrastructure Savings: By keeping memory footprints linear and maximizing GPU occupancy, infra teams can run large-scale generative modeling, domain alignment, and dataset distance metrics on standard hardware configurations without hitting memory walls.
Key Takeaways
- Sinkhorn Is Attention: Standard Sinkhorn updates mathematically mirror Softmax attention, enabling the direct application of the FlashAttention hardware-acceleration playbook.
- Eliminating Materialized Matrices: Tiling computations through on-chip SRAM avoids storing the $O(m^2)$ cost matrix in HBM, slashing memory complexity to linear scales.
- Massive Performance Gains: Custom Triton kernel fusion yields up to 32x forward-pass speedups and up to 161x end-to-end performance improvements over existing solvers like KeOps.
- Scalable Second-Order OT: Efficient Hessian-vector product streaming unlocks second-order optimization techniques—such as saddle-point escape via Newton methods—previously infeasible at scale.
- Immediate Availability: The complete codebase, paper, and pip-installable package are publicly released and ready for production integration.
About the Speaker(s)
- Felix X.-f. Ye (University of Albany): Felix Ye is from University of Albany and is presenting FlashSinkhorn, an IO-aware solver for entropic optimal transport.
Co-authors: Xingjie Li, An Yu, Ming-Ching Chang, Linsong Chu, Davis Wertheimer.
Reviews
→ Top-rated talks at International Conference on Machine Learning 2026
All talks from International Conference on Machine Learning 2026