Generative Flow Networks for Discrete Probabilistic Modeling

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

Abstract

Modeling high-dimensional discrete data is a fundamental challenge in machine learning, often hindered by the presence of isolated high-probability modes. Traditional Markov Chain Monte Carlo (MCMC) methods struggle to navigate these "valleys" of low probability, leading to the spurious mode problem. This paper introduces Energy-Based Generative Flow Networks (EB-GFN), a novel framework that combines Energy-Based Models (EBMs) with the compositional sampling capabilities of Generative Flow Networks (GFlowNets). By utilizing a GFlowNet as a learnable sampler, EB-GFN facilitates global transitions across the energy landscape. We demonstrate that EB-GFN significantly outperforms standard MCMC-based approaches in discrete image modeling and synthetic benchmarks, providing a robust solution for exploring complex discrete spaces.

Introduction

In probabilistic modeling, the goal is often to learn an energy landscape where low-energy regions correspond to realistic data. However, in high-dimensional discrete spaces—such as binary images or molecular structures—these low-energy regions (modes) are frequently separated by vast regions of high energy.

Standard tools like Markov Chain Monte Carlo (MCMC) explore these spaces through local perturbations, such as flipping a single pixel. When modes are distant, MCMC requires an impractical amount of time to transition between them, often becoming trapped in a single region. This limitation results in the "spurious mode problem," where models fail to represent the true diversity of the data distribution.

EB-GFN enables "jumping" between isolated modes in the energy landscape, whereas traditional MCMC methods often get stuck in local regions.

Methodology: Energy-Based Generative Flow Networks

The proposed EB-GFN framework addresses these challenges by training a GFlowNet to act as a smart, global sampler for an Energy-Based Model (EBM). The system consists of two primary components:

  1. The Energy-Based Model (EBM): This component defines the target distribution by assigning a scalar energy value to every possible discrete object.
  2. The GFlowNet Sampler: Instead of a random walk, the GFlowNet learns a stochastic policy to construct objects sequentially. It is trained using the Trajectory Balance objective to ensure its sampling probability aligns with the EBM's energy.

The Back-and-Forth Proposal

The core technical innovation is the use of the GFlowNet as an MCMC transition kernel. To update a sample, the model performs a "back-and-forth" move:

  • Backward Step ($P_B$): The GFlowNet’s erasure policy removes $K$ components of the object.
  • Forward Step ($P_F$): The GFlowNet’s painting policy refills those $K$ slots.
The GFlowNet learns forward ($P_F$) and backward ($P_B$) policies to construct and deconstruct objects, enabling large-block updates.

This mechanism allows the model to change many bits simultaneously while maintaining a high probability of acceptance by the EBM. Effectively, this performs large-block Gibbs sampling, enabling the model to "jump" across the energy landscape.

Experimental Evaluation

The researchers evaluated EB-GFN across several domains:

  • Ising Models: A physics benchmark testing the recovery of known mathematical interactions in 2D grids.
  • 2D Synthetic Tasks: Highly multimodal distributions (e.g., checkerboard, spirals) converted to 32-bit discrete representations.
  • Discrete Image Modeling: Standard datasets including MNIST, Omniglot, and Caltech-101 Silhouettes.

Key Results and Insights

EB-GFN demonstrated superior performance in several key areas:

  • Synthetic Benchmarks: On the challenging "checkerboard" task, EB-GFN significantly outperformed baselines like Persistent Contrastive Divergence (PCD) in both log-likelihood and Maximum Mean Discrepancy (MMD).
  • Image Modeling: The framework achieved state-of-the-art test negative log-likelihood on Omniglot, Silhouettes, and Dynamic MNIST.
  • Amortized Exploration: Unlike MCMC, which restarts its search for every sample, GFlowNets amortize the cost of exploration by learning global regularities. This allows them to "guess" the location of unvisited modes based on learned compositional rules.

Conclusion

EB-GFN represents a significant step forward in discrete probabilistic modeling. By replacing local random walks with a learnable, global sampling policy, the framework overcomes the mixing problems that have long plagued EBMs. Future work will explore scaling this approach to more complex structures like natural language and molecular graphs, where the compositional nature of GFlowNets is expected to provide even greater benefits.

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