ot-triton-lab/flash-sinkhorn
Acerca de
The official repository of FlashSinkhorn [ICML 2026 Oral]
IA y aprendizaje automáticoCrecimiento de estrellas medido
- in 24h
- 0
- in 7 days
- +1
- in 15 days
- +1
- in 1 month
- Recopilando historial
Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.
README.md
Original
FlashSinkhorn
Entropic optimal transport in PyTorch + Triton, without storing the pairwise cost matrix.
This package provides the streaming kernels of FlashSinkhorn and the multiscale, block-sparse method of FlashSinkhorn 2. Dense backends support balanced and relaxed-marginal OT, gradients, supported Hessian-vector products, and transport-plan application. A streaming c-transform supports semi-dual objectives.
v0.4.1: OT/derivative corrections, TF32 coordinate rounding and 15 Jupyter notebooks. Release notes.
Install
pip install --upgrade flash-sinkhorn
Requires Python ≥3.9, PyTorch ≥2.5, Triton ≥3.1 and an NVIDIA CUDA GPU.
Quick Start
import torch
from flash_sinkhorn import SamplesLoss
x = torch.randn(4096, 64, device="cuda", requires_grad=True)
y = torch.randn(4096, 64, device="cuda")
loss = SamplesLoss(blur=0.1, half_cost=True, debias=True, autotune=False)
value = loss(x, y)
grad_x = torch.autograd.grad(value, x)[0]
half_cost=True selects squared distance divided by two; debias=True gives the balanced Sinkhorn
divergence. For large balanced 3-D clouds, use backend="multiscale"; it currently returns forward costs
and potentials, with no gradients. See the
multiscale notebook.
By default, dense backends round centred FP32/FP64 coordinates to TF32 before cost evaluation;
FP32 arithmetic error remains. truncate_tf32=None follows allow_tf32; use allow_tf32=False
for FP32 dot products without default coordinate rounding.
The API reference covers weights, batching, unbalanced OT, stopping criteria, precision controls, HVP limits and low-level kernels.
Examples
Start with From two point clouds to a differentiable loss, then Choose parameters and check the result. The gallery contains 15 notebooks covering gradients, transport maps, relaxed marginals, embeddings, batches and large 3-D clouds.
pip install --upgrade "flash-sinkhorn[notebooks]"
git clone https://github.com/ot-triton-lab/flash-sinkhorn.git
cd flash-sinkhorn
jupyter lab examples/getting_started/first_steps.ipynb
The examples use the installed package. Reference figures come from previous script runs; running the cells
produces fresh outputs. Each application also has a Python script; install flash-sinkhorn[examples]
for its plotting dependencies.
Hugging Face Kernels Hub
Install kernels with pip, then load the Hub package:
from kernels import get_kernel
flash_sinkhorn = get_kernel("yexf308/flash-sinkhorn", version=1)
loss = flash_sinkhorn.SamplesLoss(blur=0.1, half_cost=True, debias=True)
Hub API version 1 contains Python package version 0.4.1.
Citation
Cite FlashSinkhorn for the dense streaming kernels and FlashSinkhorn 2 for the multiscale method.
BibTeX
@inproceedings{ye2026flashsinkhorn,
title={FlashSinkhorn: IO-Aware Entropic Optimal Transport on GPU},
author={Ye, Felix X.-F. and Li, Xingjie and Yu, An and Chang, Ming-Ching and Chu, Linsong and Wertheimer, Davis},
booktitle={Proceedings of the 43rd International Conference on Machine Learning (ICML)},
year={2026},
url={https://arxiv.org/abs/2602.03067}
}
@misc{ye2026flashsinkhorn2,
title={FlashSinkhorn 2: Block-Sparse Entropic Optimal Transport},
author={Ye, Felix X.-F. and Lim, Yu Chin Fabian and Wang, Naigang and Wertheimer, Davis},
year={2026},
eprint={2610.02395},
archivePrefix={arXiv},
primaryClass={cs.AI},
url={https://arxiv.org/abs/2610.02395}
}
License
MIT
Explorar proyectos relacionados
Cargando…
