acceptodds
Under review as a conference paper at ICLR 2027

Trajectory Matching: Discrete Flow Matching with Structured Actions

97 views

Abstract

The natural units of structured discrete generation are often not independent single-component edits but richer actions: attaching a fragment to a molecule, inserting a node together with an incident edge, or growing a hierarchy by adding a child. Yet most existing discrete flow matching methods (DFM) are restricted to independent component-wise edits over fixed-size states. This restriction stems from endpoint conditioning: endpoints fix the source and target during training but not the action sequence between them, making tractable conditional rates hard to define for complex actions that cannot be factorized component-wise. We propose trajectory matching, which conditions the flow on a full sequence of actions connecting the endpoints. This yields principled, simulation-free training targets for user-defined action spaces, including actions that change state size, modify multiple components, or depend on earlier actions. We prove that the resulting objective recovers the marginal flow and that trajectory matching strictly subsumes factorized DFM, while additionally capturing actions with prerequisite structure such as hierarchy growth or fragment-based molecule generation. Empirically, on tree and molecular graph generation, trajectory matching with domain-aligned actions matches or surpasses factorized DFM baselines (lifting MOSES validity from 92.8% to 99.2%) and transfers without retraining to substructure extension and linking. Trajectory matching enlarges the design space of discrete flow matching by turning the action vocabulary into a modeling choice.

Primary area:
generative models
Keywords:
generative, flow matching, discrete, actions, trajectories, graphs, molecules, edit flows

Reviews

Among:
Shape:
1234this paper, Top 1%
Figure 1. Mean review rating of the reviewed papers at ICLR 2027. This paper averages 4.00 over 3 reviews, above 99% of the others.
Reviewer_inj7OpenReview ↗
Rating
4
Confidence
2
Informativeness
3
Presentation
3
Soundness
3
Read review
Paper summary

This paper presents trajectory matching, a novel discrete flow matching approach for tree and graph generation. Trajectory matching gives a comprehensive theoretic framework and practical algorithm to condition generative flow on a full sequence of actions connecting the endpoints. Benchmark experiments on tree and molecular graph generation framework demonstrates the advantages of trajectory matching.

Critical strengths
  1. This paper makes an excellent theoretic novelty contribution by proposing trajectory matching as an efficient discrete flow matching framework for action sequence generation. Theory formulation and proof are comprehensively presented.
  2. Empirical experiments on tree and molecular graph generation clearly demonstrate the advantages of trajectory matching with strong experimental results.
Critical weaknesses
  1. There lacks a discussion and comparation of computational time cost.
  2. For molecular graph generation, an important practical application is property guided molecular generation, i.e., generating molecules with desired properties. A discussion or experiment about extending trajectory matching to property guided generation is needed.
Questions for authors

No other questions, see "Critical Weaknesses" section.

3 comments

We thank the reviewer for their thoughtful review and positive assessment of our theoretical contribution and empirical results.

Weakness 1: Computational cost.

Computational cost is reported in Appendix G.1, Tables 5–6. The additional computational overhead compared with the factorized DFM baseline DeFoG is modest for training: approximately 11–16% more time per training step on QM9. For sampling, our instantiations require 28–34% more time per generated sample at the same 500-step budget. These overheads do not necessarily translate into higher overall cost: structured actions can enable smaller models and fewer training or sampling steps. For example, on Tree, our smaller model trains in less than 1 hour, compared with approximately 8 hours reported for DeFoG, and maintains 100% validity even at 10 sampling steps. We have made the reference to these measurements more prominent in the main text.

Weakness 2: Property-guided molecular generation.

A benefit of formulating structured-action generation within discrete flow matching is that established conditioning and guidance mechanisms [1] carry over naturally to the learned action rates.

