Differentiable Top-k Operator with Optimal Transport

02/16/2020
by   Yujia Xie, et al.
6

The top-k operation, i.e., finding the k largest or smallest elements from a collection of scores, is an important model component, which is widely used in information retrieval, machine learning, and data mining. However, if the top-k operation is implemented in an algorithmic way, e.g., using bubble algorithm, the resulting model cannot be trained in an end-to-end way using prevalent gradient descent algorithms. This is because these implementations typically involve swapping indices, whose gradient cannot be computed. Moreover, the corresponding mapping from the input scores to the indicator vector of whether this element belongs to the top-k set is essentially discontinuous. To address the issue, we propose a smoothed approximation, namely the SOFT (Scalable Optimal transport-based diFferenTiable) top-k operator. Specifically, our SOFT top-k operator approximates the output of the top-k operation as the solution of an Entropic Optimal Transport (EOT) problem. The gradient of the SOFT operator can then be efficiently approximated based on the optimality conditions of EOT problem. We apply the proposed operator to the k-nearest neighbors and beam search algorithms, and demonstrate improved performance.

READ FULL TEXT
research
02/15/2021

Relaxation of optimal transport problem via strictly convex functions

An optimal transport problem on finite spaces is a linear program. Recen...
research
05/01/2019

On Scalable and Efficient Computation of Large Scale Optimal Transport

Optimal Transport (OT) naturally arises in many machine learning applica...
research
05/28/2019

Differentiable Sorting using Optimal Transport:The Sinkhorn CDF and Quantile Operator

Sorting an array is a fundamental routine in machine learning, one that ...
research
06/05/2022

Constrained Mass Optimal Transport

Optimal mass transport, also known as the earth mover's problem, is an o...
research
09/18/2020

SISTA: learning optimal transport costs under sparsity constraints

In this paper, we describe a novel iterative procedure called SISTA to l...
research
12/13/2022

Regularized Optimal Transport Layers for Generalized Global Pooling Operations

Global pooling is one of the most significant operations in many machine...
research
07/15/2020

Fast Differentiable Clipping-Aware Normalization and Rescaling

Rescaling a vector δ⃗∈ℝ^n to a desired length is a common operation in m...

Please sign up or login with your details

Forgot password? Click here to reset