Fast, Differentiable and Sparse Top-k: a Convex Analysis Perspective

Michael E. Sander, Joan Puigcerver, Josip Djolonga, Gabriel Peyré, Mathieu Blondel
2/2/2023
cs.LGstat.ML

No confident code implementation found for this paper. 2 possible matches can be shown below.

Abstract

The top-k operator returns a sparse vector, where the non-zero values correspond to the k largest values of the input. Unfortunately, because it is a discontinuous function, it is difficult to incorporate in neural networks trained end-to-end with backpropagation.

Show full abstract

Recent works have considered differentiable relaxations, based either on regularization or perturbation techniques. However, to date, no approach is fully differentiable and sparse. In this paper, we propose new differentiable and sparse top-k operators. We view the top-k operator as a linear program over the permutahedron, the convex hull of permutations. We then introduce a p-norm regularization term to smooth out the operator, and show that its computation can be reduced to isotonic optimization. Our framework is significantly more general than the existing one and allows for example to express top-k operators that select values in magnitude. On the algorithmic side, in addition to pool adjacent violator (PAV) algorithms, we propose a new GPU/TPU-friendly Dykstra algorithm to solve isotonic optimization problems. We successfully use our operators to prune weights in neural networks, to fine-tune vision transformers, and as a router in sparse mixture of experts.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 2 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{sander2023fast,
  title  = {Fast, Differentiable and Sparse Top-k: a Convex Analysis Perspective},
  author = {Michael E. Sander and Joan Puigcerver and Josip Djolonga and Gabriel Peyré and Mathieu Blondel},
  year   = {2023},
  eprint = {2302.01425},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2302.01425v3},
  journal = {ICML 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2302.01425.svg)](https://codeofpaper.com/paper/2302.01425)

Discussion