TL;DR
Generative Flow Networks (GFlowNets) excel at sampling diverse candidates proportional to a reward function, but traditional training relies heavily on on-policy data. This paper introduces Reward Prioritized Replay Sampling (R-PRS), demonstrating that replaying high-reward past experiences drastically accelerates mode discovery and improves sample diversity in both toy grids and large-scale molecular design tasks.
What Problem Does This Paper Address?
GFlowNets are a promising class of generative models trained via reinforcement learning (RL) principles to sample discrete objects (like molecular graphs) with a probability proportional to their reward. This makes them exceptionally good at "mode discovery"—finding multiple distinct, high-reward solutions rather than collapsing onto a single global optimum.
While GFlowNets are theoretically off-policy algorithms, most implementations train them using trajectories generated purely by the active, evolving policy. This on-policy focus creates an exploration bottleneck: as the policy changes, the model can "forget" previously discovered high-reward regions or struggle to find them efficiently in sparse reward landscapes. The authors investigate whether integrating an experience replay buffer—a staple tool for sample efficiency in standard RL—can solve this issue for GFlowNets.
Methods
The authors evaluate three training configurations to isolate what makes a replay buffer effective for GFlowNets:
- No Replay Buffer: Standard training using only trajectories sampled from the current online policy.
- Random Replay Buffer: Storing past trajectories in a buffer and sampling them uniformly at random to mix with online data.
- Reward Prioritized Replay Sampling (R-PRS): A novel approach inspired by Prioritized Experience Replay (PER). Instead of prioritizing transitions by their temporal-difference (TD) error (which can be unstable in GFlowNets), R-PRS prioritizes and replays full trajectories that yielded the highest rewards.
These methods are evaluated across standard GFlowNet objectives, including Flow Matching (FM) and Trajectory Balance (TB).
Datasets
The algorithms are benchmarked on two environments:
- Hypergrid: A synthetic $n$-dimensional hypercube grid where rewards are concentrated in specific coordinate corners (modes). The difficulty can be tuned by adjusting a background reward parameter ($R_0$); a lower $R_0$ makes the high-reward modes harder to find.
- Molecule Synthesis: A massive, realistic biochemical environment with approximately $10^{16}$ states. The agent constructs molecular graphs by iteratively adding building blocks. The reward function is the binding affinity of the generated molecule to a target protein, evaluated using a pretrained proxy model (AutoDock Vina and a Message-Passing Neural Network).
Key Insights and Ideas
- Random replay isn't enough: Simply adding a standard, uniformly sampled replay buffer provides virtually zero benefit in complex environments like molecule synthesis.
- Reward is the right priority metric: Prioritizing by reward (R-PRS) acts as a strong regularizer. Repeatedly exposing the network to highly successful historical paths prevents the policy from drifting away from known modes and accelerates the discovery of new ones.
- More data $\neq$ better exploration: The authors showed that simply increasing the batch size of purely on-policy samples actually degrades GFlowNet performance. The performance boost is strictly due to the quality of historical high-reward trajectories provided by the prioritized buffer, not just an increase in sample volume.
Key Results
- Hypergrid: In a challenging 4D hypergrid setup ($R_0 = 10^{-3}$), R-PRS discovered 100% of the target modes significantly faster than both the random replay and no-replay baselines. It also converged much faster toward the true reward distribution.
- Molecule Synthesis: In the large-scale molecular environment, R-PRS discovered over 9,000 high-reward modes ($R > 0.9$) within 10,000 iterations. In stark contrast, both the standard on-policy baseline and the random replay buffer failed to clear even 2,000 modes in the same timeframe.
Limitations and Future Work
While the paper clearly demonstrates the power of reward-prioritized replay, its exploration of prioritization strategies is limited. The authors only compare uniform random sampling against pure reward-based prioritization.
They note that future work should investigate other advanced experience replay variations from the broader RL literature—such as prioritizing by TD-error, trajectory freshness, or explicit diversity metrics—to see if they can provide further stability and speed improvements for GFlowNet training.
Summary updated