RGB palettes
Early interpolation took 3.131 s against a 0.678 s reference workflow on the same photo. Using joint RGB errors reduced that to 0.400 s, 1.70× as fast as the reference.
Optimal transport · Research preview
Faster dense NumPy calls with the same marginal tolerance, including warm starts used in repeated solves. Full transport-plan accuracy is available as a separate option.
The proposed POT integration speeds up supported classic dense NumPy Sinkhorn calls without requiring new arguments or a tighter accuracy target. It supports ordinary warm starts, including calls that request the scaling log for the next frame. The latest candidate also reduces shared validation work without changing the stopping rule. This is a research preview, not a released POT feature. The standalone wheels below are unchanged.
In our endpoint-moment comparison for Brenier maps, the same piece of displaced mass controls several errors at once. Tracking where it goes is more informative than bounding each error separately. We applied that idea to Sinkhorn: moving mass from one row to another changes the destination distribution by the difference between the two rows' conditional distributions.
In the resulting argument, ratios of kernel entries bound how much a single correction can affect the opposite marginal. The repeated corrections shrink geometrically, so their total gives a bound on the remaining change in the transport plan. A cheap bound using only the largest and smallest kernel entries makes this practical inside the dense solver. It lets supported calls without a warm start stop between regular checkpoints while still verifying both marginals on the returned matrix. On wide inputs the solver can sometimes make the decision before the row update, saving a transpose matrix–vector product.
The dense implementation also avoids a second kernel allocation and reuses matrix products or a fixed-cost kernel where possible. Version 0.3 adds earlier checks for calls that already pass a warm start. Those are additional sources of speedup, not part of the Brenier argument. Read the mathematical derivation and verification scope.
log=True, it includes the terminal error and scaling vectors. This is useful in repeated solves such as point-cloud registration, where a previous solution can be a good initial guess. No full-plan accuracy target is added.plan_tol to request a TV tolerance on the entire transport matrix, measured against the optimum of the same entropically regularized problem. This mode checks both marginal residuals and a float64 TV estimate. It reports failure if it cannot honor an explicit request. The estimate uses bounds proved in exact arithmetic; it is not a floating-point interval certificate. The implementation shares residual work with a capped direct bound, can save a transpose product via a pre-row check on wide inputs, and only runs the directional estimate when residual progress suggests it could help.sinkhorn2 interface, the standalone prepare(...) API, and the grid and compressed-output experiments are outside this integration. Standalone 0.2.1 was a Windows import fix, not a solver change.Who should use plan_tol? Consider it when a downstream step uses the coupling entries themselves, for example soft label transfer between datasets, and the application has an explicit accuracy budget for the total mass assigned to selected source–target pairs. If your application only needs the requested marginal accuracy, leave plan_tol unset. It is not needed to get the default speedups, and it does not guarantee unchanged match rankings or better downstream results.
Download the preview wheel for Linux x86-64 with CPython 3.12. This is an unofficial build of POT 0.9.7.post1 with the proposed Sinkhorn code. Windows and macOS wheels are not provided here.
In a fresh virtual environment, install the downloaded wheel with:
python -m pip install ./pot-0.9.7.post1+hys.66ce7cc-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Then run your usual ot.sinkhorn(...) call.
2e1b19e8c13beaff1966081789f7355a544e035121c8b2a6e6e39181260690f6
Download the benchmark report and raw CSVs. This is the measurement archive, not an installer or a standalone benchmark runner.
The original dense adapter was already faster on many standard tests. Other workloads exposed costs that aggregate tables could hide. Here is what failed, the idea that changed it, and the matched measurements that show what improved. The case studies identify which changes are in the POT candidate and which belong to separate experiments.
Early interpolation took 3.131 s against a 0.678 s reference workflow on the same photo. Using joint RGB errors reduced that to 0.400 s, 1.70× as fast as the reference.
Early interpolation was 86× slower at one temperature. Keeping separable grid arithmetic and tightening the error bound cut a separate matched grid run from 73.61 to 66.62 ms.
Early interpolation enlarged the point cloud and made one older pipeline 5.8× slower. In a later matched POT comparison, earlier warm-start checks cut five complete registration runs by 12–35%.
The newest change reduced the first-step penalty on 8×8 and reversed it on 32×128 in a synthetic follow-up. The same cleanup shortened the archived application suite by 2.21%.
These are the eight registration settings in which 0.2.0 had previously timed slower than stock. All methods used the same starting data and iteration budgets, requested stopThr=1e-7 and did not request plan_tol. Each closed-loop run generated its own subsequent poses and initial guesses. The terminal-window runs instead shared the same inputs and initial guesses. Figures are median elapsed milliseconds over 48 order-balanced rounds on one pinned CPU core and one BLAS thread.
| Setting | Stock POT | Adapter 0.2.0 | Candidate 0.3.0 |
|---|---|---|---|
| Bunny, 192 points, reg 0.08, 56 frames | 33.66 | 34.00 | 22.34 |
| Bunny, 192 points, reg 0.24, 56 frames | 26.17 | 26.36 | 17.13 |
| Bunny, 512 points, reg 0.08, 56 frames | 152.35 | 152.97 | 113.22 |
| Two-lobe cloud, 384 points, reg 0.08, 56 frames | 61.06 | 60.93 | 50.88 |
| Two-lobe cloud, 384 points, reg 0.24, 56 frames | 53.81 | 54.24 | 47.25 |
| Bunny, 192 points, reg 0.08, final 8 frames | 3.02 | 3.03 | 1.86 |
| Bunny, 192 points, reg 0.24, final 8 frames | 1.85 | 1.85 | 1.83 |
| Bunny, 512 points, reg 0.24, final 8 frames | 13.39 | 13.39 | 10.96 |
Seven of eight settings had paired timing intervals favoring the candidate over stock. The five 56-frame runs took 12–35% less time than stock. For the 192-point terminal window at regularization 0.08, updates fell 58→13, and elapsed time fell 3.02→1.86 ms. Changing only the check schedule in the same implementation took 2.33→1.88 ms. The 192-point terminal window at 0.24 already finished in one update per frame and showed no clear improvement.
Both marginal errors met 1e-7 in all 304 returned candidate plans. Earlier exits can increase full-plan TV error even when they meet the same marginal tolerance: at one frame of the 512-point 0.08 run the observed TV error against each solver's tighter numerical reference was about 3.55e-8 for stock and 1.43e-6 for the candidate. The largest observed change in the final rotation matrix across the five live jobs was 3.46e-7 in Frobenius norm. Those are measured examples, not a guarantee for other inputs.
In the ordinary warm-start candidate (0460680), these 160 settings were remeasured at the same requested marginal accuracy and iteration budgets, again without plan_tol. Times are sums of setting-level medians in milliseconds over 12 order-balanced rounds, one pinned CPU core and one BLAS thread. The comparison uses the stock classic POT solver and the original 0.2.0 adapter.
| Workload | Calls | Stock POT | Adapter 0.2.0 | Candidate 0.3.0 |
|---|---|---|---|---|
| Original 27 dense settings | 27 | 105.06 | 61.52 | 62.32 |
| Eight independent reproduction inputs, cold cache | 8 | 27.51 | 10.92 | 10.65 |
| Same eight inputs, warm cache | 8 | 26.75 | 9.28 | 9.26 |
| Four basic fixtures | 4 | 2.13 | 1.01 | 1.03 |
| 84 planted-plan fixtures | 84 | 67.21 | 29.91 | 29.92 |
| 900 MNIST pairs × three regularizations | 2700 | 1,584.69 | 833.53 | 830.81 |
| 625 MNIST pairs × three regularizations | 1875 | 1,091.99 | 583.87 | 578.82 |
| RGB palette, full dense plans | 64 | 989.55 | 623.15 | 614.51 |
| Fixed cost matrices | 36 | 65.08 | 41.99 | 42.42 |
| Cost reuse, copies and changes | 147 | 273.06 | 186.65 | 188.80 |
| graspologic graph alignment | 400 | 779.07 | 696.03 | 693.28 |
| Bunny 512, final 8 frames, reg 0.08 | 8 | 12.23 | 11.86 | 9.89 |
| Bunny 512, 56 frames, reg 0.24 | 56 | 114.90 | 115.22 | 84.70 |
All 5,417 candidate calls in this additional replay met the requested marginal tolerance. Outside the two registration rows, the 5,353 returned plans matched 0.2.0 byte for byte. Most of the speedup in those rows was already present in 0.2.0. The graph replay preserved all 209 final row-wise matches against stock. Of the 19 settings that initially ran more than 5% slower than 0.2.0, none remained over that threshold after a targeted 30-round retest.
Where the candidate can be slower. In a separate synthetic warm-start test, stock already finished in one update at 8×8 and 32×128. The candidate added about 23 microseconds per cold call (29.9→53.1 µs and 46.0→68.9 µs). On those same sizes, when the initial guess was farther away and stock ran 11 updates, the candidate was about 1.7× as fast. A separate unsafe-kernel fixture that immediately returned with a numerical warning took 70.2→88.4 µs with the same result and warning. These tests do not support a universal speedup.
The native Linux suite recorded 1,585 passed, 170 skipped and 4 expected failures. See POT issue #934 for the original proposal and @xihaian251's independent reproduction for two earlier implementation optimizations under the standard POT stopping rule. The timings above are our measurements of this candidate, not independent timings. Earlier benchmarks below refer to their stated versions and output requirements.