Generative Flow Networks (GFlowNets) are powerful amortized sampling methods that learn a distribution over discrete objects proportional to their rewards. While they excel at generating diverse candidates, they often struggle to consistently hone in on the highest-reward solutions due to over-exploration in vast sample spaces.
Presented at ICLR 2024, Local Search GFlowNets (LS-GFN) introduces a simple yet highly effective modification to GFlowNet training. By incorporating a "backtrack-and-reconstruct" local search step, the model efficiently explores the neighborhoods of promising candidates, discovering significantly more high-quality "modes" than standard methods.
The Problem: Over-Exploration in GFlowNets
In fields like drug discovery or materials science, researchers search for discrete objects (like molecules or DNA sequences) that maximize a specific property or "reward." GFlowNets are popular for this because they do not just find a single "best" solution; they learn to sample a diverse variety of solutions with probabilities proportional to their rewards.
However, GFlowNets suffer from a known weakness: over-exploration. Because they typically generate objects from scratch (starting from an empty state), they can spend too much time wandering the vast search space. Consequently, they often fail to consistently find the highest peaks of the reward landscape. They lack a mechanism for "local search"—the ability to take a good solution and perturb it slightly to see if a better one is nearby.
Methods: The LS-GFN Approach
To address this, the authors propose a three-step iterative training loop that biases samples toward high-reward solutions:
- Step A (Sampling): The GFlowNet generates a set of complete trajectories (objects) from scratch using its current forward policy. This provides "inter-mode" exploration, allowing the model to jump between different regions of the search space.
- Step B (Refining): This is the core innovation. For each sampled object, the algorithm performs a local search:
- Backtrack: It uses a "backward policy" to undo $K$ steps of the construction process, effectively deconstructing part of the object.
- Reconstruct: It uses the "forward policy" to rebuild the object from that partial state.
- Filter: It decides whether to keep the new version based on a filtering rule (either a simple greedy "is the reward higher?" rule or a more complex MCMC-style stochastic acceptance rule).
- Step C (Training): The GFlowNet is trained using these refined, higher-quality trajectories stored in a prioritized replay buffer.
By repeating this loop, the model learns not just from its random successes, but from the improved versions of those successes found through local refinement.
Experimental Setup
The authors evaluated LS-GFN on six biochemical design benchmarks:
- QM9: Generating small molecules to maximize the HOMO-LUMO gap.
- sEH: Designing molecules that bind to the soluble Epoxide Hydrolase protein.
- TFBind8: Designing 8-nucleotide DNA sequences with high binding affinity.
- RNA-Binding: Designing 14-nucleotide RNA sequences for three different target transcriptions (L14-RNA1, RNA2, and RNA3).
Key Insights
- Synergy of Global and Local Search: GFlowNets and local search are highly complementary. GFlowNets provide the "global" map to find promising neighborhoods, while the backtrack-reconstruct mechanism provides the "local" fine-tuning to reach the absolute peaks.
- Exploiting the Learned Policy: Unlike traditional local search methods that rely on random mutations, LS-GFN uses the model’s own learned policies to backtrack and reconstruct. This means the local search becomes more intelligent and targeted as the model improves during training.
- The "Greediness" Paradox: Usually, making a generative model more "greedy" (focusing strictly on high rewards) reduces the diversity of its outputs. Surprisingly, LS-GFN actually increases diversity. By finding the peaks of high-reward regions more quickly and efficiently, it frees up the model's capacity to discover more unique "modes" (distinct high-reward clusters) that standard GFlowNets might never reach.
Key Results
- Massive Mode Discovery: In the sEH molecular design task, the standard GFlowNet (Trajectory Balance) found roughly 706 modes. LS-GFN found 5,228 modes—a massive seven-fold increase in the number of diverse, high-quality solutions discovered.
- Distribution Accuracy: LS-GFN consistently matched the target reward distribution more accurately than baselines across all evaluated tasks.
- Outperforming RL: LS-GFN outperformed traditional Reinforcement Learning baselines like PPO and Soft Q-Learning. While RL methods often "collapsed" onto a few high-reward samples (exhibiting low diversity), LS-GFN maintained a high fraction of unique samples while achieving higher top-K rewards.
Limitations and Future Work
The effectiveness of the local search heavily depends on the quality of the backward policy. If the model has not learned how to "undo" steps effectively, the local search might be inefficient. Additionally, the number of backtracking steps ($K$) and local search iterations ($I$) introduce new hyperparameters that require task-specific tuning.
Future directions suggested by the authors include fine-tuning the backward policy specifically for local search or incorporating more exploratory elements (like $\epsilon$-greedy strategies) into the local search step to further push performance boundaries.
Summary updated