Specifically, we train a conditional rate predictor utθ(s,a∣r)u_t^\theta(s,a\mid r), providing the final training molecule’s property value rr alongside sampled intermediate states. The trajectory-matching targets and objective remain unchanged. Randomly replacing the condition with a null condition ∅\varnothing during training allows the same network to learn conditional and unconditional rates. At generation time, we specify a desired value r⋆r^\star and apply classifier-free guidance:

$u_t^{\theta,w}(s,a\mid r^\star) = \bigl[u_t^\theta(s,a\mid r^\star)\bigr]^w \bigl[u_t^\theta(s,a\mid\varnothing)\bigr]^{1-w}. $

Here, w=0w=0 gives unconditional generation, w=1w=1 uses the conditional model, and w>1w>1 strengthens guidance. These rates are used in the usual sampling procedure.

As an initial experiment, we evaluated logP-conditioned generation on QM9 for AtomGrow and FragGrow:

ModelwwlogP MAE ↓Within ±0.5 ↑Validity ↑
AtomGrow01.00831%99%
AtomGrow10.18488%97%
AtomGrow20.16192%97%
FragGrow01.04631%100%
FragGrow10.16390%99%
FragGrow20.14697%99%

These initial results show that property guidance enables both instantiations to generate molecules with property values closer to the desired targets. Stronger guidance further improves agreement with these targets while maintaining high validity. We have added the guidance formulation, experimental details, and results to Appendix G.8.

[1] Nisonoff et al. Unlocking Guidance for Discrete State-Space Diffusion and Flow Models. ICLR 2025.

Reviewer_inj7OpenReview ↗

Follow-up Response

I appreciate authors' efforts in rebuttal. My concerns have been addressed so I will keep my rate.

Thank you again for your thoughtful review, fast follow-up and constructive suggestions!

Reviewer_7P85OpenReview ↗
Rating
4(+1)
Confidence
4
Informativeness
3
Presentation
3
Soundness
3
Read review
Paper summary
  • Main contribution: The development of a trajectory matching strategy for discrete flow modeling with structured actions. While many previous discrete models (diffusion and flow models) generate molecules in a fixed-size state space using component-wise atom and bond updates, trajectory matching leverages integrated, chemically informed actions, such as adding an atom together with a bond or attaching a fragment.
  • The paper shows that the proposed training objective recovers the marginal flow under the stated assumptions and that factorized DFM is a special case of trajectory matching. Specifically, while many previous models generate graphs using endpoint-conditioned rates defined over restricted action spaces, trajectory matching learns rates for structured actions, analogous to Edit Flows for sequence generation. The paper proves that training on action-rate targets from individual sampled trajectories recovers the marginal flow at the population optimum, even when the action order differs across trajectories.
  • The paper extends the theory to actions with ordering dependencies and unifies different structured-generation actions, such as tree growth and atom addition, within one framework.
  • One variant of trajectory matching, FragGrow, achieves higher MOSES validity than DeFoG (99.2% vs. 92.8%), while another variant, AtomGrow, outperforms BondEdit on substructure extension and linking.
  • Trajectory matching maintains high validity with fewer sampling steps and supports transfer to structured downstream tasks, such as substructure linking, without retraining.
Critical strengths
  • Theoretically supported framework as well as its appropriate realization to modeling technique: The paper introduces a systematic approach to integrating different actions into a single framework. It establishes the relationship between trajectory-conditioned rate matching and marginal rate matching and, under appropriate conditions, shows that the model can recover the marginal flow. It also addresses dependencies in action ordering. This is an important contribution because it connects different action designs to a unified training strategy with theoretical support.

  • Well-motivated framework for molecular generative modeling and its supporting results: In molecular generation, atom–bond interdependence and the validity of partial structures (e.g., valence constraints) are important. The paper is well motivated, and its experiments align well with this motivation, particularly the higher validity achieved by FragGrow and the experiments with fewer sampling steps. These results support the idea that designing actions and intermediate states relevant to the task can improve overall generative performance.

