Generative Flow Networks for Discrete Probabilistic Modeling

Dinghuai Zhang, Nikolay Malkin, Zhen Liu, Alexandra Volokhova, Aaron C. Courville, Yoshua Bengio

Introduction

Modeling probability distributions in high-dimensional discrete spaces—such as binary images or molecular structures—is a notoriously difficult challenge in machine learning. These distributions frequently feature "modes" (islands of high probability) separated by vast "valleys" of near-zero probability. Standard tools like Markov Chain Monte Carlo (MCMC) typically explore these spaces through local moves, such as flipping one pixel at a time. Consequently, if two modes are far apart, MCMC often gets stuck in one and fails to discover the other. This "spurious mode problem" causes the model to learn a distorted version of the true data distribution. While Energy-Based Models (EBMs) are powerful, they traditionally rely on MCMC for training, thereby inheriting these exact mixing issues.

To overcome this, researchers have introduced Energy-Based Generative Flow Networks (EB-GFN), a novel framework that jointly trains an energy function and a GFlowNet sampler to model complex, high-dimensional discrete data. By treating data generation as a sequential construction process, EB-GFN effectively bypasses the mode-mixing problem, allowing the model to efficiently jump between distant clusters of high-probability data.

The EB-GFN Framework

The core of the EB-GFN approach is a "virtuous cycle" between two primary components:

  1. An Energy Function ($E_\phi$): This component learns to assign low energy (high probability) to real data and high energy to "fake" or generated data.
  2. A GFlowNet Sampler ($P_F$): Instead of relying on random walks, the GFlowNet learns to construct objects step-by-step (e.g., painting an image pixel by pixel).
The EB-GFN framework uses a GFlowNet to explore the state space and discover modes in the discrete space, aiding the energy function's training by avoiding MCMC's local trapping.

Sequential Construction and Back-and-Forth Proposals

GFlowNets reframe the generation of a $D$-dimensional vector as a path in a Directed Acyclic Graph (DAG). The process starts from an empty state and takes $D$ steps to reach a complete object.

A key innovation in this paper is the introduction of a novel MCMC proposal mechanism. The authors utilize a backward policy ($P_B$) to partially "erase" or deconstruct an existing sample, followed by a forward policy ($P_F$) to "re-paint" it. This back-and-forth dynamic allows for massive, high-dimensional jumps in the state space that are significantly more likely to be accepted than random local flips.

Illustration of the forward (painting) and backward (erasing) policies, which enable the model to make large, structured jumps in the state space.

During joint training, the GFlowNet is optimized to match the distribution defined by the energy function. Simultaneously, the energy function is updated using the GFlowNet's samples as "negative examples" in a contrastive divergence-like objective.

Key Insights

  • Amortized Exploration: Traditional MCMC "forgets" what it has seen. In contrast, GFlowNets are neural networks that "remember" the structure of the data. If the model observes several modes with a similar pattern, it can generalize and predict where other modes might be located.
  • The Power of Erasure: By learning a backward policy ($P_B$), the model gains a principled method for local exploration. This back-and-forth mechanism acts as a highly efficient version of block Gibbs sampling.
  • Maximum Entropy: The authors demonstrate mathematically that using a uniform backward policy forces the GFlowNet to find a maximum-entropy flow. This theoretically encourages the model to discover as many diverse modes as possible.

Experimental Results

The authors evaluated EB-GFN across three distinct domains: Ising models (a physics benchmark), 2D synthetic tasks (complex distributions converted into 32-bit binary strings via Gray codes), and discrete image datasets (Omniglot, Silhouettes, Static MNIST, and Dynamic MNIST).

EB-GFN consistently outperformed strong baselines like Persistent Contrastive Divergence (PCD) and ALOE.

  • Mode Capture: On synthetic tasks like checkerboard and 8gaussians, EB-GFN captured the multimodal structure far more accurately than MCMC-based methods, which frequently missed entire clusters.
  • Image Modeling: On discrete image datasets, EB-GFN achieved state-of-the-art Negative Log-Likelihood (NLL) on three out of four benchmarks, surpassing the previous leader, Gibbs-With-Gradients (GWG).
  • Efficiency: Ablation studies showed the "back-and-forth" proposal was crucial; without it, training on complex tasks like MNIST often diverged.

Limitations and Future Directions

While highly effective, the framework does introduce computational overhead. Training both an energy function and a GFlowNet sampler is more computationally expensive than training a single model. However, this cost is "amortized" because the resulting sampler is much faster than MCMC during inference.

Additionally, the current work assumes a fixed number of construction steps ($D$), though GFlowNets can theoretically learn to generate in any order. Scaling to very high-resolution images also remains a universal challenge for discrete modeling approaches. Future iterations of the framework may explore iterating the "back-and-forth" proposal multiple times for even deeper exploration of the state space.

Summary updated

BibTeX
@inproceedings{zhang2022generative,
  author = {Dinghuai Zhang and Nikolay Malkin and Zhen Liu and Alexandra Volokhova and Aaron C. Courville and Yoshua Bengio},
  title = {{Generative Flow Networks for Discrete Probabilistic Modeling}},
  booktitle = {International Conference on Machine Learning},
  year = {2022},
  url = {https://openreview.net/forum?id=yOufK9iQX_1},
}
Figure