Introduction
When fine-tuning generative models—whether aligning a Large Language Model (LLM) for mathematical reasoning or training a GFlowNet for drug discovery—the goal is to align the model's output distribution with a target distribution defined by a reward function. The industry standard for this alignment is minimizing the Reverse KL divergence. While effective, Reverse KL is notoriously "mode-seeking": it encourages the model to collapse onto a few high-reward peaks while ignoring other valid, slightly less optimal solutions. In fields like molecule discovery, this lack of diversity is a critical flaw.
Furthermore, standard Reinforcement Learning (RL) estimators like REINFORCE suffer from high variance, making training unstable. While recent squared-error losses offer lower variance and work well with off-policy data, they remain locked into the mode-seeking behavior of Reverse KL. This paper introduces $f$-Trajectory Balance ($f$-TB), a generalized loss family that bridges this gap, allowing researchers to precisely tune the balance between reward maximization and distributional diversity, even when training on off-policy data.
The $f$-Trajectory Balance Framework
The authors derive a mathematical bridge between translation-invariant losses (functions that depend only on the difference between model and target log-probabilities) and the broader family of $f$-divergences.
Key technical innovations include:
- The $f$-TB Loss Formula: A general recipe that converts any convex function $f$ into a surrogate loss. When evaluated on-policy, the gradients of this loss exactly match the gradients of the corresponding $f$-divergence. Crucially, it retains the same global minimizer even when evaluated off-policy.
- The $\alpha$-Divergence Knob: By focusing on the $\alpha$-divergence family, the authors provide a single hyperparameter ($\alpha$) that acts as a "diversity knob." Setting $\alpha=0$ (Forward KL) encourages mode-covering and diversity, while $\alpha=1$ (Reverse KL) encourages mode-seeking.
- DevGrad: A generalization of the "VarGrad" estimator that uses "generalized deviations" to estimate the partition function batch-wise, significantly reducing gradient variance.
- Tempered Losses: To handle the extreme numerical ranges often found in LLM rewards—where probabilities can span hundreds of orders of magnitude—a tempering mechanism is introduced to keep gradients stable without losing signal.
Experimental Results
The researchers validated $f$-TB across four distinct domains, demonstrating its versatility and effectiveness:
1. Synthetic Grids and Molecule Discovery
In a 2D synthetic hypergrid designed to test multi-modal discovery, the Forward KL ($\alpha=0$) version of $f$-TB found all four reward modes significantly faster than standard Trajectory Balance. This success translated to SynFlowNet, where the goal is to generate diverse, synthetically accessible molecules with high binding affinity (across targets like sEH, GSK3$\beta$, and DRD2). The authors found that "annealing" $\alpha$—starting with a mode-covering loss to explore and ending with a mode-seeking loss to refine—produced the best results for molecule generation.
2. Mode Coverage in Diffusion Models
The team tuned a pre-trained MNIST diffusion model to conditionally sample only "odd" or "even" digits. Standard methods tended to oversample specific digits (e.g., "0" and "6" for evens). In contrast, $f$-TB successfully covered all digits in the parity class, sampling them with much higher uniformity.
3. Asynchronous LLM Fine-Tuning
Training LLMs like Qwen 2.5 (3B to 14B) and OLMo-2 (7B) on math problems (GSM8k and Hendrycks MATH) using asynchronous RL is notoriously difficult. Because $f$-TB losses remain valid off-policy, they successfully trained LLMs with a 50-step asynchronous delay—a setting where standard algorithms like GRPO often fail. Furthermore, models trained with more "mode-covering" $f$-TB losses maintained higher entropy and generalized better to unseen downstream tasks, such as the AIME 2024 math competition.
Key Takeaways and Limitations
The most powerful insight from this work is the ability to control the exploration-exploitation trade-off simply by swapping the loss function, without altering the model architecture or adding complex entropy penalties. The theoretical proof that any convex, translation-invariant loss on log-probabilities implicitly minimizes a specific $f$-divergence fundamentally reframes how we view divergence minimization.
However, the approach is not without limitations. The introduction of the $\alpha$ parameter (and potential annealing schedules) adds another layer of hyperparameter tuning to already complex pipelines. Additionally, even with tempering, extreme mode-covering settings (very low $\alpha$ values) can face numerical stability issues in high-dimensional spaces. Finally, while the paper touches on diffusion, extending the full "DevGrad" suite to continuous-time path integrals remains an open area for future exploration.
Summary updated