Critical weaknesses
  • The positioning of the work, related work, and baselines: The paper should more clearly distinguish the contribution of its structured-action flow framework from its practical gains in molecular generation. The paper uses chemically informed actions and demonstrates high validity with fewer sampling steps, as well as transfer to other molecular generation tasks. However, its discussion of and comparisons with recent works addressing related problem settings and motivations are limited. For example, SimGFM [1] studies graph DFM with fewer sampling steps and is relevant to the discussion of sampling efficiency. FragFM [2] generates molecules through fragment-level discrete flow matching and also investigates generation with fewer sampling steps. GenMol [3] and SAFE-GPT [4] use SAFE strings for fragment-constrained generation and support related tasks, such as motif extension and linker design. These methods differ in their representations and training procedures but address overlapping application problems. Thus, while the current comparisons support the benefits of structured actions relative to factorized baselines, they provide limited evidence for assessing trajectory matching’s additional practical gains over these related molecular generation methods (I nevertheless support the methodological and theoretical contributions of the paper). The paper should explain its methodological differences from relevant prior work more clearly and include comparisons with representative methods on tasks where the input constraints and evaluation conditions can be made comparable, while accounting for differences in training data.

[1] SimGFM: Simplifying Discrete Flow Matching for Graph Generation (ICML, 2026)

[2] FragFM: Hierarchical Framework for Efficient Molecule Generation via Fragment-Level Discrete Flow Matching (ICLR, 2026)

[3] GenMol: A Drug Discovery Generalist with Discrete Diffusion (ICML, 2025)

[4] Gotta be SAFE: a new framework for molecular design (Digital Discovery, 2024)

Questions for authors
  • Regarding the training loss, Rao–Blackwellization, and variance reduction: In Section G.4, did the authors use equation 11, the decomposed loss for the positive-rate classifier and the rate predictor? The variance-reduction guarantee in B.3 is proved for the Bregman loss in equation 4. However, in equation 11, averaging the rate target may change the BCE target. In particular, the following inequality may hold: E[1[R>0]∣C]≠1[E[R∣C]>0],\mathbb{E}\left[\mathbf{1}[R>0]\mid C\right] \neq \mathbf{1}\left[\mathbb{E}[R\mid C]>0\right], where CC denotes the conditioning information used for Rao–Blackwellization and RR denotes the trajectory-conditioned rate target. Proposition G.1 establishes consistency of the optimal predicted rate for either target, but does not appear to establish preservation of the expected gradient or reduction in gradient variance when replacing the trajectory-conditioned target with its Rao–Blackwellized counterpart in equation 11. If equation 11 was used, can the authors explain whether the guarantees in B.3 extend to this loss? If not, could the authors distinguish the empirical findings in Section G.4 from the theoretical guarantees?

  • Scalability of trajectory matching to larger molecules: While datasets such as ZINC250k and MOSES contain relatively small molecules with low complexity (containing 1-4 rings), can the authors also report generative performance on datasets containing larger and more complex molecules (e.g., GuacaMol or other larger molecular datasets) to demonstrate the effectiveness of trajectory matching at larger molecular sizes?

3 comments

We thank the reviewer for their detailed review.

Related Work and Baselines

We have expanded the related-work discussion in Sec. 6 and App. A to cover more approaches to unconditional and fragment-constrained molecular generation. We clarify that our main contribution is a principled, general discrete flow-matching framework for structured actions, with molecular generation serving as one application. In particular, we distinguish between incorporating domain structure through the state representation and through the action space. For example, FragFM performs flow matching over fragment types and reconstructs atom-level connectivity using a separate decoder and matching algorithm. In contrast, our FragGrow instantiation retains atom-level graph states and incorporates fragments through structured attachment actions, whose rates are learned within the general trajectory-matching framework.

