Learning Latent Permutations with Gumbel-Sinkhorn Networks

Gonzalo E. Mena, David Belanger, Scott W. Linderman, Jasper Snoek

Abstract

Permutations and matchings are core building blocks in a variety of latent variable models, as they allow us to align, canonicalize, and sort data. Learning in such models is difficult, however, because exact marginalization over these combinatorial objects is intractable. In response, this paper introduces a collection of new methods for end-to-end learning in such models that approximate discrete maximum-weight matching using the continuous Sinkhorn operator. Sinkhorn iteration is attractive because it functions as a simple, easy-to-implement analog of the softmax operator. With this, we can define the Gumbel-Sinkhorn method, an extension of the Gumbel-Softmax method to distributions over latent matchings. We demonstrate the effectiveness of our method by outperforming competitive baselines on a range of qualitatively different tasks: sorting numbers, solving jigsaw puzzles, and identifying neural signals in worms.

Introduction

Permutations and matchings are fundamental operations in computer vision, robotics, and bioinformatics. Whether reconstructing a jigsaw puzzle, tracking objects across video frames, or aligning genomic sequences, the ability to find the "correct" ordering or correspondence is crucial. However, permutations are discrete combinatorial objects. In the context of deep learning, this discreteness poses a significant challenge: the gradient of a permutation operation is zero almost everywhere, making it incompatible with standard backpropagation.

Historically, researchers have turned to Reinforcement Learning (REINFORCE) or heuristic relaxations to handle latent permutations. REINFORCE often suffers from high variance and slow convergence, while heuristics may lack a solid probabilistic foundation. Mena et al. (2018) bridge this gap by introducing Gumbel-Sinkhorn networks, which provide a differentiable, reparameterizable relaxation for permutations.

Methodology: The Gumbel-Sinkhorn Framework

The core contribution of this work is a continuous relaxation of the permutation matrix. A permutation matrix is a square binary matrix where each row and column sums to exactly one. The convex hull of these matrices is the Birkhoff polytope, consisting of all doubly stochastic matrices.

The Sinkhorn Operator

The authors propose the Sinkhorn operator ($S$) as a differentiable analog to the Softmax function for permutations. Given a square matrix $X$, the Sinkhorn operator iteratively normalizes the rows and columns until the matrix becomes doubly stochastic. This results in a matrix within the Birkhoff polytope, allowing for gradient-based optimization.

The Gumbel-Sinkhorn Distribution

To enable probabilistic modeling and the "reparameterization trick," the authors introduce the Gumbel-Sinkhorn distribution. By adding i.i.d. Gumbel noise $\epsilon$ to an input matrix $X$ and applying the Sinkhorn operator with a temperature parameter $\tau$, they define: $$P = S((X + \epsilon)/\tau)$$ As the temperature $\tau \to 0$, the resulting "soft" permutation matrix $P$ converges to a "hard" discrete permutation matrix. This allows for end-to-end gradient-based learning of models that involve latent matching.

Figure 1: Overview of the Gumbel-Sinkhorn architecture for solving jigsaw puzzles. The model takes scrambled patches, computes a matching matrix via the Sinkhorn operator, and reconstructs the original image.

Experimental Evaluation

The authors evaluated Gumbel-Sinkhorn networks across three diverse domains:

  1. Synthetic Sorting: The task is to sort a list of $N$ numbers sampled from a uniform distribution $U(0,1)$. This tests the model's ability to learn the underlying sorting operation as a permutation.
  2. Jigsaw Puzzles: Using MNIST, CelebA, and ImageNet, the model learns to reconstruct images from scrambled patches. This requires the network to understand the spatial structure and semantic content of the images to find the correct permutation of patches.
  3. Neural Inference in C. elegans: The model identifies 282 somatic neurons by matching observed neural dynamics to a known canonical connectome, a task where the true permutation is latent and must be inferred from noisy signals.

Key Results and Discussion

The Gumbel-Sinkhorn method demonstrated significant improvements over existing baselines. In the sorting task, the network successfully learned to sort up to $N=120$ numbers, far surpassing previous state-of-the-art models like Pointer Networks, which failed beyond $N=15$.

In the jigsaw puzzle tasks, the model showed remarkable robustness. On the CelebA dataset, it solved 5x5 puzzles with high accuracy. Crucially, the authors demonstrated the effect of the temperature parameter $\tau$ on the quality of reconstructions.

Figure 4: Visual results for jigsaw puzzle reconstruction on CelebA (a) and MNIST (b). The rows show the original image, the scrambled input, and reconstructions at varying temperatures. Lower temperatures lead to "harder" and more accurate permutations.

On ImageNet, the Gumbel-Sinkhorn network achieved a Kendall tau of 0.73, matching the performance of much larger, specialized architectures like DeepPermNet. This suggests that the Sinkhorn relaxation is a powerful inductive bias for permutation-related tasks.

Conclusion and Limitations

Gumbel-Sinkhorn networks offer a principled and efficient way to incorporate latent permutations into deep learning. While the iterative nature of the Sinkhorn operator adds some computational overhead, the benefits in terms of differentiability and performance are substantial.

However, limitations remain. The model struggles with datasets like ImageNet that lack a universal sequential structure across all classes. Additionally, while the Gumbel-Sinkhorn distribution provides a useful relaxation, the KL divergence in the VAE setting is calculated in the noise space rather than the permutation space, which may lead to a looser evidence lower bound (ELBO). Future work may explore more complex combinatorial structures, such as quadratic assignment problems, to further enhance the model's capabilities.

Summary updated

BibTeX
@inproceedings{mena2018learning,
  author = {Gonzalo E. Mena and David Belanger and Scott W. Linderman and Jasper Snoek},
  title = {{Learning Latent Permutations with Gumbel-Sinkhorn Networks}},
  booktitle = {International Conference on Learning Representations},
  year = {2018},
  url = {https://openreview.net/forum?id=Byt3oJ-0W},
}
Figure