GFNOrg/torchgfn

A modular, easy to extend GFlowNet library

What it solves

It provides a standardized framework for prototyping and implementing GFlowNets (Generative Flow Networks), allowing researchers and engineers to experiment with different sampling processes, environment definitions, and loss functions without having to build everything from scratch.

How it works

The library decouples three main components: the environment (which defines states and actions), the sampling process (how states are produced), and the function approximators (the neural networks or modules used to calculate GFN loss). It includes a variety of pre-built environments (discrete and continuous), multiple loss function parameterizations (such as TB, DB, and FM), and support for diverse policy types, including recurrent, non-autoregressive, and diffusion-based policies.

Who it’s for

Researchers and engineers working with GFlowNets who need a flexible tool for developing new algorithms or reproducing published results.

Highlights

  • Support for both discrete and continuous environments.
  • Implementation of multiple GFlowNet loss types (TB, DB, SubTB, FM, ZVar, and RTB).
  • Advanced training features including off-policy training, replay buffers, and expert data warm-starting.
  • Various exploration strategies like epsilon-greedy, temperature scaling, and variance annealing.
  • Support for conditional GFlowNets and diffusion-based sampling.

Related

  • Project
  • Project
  • Project
  • Project
  • Project