Our empirical evaluation aims to demonstrate the flexibility of trajectory matching and assess the benefits of structured actions. To this end, our main comparisons focus on diffusion and DFM methods operating on comparable graph representations. We have made this scope more explicit. SimGFM fits directly within this scope, and we have added it as another baseline (upd. Tab 1-2). Our FragGrow and GrowHierarchy achieve higher validity on MOSES (99.2% vs. 91.1%) and Tree (100% vs. 95%), while maintaining competitive distributional fit. Since SimGFM specifically targets sampling efficiency, the low-step comparison is particularly relevant (upd. Fig. 3): at 10 Euler steps on Tree, GrowHierarchy retains 100% validity, compared with 53% for SimGFM. For substructure extension and linking, we have clarified that the experiments demonstrate how starting from meaningful partial states enables a single trained model to perform both tasks without retraining. We have added DeFoG as another graph baseline alongside BondEdit. AtomGrow still substantially outperforms both on the evaluated tasks (upd. Tab. 3).

To place our results in a broader context, we have expanded the MOSES comparison in Tab. 9 to include methods using different representations (e.g., FragFM and SAFE-GPT) or generation paradigms. FragGrow achieves competitive validity, while FragFM and SAFE-GPT who operate on different representations obtain lower FCD. Our atom-level graphs omit explicit formal-charge, hydrogen counts and stereochemistry attributes, and these differences in representation might limit direct comparisons (App. G.3).

Question 1: Rao-Blackwellized Decomposed Loss

Yes, the additional experiments in App. G.4 used the decomposed objective of Eq. (11), App. G.1. You are right that our proofs establish expected-gradient preservation and variance reduction (Prop. B.2–B.3) for the direct Bregman objective in Eq. (4); these guarantees do not automatically extend to substituting Rao–Blackwellized targets into the decomposed objective.

We have clarified the scope of these guarantees in App. G.1 and revised the discussion of the training curves in App. G.4. We now describe the faster convergence and smaller fluctuations in validation validity observed with Rao–Blackwellized targets under the decomposed objective as empirical findings, rather than as consequences of Prop. B.3.

This clarification does not change the theoretical results, which remain valid under their stated assumptions. Additionally, the central population-consistency guarantee also holds for the decomposed objective (Prop. G.1). Empirically, our Tree ablation shows similar final generation quality for the direct and decomposed objectives (Tab. 4, App G.1).

Question 2: GuacaMol results

We have conducted new experiments on GuacaMol and compare AtomGrow and FragGrow with the DFM baseline DeFoG. We use a matched budget of 200,000 training steps with the same backbone sizes and evaluation protocol.

At 500 sampling steps:

ModelValid (%) ↑Valid & connected (%) ↑KL score (×100) ↑FCD ↓
DeFoG93.1 ± 0.178.6 ± 0.294.7 ± 0.72.66 ± 0.03
AtomGrow (ours)85.3 ± 0.185.3 ± 0.193.4 ± 0.31.82 ± 0.04
FragGrow (ours)98.5 ± 0.298.5 ± 0.296.0 ± 0.11.89 ± 0.01

Notably, FragGrow improves validity and distributional fit over DeFoG. And for these large molecules DeFoG struggles to generate connected molecules while the actions of FragGrow and AtomGrow can guarantee connectedness by construction.

The advantage of structured actions becomes even more pronounced at 50 steps:

ModelValid (%) ↑Valid & connected (%) ↑KL score (×100) ↑FCD ↓
DeFoG67.7 ± 0.951.3 ± 1.188.3 ± 0.14.82 ± 0.05
AtomGrow (ours)85.7 ± 0.485.7 ± 0.490.2 ± 0.72.05 ± 0.03
FragGrow (ours)98.4 ± 0.198.4 ± 0.194.9 ± 0.51.90 ± 0.04

FragGrow nearly maintains its validity and FCD, while DeFoG’s performance deteriorates.

We will add extended training runs in the camera-ready version.

