Introduction
Generative Flow Networks (GFlowNets) are a powerful class of generative models designed to sample objects—such as molecular graphs or complex sequences—with a probability proportional to a given reward. To train them, algorithms typically attempt to "balance" the flow of probability moving forward through a sequence of actions with the flow moving backward.
Most GFlowNets are trained using a standard squared error loss to achieve this balance. However, this "one-size-fits-all" approach often limits their ability to explore complex spaces. This paper provides a rigorous theoretical bridge between regression losses and $f$-divergences, allowing researchers to swap the standard quadratic loss for new designs like Shifted-Cosh and Linex. These novel losses significantly improve convergence speed, sample diversity, and robustness across a variety of tasks.
The Hidden Cost of Quadratic Loss
Until now, the vast majority of GFlowNet implementations have relied on the quadratic regression loss (squared error in log-space). While effective in many scenarios, it was chosen largely by default rather than through theoretical necessity.
The authors argue that this choice carries a hidden cost: the quadratic loss is mathematically equivalent to minimizing the reverse KL divergence, which is a "zero-forcing" objective. In practice, this makes the model highly conservative. It focuses heavily on exploiting high-reward areas it has already discovered but struggles to explore and find new, diverse modes in the target distribution.
A Unified Framework for GFlowNet Training
To address this, the authors introduce a unified framework that identifies five key components of GFlowNet training: training objects, parameterization, sampling weights, backward policies, and the regression loss function ($g$).
The core contribution of the paper is establishing a formal mathematical correspondence between the choice of regression loss $g$ and a specific $f$-divergence. By picking a different $g$, you are essentially choosing a different way to measure the "distance" between your model's distribution and the target reward distribution.
Designing New Loss Functions
The researchers categorize loss functions based on two distinct properties that govern exploration and exploitation:
- Zero-forcing: Encourages the model to avoid placing probability where the reward is zero. This leads to high-quality but potentially narrow samples (exploitation).
- Zero-avoiding: Encourages the model to cover the entire support of the target distribution. This leads to high diversity and better discovery (exploration).
Based on this taxonomy, they propose three new "plug-and-play" losses that can easily replace the standard quadratic loss in existing architectures:
- Linex(1): Corresponds to forward KL divergence. It is zero-avoiding and heavily promotes exploration.
- Linex(1/2): Corresponds to Hellinger distance. It is neither zero-forcing nor zero-avoiding, offering a balanced middle ground.
- Shifted-Cosh: A "best of both worlds" loss corresponding to symmetric KL divergence. It is simultaneously zero-forcing and zero-avoiding.
Experimental Validation
The researchers evaluated these new losses on three standard GFlowNet benchmarks, revealing a clear trade-off between diversity and average reward:
- Robustness in High Dimensions (Hyper-grid): In a 5D hyper-grid task where the model must find hidden rewards, the baseline quadratic loss failed completely to converge. In contrast, Linex(1) and Shifted-Cosh remained robust and successfully reached the target distribution.
- Faster Discovery (Bit-sequence generation): When generating $n$-bit strings to find distinct "peaks" in a large search space, Linex(1) found all 60 target modes significantly faster than the quadratic baseline (e.g., 20.3k steps vs. 50.6k steps in the Sub-Trajectory Balance setting).
- Molecular Diversity (Molecule generation): In a real-world scientific discovery task designing small molecules to bind to the sEH protein, the zero-avoiding losses produced a much more diverse set of high-quality candidates. This is critical for drug discovery, where identifying many distinct "leads" is more valuable than finding variations of a single molecule.
Limitations and Future Directions
While the theoretical framework assumes specific sampling and resampling weights, many practical GFlowNet implementations use "on-policy" sampling that doesn't perfectly match these requirements. Despite this theoretical gap, the empirical results demonstrate that the proposed losses still perform remarkably well in practice.
Future work could explore adaptive loss functions that dynamically transition from zero-avoiding (exploration) early in training to zero-forcing (exploitation) as the model converges. Additionally, applying these diverse loss functions to more complex, non-deterministic environments or Large Language Model (LLM) alignment tasks presents an exciting frontier for GFlowNet research.
Summary updated