Learning Unbiased Permutations via Flow Matching

Yimeng Min, Carla P. Gomes

TL;DR

PermFlow is a novel conditional flow matching framework designed to learn probability distributions over permutations directly on the affine subspace of doubly stochastic matrices. By utilizing a closed-form tangent-space projector and a nearest-target coupling strategy, it enforces strict structural constraints exactly while successfully capturing multimodal, ambiguous permutation distributions where traditional Sinkhorn methods collapse.

What Problem Does This Paper Address?

Learning permutations—essential for sorting, ranking, and matching—is notoriously difficult for deep learning models because permutations are discrete combinatorial objects. A valid permutation matrix must contain exactly one "1" in each row and column.

To make this setup differentiable, standard approaches typically relax the discrete constraints using entropy-regularized Sinkhorn layers, mapping the problem to the continuous Birkhoff polytope. However, Sinkhorn optimization introduces an entropic bias that pushes solutions away from the true discrete vertices. More critically, it is fundamentally deterministic: when an input is ambiguous and multiple permutations are equally valid, Sinkhorn collapses the distribution into a single, blurred, averaged solution. Alternative manifold-ODE methods also struggle because their constraint violations tend to grow exponentially over integration time.

Feasibility behavior of different constraint-enforcement methods.

Methods

The authors introduce PermFlow (Affine Permutation Flow), which models permutations through continuous dynamics directly on the affine constraint manifold of matrices with unit row and column sums.

Key technical innovations include:

  1. Closed-Form Tangent-Space Projector: Instead of relying on iterative corrections or soft relaxations, PermFlow uses an exact algebraic centering operator, $C(U) = (I - J)U(I - J)$ (where $J$ is a rank-one averaging matrix). Projecting the learned velocity fields onto this tangent space ensures that row and column sum constraints hold exactly at every time step $t$, independent of network expressivity or Lipschitz conditions.
  2. Nearest-Valid-Target-Wins Coupling: In standard flow matching, training trajectories can suffer from gradient cancellation if nearby noisy initializations are pulled toward conflicting targets. PermFlow resolves this by pairing each noisy initialization with its closest valid target permutation in Frobenius norm. This anchors trajectories locally and forces the learned velocity field to naturally bifurcate, allowing the model to represent diverse, multimodal distributions.
Figure 2: Our model: noise is added to the uniform X0 and projected to the tangent space. Training learns a velocity field via conditional flow matching to the nearest valid permutation, while inference integrates the ODE and rounds to obtain candidate permutations.

During inference, the model samples fresh noise, projects it onto the tangent space, integrates the learned ODE via Euler steps, and maps the continuous endpoints to discrete permutations using standard Hungarian rounding.

Datasets

The framework was evaluated on two primary tasks designed to test accuracy and multi-modal recovery under ambiguity:

  • NoisyMNIST (Visual Sorting): A sequence of 9 MNIST digit images must be sorted in ascending order. To introduce ambiguity, one position in the sequence contains a blended image (e.g., a mix of a '3' and a '0'), creating exactly two valid sorted orderings depending on how the blend is interpreted.
  • Symmetric Linear Assignment Problem (SLAP): Synthetic cost matrices generated with strict symmetry ($C = C^\top$). This structural symmetry creates degenerate bimodal instances where swapping matched pairs yields two globally optimal matchings with identical costs.
Illustration of the ambiguous digit sorting task using blended MNIST digits.

Key Insights and Ideas

  • Exact vs. Asymptotic Feasibility: Traditional methods satisfy constraints only in the limit (Sinkhorn iterations) or suffer from exponential error accumulation (generic manifold-ODEs). PermFlow proves that operating on an affine subspace allows constraints to be preserved as an exact algebraic identity along the entire trajectory.
  • Bifurcation via Local Anchoring: The "nearest-target" coupling rule is the secret sauce for handling ambiguity. By routing distinct noisy initializations to distinct valid permutations, the model avoids averaging out conflicting supervision and successfully learns split-path (bifurcated) dynamics.
  • The Sinkhorn Blindspot: The paper formalizes why Gumbel-Sinkhorn baselines fail on ambiguous tasks: the limitation is structural. Sinkhorn maps to a single deterministic point in the polytope, meaning it cannot distribute probability mass across distinct permutation modes from a deterministic input.

Key Results

  • High Accuracy on Clean Inputs: PermFlow achieves $\sim98\%$ exact-match accuracy on unambiguous NoisyMNIST sequences and $\sim94.5\%$ accuracy on SLAP ($N=20$).
  • Robust Mode Coverage: Under ambiguity, PermFlow successfully recovers both valid permutations, achieving $\sim99\%$ mode coverage on NoisyMNIST and $\sim95.7\%$ coverage on SLAP.
  • Baseline Failure: Gumbel-Sinkhorn baselines completely fail on these ambiguous tasks, scoring $0\%$ on mode coverage and accuracy metrics due to structural mismatch and incomplete convergence.
  • Excellent Mode Balance: On the SLAP benchmark, PermFlow samples both optimal modes with near-equal frequency (mode balance error $< 0.002$), demonstrating unbiased distribution learning.

Limitations and Future Work

The authors note a persistent but bounded residual calibration error ($\sim0.18$ on NoisyMNIST) between the sampling frequency and the true blend weight. This is characterized as a finite-sample training gap rather than a structural flaw, meaning the neural network is only approximating the ideal velocity field.

Future directions include scaling the framework to larger combinatorial problems and extending this geometry-aware flow matching paradigm to other highly constrained discrete structures, such as graph matching or traveling salesperson tours.

Summary updated

BibTeX
@inproceedings{min2026learning,
  author = {Yimeng Min and Carla P. Gomes},
  title = {{Learning Unbiased Permutations via Flow Matching}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=3OprvEHAw6},
}
Figure