Thank you to the authors for their detailed responses. I agree that the paper introduces a “principled, general discrete flow-matching framework for structured actions.” It also outperforms most atom-level baselines across various benchmarks. I found it interesting that AtomGrow maintains 85.7% validity on GuacaMol even with only 50 generation steps. While other approaches, such as JT-VAE, focus on simplifying the action space, this paper studies the denoising process itself, which I see as a clear contribution.

I also appreciate the clarification regarding the Rao–Blackwellized loss raised in Q1.

After reading the authors’ response to Reviewer inj7 regarding conditional sampling, I believe that including the conditional generation results in the paper would further strengthen the work.

Considering these clarifications and revisions, I will raise my score.

Thank you for your fast and thoughtful follow-up. We will be sure to include the conditional generation results also in the camera-ready version.

Reviewer_UugNOpenReview ↗
Rating
4(+1)
Confidence
2
Informativeness
2
Presentation
3
Soundness
3(+1)
Read review
Paper summary

This paper introduces Trajectory Matching — discrete flow matching that is able to condition the flow on a sequence of structured actions connecting endpoints sIs_I and sFs_F, as opposed to just the endpoints. The method allows discrete transitions to be structured actions with component-wise dependencies that grow or shrink the space, rather than simple factorized per-position transitions between the individual components of sIs_I and sFs_F, as most DFM papers support. The approach ensures validity by construction and improves over factorized DFM baselines on tree and molecule generation.

Critical strengths
  • The paper is well-structured and well-motivated, with a principled motivation for conditioning on valid domain-specific state trajectories that surpass simple component-wise flips sI(i)s_I^{(i)} to sFIs_F^{I}. The unified framing CTMC and the discussion of training and sampling is practically useful in scenarios where non-trivial action spaces can be described and enumerated (and reduces to simple DFM otherwise).

  • The discussion in Section 4 starting from independent fixed-action distributions all the way to endpoints which admit multiple action sets to describe trajectories between them, establishes a helpful taxonomy for structured DFM-based approaches.

Critical weaknesses
  • The need for manually specifying (rather than, e.g., learning) domain-specific action spaces limits it to settings where a user can enumerate useful actions, so the proposal is not a drop-in improvement to existing methods.

  • For small molecule generation (ZINC and MOSES are both small-molecule datasets), the specification of structured action spaces seems straightforward, and probably makes the reachable state space and average trajectory length much smaller than that of the unstructured DFM baselines. It would be helpful to see the performance of the method on larger and more diverse molecule generation where simple endpoint-conditioned baselines struggle to produce valid molecules, and where a much larger fragment vocabulary becomes necessary to achieve good coverage.

Questions for authors
  • The results in Table 2 of the experiments section could be disambiguated to more transparently indicate which methods manually specify their action space and which ones do not. For the proposed DFM instantiations MolEdit, BondEdit, AtomGrow, and FragGrow, it would be helpful if the authors could annotate Table 2 with trajectory lengths and average number of permissible actions per each reachable state. For FragGrow, could the authors ablate what fragment vocabulary selection options are possible and how each respective option impacts performance?

  • [Suggestion for future work.] Can we characterize the coarseness or fineness of the trajectory (when coarser or finer action spaces can be prescribed) needed to make trajectory matching tractable?

1 comment

We thank the reviewer for their thoughtful review and constructive suggestions.

Weakness 1: Domain-specific action design

We agree that exploiting domain-specific actions requires additional modeling choices, including an action space and an efficiently sampleable trajectory distribution, as acknowledged in our Limitations section. Our contribution is to make such structured actions available within a principled discrete flow-matching framework, thereby enlarging the design space of DFM and allowing additional domain knowledge to enter the generation process. When suitable structured actions are unavailable, the framework can recover standard factorized DFM through independent component-wise actions. Learning useful action vocabularies and trajectory distributions is an interesting direction for future work which we have added to the paper.

Weakness 2: Scaling to larger and more diverse molecules

