Your GFlowNet Secretly Learns an Optimal Transport Plan

Ian Maksimov, Nikita Morozov, Denis Belomestny, Sergey Samsonov

TL;DR

This paper reveals a deep theoretical connection between Generative Flow Networks (GFlowNets) and Optimal Transport (OT). They show that a specific formulation of GFlowNets, when trained to minimize total flow, effectively learns an optimal transport plan. This opens up GFlowNets as a powerful new tool for solving OT problems, especially on large, complex graphs.

What Problem Does This Paper Address?

Optimal Transport (OT) is a fundamental problem in mathematics and machine learning, concerned with finding the most efficient way to move "mass" from one distribution to another, considering the underlying geometry. While OT has many applications, solving it for large, discrete structures can be computationally intractable.

Generative Flow Networks (GFlowNets) are a recent framework for generating structured data by learning stochastic trajectories on graphs. While successful in sampling, their connection to OT was not well-understood. This paper bridges this gap by showing that a particular type of GFlowNet (non-acyclic, minimum-flow) can be framed as an OT problem, specifically a graph-induced shortest path OT problem. This allows GFlowNets to be used for OT, and conversely, provides a new perspective on GFlowNets.

Methods

The core of the paper is establishing a theoretical equivalence between a minimum-flow GFlowNet formulation and the Kantorovich Optimal Transport problem.

  1. GFlowNet Formulation: They focus on non-acyclic GFlowNets and their minimum-flow objective, which aims to minimize the expected trajectory length. This objective is shown to be equivalent to minimizing the total flow through the graph.
  2. Linear Programming Equivalence: The minimum-flow GFlowNet problem is reformulated as a linear program (LP) by eliminating the policy variables and treating flow variables directly.
  3. Connection to OT: By fixing the initial flow distribution in the GFlowNet LP to match a source distribution (L) and setting terminal flows to match a target distribution (R), the GFlowNet objective becomes identical to a Kantorovich OT problem. The "cost" in this OT problem is defined by the shortest path distances within the graph structure.
  4. Learning-based Approach: They propose using the GFlowNet learning framework (specifically, a trajectory balance objective) to train neural networks that approximate the optimal transport plan.

Datasets

The paper uses synthetic environments for evaluation:

  • Hypergrids: Non-acyclic grid environments of varying sizes (H=10, 15, 20). These are used to compare the GFlowNet solution against exact OT solvers.
  • Permutations: Environments based on the Cayley graph of the symmetric group (Sn). These are used to test scalability for larger problem sizes (n=4, 8, 20).

Key Insights and Ideas

  • GFlowNets as OT Solvers: The most significant insight is that GFlowNets, under specific conditions (minimum-flow objective, fixed initial distribution), are optimal transport solvers. This is a powerful new interpretation.
  • Graph Shortest Paths as OT Costs: The paper demonstrates that the graph structure of GFlowNets naturally induces shortest path costs, which are a common and meaningful cost function in graph-based OT.
  • Learning OT Plans: The GFlowNet learning framework can be directly applied to learn optimal transport plans, offering a flexible and scalable approach, especially for complex graphs where traditional LP solvers struggle.
  • Dual Equivalence: The GFlowNet formulation also leads to a dual problem that is equivalent to the dual of the OT problem, further solidifying the connection.

Key Results

  • Theoretical Equivalence: The paper rigorously proves that the minimum-flow GFlowNet problem is equivalent to a graph-based Kantorovich OT problem.
  • Empirical Validation:
    • On hypergrid environments, the learned GFlowNet policy recovers the optimal OT cost (OT*) and achieves low total variation (TV) distance from the target distribution, comparable to perfect samplers.
  • On permutation environments, the method recovers near-optimal OT solutions for smaller sizes (n=4, 8) and provides reasonable approximations for larger sizes (n=20) where exact OT is intractable.
  • Ablation studies show that the regularization parameter (λ) in GFlowNets controls a trade-off between sampling optimality and trajectory length, consistent with prior work.

Limitations and Future Work

  • Regularization Parameter Tuning: The paper notes that tuning the regularization coefficient (λ) is crucial for balancing OT optimality and sampling quality, which can be a practical challenge.
  • Unnormalized Distributions: Future work could explore applying GFlowNet methodology to learn transport maps between unnormalized probability distributions, which is a common scenario in machine learning.
  • Backward Policy Optimization: The established connection opens avenues for exploring backward policy optimization algorithms for GFlowNets, motivated by their RL connections.
  • Scalability: While experiments show scalability, further work could address practical challenges for extremely large-scale problems.

Summary updated

BibTeX
@inproceedings{maksimov2026your,
  author = {Ian Maksimov and Nikita Morozov and Denis Belomestny and Sergey Samsonov},
  title = {{Your GFlowNet Secretly Learns an Optimal Transport Plan}},
  booktitle = {SPIGM @ ICML},
  year = {2026},
  url = {https://openreview.net/forum?id=pyTU2BPVOF},
}
Figure