Generative Flow Networks as Entropy-Regularized RL

Daniil Tiapkin, Nikita Morozov, Alexey Naumov, Dmitry P. Vetrov

Abstract

The recently proposed generative flow networks (GFlowNets) are a method of training a policy to sample compositional discrete objects with probabilities proportional to a given reward via a sequence of actions. GFlowNets exploit the sequential nature of the problem, drawing parallels with reinforcement learning (RL). Our work extends the connection between RL and GFlowNets to a general case. We demonstrate how the task of learning a generative flow network can be efficiently redefined as an entropy-regularized RL problem with a specific reward and regularizer structure. Furthermore, we illustrate the practical efficiency of this reformulation by applying standard soft RL algorithms to GFlowNet training across several probabilistic modeling tasks. Contrary to previously reported results, we show that entropic RL approaches can be competitive against established GFlowNet training methods. This perspective opens a direct path for integrating RL principles into the realm of generative flow networks.

Introduction

Generative Flow Networks (GFlowNets) have emerged as a powerful framework for sampling discrete objects, such as molecular graphs or bit strings, with probabilities proportional to a target reward. While GFlowNets share a sequential decision-making structure with Reinforcement Learning (RL), the two fields have largely evolved independently. Conventional wisdom suggested that RL was primarily suited for finding a single optimal path, whereas GFlowNets were necessary for diverse sampling across all possible paths. This paper challenges that distinction by providing a formal unification, showing that GFlowNets are a specific case of entropy-regularized RL on a specially constructed Markov Decision Process (MDP).

Methodology: Bridging GFlowNets and RL

The authors establish a Direct Reduction (Theorem 1) that transforms the GFlowNet learning objective into an entropy-regularized RL problem. This is achieved through a specific MDP construction:

  1. Intermediate Rewards: Instead of only rewarding the final state, rewards are injected into every transition based on the GFlowNet's backward policy ($P_B$). For non-terminal transitions, the reward is $r(s, s') = \log P_B(s|s')$.
  2. Terminal Rewards: For terminal states, the reward is set to $r(s, x) = \log R(x)$.
  3. Algorithm Porting: This reduction allows the use of standard soft RL algorithms. The authors specifically highlight MunchausenDQN (M-DQN), which adds a "Munchausen penalty" (the log-policy of the target network) to the reward. This penalty improves stability and prevents the policy from collapsing into a single mode, a common failure mode in generative tasks.

This theoretical link reveals that existing GFlowNet losses, such as Trajectory Balance (TB) and Detailed Balance (DB), are mathematically equivalent to specific RL architectures like Dueling SoftDQN.

Experimental Results

The unified framework was evaluated on several standard benchmarks, including Hypergrid (2D and 4D), small molecule generation (sEH protein binding), and non-autoregressive sequence generation.

Hypergrid Performance

In the Hypergrid task, agents navigate a grid to find hidden reward "modes." The performance is measured by the $L^1$ error between the learned sampling distribution and the true reward distribution. As shown in the figure below, Munchausen DQN (M-DQN) consistently matches or outperforms specialized GFlowNet training methods.

Empirical L1 error comparison on Hypergrid tasks. Munchausen DQN (red) shows competitive or superior convergence compared to Trajectory Balance (blue), Detailed Balance (orange), and Sub-trajectory Balance (green).

Molecule and Sequence Generation

Beyond synthetic grids, the RL-based approach excelled in complex domains:

  • Mode Discovery: In molecule generation, M-DQN discovered significantly more unique high-reward modes than Trajectory Balance or Detailed Balance within the same training budget.
  • Robustness: RL-based approaches demonstrated greater stability across various learning rates and reward exponents compared to specialized GFlowNet objectives like Subtrajectory Balance (SubTB).

Key Insights and Future Directions

This research provides several critical insights into the nature of generative modeling:

  • Log-space is Fundamental: The common practice of using log-space in GFlowNet losses is not just for numerical stability; it is the theoretically correct representation of the Value function in a soft RL framework.
  • Diversity through Regularization: The Munchausen penalty acts as a powerful regularizer that maintains high-entropy sampling, which is crucial for discovering multiple modes in complex reward landscapes.

While the current work primarily focuses on discrete spaces and fixed backward policies, it opens the door for integrating advanced RL techniques, such as AlphaZero-style Monte Carlo Tree Search (MCTS), into the GFlowNet ecosystem. Future research will explore extending these theoretical guarantees to continuous action spaces and learnable backward policies.

Summary updated

BibTeX
@inproceedings{tiapkin2024generative,
  author = {Daniil Tiapkin and Nikita Morozov and Alexey Naumov and Dmitry P. Vetrov},
  title = {{Generative Flow Networks as Entropy-Regularized RL}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2024},
  url = {https://openreview.net/forum?id=XZYDTK5nQR},
}
Figure