Manuscript Offprint
arXiv:2610.02395FlashSinkhorn 2: Block-Sparse Entropic Optimal Transport
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
ABSTRACT
Streaming GPU solvers for entropic optimal transport (EOT), such as FlashSinkhorn, avoid storing the dense kernel but still evaluate all point pairs in every Sinkhorn iteration. We present FlashSinkhorn 2 (FS2), a solver for squared-Euclidean cost on low-dimensional point clouds that solves large discrete EOT problems to a prescribed marginal residual on a single GPU by coupling two stages. A coarse stage solves on cell centroids, lifts the potentials to every point and, when a sampled marginal check rejects the lift, continues on the centroids, replacing most point-level updates. A block-sparse fine stage then removes the centroid error that coarse updates cannot. Its Morton-ordered blocks support screening and fused tensor-core execution, and a threshold set by the block masses bounds each omitted tile's contribution to every row and column. On synthetic benchmarks, FS2 reaches the target residual on all 32 problems and GeomLoss multiscale on 10. On one A100, FS2 solves discrete EOT between two -particle measures from a cosmological N-body simulation, at an entropic blur equal to the mean interparticle distance, to an all-particle marginal residual below 0.01 in under 2.5 hours. To our knowledge, it is the largest discrete EOT problem solved to this accuracy within hours. For reproducibility, we release an open-source implementation at https://github.com/ot-triton-lab/flash-sinkhorn.
1 INTRODUCTION
Optimal transport (OT) compares probability measures in applications ranging from generative modeling to cell dynamics and cosmological reconstruction (Arjovsky et al., 2017; Schiebinger et al., 2019; Frisch et al., 2002). Entropic regularization (Cuturi, 2013) yields a differentiable problem, entropic OT (EOT), solved by Sinkhorn iterations. Applications in computational biology, medical imaging, and cosmology now routinely produce point clouds with – points per measure (Bunne et al., 2024; Feydy et al., 2019a; Lévy et al., 2025). Solvers that store the dense kernel exceed GPU memory beyond about points. MOSCOT (Klein et al., 2025) couples a few hundred thousand cells per time point and suggests low-rank plans (Scetbon et al., 2021) for millions. Lévy et al. (2025) recover initial particle positions from a cosmological dataset with target particles by semi-discrete transport, and note that a Sinkhorn iteration between unstructured point clouds costs quadratic time, “prohibiting very large-scale applications.” Solvers that evaluate entries on the fly, GeomLoss (Feydy et al., 2019b) through KeOps (Charlier et al., 2021) and FlashSinkhorn (Ye et al., 2026) through one fused tiled kernel per update, avoid storing the matrix but still perform work per update.
At moderate regularization, much of this work is wasted, because the entropic plan concentrates on nearby pairs. Multiscale solvers first solve a coarser problem, which cuts the number of fine iterations, and then skip distant pairs whose contribution is bounded (Schmitzer, 2019) or estimated from the coarse potentials (Feydy et al., 2019a). GeomLoss multiscale combines both on the GPU but does not test the marginals it returns. Bringing a large problem to a prescribed residual with both ideas raises three practical issues. First, the solution of the coarser problem is only approximate, and checking whether it is accurate enough costs . Second, screening all point pairs to find the useful ones costs as well. Third, the surviving pairs are distributed unevenly across rows, yet GPU tensor cores require fixed-size tiles.
We introduce FlashSinkhorn 2 (FS2), which addresses these issues for squared-Euclidean costs in by coupling a coarse stage with a block-sparse fine stage. FS2 first groups nearby points into cells and solves the much smaller problem between the cell centroids. It then lifts this solution to the original points and checks it on randomly drawn rows and columns instead of all nm pairs. If the check fails, FS2 refines the centroid solution further and, if the check still fails, removes the error of replacing points by centroids with sparse updates on the points. These updates skip negligible pairs by screening fixed-size blocks of nearby points instead of single points, and each block pair they keep maps onto whole tensor-core tiles. Every update runs FlashSinkhorn's streaming kernel, so FS2 stores block-pair indices but no kernel entries. Our contributions are:
• Error guarantees. Building on Schmitzer (2019), we bound each omitted tile’s contribution to every row and column, and hence the full marginal residual. For the lift, we isolate the centroid error that only fine updates remove.
• GPU co-design. Cells and blocks are contiguous ranges of one Morton order. The fine stage screens block pairs, cutting the cost to , and runs each sparse half-step through FlashSinkhorn's fused kernel on the kept tiles.
• Large-scale evaluation. On one A100, FS2 solves discrete EOT between two -particle measures to a marginal residual below 0.01 in under 2.5 hours. To our knowledge, it is the largest discrete EOT problem solved to this accuracy within hours.
2.1 ENTROPIC OT AND FLASHSINKHORN
For point clouds , in , strictly positive probability weights , , and squared Euclidean cost , EOT solves
where . The optimal plan is , with dual potentials , . With denoting the log-sum-exp over the index , log-domain Sinkhorn uses the half-steps
Alternating updates apply the half-steps sequentially. Symmetric updates compute both from the same previous potentials, then average each updated potential with its previous value (Feydy, 2020). At converged balanced potentials, the source-coordinate gradient of EOT is , where is the barycentric projection of (Li et al., 2025).
FlashSinkhorn (FS) rewrites each half-step as a row-wise LSE reduction of a biased dot-product score matrix (Ye et al., 2026). For squared Euclidean cost, , so with shifted potentials and the first half-step becomes , and the second exchanges the points and weights. A fused Triton kernel (Tillet et al., 2019) computes each half-step in one pass over tiles, fixed-size submatrices of the score matrix. For each tile it forms the dot products as a matrix product (GEMM), adds the bias, and folds the tile's scores into a running LSE (Milakov & Gimelshein, 2018). The matrix products run on TF32 tensor cores, which offer higher throughput than FP32 at reduced mantissa precision. Scores and running statistics stay on chip and the kernel writes only the updated potentials to high-bandwidth memory (HBM), so FlashSinkhorn uses working memory without materializing the score matrix. KeOps (Charlier et al., 2021) evaluates the same reduction pair by pair in scalar FP32 arithmetic and forms no matrix product, so it does not use the tensor cores. Each dense half-step still evaluates all nm point pairs. The reduction streams over tiles, so a block mask can select the tiles the kernel visits, as in block-sparse variants of FlashAttention (Dao et al., 2022; Dong et al., 2025).
2.2 MULTISCALE SINKHORN AND RELATED APPROACHES
The remaining question is which tiles to skip. Prior multiscale Sinkhorn methods answer it through spatial coarsening and potential-based truncation. In the plan, the factor falls to at , so is the spatial scale of the regularization, called the blur. In a locally uniform cloud, a ball whose radius is proportional to the blur holds few of the target points when the blur spans a few nearest-neighbour spacings, so most point pairs carry negligible mass and screening pays off. The number of points in such a ball grows exponentially with the dimension , as the -th power of the blur over the spacing, and the methods below, including ours, therefore target .
Schmitzer (2019) combines coarsening and potential-based truncation with -annealing. It truncates the kernel at the current potentials, keeping only entries above a threshold, and bounds the resulting error in the primal–dual gap (Eq. (3.7) and Propositions 10–11). To find these entries without testing all of them, it descends a hierarchy of cells and discards each cell pair that a bound shows to be negligible. This search combines potential maxima and cost lower bounds with entrywise refinement (Definition 13 and Algorithm 4). The reported experiments use a single CPU core (Section 5.1). GeomLoss multiscale (Feydy et al., 2019a; Feydy, 2020) anneals on weighted cell centroids and lifts the coarse potentials to the points without checking them. Before the fine updates, it builds a cell-pair mask from the last coarse potentials, keeping a pair of cells when their centroid cost is below the sum of their potentials plus a default margin of . KeOps (Charlier et al., 2021) then evaluates the fine updates on the kept pairs. Because the centroid cost does not bound the point-pair costs from below, this mask approximates Schmitzer's truncation but carries no bound on the mass it drops. Domain-decomposition methods solve local entropic subproblems in parallel, on CPUs (Bonafini & Schmitzer, 2021) or, for regular grids, on GPUs (Medina & Schmitzer, 2025).
2.3 ADDITIONAL RELATED WORK
Other approaches replace the Sinkhorn half-steps with gradient-based or Newton-type optimization to reduce iteration counts. Kemertas et al. (2025b) combine mirror descent with conjugate gradients, and Kemertas et al. (2025a) achieve locally quadratic convergence with a truncated Newton method. Like Sinkhorn-Newton-Sparse (Tang et al., 2024) and cuRegOT (Qiu, 2026), these solvers retain work per iteration and become impractical at the problem sizes we target. Over-relaxed Sinkhorn iterations (Thibault et al., 2021; Lehmann et al., 2022) reduce the iteration count but also retain work per iteration. Nyström (Altschuler et al., 2019) and low-rank (Scetbon et al., 2021) methods approximate the kernel or plan globally rather than exploiting spatial locality. Hierarchical Refinement (Halmos et al., 2025) refines low-rank couplings recursively into a bijective Monge map in log-linear time, a different output from an EOT plan at a prescribed marginal residual.
Other multiscale methods address unregularized OT (Schmitzer, 2016; Gerber & Maggioni, 2017), and octree extensions apply the GeomLoss centroid test at successive resolutions (Schindler, 2025). Chowdhury et al. (2021) scale a quantized Gromov–Wasserstein variant to more than a million points. Sparse local corrections (Gasteiger et al., 2021) extend the Nyström approximation of Altschuler et al. (2019). Convolutional heat kernels on grids (Solomon et al., 2015) and nonequispaced fast Fourier transforms accelerate kernel application. Lakshmanan et al. (2023) report matrix-free Sinkhorn computations with points in low dimension. Screenkhorn fixes selected dual variables before solving the reduced problem (Alaya et al., 2019). Native Sparse Attention (Yuan et al., 2025) uses compressed representations to score, rank and select key/value blocks. Each selected block contains consecutive tokens, allowing contiguous loads and tiled matrix computations even when selected blocks are separated in the sequence. FS2 uses spatial blocks of points and selects tiles through the potential-dependent, mass-based rule in Section 3.2.
3 FLASHSINKHORN 2: ALGORITHM AND ANALYSIS
FS2 rests on two observations. First, coarse updates are cheap but cannot remove the error of replacing points by centroids. FS2 therefore stays on the centroids until coarse updates stall. It switches to fine updates (Sinkhorn updates on the points themselves) only if a sampled check of the lifted potentials fails (Section 3.1). Second, most block pairs carry negligible mass. Fine updates skip them using a threshold set by the block masses, with a bounded error (Section 3.2). Figure 1
GPU dataflow
Registers
- SRAM
HBM
Arrays
Group by prefix
Drop t low bits
Variable populations
(b) Coarse updates
Cell records
Morton-prefix order
FS backend
TF32 GEMM + LSE
Updated
anneal to
(c) Lift to points
At target
Original points X, Y
Rectangular lift
half-step from
half-step from
Point potentials
All coarse neighbours
(d) Marginal check
On original points
Sampled residual
Rows + columns
Full opposite cloud
Pass
Return
Rejected: (b)-(d) again at
Rejected again
(a) Morton order
4 points/block
Fine updates
Next fine update at target

