In many generative tasks, from designing molecules to planning complex procedures, we construct an object through a sequence of discrete actions. Traditionally, models learn these sequences using local objectives—ensuring that each individual step is likely given the previous one. However, local learning often struggles with "credit assignment": if a molecule only receives a reward at the very end of its construction, it takes many iterations for that reward signal to propagate back to the early, foundational actions.
Trajectory Balance (TB) and its derivatives shift this paradigm by enforcing consistency across entire sequences rather than isolated transitions. By treating the generation process as a "flow" through a state-space graph, these objectives allow models to learn from global outcomes in a single update, significantly accelerating convergence and improving the diversity of generated samples.
The Problem with Local Consistency
Standard Reinforcement Learning (RL) and Generative Flow Networks (GFlowNets) often rely on local consistency rules, such as Detailed Balance or Temporal Difference learning. As noted by Zhao et al., these methods only ensure consistency between adjacent states. In high-dimensional or noisy environments, this local focus can lead to brittle value estimations that lack a coherent global perspective.
In the context of GFlowNets, local flow matching requires that the flow entering a state equals the flow exiting it. While theoretically sound, Jain et al. argue that these local rules result in slow credit assignment. Because the reward is only seen at the terminal state, the "knowledge" of that reward must trickle backward one step at a time through the graph.
The Trajectory Balance Objective
To solve this, Jain et al. proposed the Trajectory Balance objective. Instead of matching flows at each state, TB enforces a constraint on the entire path from the start ($s_0$) to the terminal state ($s_n$).
The intuition is to equate two ways of looking at a path:
- The Forward Path: The product of the forward transition probabilities ($P_F$) along the trajectory, scaled by a learnable global flow ($Z$).
- The Backward Path: The product of the backward transition probabilities ($P_B$) along the trajectory, scaled by the terminal reward ($R$).
When these two products are equal, the model is guaranteed to sample objects with a probability proportional to their rewards. Because this identity involves the entire path, a single gradient update allows information from the terminal reward to influence every action in the sequence simultaneously. This mechanism bypasses the delays of step-by-step propagation, leading to much faster training in complex tasks like molecule design.
Bridging Local and Global: Subtrajectory Balance
While global trajectory objectives offer low bias and fast credit assignment, they can suffer from high variance, especially in very long sequences. Madan et al. introduced Subtrajectory Balance (SubTB) to find a middle ground.
SubTB enforces consistency across all possible sub-segments of a sampled episode. By matching the flow at the start of a sub-path with the flow at the end (adjusted by the transition probabilities within that segment), the model can learn from partial sequences of varying lengths. As Xue et al. demonstrate in the context of language modeling, this approach provides more stable gradients and better convergence by balancing the stability of local updates with the long-range signals of global objectives.
Generalizing the Principle
The power of trajectory-level consistency has led to its adoption across diverse domains:
- Continuous Spaces: Lahlou et al. extended the theoretical foundation of TB to continuous and hybrid state spaces, proving that trajectory-based objectives remain robust for sampling from complex, multi-modal distributions where traditional methods fail.
- Reinforcement Learning: In Atari games, Zhao et al. showed that enforcing path consistency—ensuring the sum of rewards and future returns remains stable along an optimal path—allows agents to master games with significantly less data than standard temporal difference methods.
- Procedural Reasoning: For tasks like "how-to" script induction, Zhou et al. utilized a global path-consistency loss to ensure that generated sequences follow logical dependencies. By evaluating the entire path, the model avoids the local errors common in standard language models that only predict one step ahead.
- Combinatorial Optimization: Morozov et al. applied a regularized TB objective to solve shortest-path problems in large graphs, such as the Rubik's Cube, demonstrating that global consistency is key to search efficiency in non-acyclic environments.
By shifting the focus from "what is the next best step" to "does this entire path make sense," trajectory-based objectives provide a mathematically rigorous way to train generative models that are both globally coherent and efficient to optimize.
Key Foundational Work
Learning GFlowNets From Partial Episodes For Improved Convergence And Stability (2023) — contributed 4 concept elements to this direction.
Trajectory balance: Improved credit assignment in GFlowNets (2022) — contributed 3 concept elements to this direction.
Generalized Weighted Path Consistency for Mastering Atari Games (2023) — contributed 3 concept elements to this direction.