We have now conducted additional experiments on GuacaMol [1], which includes much larger molecules (up to 88 heavy atoms) and broader chemical diversity, comparing FragGrow and AtomGrow with the factorized DFM baseline DeFoG.

We used a matched budget of 200,000 training steps with the same backbone sizes and evaluation protocol. For FragGrow, we have a vocabulary of 700 fragments covering > 90% of all molecules.

At 500 sampling steps, we obtain:

ModelValid (%) ↑Valid & connected (%) ↑KL score (×100) ↑FCD ↓
DeFoG93.1 ± 0.178.6 ± 0.294.7 ± 0.72.66 ± 0.03
AtomGrow (ours)85.3 ± 0.185.3 ± 0.193.4 ± 0.31.82 ± 0.04
FragGrow (ours)98.5 ± 0.298.5 ± 0.296.0 ± 0.11.89 ± 0.01

Notably, FragGrow improves both validity and distributional fit over DeFoG. Additionally, for these large molecules DeFoG struggles to generate connected molecules while the actions of FragGrow and AtomGrow can guarantee connectedness by construction.

The advantage of structured actions becomes even more pronounced when reducing the sampling budget to 50 steps.

ModelValid (%) ↑Valid & connected (%) ↑KL score (×100) ↑FCD ↓
DeFoG67.7 ± 0.951.3 ± 1.188.3 ± 0.14.82 ± 0.05
AtomGrow (ours)85.7 ± 0.485.7 ± 0.490.2 ± 0.72.05 ± 0.03
FragGrow (ours)98.4 ± 0.198.4 ± 0.194.9 ± 0.51.90 ± 0.04

FragGrow maintains nearly unchanged validity and FCD, while DeFoG’s performance deteriorates substantially.

We will extend the training runs and include the results in the camera-ready version.

Question 1.1: More Detail for Table 2

We have expanded Table 2 with Tables 8–9 in Appendix G.3, describing each method’s representation and update operations. For our four instantiations, we additionally report average trajectory lengths and average numbers of permissible actions per state.

For example, on ZINC:

MethodAverage actions per trajectoryAverage permissible actions per state
BondEdit55.5975
MolEdit47.0507
AtomGrow44.3281
FragGrow32.31,740

FragGrow indeed requires fewer actions to construct a molecule, which is one benefit of using larger structural units (and might also be one of the reasons why it performs well with fewer sampling steps). The GuacaMol results above further suggest that FragGrow remains effective on larger molecules that require more actions.

Question 1.2: Fragment Vocabulary Ablation

We evaluated two vocabulary constructions for FragGrow on ZINC: typed fragments, which distinguish fragments by their topology and feature labels, and topology-only fragments, which handle chemical features separately (App. E.2 & E.6). We varied the typed vocabulary size and compared it with a topology-only vocabulary of just 105 fragments.

VocabularyFragmentsCoverage ↑FCD ↓Validity ↑Uniqueness ↑
Typed10064.5%2.6499.5%97.2%
Typed25088.3%1.6899.5%97.6%
Typed50097.2%1.5399.6%97.9%
Typed75099.0%1.5299.6%97.8%
Topology-only105>99.9%1.2298.9%100.0%

These results suggest that broad vocabulary coverage (fraction of molecules representable) improves distributional fit (lower FCD), while the method remains robust across the tested vocabulary sizes in terms of validity and uniqueness.

More generally, the flexibility of Trajectory Matching allows us to use any fragmentation scheme as long as it admits efficient sampling of trajectories. We have added the vocabulary ablation to App G.6.

Question 2: Future work: Granularity of Actions

Action granularity alone does not determine tractability: E.g., both fragment and atom insertions admit efficient training. However, it does indeed affect trajectory length, action-space size, and inductive biases. We now discuss investigating the best granularity across domains as future work.

[1] Brown et al. GuacaMol: Benchmarking Models for de Novo Molecular Design. Journal of Chemical Information and Modeling, 2019.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.