Arrays in HBM
X 11 12 13 14
Y J1 J2 J3 J4 J5
(e) Box screen
Block summaries
box gap
-
max f
-
max g
J1 J2 J3 J4 J5
(f) Verification
Point blocks
One pair
passes
Keep tile
14 × J4
J1 J2 J3 J4 J5

Candidate CSR
Below cutoff: skip
(g) Sparse update
Point blocks
All CSR rows + transpose
11 J1 J2 J2
12 J2 J3 J3
13 J2 J4 J5
14 J4 J5
HBM storage
FS backend
TF32 GEMM + LSE
Updated f, g
Figure 1: FlashSinkhorn 2 overview (Algorithm 1), drawn with B=4. Panel (a) is the Morton order both stages share. Panels (b)–(d) are the coarse stage (Section 3.1) and panels (e)–(g) the fine stage (Section 3.2). Red outlines trace source block I4. Yellow and green mark candidate and admitted tiles. Purple denotes on-chip work, and hatched grey denotes HBM storage.
Algorithm 1 FlashSinkhorn 2 forward solver. Appendix B.2 gives the full stopping rules.
Require: Source X, target Y, probability weights a, b, regularization , tolerance
Ensure: pointwise potentials and the sampled-check outcome
1: Morton-sort, choose B and t, form blocks, boxes, and cells // (a)
2: anneal on centroids with FS streaming kernels to reach // (b)
3: lift: by one half-step of (2) against the coarse records // (c)
4: sample , then if both means plus three standard errors , return // (d)
5: continue coarse updates at until they stall, lift, then if the check passes, return
6: for each fine update within budget do
7: screen: keep with // (e)
8: verify: in CSR form // (f)
9: update: both sparse half-steps on from the same , then average // (g)
10: if a scheduled sampled check passes, return
11: end for
12: return potentials and check outcome
illustrates the dataflow and Algorithm 1 summarizes the solver. Appendix A gives the proofs and Appendix B the implementation details.
Both stages need spatially compact groups of points stored contiguously for coalesced GPU access. We sort the points by Morton key (Figure 1a), which interleaves the bits of the coordinates, so points that share a key prefix are contiguous and lie in one axis-aligned box. Two partitions of the sorted order serve the two stages: cells, whose points share all but the lowest t key bits, for the coarse stage of Section 3.1, and blocks of B consecutive points for the fine stage of Section 3.2. We replace each cell by its total mass and mass-weighted centroid, giving source records and target records . A finer partition reduces the distance from points to their centroids, but increases the pairs evaluated by each coarse update. The automatic policy chooses by comparing the estimated block-summary memory with the L2 budget, and takes the smallest whose coarse state fits the same budget, with at most twice as many cells as blocks.
3.1 COARSE SINKHORN UPDATES
The coarse stage solves the EOT problem between the cell records. We anneal with FlashSinkhorn's streaming TF32 kernels (Ye et al., 2026) (Figure 1b), running coarse updates along a decreasing -schedule, each from the potentials of the previous one. When the schedule first reaches the requested , we lift the coarse potentials to the original points (Figure 1c). The lifted is the first half-step of (2) with the coarse target records in place of , and is the second with in place of . The two lifts evaluate pairs.
The solver returns once a check finds both marginal residuals of the current plan, and , below a tolerance . Computing them exactly costs , so we check by sampling (Figure 1d). We draw rows with probability and average , where the row sum costs . The average is an unbiased estimate of the row residual, and columns are sampled in the same way. The check passes when both estimates plus three standard errors are below . Every residual we report is evaluated at the returned potentials, independently of the check. A lifted plan can miss for two reasons, which the following bound separates.
Proposition 1. Let be the entropic plan induced by any finite coarse potentials, its largest log column-mass error, the largest target-cell radius, and . The plan induced by the two lifts satisfies
With the clouds exchanged, the same bound holds for the column residual .
The proof is in Appendix A.1. The first term comes from inexact coarse marginals and vanishes at coarse convergence. The second bounds the error of replacing points by centroids. It grows like for small , and at coarse convergence it reduces to , which no coarse update changes. When the check rejects a lift, the solver therefore shrinks the first term with further coarse updates at the target , which cost only centroid pairs each, until its potentials stall or 2048 extra updates have run, and then lifts and checks again. If this check also fails, the solver turns to fine updates on the points, repeats the check on a schedule, and reports that the tolerance was not confirmed if the fine-update budget runs out first. On all our problems the bound of Proposition 1 exceeds , so the sampled check, not the bound, decides whether to accept a lift.
Outside the forward solve, the coarse records also yield a surrogate gradient for optimization. Holding the coarse target records fixed makes each lifted a function of alone, and the surrogate has gradient , where is the barycentric projection of against these records. The gradient costs the lift's pairs and needs no fine update. Appendix A.2 gives a condition on direction and step size sufficient to decrease the original objective.
3.2 SPARSE SINKHORN UPDATES
A dense fine update evaluates all nm point pairs, so FS2 restricts each fine update to the block pairs in a mask. We build the mask over the source and target blocks of at most B points by potential-dependent truncation of the current entropic plan . From here on, I and J index blocks rather than cells. Both half-steps share the mask, so its threshold must account for both block masses. The following bound makes this precise.
Theorem 1. Fix the potentials and . Write , , and define
If , then for every , and for every .
The proof is in Appendix A.3: bound each plan entry by , then sum the weights in the opposite block. Testing every directly would evaluate all nm point pairs, so we screen in two stages
(Figure 1e–f). First, a box screen rejects block pairs whose axis-aligned bounding boxes are far apart, using only block-level potential maxima , and the minimum squared distance :
This reduces the scan from nmd to . Second, a verification pass evaluates the exact over all point pairs of each candidate (a block pair that passes the box screen) and rejects those with . We store the admitted tiles in CSR form, which lists, for each source block , the target blocks with . The half-step reads this index and the half-step reads its transpose. If a block has no admitted tile, its sparse half-step would have no terms, so the solver computes it densely, against every point of the other cloud. The other blocks stay sparse.
Both the truncation principle, which rejects negligible pairs with the current potentials, and the block relaxation behind Equation (5) come from Schmitzer (2019), but FS2 differs from his solver in three ways. First, Schmitzer stores the truncated kernel, one entry per retained point pair, and iterates by sparse matrix-vector products. FS2 stores one index per admitted tile instead of its entries, because each sparse half-step runs FlashSinkhorn's streaming kernel (Section 2.1) over these tiles and recomputes their scores on chip. Second, Schmitzer refines a cell hierarchy recursively down to point pairs, whereas we screen all block pairs in parallel at a single level and keep whole tiles, since the kernel evaluates every pair of an admitted tile. Each kept tile spans two contiguous ranges of the Morton order, so the kernel loads both ranges with coalesced reads and forms their scores on tensor cores. Third, Schmitzer's threshold is uniform, whereas ours is set by the block masses. Because Theorem 1 certifies a mask only at the potentials used to build it, we rebuild the mask at every fine update. The mask also determines the error in each sparse update and in the gradient.
Proposition 2. Let be the fraction of row 's plan mass omitted by the mask, with positive retained mass. Then (i) the sparse and full row updates differ by , and (ii) the barycentric projection over the admitted columns satisfies diam( ).
The proof is in Appendix A.4. Both errors vanish with , which Theorem 1 bounds. Each omitted tile contributes at most to row , and a source block omits at most tiles, so , where tends to 1 as the marginals converge. This bound guides the choice of for a tolerance . The automatic policy takes , so in every row and the mass the mask omits, summed over all rows or over all columns, is at most . This also certifies the full residual. Let keep only the admitted tiles of , and let , where is for a rejected candidate and for a pair the box screen rejects. Then , at most , bounds the omitted mass. At the potentials used to build the mask, , and likewise for the columns. The sparse half-steps give the marginals of at no extra cost, since , and costs one reduction over values the two passes already form.
When an application needs an accurate gradient rather than the surrogate, FS2 evaluates the gradient on the points. It builds a mask at the returned potentials by the same rule and replaces by , the barycentric projection over the admitted tiles of the source block containing . A kernel computes it by streaming alongside the row sum, and the transposed index gives the target-side gradient in the same way. Proposition 2(ii) bounds the error that the mask adds, and the potentials' distance from convergence and the kernel's arithmetic add the rest.
Each fine update has three costs: the box screen ( ), the verification ( per candidate), and both sparse half-steps ( ). As the blur falls to a few nearest-neighbour spacings, drops well below and sparse updates become cheaper than dense ones. Beyond the points and potentials, working memory holds only the indices of the candidate and admitted tiles. Appendices A.5 and B.4 give the IO model and the complete operation count.
4 EXPERIMENTS
We evaluate FS2 on 32 synthetic problems and on the Quijote cosmological N-body simulation, measuring the time each solver takes to return potentials whose full two-sided marginal residual, , is at most a tolerance . On the synthetic problems (Sec-
FS2
GL
(a) Clustered

(b) Clustered
(e) Memory Clustered

(f) Residual trace Clustered
(c) Heterogeneous
(d) Heterogeneous

(g) Optimization Clustered
(h) Optimization Heterogeneous

Figure 2: FS2 vs GeomLoss (GL). (a–d) Time of a complete solve on 26 problems: n from to (a,c) and from 0.001 to 0.02 at (b,d). A cross marks a GL return with residual . (e) Peak GPU memory allocated by PyTorch. (f) On clustered , the time at which each new best full residual R is reached, for FS2's potentials along the solve and for GL's native returns. The residual decreases to the right. The dotted line marks and the arrow marks the first fine update. (g,h) Change in the grouped objective U over twenty optimization steps at , against cumulative end-to-end (E2E) time, including compilation and autotuning.
tion 4.1), we compare FS2 with GeomLoss multiscale and FlashSinkhorn and isolate its three ingredients: the coarse stage, the sparse fine stage and the surrogate gradient for optimization. On Quijote (Section 4.2), we scale FS2 from particles to the full -particle box.
Every solve runs on one A100, and FS2 receives centered, TF32-rounded coordinates. Any potentials induce the plan , which is the exact EOT solution for its own marginals P1 and P 1 (Peyré & Cuturi, 2019). Its error therefore lies entirely in these marginals, and R measures how far they are from a and b.
4.1 BENCHMARKS
Setup. We benchmark 32 problems in with uniform weights, 16 on clustered clouds of 32 Gaussian clusters and 16 on heterogeneous clouds that mix a compact Gaussian, a thin needle and a 1% uniform background. Both families span from to and from 0.001 to 0.02. This range of puts the blur between 0.032 and 0.14, or 3–14% of the side of the unit cube of the clustered clouds. All methods receive the same coordinates and the full squared-Euclidean cost, GeomLoss always runs its multiscale solver, and the target is . Appendix C gives the data, the protocol, the endpoint of every run and a sweep of GeomLoss's scaling and cluster scale.
Speed. FS2 meets on all 32 problems and GeomLoss on 10, all heterogeneous (Figure 2a–d). At the returned potentials, the certificate of Section 3.2 confirms for every return we evaluated on the 32 problems. Across 20 further sampling seeds on each of the seven problems closest to , the check never accepted potentials whose residual exceeds (Appendix C.4). On clustered problems GeomLoss misses at every size and regularization. Table 1a shows one such problem, , in full: FS2 meets in 15.4 s, GeomLoss ends its schedule after 21.45 s at residual 0.054, and FlashSinkhorn needs 312 s to reach 0.060, because each of its 44 updates evaluates all pairs. With its native schedule, GeomLoss misses on this problem at every scaling and cluster scale.
Table 1: FS2 against GeomLoss (GL) and FlashSinkhorn (FS) on the clustered , problem. Bold marks solves that meet . In (a), stage times are GPU kernel time from a separate profiled call, with sampled checks counted in the fine stage. is GL at scaling 0.99, continued at the target until its full residual first meets .
(a) Complete solve
| FS2 | GL | FS | ||
|---|---|---|---|---|
| Time (s) | 15.44 | 21.45 | 421.10 | 311.98 |
| coarse stage | 2.94 | 0.005 | 0.022 | - |
| fine stage | 12.30 | 21.40 | 420.67 | 311.98 |
| Fine updates | 18 | 12 | 225 | 44 |
| per update (s) | 0.68 | 1.78 | 1.87 | 7.09 |
| Memory (GiB) | 2.09 | 0.26 | 0.26 | 0.20 |
| Residual | 0.00483 | 0.05416 | 0.004997 | 0.05972 |
(b) One fine update per direction
| FS2 | GL | FS | |
|---|---|---|---|
| Point pairs () | 2.58 | 2.58 | 44.0 |
| Kernel time (ms) | 251 | 394 | 3,600 |
| ms per pairs | 0.97 | 1.53 | 0.82 |
| Warp instr. per pair | 0.28 | 0.63 | 0.34 |
| HBM read (B/ pairs) | 14.9 | 0.32 | 4.35 |
| Tensor pipe (%) | 21.1 | 0.07 | - |
| Math-pipe stall (%) | 2.3 | 17.4 | 9.0 |
Table 2: Ablations on clustered , .
| Control | Coarse | Fine | Time (s) | Time/FS2 |
|---|---|---|---|---|
| FS2 | 2196 | 15 | 4.17 | 1 |
| No coarse stage | 0 | 130 | 153.33 | |
| Early coarse stop | 404 | 1115 | 215.67 | 51.59 |
| Dense fine | 2196 | 15 | 33.33 | 8.00 |
| Box only | 2196 | 15 | 4.34 | 1.04 |
Coarse, Fine: updates. Early coarse stop: fine cap 8192.
Table 3: FS2 peak memory at .
| Cloud | n | B | Admitted | Peak (GiB) |
|---|---|---|---|---|
| Clustered | 128 | 6.3% | 0.85 | |
| Heterog. | 128 | 60.6% | 2.72 | |
| Heterog. | 128 | 59.8% | 9.89 | |
| Clustered | 128 | 5.2% | 16.17 | |
| Clustered | 256 | 5.6% | 6.88 | |
| Heterog. | 128 | no mask | 3.40 |
we tried, and the best setting needs 421 s when continued at the target until it meets (GL). Figure 2(f) shows how FS2 reaches on clustered . At , FS2 lifts after less than a second, because a coarse update evaluates centroid pairs rather than point pairs, and the lifted residual is already below GeomLoss's final one. Further coarse updates then lower the residual, and the fine updates remove the remaining centroid error, bringing the residual below in about a quarter of GeomLoss's time. At the blur is times wider relative to the cells, so the centroid error is smaller and the coarse stage alone reaches . GeomLoss returns sooner but misses it.
On the ten problems where both solvers meet , FS2 is faster than GeomLoss at its default cluster scale. The largest gap is on heterogeneous at , where FS2 returns in 4.026 s and GeomLoss takes 2595 s. On all ten, FS2's first lift already passes the check, so its only work on the points is that lift and the check. GeomLoss's default gives far fewer cells, wider than the final blur, so its schedule ends with levels on the points, and it never checks its lift. FS2 picks its cell count from the input. We tested that count on one of these ten problems, where GeomLoss also stops after its coarse stage and comes close to FS2 but remains slower.
Ablations. Each row of Table 2 removes or shortens one component of FS2. FS2 itself runs 2196 coarse updates and then needs just 15 fine updates. Without the coarse stage, the solve anneals on the points and misses even at the fine-update cap. Stopping the coarse stage after 404 updates instead leaves 1115 fine updates and makes the solve slower. With the same 15 fine updates, dense execution evaluates every tile rather than the the mask admits and is slower. The box screen alone, without tile verification, recovers almost all of this gain and is only slower.
Profiling insight. To see why FS2's fine update is fast, Table 1b profiles one, in both directions, with NCU on an A100, next to a dense FlashSinkhorn update and GeomLoss's KeOps executor on FS2's mask and potentials. FS2's update evaluates only of the point pairs of the dense update, and NCU measures a shorter kernel time. Per pair, the sparse kernel is nearly as cheap as the dense one, 0.97 against 0.82 ms per pairs, and executes fewer warp instructions. This holds although it gathers each admitted target block through the CSR index, while the dense kernel streams every block in order (Proposition 5). On the same mask, GeomLoss's KeOps executor takes longer and executes more instructions per pair, because FS2 computes the squared distances as tiled dot products on the tensor cores. FS2 even reads more HBM data per pair than GeomLoss, so on the same mask its speed comes from fewer instructions, not fewer bytes.
Memory. FS2 trades memory for speed by design. The selector keeps the coarse state and the block summaries within the L2 budget and, within it, picks the finest cells and blocks, so the coarse stage stays cheap and the mask screens at fine granularity. The price is the mask's index, 24 bytes per screened or admitted tile, which puts FS2's peak allocation at 8–10× that of either baseline in Table 1a. The peak follows the mask (Table 3). At the heterogeneous mask admits ten times the clustered share and needs three times the memory. At the heterogeneous solve returns its first lift and builds no mask, so its peak lies below the one at . Without a mask, as at for , the peak grows only as GeomLoss's does. At fixed the mask grows faster than , because each point has more neighbours within the blur, so over the clustered sweep at the peak rises 40-fold while rises 16-fold (Figure 2e). Larger blocks cut this cost. At , instead of the selected 128 lowers the peak from 16.2 to 6.9 GiB for slightly more time, and the selector itself takes for the Quijote run, whose peak stays within the 80 GiB card.
Optimization. Many applications move points along an OT gradient and need a descent direction rather than an exact gradient. We test FS2's direction and its end-to-end cost by moving the source points to decrease their EOT cost (Equation (1)) to a fixed target cloud, with no other term in the objective. FS2 steps along the surrogate gradient , which takes the barycentric projection over the coarse target centroids instead of the targets. A step therefore costs one coarse solve and one pass over the centroids, and needs no fine update. A small step along any direction whose relative error to the exact gradient is below one decreases the objective (Proposition 4). On each of the 32 inputs, both methods take twenty normalized steps , with for FS2 and, for GeomLoss, the autograd gradient with respect to the source points, which costs about one forward solve per step. Each step moves the points by RMS, so the twenty steps measure the direction at the initial points rather than following a long flow. Both methods' iterates are scored by the same grouped objective , which fixes groups of the initial source points and of the targets and adds the EOT cost between the mass-weighted group centroids, solved accurately, to the mean squared distance of the points to their group centroids. This score ranks the iterates without a full-point solve, and the surrogate lowers it at every checkpoint on all 32 inputs. At (Figure 2g,h), FS2 is faster end to end on heterogeneous data, with tied final scores. On clustered data it reaches a lower final at both , and is also faster at . GeomLoss is faster only at clustered , where its forward solve takes 0.03 s but misses .
4.2 QUIJOTE PARTICLE TRANSPORT
Problem and data. We test FS2 on one fiducial realization of the Quijote cosmological N-body suite, dark-matter particles in a periodic Gpc box (Villaescusa-Navarro et al., 2020). The sources are the redshift-zero positions and the targets are the Lagrangian lattice sites , both with uniform weights. The particle IDs define the reference displacements but are hidden from the solve. Nested subdomains centered in the box give from to , the full box. We fix the blur Mpc/h at one lattice spacing, the mean interparticle distance and 0.2–0.4% of the domain width, and use the plain squared-Euclidean cost, which ignores the periodic wrap of the box. The evolved cloud is strongly clustered and far from the lattice. In the subdomain the median particle lies 4.6 blurs from its lattice site. At this blur the coarse stage alone does not reach the target, so every solve's fine updates start from the first lift. We set the cell level and the fine-update cap for each size. Appendix D gives the data, the protocol and every run.
Scaling. At , FS2 meets the target at all four sizes of Figure 3, verified on sampled points at the two intermediate sizes. From to particles, the time grows 9.2-fold for an 8-fold increase in n, and the peak memory stays within the 80 GiB card. As on the clustered benchmarks, the fine stage does most of the work. It begins within the first 3% of each run's time and lowers the sampled residual from about 1 to the target. GeomLoss multiscale at scaling 0.95 takes 25 times as long as FS2 at and still misses . Its time grows almost quadratically with n on the synthetic benchmarks, so we run it only at . At , a first complete call of FS2 solves the full box, particle pairs, on one A100 in under 2.5 hours. Its full marginal residual is below 0.01, even after an FP64 correction estimated on sampled points. The certificate of Section 3.2 gives the same bound from one mask build at the returned potentials, in minutes rather than the hours of the full evaluation. To our knowledge, the full box is the largest discrete EOT problem solved to this

