gfnx: Fast and Scalable Library for Generative Flow Networks in JAX
Abstract
In this paper, we present gfnx, a fast and scalable package for training and evaluating Generative Flow Networks (GFlowNets) written in JAX. gfnx provides an extensive set of environments and metrics for benchmarking, accompanied with single-file implementations of core objectives for training GFlowNets. We include synthetic hypergrids, multiple sequence generation environments with various editing regimes and reward designs, phylogenetic tree construction, Bayesian structure learning, and sampling from the Ising model energy. Across benchmark tasks, gfnx achieves significant wall-clock speedups compared with PyTorch-based benchmarks, including torchgfn, and other reference implementations. For example, gfnx achieves up to 55 times speedup on CPU-based sequence generation environments, and up to 80 times speedup with the GPU-based Bayesian network structure learning setup. Our package provides a diverse set of benchmarks and aims to standardize empirical evaluation and accelerate research and applications of GFlowNets.