Fast Differentiable Sorting and Ranking
Mathieu Blondel, Olivier Teboul, Quentin Berthet, Josip Djolonga
Abstract
The sorting operation is one of the most commonly used building blocks in computer programming. In machine learning, it is often used for robust statistics. However, seen as a function, it is piecewise linear and as a result includes many kinks where it is non-differentiable. More problematic is the related ranking operator, often used for order statistics and ranking metrics. It is a piecewise constant function, meaning that its derivatives are null or undefined. While numerous works have proposed differentiable proxies to sorting and ranking, they do not achieve the time complexity one would expect from sorting and ranking operations. In this paper, we propose the first differentiable sorting and ranking operators with time and space complexity. Our proposal in addition enjoys exact computation and differentiation. We achieve this feat by constructing differentiable operators as projections onto the permutahedron, the convex hull of permutations, and using a reduction to isotonic optimization. Empirically, we confirm that our approach is an order of magnitude faster than existing approaches and showcase two novel applications: differentiable Spearman's rank correlation coefficient and least trimmed squares.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
98 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Learning with Differentiable Pertubed Optimizers cites Optimizing Rank-Based Metrics With Blackbox Differentiation
- Uncertainty Quantification over Graph with Conformalized Graph Neural Networks cites Learning Optimal Conformal Classifiers
- Equivariance with Learned Canonicalization Functions cites Efficient and Modular Implicit Differentiation
Cited by top-tier papers98
- Efficient and Modular Implicit DifferentiationMathieu Blondel, Quentin Berthet, Marco Cuturi, Roy Frostig et al.NeurIPS 2022 · 386 citations
- Learning with Differentiable Pertubed OptimizersQuentin Berthet, Mathieu Blondel, Olivier Teboul, Marco Cuturi et al.NeurIPS 2020 · 181 citations
- Uncertainty Quantification over Graph with Conformalized Graph Neural NetworksKexin Huang, Ying Jin, Emmanuel J. Candès, Jure LeskovecNeurIPS 2023 · 124 citations
- Learning Optimal Conformal ClassifiersDavid Stutz, Krishnamurthy Dvijotham, Ali Taylan Cemgil, Arnaud DoucetICLR 2022 · 123 citations
- Equivariance with Learned Canonicalization FunctionsSékou-Oumar Kaba, Arnab Kumar Mondal, Yan Zhang, Yoshua Bengio et al.ICML 2023 · 109 citations
Builds on1
Related papers
- Differentiable sorting for censored time-to-event dataAndre Vauvelle, Benjamin Wild, Roland Eils, Spiros C. DenaxasNeurIPS 2023 · 6 citations
- Generalized Neural Sorting Networks with Error-Free Differentiable Swap FunctionsJungtaek Kim, Jeongbeen Yoon, Minsu ChoICLR 2024 · 5 citations
- LapSum - One Method to Differentiate Them All: Ranking, Sorting and Top-k SelectionLukasz Struski, Michal B. Bednarczyk, Igor T. Podolak, Jacek TaborICML 2025
- PiRank: Scalable Learning To Rank via Differentiable SortingRobin M. E. Swezey, Aditya Grover, Bruno Charron, Stefano ErmonNeurIPS 2021 · 45 citations
- Fast, Differentiable and Sparse Top-k: a Convex Analysis PerspectiveMichael Eli Sander, Joan Puigcerver, Josip Djolonga, Gabriel Peyré et al.ICML 2023 · 35 citations