Particles per measure
(d) Key results
| τ | Time (s) | R | ||
|---|---|---|---|---|
| FS2 | 0.05 | 147 | 0.047 | |
| GL | 0.05 | 3713 | 0.058 | |
| FS2 | 0.05 | 1352 | 0.049 | |
| FS2 | 0.01 | 8833 | 0.009 | |
| FS2 | Zero | |||
| RMSE (Mpc/h) | 6.47 | 10.06 | ||
Figure 3: FS2 on Quijote. (a) Time of a complete warm call of FS2 at . The cross marks GL's instrumented call at . (b) Peak GPU memory allocated by PyTorch, and the selected block size . (c) Best sampled residual versus time. Diamonds mark the first fine update and dotted lines the targets. (d) Key results. Orange marks a return with residual above , and RMSE is the displacement error of the solution at and of a zero-displacement predictor.
accuracy within hours, and it matches the particle count of the semi-discrete reconstruction of Lévy et al. (2025).
Displacement reconstruction. The plan also estimates each particle's displacement. On 4096 particles sampled from the , solution, the barycentric projection of Section 2.1, taken over all targets, gives displacements whose RMSE against the particle-ID displacements , both wrapped to the periodic box, is below that of predicting no displacement (Figure 3d). The three components correlate equally well with the reference, and particles whose reference trajectories cross a periodic face have larger errors than the rest.
5 CONCLUSION AND LIMITATIONS
We introduced FlashSinkhorn 2 (FS2), which solves large discrete EOT problems to a prescribed marginal residual by coupling a coarse stage on cell centroids with a block-sparse fine stage that removes the centroid error. On synthetic benchmarks, FS2 reaches the target residual on all 32 problems and GeomLoss on 10. On one A100 it solves EOT between two -particle measures, at a blur of one lattice spacing, to a marginal residual below 0.01 in under 2.5 hours.
FS2 targets squared-Euclidean cost in , where a blur-sized ball holds few points and screening pays off. Reaching the points that Lévy et al. (2025) set as the goal for cosmology needs blocks spread over several GPUs, because the coordinates of one measure alone take 112 GiB in FP32, more than an A100's 80 GiB. It also needs a sub-quadratic pair search, such as a dual-tree traversal (Lee et al., 2011), because the box screen tests every block pair.
AI USE STATEMENT
Generative AI tools (Anthropic's Claude through Claude Code, and OpenAI's Codex) assisted with code, experiments, figures and editing. The authors checked every reported number against the experiment records and take full responsibility for the content.
REFERENCES
Mokhtar Z. Alaya, Maxime Bérar, Gilles Gasso, and Alain Rakotomamonjy. Screening Sinkhorn algorithm for regularized optimal transport. In Advances in Neural Information Processing Systems 32 (NeurIPS), 2019. URL https://arxiv.org/abs/1906.08540.
Jason Altschuler, Francis Bach, Alessandro Rudi, and Jonathan Niles-Weed. Massively scalable Sinkhorn distances via the Nyström method. In Advances in Neural Information Processing Systems 32 (NeurIPS), 2019. URL https://arxiv.org/abs/1812.05189.
Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein generative adversarial networks. In International Conference on Machine Learning, pp. 214–223, 2017.
R. R. Bahadur and L. J. Savage. The nonexistence of certain statistical procedures in nonparametric problems. The Annals of Mathematical Statistics, 27(4):1115–1122, 1956.
Mauro Bonafini and Bernhard Schmitzer. Domain decomposition for entropy regularized optimal transport. Numerische Mathematik, 149(4):819–870, 2021. doi: 10.1007/s00211-021-01245-0.
Charlotte Bunne, Geoffrey Schiebinger, Andreas Krause, Aviv Regev, and Marco Cuturi. Optimal transport for single-cell and spatial omics. Nature Reviews Methods Primers, 4(1):58, 2024.
Benjamin Charlier, Jean Feydy, Joan Alexis Glaunès, François-David Collin, and Ghislain Durif. Kernel operations on the GPU, with autodiff, without memory overflows. Journal of Machine Learning Research, 22(74):1–6, 2021.
Samir Chowdhury, David Miller, and Tom Needham. Quantized Gromov-Wasserstein. In Machine Learning and Knowledge Discovery in Databases (ECML PKDD), volume 12977 of Lecture Notes in Computer Science, pp. 811–827, 2021. doi: 10.1007/978-3-030-86523-8_49. URL https://arxiv.org/abs/2104.02013.
Marco Cuturi. Sinkhorn Distances: Lightspeed computation of optimal transport. In Advances in Neural Information Processing Systems, volume 26, 2013.
Tri Dao, Dan Fu, Stefano Ermon, Atri Rudra, and Christopher Ré. FlashAttention: Fast and memory-efficient exact attention with IO-awareness. In Advances in Neural Information Processing Systems, volume 35, pp. 16344–16359, 2022.
Juechu Dong, Boyuan Feng, Driss Guessous, Yanbo Liang, and Horace He. Flex attention: A programming model for generating optimized attention kernels. In Proceedings of Machine Learning and Systems (MLSys), volume 7, 2025. arXiv:2412.05496.
Jean Feydy. Geometric data analysis, beyond convolutions. PhD thesis, Université Paris-Saclay, 2020.
Jean Feydy, Pierre Roussillon, Alain Trouvé, and Pietro Gori. Fast and scalable optimal transport for brain tractograms. In Medical Image Computing and Computer Assisted Intervention (MICCAI), pp. 636–644, 2019a. doi: 10.1007/978-3-030-32248-9_71.
Jean Feydy, Thibault Séjourné, François-Xavier Vialard, Shun-ichi Amari, Alain Trouvé, and Gabriel Peyré. Interpolating between optimal transport and MMD using Sinkhorn divergences. In International Conference on Artificial Intelligence and Statistics, pp. 2681–2690, 2019b.
Uriel Frisch, Sabino Matarrese, Roya Mohayaee, and Andrei Sobolevski. A reconstruction of the initial conditions of the Universe by optimal mass transportation. Nature, 417:260–262, 2002. doi: 10.1038/417260a.
Johannes Gasteiger, Marten Lienen, and Stephan Günnemann. Scalable optimal transport in high dimensions for graph distances, embedding alignment, and more. In Proceedings of the 38th International Conference on Machine Learning (ICML), 2021. URL https://arxiv.org/abs/2107.06876.
Samuel Gerber and Mauro Maggioni. Multiscale strategies for computing optimal transport. Journal of Machine Learning Research, 18(72):1–32, 2017.
Peter Halmos, Julian Gold, Xinhao Liu, and Benjamin J. Raphael. Hierarchical refinement: Optimal transport to infinity and beyond. In Proceedings of the 42nd International Conference on Machine Learning, volume 267 of Proceedings of Machine Learning Research, pp. 21629–21661, 2025.
Mete Kemertas, Amir-massoud Farahmand, and Allan D. Jepson. A truncated Newton method for optimal transport. In International Conference on Learning Representations (ICLR), 2025a. URL https://arxiv.org/abs/2504.02067.
Mete Kemertas, Allan D. Jepson, and Amir-massoud Farahmand. Efficient and accurate optimal transport with mirror descent and conjugate gradients. Transactions on Machine Learning Research, 2025b. URL https://openreview.net/forum?id=FVFqrxeF8e.
Dominik Klein, Giovanni Palla, Marius Lange, Michal Klein, Zoe Piran, Manuel Gander, Laetitia Meng-Papaxanthos, Michael Sterr, Lama Saber, Changying Jing, Aimée Bastidas-Ponce, Perla Cota, Marta Tarquis-Medina, Shrey Parikh, Ilan Gold, Heiko Lickert, Mostafa Bakhti, Mor Nitzan, Marco Cuturi, and Fabian J. Theis. Mapping cells through time and space with moscot. Nature, 638(8052):1065–1075, 2025. doi: 10.1038/s41586-024-08453-2.
Rajmadan Lakshmanan, Alois Pichler, and Daniel Potts. Nonequispaced fast Fourier transform boost for the Sinkhorn algorithm. Electronic Transactions on Numerical Analysis, 58:289–315, 2023. doi: 10.1553/etna_vol58s289.
Dongryeol Lee, Alexander G. Gray, and Andrew W. Moore. Dual-tree fast Gauss transforms. arXiv preprint arXiv:1102.2878, 2011. URL https://arxiv.org/abs/1102.2878.
Tobias Lehmann, Max-K. von Renesse, Alexander Sambale, and André Uschmajew. A note on overrelaxation in the Sinkhorn algorithm. Optimization Letters, 16(8):2209–2220, 2022.
Bruno Lévy, Nicolas Ray, Quentin Mérigot, and Hugo Leclerc. Large-scale semi-discrete optimal transport with distributed Voronoi diagrams. Journal of Computational Physics, 542:114374, 2025. doi: 10.1016/j.jcp.2025.114374. arXiv:2406.04192.
Xingjie Li, Fei Lu, Molei Tao, and Felix X-F Ye. Robust first- and second-order differentiation for regularized optimal transport. SIAM Journal on Scientific Computing, 47(3):C630–C654, 2025. doi: 10.1137/24M1674030.
Ismael Medina and Bernhard Schmitzer. Flow updates for domain decomposition of entropic optimal transport. ESAIM: Mathematical Modelling and Numerical Analysis, 59(3):1239–1270, 2025. doi: 10.1051/m2an/2025022.
Maxim Milakov and Natalia Gimelshein. Online Normalizer Calculation for Softmax. arXiv preprint arXiv:1805.02867, 2018.
Gabriel Peyré and Marco Cuturi. Computational Optimal Transport. Foundations and Trends in Machine Learning, 11(5-6):355–607, 2019.
Yixuan Qiu. cuRegOT: A GPU-Accelerated Solver for Entropic-Regularized Optimal Transport. arXiv preprint arXiv:2605.08793, 2026. URL https://arxiv.org/abs/2605.08793.
Meyer Scetbon, Marco Cuturi, and Gabriel Peyré. Low-rank Sinkhorn factorization. In International Conference on Machine Learning, pp. 9344–9354, 2021.
Geoffrey Schiebinger, Jian Shu, Marcin Tabaka, Brian Cleary, Vidya Subramanian, Aryeh Solomon, Joshua Gould, Siyan Liu, Stacie Lin, Peter Berube, Lia Lee, Jenny Chen, Justin Brumbaugh, Philippe Rigollet, Konrad Hochedlinger, Rudolf Jaenisch, Aviv Regev, and Eric S. Lander. Optimal-Transport analysis of single-cell Gene expression identifies developmental trajectories in reprogramming. Cell, 176(4):928–943.e22, 2019.
Marwin Schindler. Shape shifting: A multiscale optimal transport approach to 3D point cloud comparison. Master's thesis, TU Wien, 2025. URL https://repositum.tuwien.at/handle/20.500.12708/216205.
Bernhard Schmitzer. A sparse multiscale algorithm for dense optimal transport. Journal of Mathematical Imaging and Vision, 56(2):238–259, 2016. doi: 10.1007/s10851-016-0653-9. URL https://arxiv.org/abs/1510.05466.
Bernhard Schmitzer. Stabilized sparse scaling algorithms for entropy regularized transport problems. SIAM Journal on Scientific Computing, 41(3):A1443–A1481, 2019.
Justin Solomon, Fernando de Goes, Gabriel Peyré, Marco Cuturi, Adrian Butscher, Andy Nguyen, Tao Du, and Leonidas Guibas. Convolutional Wasserstein Distances: Efficient optimal transportation on geometric domains. ACM Transactions on Graphics, 34(4):66:1–66:11, 2015.
Xun Tang, Michael Shavlovsky, Holakou Rahmanian, Elisa Tardini, Kiran Koshy Thekumparampil, Tesi Xiao, and Lexing Ying. Accelerating Sinkhorn Algorithm with Sparse Newton Iterations. In The Twelfth International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=Kuj5gVp5GQ.
Alexis Thibault, Lénaïc Chizat, Charles Dossal, and Nicolas Papadakis. Overrelaxed Sinkhorn–Knopp algorithm for regularized optimal transport. Algorithms, 14(5):143, 2021. doi: 10.3390/a14050143.
Philippe Tillet, Hsiang-Tsung Kung, and David Cox. Triton: An intermediate language and compiler for tiled neural network computations. In Proceedings of the 3rd ACM SIGPLAN International Workshop on Machine Learning and Programming Languages, pp. 10–19, 2019.
Francisco Villaescusa-Navarro, ChangHoon Hahn, Elena Massara, et al. The Quijote simulations. The Astrophysical Journal Supplement Series, 250(1):2, 2020. doi: 10.3847/1538-4365/ab9d82.
Felix X.-F. Ye, Xingjie Li, An Yu, Ming-Ching Chang, Linsong Chu, and Davis Wertheimer. FlashSinkhorn: IO-aware entropic optimal transport on GPU. In Proceedings of the 43rd International Conference on Machine Learning, volume 306 of Proceedings of Machine Learning Research. PMLR, 2026.
Jingyang Yuan, Huazuo Gao, Damai Dai, Junyu Luo, Liang Zhao, Zhengyan Zhang, Zhenda Xie, Yuxing Wei, Lean Wang, Zhiping Xiao, Yuqing Wang, Chong Ruan, Ming Zhang, Wenfeng Liang, and Wangding Zeng. Native sparse attention: Hardware-aligned and natively trainable sparse attention. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 23078–23097, 2025. doi: 10.18653/v1/2025.acl-long.1126.
A PROOFS FOR SECTION 3
A.1 PROOF OF PROPOSITION 1
Let , be finite coarse potentials, not necessarily converged, with coarse plan and target marginal ratios
The first lift defines weights with , and is the conditional distribution over source centroids for target cell , with mean . For write and
Substituting both lifts into the fine plan and expanding the squared distances, the two copies of cancel, and
Proof. Fix and , and put and , so that . Exact centroids are convex combinations of points, so . With and the mean and variance of under probabilities proportional to , we have and . Since and on , , and
The cell average of vanishes because is the exact mass-weighted centroid, so . Substituting into Equation (6) with , and gives, for every row,
and multiplying by and summing proves Equation (3). The column bound exchanges the roles of the two clouds.
Exact coarse convergence does not remove the second term. Let both measures put mass 1/2 at -h and h, aggregated into one cell at zero. Then is optimal, the lifted potentials are , and .
Size of the bound on the grid. On the 32 grid problems of Section C.3, ranges from 2.1 to 143 for rows and from 2.1 to 145 for columns, so the second term of Equation (3) exceeds 4.8 everywhere and the bound never accepts a lift, while the 20 lifted returns have residuals of at most 0.0041. The two terms still separate the two ways a lift fails. On clustered problems with , extra coarse updates lower the lifted residual. On heterogeneous problems at and , and on clustered at , it stays flat, and fine updates are required.
Stored centroids. The proof uses exact centroids. FS2 rounds the aggregated coordinates once to TF32, so that the same stored coordinates supply the norms, the dot products and the lift, and this rounding changes the potentials by about and the lift's residual by 0.5%.
A.2 COORDINATE GRADIENTS FROM COARSE POTENTIALS (PROPOSITIONS 3 AND 4)
At each outer step the optimization rebuilds the geometry at the current iterate and anneals on the cells until it first reaches . The target centroids , masses and potentials are then held fixed, so gradients do not pass through the partition, the centroids or the coarse updates. With the source coordinates replaced by , let
At these are the lift weights of Section A.1 and the projection of Section 3.1, and direct differentiation gives , the gradient formula of Section 3.1.
The surrogate gradient can differ from a gradient built on a fine barycentric projection in two ways. Let be any normalized conditional distribution over the target points for source row , , and, when , . With , let and .
Proposition 3. For and ,
Consequently, for and ,
Proof. Insert the intermediate barycentre . The within-cell term satisfies
The differences sum to zero, so their positive and negative parts both have total mass . If , the two centroid averages coincide. Otherwise
The two sums in parentheses are convex combinations of the same centroid set and their distance is at most its diameter. This proves . The first claim follows by another triangle inequality. Multiplying row by , squaring, and summing proves Equation (8).
The first term of Equation (7) is quantization and the second the difference in conditional weights, which includes coarse solve error. With , is the gradient of the converged balanced OT value.
Proposition 4. Let , let be a supplied direction, and write . Suppose the gradient of is -Lipschitz, with , on the segment from to . Then
If and , the objective decreases. A sufficient condition for is with , which implies .
Proof. Let . The descent lemma for a -smooth function gives
Since , this is Equation (9), and the stated step-size condition makes its right-hand side strictly smaller than .
For the relative-error claim, set , , and . If , then , and therefore
where the last step is the arithmetic–geometric mean inequality.
A.3 PROOF OF THEOREM 1
Proof. Write the plan at the current potentials, with no convergence assumed, as
Every exponent in the tile is at most , so for , , and summing over the opposite block gives
Since and both block masses are at most , the hypothesis bounds the two right-hand sides by and .
One bound thus serves both directions, because the row bound carries the factor , the column bound carries , and one of the two is always 1. The box screen is conservative, because , and give
so a pair that fails Equation (5) has . Both bounds use only pointwise inequalities at the current potentials and hold at every level of the schedule. The screen depends on the potentials only through , so it is invariant under the shift , , which leaves the plan unchanged. A rule built on would give different masks for these equivalent potential pairs.
Non-uniform weights. Every benchmark uses uniform weights, for which is the constant whenever divides . We rerun the two problems of Table 4 with the non-uniform weights of FlashSinkhorn's public benchmark code (Ye et al., 2026), with uniform on , and with a rank power law. FS2 meets in all four cases, and the per-point bound of Theorem 1 holds everywhere. Against a scalar rule that uses the largest block mass for every pair, the mass-dependent rule admits 0.3–0.5% fewer block pairs under the first weighting and 2.9–5.3% fewer under the power law, with the same number of fine updates.
A.4 PROOF OF PROPOSITION 2
Proof. (i) Write . The common factor cancels from the omitted mass ratio, so the restricted sum is and
The column update is identical.
(ii) The masked projection restricts both sums of to the admitted columns. Subtracting it from the full projection gives the exact identity
whose denominator sums over all targets, and the triangle inequality gives
The middle term of Equation (14) keeps the distance of each omitted contribution, so it is much smaller than the diameter bound when the omitted mass lies near the masked projection. The diameter bound is nevertheless sharp. Take two identical one-dimensional clouds, each with points at and at , uniform weights and one block per location. At the balanced optimum every row sends the fraction to the opposite location, so when the admission rule keeps only the two same-location tiles. For , while . By (ii), the source gradient changes by at most diam(Y) when the masked projection is used.
Measured error. Table 4 evaluates Proposition 2 at the potentials FS2 returns on the clustered and heterogeneous , problems, with the production and with as a positive control. One FP64 pass over all pairs splits each row's mass and first moment into admitted and omitted sums. No row exceeds either bound, and the looser mask raises the largest error 50–70-fold, so the production values are not a floor of the measurement. The block-sparse gradient kernel, run on the production mask, adds its own arithmetic error. Against the FP64 masked gradient it is within (clustered) and (heterogeneous) in relative in FP32, far above the masking error of the table.
A.5 IO MODEL (PROPOSITION 5)
The dense FlashSinkhorn kernel moves scalars between HBM and fast memory of size (Ye et al., 2026). For the sparse traversal of Algorithm 3, the count is governed by neighbour-record misses.
Proposition 5. Let a neighbour block record occupy scalars. Suppose one source block's queries and accumulators stay resident in fast memory of size for a fixed constant , costs are computed online, CSR indices are read once per traversal, and caches are cold at the
Table 4: Proposition 2 at FS2's returned potentials, , : largest values over all rows. The column divides by the Theorem 1 bound , the error column by diam(Y), and the gradient compares with .
| Cloud | factor | Admitted | Max | over Thm. 1 bound | Max error | over diam(Y) | Gradient rel. |
|---|---|---|---|---|---|---|---|
| Clustered | 1 | 6.33% | 0.005 | 0.48 | |||
| Clustered | 64 | 5.32% | 0.005 | 0.48 | |||
| Heterog. | 1 | 60.54% | 0.023 | 0.23 | |||
| Heterog. | 64 | 49.24% | 0.038 | 0.23 |
start of each half-step. If and count neighbour-record misses along the CSR and its transpose, one iteration evaluating both directions moves
scalars between slow and fast memory. Each miss count lies between the number of active neighbour blocks in its traversal and .
Proof. We count the half-step, and the half-step is the same count on the transposed index. Each of the source blocks moves its queries and writes back once, scalars, because both stay resident for the whole row. Over both directions this is . The traversal reads crow once and each entry of col once, scalars, and is absorbed by the first term. An empty row reads no neighbour record. Its repair is a dense reduction, counted with the dense updates in Equation (19). Visiting an admitted pair needs , and , scalars, and moves nothing when the record is already resident. The visits that miss contribute . Summing gives Equation (15). Each half-step starts cold, so every active neighbour block misses at least once. At most one miss is charged per admitted pair, so lies between the number of active neighbour blocks and , and so does .
On-chip memory is private to each program, and within one row the CSR entries are distinct, so a neighbour record can be reused across source blocks only through L2. The upper end, one gather per admitted pair, is therefore the bound that always holds. Unlike the dense case, enlarging does not reduce it, because the admitted columns of a row form an arbitrary subset.
B IMPLEMENTATION DETAILS
B.1 BLOCK SIZE AND COARSE CELLS
The automatic policy chooses the block size from by estimating the memory of the block summaries. Each summary holds a bounding box, a potential maximum and a log block mass, 32 bytes for , so the summaries of both clouds take bytes, with and . The chosen keeps this estimate within , where is the physical L2 cache size, so the budget forces larger blocks on larger clouds.
For each , we count the occupied prefixes of the sorted 63-bit Morton keys. Smaller gives a finer partition. We choose the smallest satisfying
The first two conditions limit the coarse point count relative to the execution blocks. The third limits estimated storage for coarse arrays, and the fourth checks signed 32-bit offsets for coordinates padded to width 16. The fourth errs by one on the safe side, so it excludes , whose largest offset still fits. Cell counts come from the sorted keys, without solving a coarse problem for each . The budget constants are empirical. They make the cells and blocks as fine as memory allows, which raises memory traffic.
B.2 FORWARD SOLVER AND STOPPING RULES
Sampled check. In exact arithmetic , where is the unrestricted row update, so for potentials fixed independently of the sample, drawing with probability gives
and columns drawn with estimate in the same way. The check draws 1024 indices per side with seed 0, reduces each sampled marginal over all opposite points, and bounds each residual by its sample mean plus three standard errors. It passes when the larger bound is below and fails when a mean minus three standard errors exceeds . Otherwise it evaluates 8192 further indices and passes only if their bound is below . No sample size gives a distribution-free guarantee on a mean (Bahadur & Savage, 1956). With uniform weights, draws miss a given row with probability , and the solver draws the indices once per solve and reuses them at every check, so the potentials at the stopping check depend on the sample, whereas Equation (17) assumes they do not. The check can therefore accept potentials whose full residual exceeds , and every reported residual comes from a full evaluation, except at two intermediate Quijote sizes. Section C.4 measures how often the check accepts such potentials on the grid.
Coarse stage. The coarse solve anneals on the Morton-prefix cells of Section 3 with GeomLoss's -scaling schedule, from the diagonal of the joint bounding box down to the blur with scaling 0.95 and averaged updates, and lifts when it first reaches the requested . If the sampled check rejects the lift, the solver completes the 64-entry target- tail, lifts and checks again, and then continues in batches of 64 coarse updates. After each batch it evaluates, from the shifted coarse potentials before and after the last averaged update,
accumulated in FP64. In exact arithmetic is the larger of the two mass-weighted coarse log-marginal errors before that update. These are means, whereas in Proposition 1 is a maximum over target cells, so the stop does not bound the first term of Equation (3). Extra coarse work stops after two consecutive batches with , three consecutive relative improvements below 1%, or 2048 extra updates. A non-finite discards the extra batches. The refined state is lifted and checked.
Fine stage. The lifted pair initializes the fine updates without another annealing schedule. The two symmetric half-steps start from the same incoming potentials, so one mask, rebuilt before every fine update, serves both. The first two ordinary updates are checked one by one. Afterwards the check interval is the smallest of 1, 2, 4, 8 and 16 updates whose combined time is at least ten times that of a check, and 1 once the 1024-index bound is at most , with further checks at every 16th update and at the cap. A terminal preview is a complete fine update with its own mask that forms unaveraged potentials from the same incoming pair. It runs after the re-lift that ends the coarse continuation, after the second ordinary update, at every 16th ordinary update once the 1024-index bound is at most , and at the cap. A rejected preview does not enter the ordinary trajectory, and the fine-update counts of Section 4.1 include previews.
Return. The solver returns as soon as a sampled check passes. At the fine-update cap, 128 ordinary updates unless stated otherwise, it returns the checked potentials with the best finite sample score and reports the tolerance as not confirmed. If no score is finite, it returns the retained lift.
B.3 MASK CONSTRUCTION AND SPARSE HALF-STEPS
Algorithm 2 builds the candidates of the box screen Equation (5) in CSR form, and verification then evaluates on each candidate tile. Algorithm 3 gives the sparse half-step over the admitted blocks, and the half-step runs the same kernel on the transposed index.
All forward solves form the dot products on TF32 tensor cores with FP32 accumulation, keep the potentials in FP32, and add the bias in FP32 after the dot product. Folding the bias into the dot as an extra coordinate would round an operand to TF32, an absolute logit error of about 5 at .
Algorithm 2 BUILDMASK: Equation (5) as two Triton passes over block rows, one counting and one writing. Both scan the full grid with the predicate in registers. Each tile test costs about operations, about 0.010 per point pair at and .
Require: boxes , , block maxima , , log masses , , ,
Ensure: CSR arrays crow, col
1: for each block row in parallel do
2: // pass 1: count
3: for each tile of column blocks do
4: // per-axis box separation
5: // lower-bounds every pair in the tile
6: // Equation (5), is hoisted
7:
8: end for
9: write to HBM
10: end for
11: crow ExclusiveScan( ) // offsets exist before any row writes
12: if crow[ ] exceeds the index type then raise // refuse rather than wrap silently
13: for each block row in parallel do
14: base crow[ ], // pass 2: fill
15: for each tile of column blocks do
16: recompute keep in registers // cheaper than storing a dense Boolean mask
17: pos ExclusiveScan(keep) // slot inside this tile
18: col[base + ] where keep // one program per row, so ascending
19:
20: end for
21: end for
Algorithm 3 SPARSELSE: the streaming -update over the admitted blocks. The online max/sum-exp recurrence is FlashSinkhorn's, run here over a CSR row rather than over every column block. The cost is never formed either way.
Require: , , , , CSR (crow, col),
Ensure:
1: // precompute the weight bias
2: for each block row of size do
3: load to SRAM, , // running max and sum-exp
4: ,
5: for do
6: , load , , to SRAM // admitted blocks only
7: // one kernel tile, the cost is never formed
8:
9: ,
10: end for
11: , write to HBM // over the admitted blocks
12: end for
B.4 OPERATION COUNT
Let count all coarse updates, including annealing and additional iterations at the requested , and let count paired lifts. Each contributes respectively and operations. For sampled checks, define , where are the actual sample sizes in check . Both stages of an enlarged check contribute to this sum.
For fine update , let be the bounding-box candidates and the verified tiles. Computing potential maxima and scanning block pairs costs . Verification and the two sparse half-steps cost . Writing and transposing the indices adds as a conservative bound including sorting, where . Let
count point pairs evaluated by dense updates and empty-row repairs. The complete arithmetic and index work is bounded by
(19)
The sum runs over ordinary updates and terminal previews, rejected ones included, and each dense update adds its nm evaluations to . No score matrix is stored. Beyond the point and coarse arrays, memory holds the candidate and admitted CSR indices, and an index with z nonzeros is allocated only if it fits signed 32-bit offsets and bytes, with the free GPU memory. The selector's limits give and . Both remain quadratic in n at fixed B.
C SYNTHETIC BENCHMARKS
After the setup and the GeomLoss baseline, the subsections follow the paragraphs of Section 4.1 in order, each with its own protocol.
C.1 SETUP
Unless stated otherwise, every run uses one A100 with PyTorch 2.8.0+cu128, Triton 3.4.0, GeomLoss 0.3.1 and PyKeOps 2.3. The kernel profiles of Section C.6 use a separate A100. Inputs are three-dimensional with uniform weights and seed zero, and all methods receive the same centered, TF32-rounded coordinates and the full squared-Euclidean cost, without a factor of 1/2, so GeomLoss's default blur of 0.05 is the grid point . Times are warmed complete calls, from preparation and parameter selection to return, and exclude input loading, compilation and validation. Grid endpoints are single calls, and comparisons and ablations report medians of three. Accuracy is the full residual R of the returned potentials (Section 4), evaluated on all points, against . Peak memory is the largest PyTorch allocation, inputs included, in a separate warmed call.
Methods compared
• FS2: the automatic policy of Section B, which chooses over 64 on every problem and, for , the cell levels and 42 on clustered and 43, 42, 41, 40 and 39 on heterogeneous clouds.
• GeomLoss multiscale: its native multiscale solver with scaling 0.9, default cluster scale and truncation 5, with KeOps for the fine reductions.
• FlashSinkhorn: its native dense solver with scaling 0.9.
Neither baseline gets added refinement or a residual-based stopping rule.
Data. A clustered cloud draws 32 centers uniformly in and places each point at a uniformly chosen center plus isotropic Gaussian noise of standard deviation 0.02. Source and target draw their centers independently. A heterogeneous cloud mixes three components: 80% of the points in a compact Gaussian at with standard deviations , 19% in a thin needle at with standard deviations , rotated by 0.6 rad about the z-axis, and 1% uniform background in . The target shifts the two Gaussian centers by and and is drawn independently.
C.2 GEOMLOSS MULTISCALE WORKFLOW
The evaluated GeomLoss 0.3.1 point-cloud backend (Feydy et al., 2019a; Feydy, 2020) uses two resolutions, the weighted centroids of cells of side and the original points. It follows a decreasing schedule on the centroids, switches to the points just before the first level whose blur falls below , and lifts the potentials there by an LSE against the coarse records. If the schedule never reaches such a blur, or reaches it only at its last level, GeomLoss lifts its final coarse potentials and takes no fine update. Otherwise it builds the mask of Section 2.2 once, at the last coarse level ,
and reuses the resulting KeOps index ranges (Charlier et al., 2021) for every fine update.
Omitted mass. One FP64 pass over all pairs of the two problems of Table 4 measures the plan mass each mask omits. At FS2's returned potentials on clustered data, the GeomLoss mask, built at its switch to the points, omits more than half the plan mass of 964 of the rows and nearly all of it in 12, while FS2's mask omits at most of any row and keeps half as many point pairs. This difference includes the stage at which GeomLoss builds its mask, not only its criterion. At GeomLoss's own returned potentials its mask omits of the mass, 0.02% of its residual of 0.054, so that residual is not mainly omitted mass. On heterogeneous data GeomLoss's mask omits at most of any row, and FS2's at most .
C.3 SPEED
The grid covers clustered and heterogeneous clouds with a size sweep over at and a regularization sweep over at . Eight problems are shared, which leaves 32 inputs (Table 5). Figure 2(a–d) shows the size sweep and the regularization sweep, 26 problems. FS2 runs its automatic policy (Sections B.1 and B.2) with one fixed kernel calibration and no per-problem tuning.
Trajectories. In Figure 2(f), FS2's potentials are lifted every 64 coarse updates and taken after every fine update, and each is placed at the time in the solve at which it is available, its own lift included.
GeomLoss settings. The grid runs GeomLoss at scaling 0.9 with its default cluster scale and truncation 5. Table 6 varies the scaling and the cluster scale on two problems. The matched cluster scale gives GeomLoss FS2's cell count, taken from FS2's record and not charged to GeomLoss, and at this scale GeomLoss's schedule stays on the centroids and ends with a lift. On clustered data at none of the six settings meets . The best, scaling 0.99 at the default cluster scale, returns 0.0069 after 200 s, 13 times FS2's time. FS2's own coarse stage also misses there, so the target needs fine updates, and GeomLoss's fine stage in these settings does not reach it. On heterogeneous data at all six settings meet . At the default cluster scale GeomLoss takes 57.8 s, 212 times FS2, while with FS2's cell count its coarse exit takes 0.39 s, 1.4 times FS2. The two scaling-0.9 runs differ only in the cluster scale, so on this problem the gap under the default setting comes from the cluster scale.
GeomLoss continued at the target . The grid gives GeomLoss no residual-based stopping rule, so here we give it one that favours it. We append copies of the target to its native schedule and stop at , found by scoring and bisecting the first bracket that meets . This oracle stop charges GeomLoss for no residual test, whereas FS2's times include its sampled checks. On clustered , scaling 0.99 at the default cluster scale reaches after 118 extra entries in 421 s, 27.3 times FS2's 15.4 s (Table 7), and the grid's setting reaches it at none of the scored . At the matched setting reaches in 1.13 s, 1.38 times FS2, while both default-cell settings level off at 0.037. Both results are specific to these two problems.
C.4 RESIDUAL CERTIFICATE AND SAMPLED CHECK
Certificate. The solver as run stops on its sampled check, and the certificate is computed afterwards. At each evaluated return we build the mask by the production rule at the returned pair and compute with the solver's sparse kernel. We evaluated the clustered returns up to at and up to at the other regularizations, the heterogeneous returns at up to , and both Quijote solutions, but not the other grid returns. All 15 are certified (Table 8). On the grid, is at most 1% of and agrees with the recorded full residual to within , at the cost of one mask build and one sparse update. The heterogeneous returns take the dense update, so their certificate is the full residual. At , is below , so FP32 arithmetic rather than the mask sets the certificate, which gives 0.009108 at against a recorded full residual of 0.009154. Both are FP32 estimates, and the FP64 correction of Section D.3 gives .00882 and .00869 for rows and columns. The certificate takes minutes on one A100, where the full evaluation takes some 38 hours.
Table 5: The 32-problem forward grid. A dagger marks . FS2 meets the target on all 32 problems and GeomLoss on 10, all heterogeneous. Each entry is one call. Table 1a and Table 6 remeasure clustered , as medians of three calls.
| FS2 time (s) | FS2 | GL time (s) | GL | ||
|---|---|---|---|---|---|
| Clustered | |||||
| 0.001 | 5.638 | 0.004879 | 1.521 | ||
| 0.01 | 0.290 | 0.002918 | 0.026 | ||
| 0.001 | 4.176 | 0.004791 | 5.500 | ||
| 0.01 | 0.275 | 0.003245 | 0.027 | ||
| 0.001 | 15.593 | 0.004828 | 21.448 | ||
| 0.002 | 5.380 | 0.004094 | 14.305 | ||
| 0.005 | 2.318 | 0.003198 | 7.167 | ||
| 0.01 | 0.812 | 0.002673 | 0.031 | ||
| 0.02 | 0.646 | 0.001066 | 0.029 | ||
| 0.001 | 20.289 | 0.004639 | 85.484 | ||
| 0.002 | 9.843 | 0.004871 | 56.868 | ||
| 0.005 | 3.676 | 0.004129 | 28.455 | ||
| 0.01 | 2.825 | 0.001989 | 0.037 | ||
| 0.02 | 2.248 | 0.000810 | 0.037 | ||
| 0.001 | 45.405 | 0.004694 | 346.051 | ||
| 0.01 | 9.914 | 0.001276 | 0.052 | ||
| Heterogeneous | |||||
| 0.001 | 0.929 | 0.003605 | 10.547 | ||
| 0.01 | 0.045 | 0.001944 | 3.314 | 0.002151 | |
| 0.001 | 1.824 | 0.004342 | 39.628 | ||
| 0.01 | 0.106 | 0.000970 | 14.886 | 0.000886 | |
| 0.001 | 7.060 | 0.003875 | 154.122 | ||
| 0.002 | 0.302 | 0.001911 | 125.213 | ||
| 0.005 | 0.285 | 0.000962 | 86.684 | 0.002550 | |
| 0.01 | 0.272 | 0.000949 | 57.820 | 0.000841 | |
| 0.02 | 0.261 | 0.000548 | 19.300 | 0.001679 | |
| 0.001 | 1.096 | 0.003059 | 612.415 | ||
| 0.002 | 1.053 | 0.001056 | 497.391 | ||
| 0.005 | 0.992 | 0.000644 | 344.334 | 0.002531 | |
| 0.01 | 0.947 | 0.000880 | 229.573 | 0.000846 | |
| 0.02 | 0.908 | 0.000531 | 76.566 | 0.001682 | |
| 0.001 | 4.026 | 0.001624 | 2595.417 | 0.003906 | |
| 0.01 | 3.484 | 0.000885 | 915.975 | 0.000883 | |
Sampled check. Of the 40 reported returns with a full residual, none exceeds , and the largest is . We re-solved the seven grid problems closest to , clustered at , and , clustered at , and heterogeneous at , and , with the check's index seeds set to for . All 140 solves returned confirmed pairs, and none has a full residual above , which bounds the rate of false acceptance at (Clopper-Pearson, ), or at over the 60 solves on the three problems whose stopping update moved with the seed. At the accepting check, over the 280 sides has mean 0.03 and standard deviation 1.01, so reusing one sample across checks leaves no detectable bias at the stop.
Concentrated error. On the accepted pair of heterogeneous at (), we shift on a random , or of the rows so that the row residual becomes or , and run the check with 1000 index seeds per setting. The row side alone accepts , and of the seeds, close to the rates predicted from the exact per-row values. The production check also tests the columns, whose residual the shift raises to , and accepted none of the 6000 perturbed states. These measurements do not extend to , to other , to non-uniform weights or to the Quijote blur.
Table 6: GeomLoss settings on two problems, truncation 5, rerun with FS2 in the same session. Bold marks solves that meet . Default is GeomLoss's cluster scale (430 and 2033 source cells), and matched gives as many source cells as FS2's coarse stage, to within one (23,799 against 23,800, and 28,332). FS2 and matched times are medians of three calls, the others single calls. is the full two-sided residual.
| Solver | Cells | Clustered, | Heterogeneous, | ||
|---|---|---|---|---|---|
| Time (s) | Time (s) | ||||
| FS2 | auto | 15.37 | .00483 | 0.273 | .00095 |
| GL, scaling .90 | default | 21.46 | .0542 | 57.80 | .00084 |
| GL, scaling .95 | default | 39.48 | .0310 | 86.59 | .00094 |
| GL, scaling .99 | default | 200.38 | .00687 | 404.03 | .00020 |
| GL, scaling .90 | matched | 0.361 | .0597 | 0.391 | .00076 |
| GL, scaling .95 | matched | 0.548 | .0373 | 0.567 | .00083 |
| GL, scaling .99 | matched | 2.023 | .0171 | 2.012 | .00036 |
Table 7: GeomLoss continued at the target on clustered , truncation 5, on the GPU of Table 6. is the smallest number of appended target- entries whose full residual meets . Time is the median of three clean calls at , which at are the GL calls of Table 1a. Bold marks solves that meet . Without a , the last column gives the lowest scored residual. FS2 takes 15.44 s with at (Table 1a) and, in the run of this table, 0.817 s with at .
| Problem | GL setting | Continued at the target | |||
|---|---|---|---|---|---|
| Time (s) | |||||
| .90, default | .0542 | - | - | .0203 at | |
| .99, default | .00687 | 118 | 421.10 | .004997 | |
| .90, matched | .0597 | - | - | .0160 at | |
| .90, default | .0731 | - | - | .0372 at | |
| .99, default | .0373 | - | - | .0372 at | |
| .90, matched | .0591 | 183 | 1.13 | .004976 | |
Table 8: The certificate of Section 3.2 at returned potentials, with the larger of the row and column residuals of in IEEE FP32 and the tile-sum bound on the omitted mass in FP64. Where the mask would admit more than half of the tiles (dense), the update is dense, and is the full residual. is the recorded full residual, and bold certifies .
| Problem | Mask | |||||||
|---|---|---|---|---|---|---|---|---|
| Clustered | 0.001 | 0.005 | sparse | 0.004879 | 0.004879 | |||
| Clustered | 0.01 | 0.005 | sparse | 0.002918 | 0.002918 | |||
| Clustered | 0.001 | 0.005 | sparse | 0.004791 | 0.004791 | |||
| Clustered | 0.01 | 0.005 | sparse | 0.003245 | 0.003246 | |||
| Clustered | 0.001 | 0.005 | sparse | 0.004828 | 0.004828 | |||
| Clustered | 0.002 | 0.005 | sparse | 0.004094 | 0.004094 | |||
| Clustered | 0.005 | 0.005 | sparse | 0.003198 | 0.003198 | |||
| Clustered | 0.01 | 0.005 | sparse | 0.002673 | 0.002674 | |||
| Clustered | 0.02 | 0.005 | sparse | 0.001066 | 0.001067 | |||
| Clustered | 0.001 | 0.005 | sparse | 0.004639 | 0.004639 | |||
| Heterog. | 0.001 | 0.005 | dense | 0.003605 | 0.003605 | |||
| Heterog. | 0.001 | 0.005 | dense | 0.004342 | 0.004342 | |||
| Heterog. | 0.001 | 0.005 | dense | 0.003875 | 0.003875 | |||
| Quijote | 3.81 | 0.01 | sparse | 0.009154 | 0.009108 | |||
| Quijote | 3.81 | 0.05 | sparse | 0.048965 | 0.048953 |
C.5 ABLATIONS
The ablations use clustered and heterogeneous clouds with at , and pair each control with an FS2 reference measured in the same run on the same GPU. Each of three controls removes one component. No coarse stage anneals on the points instead of the centroids, with no lift and no coarse continuation. Dense fine keeps the coarse stage and replaces every fine update by a dense streaming update. Box only keeps the box screen and sparse execution but skips tile verification.
Table 9: Component ablations. C and H denote clustered and heterogeneous inputs, followed by . The ratio (control/FS2) is given for active controls that meet the target.
| Case | Control | FS2 (s) | Control (s) | Full R | Ratio | State |
|---|---|---|---|---|---|---|
| C, 0.001 | No coarse stage | 4.165 | 153.330 | 0.02135 | - | misses target |
| Dense fine | 4.165 | 33.327 | 0.00479 | 8.001 | qualified | |
| Box only | 4.167 | 4.335 | 0.00479 | 1.040 | qualified | |
| C, 0.01 | No coarse stage | 0.275 | 183.132 | 0.00477 | 664.818 | qualified |
| Dense fine | 0.276 | 0.275 | 0.00325 | - | inactive | |
| Box only | 0.276 | 0.275 | 0.00325 | - | inactive | |
| H, 0.001 | No coarse stage | 1.825 | 281.133 | 0.00039 | 154.023 | qualified |
| Dense fine | 1.824 | 2.423 | 0.00434 | 1.328 | qualified | |
| Box only | 1.824 | 1.576 | 0.00434 | 0.864 | qualified | |
| H, 0.01 | No coarse stage | 0.089 | 145.599 | 0.00318 | 1643.418 | qualified |
| Dense fine | 0.089 | 0.089 | 0.00097 | - | inactive | |
| Box only | 0.089 | 0.107 | 0.00097 | - | inactive |
Coarse stage. Removing the coarse stage slows the solve by 154–1643× on the three problems where both arms meet the target (Table 9). On clustered the control stops at the 128-update fine cap with R = 0.02135. A shorter coarse continuation has the same effect on a smaller scale (Table 10a): after 64 or 256 extra coarse updates the solve misses within the fine cap, and with the cap raised to 8192 it needs 1305 or 1115 fine updates, 51.6–60.0× the FS2 time.
Table 10: Coarse-continuation and threshold controls at , . Fine updates count ordinary updates plus terminal previews. (a) Clustered, with the number of extra coarse updates fixed. Ratios divide by the FS2 reference of the same run. (b) Every threshold control meets the target.
| (a) Extra coarse updates, clustered | |||||
|---|---|---|---|---|---|
| Extra coarse | Fine cap | Fine updates | Time (s) | R | Ratio |
| 2048 (native) | 128 | 13 + 2 | 4.169 | 0.00479 | 1 |
| 64 | 128 | 128 + 3 | 24.355 | 0.01896 | - |
| 256 | 128 | 128 + 3 | 24.817 | 0.01421 | - |
| 64 | 8192 | 1267 + 38 | 250.235 | 0.00478 | 60.0 |
| 256 | 8192 | 1077 + 38 | 215.674 | 0.00477 | 51.6 |
| (b) scaled by a factor; time relative to the native threshold | |||||
| Factor | Clustered | Heterogeneous | |||
| 1.080 | 1.039 | ||||
| 1.068 | 1.027 | ||||
| 0.965 | 0.945 | ||||
| 0.908 | 1.530 | ||||
Sparse fine execution. On clustered both arms run 13 ordinary updates and two terminal previews, and sparse execution cuts the time from 33.327 to . Heterogeneous takes one terminal preview over a mask that admits of the tiles and gains . At neither geometry takes a fine update.
Tile verification. On clustered , verification cuts the padded point-pair work from to and the time from 4.335 to 4.167 s. On heterogeneous data it removes of the work and costs time, 1.824 against 1.576 s. Scaling by to changes the clustered time by at most , and the largest factor slows the heterogeneous solve by (Table 10b).
C.6 PROFILING
The profiles use the clustered , problem of Table 1. The stage times of Table 1a come from one Nsight Systems call per solver. FS2's coarse stage is its coarse kernels (2.663 s) and lifts (0.277 s), and its fine stage its fine kernels (8.274 s), mask construction (3.118 s) and sampled checks (0.909 s). GeomLoss's fine phase is 96 kernels averaging 0.22 s, so kernel launches do not explain its time. The kernel counters come from NCU on a separate A100, where the unprofiled solve takes 16.23 s with FS2 and 21.49 s with GeomLoss.
Table 11: Kernel counters for one fine update per direction on clustered , , on the profiling A100. FS replays one dense reduction per direction from its native incoming state, with its counters averaged over the two directions. GL and FS2 run FS2's first ordinary fine update on the same mask, and gives the two directions. Per-pair counts divide totals by the point pairs they cover, instructions are executed warp instructions, and dashes mark counters not collected.
| Metric | FS (dense) | GL (KeOps, FP32) | FS2 (TF32) |
|---|---|---|---|
| Point pairs per direction | |||
| NCU time per direction (ms) | 3,600 | 393.957 | 251.435 |
| Warm update, both directions (ms) | - | 791.073 | 504.392 |
| Warp instructions / pair | 0.34 | 0.628315 | 0.278530 |
| Shared-load wavefronts / pair | - | 0.0625001 | 0.0246587 |
| Shared-store wavefronts / pair | - | 0.0009806 | 0.0053709 |
| HBM read bytes / pair | 0.0043542 | 0.0003161 | 0.0149489 |
| HBM write bytes / pair | 0.0000025 | 0.0001135 | 0.0000558 |
| Tensor-pipe instructions / pair | - | 0.0003344 | 0.015625 |
| Tensor activity, (%) | - | 0.07 / 0.07 | 21.11 / 21.08 |
| Occupancy, (%) | 37.08 | 91.4 / 91.14 | 12.48 / 12.47 |
| Math-pipe throttle, (%) | 8.995 | 17.39 / 17.41 | 2.32 / 2.31 |
| Long scoreboard, (%) | 1.21 | 0.51 / 0.51 | 6.05 / 6.03 |
Kernel counters. Table 11 compares the GL and FS2 executors on the same mask. We freeze FS2's first ordinary fine update on the clustered , problem, with a mask of 15,760,133 admitted block pairs and point pairs over both directions. FS2's TF32 kernels and GeomLoss's FP32 KeOps executor receive the same sorted points, incoming potentials, weights and transposed support, KeOps with each run of contiguous target blocks as one range. Over 20 warmed repetitions the update takes 504.392 ms with FS2 and 791.073 ms with KeOps, longer. Per pair, FS2 executes fewer warp instructions and fewer shared-load wavefronts, with tensor-pipe activity of against , despite more HBM reads, lower occupancy and more long-scoreboard stall. The extra HBM traffic follows from the policy's block size (Section B.1). The dense FlashSinkhorn reduction evaluates all pairs of one direction in 3.6 s, longer than FS2's reduction on its mask.
C.7 MEMORY
Figure 2(e) reports the PyTorch allocator peak, inputs included. The same protocol on the five heterogeneous FS2 solves at gives peaks of 0.80, 2.72, 9.89, 1.70 and 3.40 GiB for to . Up to , FS2 takes one or two fine updates over 60–61% of the tiles. From it returns the lifted coarse potentials without a fine update and builds no mask.
Block size. We hold the clustered , problem and its coarse partition fixed () and change only the block size. Raising from 128 to 256 cuts the admitted tiles from to and the PyTorch peak from 16.17 to 6.88 GiB, for more time, 48.52 against 45.38 s, with the same returned . The automatic policy chooses from the L2 budget of the block summaries, not from this mask memory.
C.8 OPTIMIZATION
The optimization grid reuses the 32 forward inputs of Section C.3. Each method runs one trajectory of twenty normalized updates (Section 4.1) and saves steps 0, 5, 10, 15 and 20. The timer includes compilation and autotuning, and a run stops at 7200 s. FS2 steps along the surrogate gradient of Section 3.1, while GeomLoss differentiates its native multiscale loss with autograd. GeomLoss reaches the time limit on six problems: clustered at , and heterogeneous at and at . Table 12 summarizes the runs of Figure 2(g,h).
Score. The evaluator fixes nested groups of the initial source cloud and of , with FP64 centroids and within-group variances. At a saved iterate, is the entropic cost between the source and target group centroids, solved to row and column residuals of at most , plus the within-group squared-distance averages. We report at , 65536 at and 16384 at , and require every decrease to agree with the one at a coarser count (65536, 16384 and 4096) within . The score ranks trajectories and is not the full-point OT value.
Direction at . At the initial points of the four runs, we compare and GeomLoss's autograd direction with from a separate solve at . On clustered data ( and 0.01), has cosine 0.92 and 0.96 with and relative error 0.39 and 0.28, against 0.49 and 0.40 for GeomLoss's direction. On heterogeneous data its cosine is at least 0.9997 and, from 4096 rows evaluated in FP64, its relative error is 0.023 and 0.012, and the difference between the two directions lies within the uncertainty of the references. These values measure alignment with a numerical reference, not the error to the exact gradient, because references at and differ by 0.2–3%, and on clustered data at the tighter solve stopped at residual , above its target. On the same 4096 rows, on three of the four problems, the right-hand side of Equation (8) exceeds , so Proposition 3 does not certify a relative error below one there.
Table 12: Twenty-step optimization at . A decrease is the percentage drop of from the common initial score over the twenty steps, and final scores within tie. Times cover the twenty updates, including compilation and autotuning.
| Cloud | ε | FS2 s | GL s | FS2 decrease | GL decrease | |
|---|---|---|---|---|---|---|
| Heterogeneous | .001 | .004297 | 52.80 | 3215.67 | .5829% | .5826% |
| Heterogeneous | .01 | .01501 | 51.66 | 1290.01 | .2551% | .2550% |
| Clustered | .001 | .05230 | 79.81 | 453.22 | .3064% | .2906% |
| Clustered | .01 | .08166 | 42.58 | 0.80 | .1756% | .1682% |
D QUIJOTE PARTICLE TRANSPORT
D.1 PROBLEM AND DATA
The sources are redshift-zero positions matched by particle ID to their Lagrangian lattice sites, the targets. The instance is the central subcube and the instance the full box, with , so that the blur Mpc/h equals the lattice spacing, and a nonperiodic cost. FS2 solves on TF32-rounded coordinates, which move each particle by at most 0.125 Mpc/h, of the blur. In the subcube the particle-ID displacement has median 9.013, 99th percentile 20.668 and maximum 39.135 Mpc/h.
D.2 CONFIGURATION AND TIMING
Configuration. At , FS2 uses , the selector's and a sampled check every 16 fine updates. At it uses the selector's , processed as point tiles, and an automatic check interval. The fine cap is 128 at and 800 at , where the two sizes return after 432 and 560 ordinary updates. At every size the solver completes the 64 entries at before its first lift. In place of the continuation of Appendix B.2, it then runs at most one batch of 64 to 384 coarse updates after the second fine update and lifts again, and in every run the check scored
Table 13: Quijote forward solves, with the size sweep in the first four rows. : block size, cell level, fine cap and returned ordinary updates. Peak: PyTorch allocator peak of the size sweep. Light validation: mean absolute relative marginal error on 4096 sampled indices per direction, 65,536 at and , with the mean plus three standard errors in brackets. Full max: , with dashes where it is not enumerated. W: warm call, F: first call, I: instrumented call. MS/.95/default/5: multiscale, scaling 0.95, default cluster scale, truncation 5.
| method | n = m | τ | configuration | time (s) | peak (GiB) | light validation [U3SE] | full max |
|---|---|---|---|---|---|---|---|
| FS2 | .05 | B64/t47/c128/h80 | 12.053 | .046836 [.048531] | .046631 ✓ | ||
| FS2 | .05 | B64/t45/c128/h48 | 19.472 | .049304 [.049758] | — | ||
| FS2 | .05 | B128/t45/c128/h72 | 33.131 | .048340 [.048783] | — | ||
| FS2 | .05 | B256/t45/c128/h80 | 64.129 | .049009 [.050797] | .048965 ✓ | ||
| FS2 | .01 | B64/t47/c800/h432 | — | .009538 [.009924] | .009433 ✓ | ||
| FS2 | .01 | B256/t45/c800/h560 | — | .009585 [.009954] | .009154 ✓ | ||
| native GL | .05 | MS/.95/default/5 | — | .058976 [.060909] | .058463 ✗ |
that lift worse than the fine iterate. The time of this batch is included. We set by hand. At the rule would select if its fourth condition admitted that size, but with the sampled check became non-finite in the first fine updates, so we use , whose coarse state exceeds the L2 budget of Equation (16). With the continuation of Appendix B.2 instead of the single batch, the , solve took 2030.4 s and 119 ordinary updates, against 1351.6 s and 80 in Table 13. GeomLoss runs only at and , at scaling 0.95, default cluster scale and truncation 5.
Mask size. At and , in the update that produced the returned potentials, the box screen passed 107,397,067 of the block pairs and verification admitted 24,451,822, which hold point pairs. A truncated kernel with one FP32 value and one 32-bit index per pair would take 11.7 TiB. FS2's index for the candidate and admitted tiles, at 24 bytes per tile, takes 2.9 GiB.
Timed calls. Every time in Table 13 is a single call. FS2's are warm calls, except the first complete call at and , and at a second call returns identical potentials, so the all-particle validation applies to the timed call. GeomLoss's is the instrumented call whose potentials are scored. Validation is not timed. The light validation of Table 13 uses seed 1 and reduces each sampled marginal against every point of the opposite measure. At the IEEE-FP32 evaluator of the full residual takes some 38 hours on an A100 for the solution.
D.3 EVALUATOR PRECISION
The full residuals come from an IEEE-FP32 evaluator that forms each row's log marginal ratio as the difference of two potentials shifted by . Near the box corners reaches , whose FP32 spacing is of , so a single row's mass is resolved only to . On 4096 or 16384 sampled rows and columns per entry, we recompute each row's error in FP64 from coordinate differences and subtract the mean paired difference from the full FP32 residual. This gives .04653/.04661, .04883/.04889, .00939/.00942 and .00882/.00869 (row/column) for the rows of Table 13 with a full residual, in table order, with three standard errors of at most .0002, so every entry stays below its .
D.4 SIZE SWEEP
Figure 3(a,b) and the first four rows of Table 13 fix and use FS2 only, on nested cuboids centered in the box from to lattice sites with the lattice spacing and fixed. At the time and the memory come from two calls with identical potentials. The middle sizes are single warm calls with the configuration and the selector's . Both pass the solver's sampled check and are validated on 65,536 sampled outputs per side, without enumerating the full residual.
D.5 DISPLACEMENT RECONSTRUCTION
We take the -particle, solution of Table 13 and a uniform sample of 4096 source indices, drawn without replacement with seed 20260919. Each projection sums over all targets without a mask, using the plan of the TF32-rounded input and the unrounded physical target positions. With Mpc/h and the componentwise minimum image , we evaluate
The wrapping enters only the scoring, and the solver's cost stays nonperiodic. Over the sample , displacement RMSE is , and normalized RMSE divides it by the RMS reference displacement (Table 14). The component correlations are 0.797, 0.789 and 0.802, and the unwrapped position RMSE is 122.268 Mpc/h.
Table 14: Displacement reconstruction from the -particle FS2 solution at on 4096 sampled particles, with minimum-image scoring. The interval comes from 500 bootstrap resamples over particles at 95% confidence. The subsets split the sample by whether the reference trajectory crosses a periodic face.
| Predictor | Particles | RMSE (Mpc/h) | Normalized RMSE | 95% interval |
|---|---|---|---|---|
| Zero displacement | 4096 | 10.064 | 1.000 | - |
| FS2 barycentric displacement | 4096 | 6.473 | 0.643 | [0.625, 0.662] |
| no periodic-face crossing | 4034 | 6.333 | - | - |
| periodic-face crossing | 62 | 12.603 | - | - |
The 4096-query projection takes 9.303 s on one A100, excluding 43.474 s of loading and preparation, and FP64 direct-distance projections of eight sampled queries agree with the FP32 stream within 0.002281 Mpc/h.