FragFM: Hierarchical Framework for Efficient Molecule Generation via Fragment-Level Discrete Flow Matching

Joongwon Lee, Seonghwan Kim, Seokhyun Moon, Hyunwoo Kim, Woo Youn Kim

Generating new, chemically valid molecules is akin to building a complex machine. Traditional "atom-based" generative models attempt to place every single atom and bond individually. While precise, this approach often leads to "spaghetti" structures that lack chemical validity or simply take too long to compute as target molecules grow larger.

A new paper introduces FragFM, a hierarchical framework that changes the paradigm by building molecules out of "pre-assembled" blocks called fragments. By combining discrete flow matching with a clever "fragment bag" strategy, the authors demonstrate a faster, more scalable way to explore chemical space.

TL;DR

FragFM is a hierarchical generative framework that assembles molecules at the fragment level using discrete flow matching, then reconstructs atom-level details via a coarse-to-fine autoencoder. It significantly outperforms atom-based models in speed and chemical validity, particularly on a newly introduced, high-complexity benchmark for natural products (NPGen).

What Problem Does This Paper Address?

Most state-of-the-art molecular generators (like diffusion or flow-based models) operate at the atom level. This presents three major hurdles:

  1. Scalability: The number of potential bonds grows quadratically with the number of atoms, making large molecules computationally expensive to generate.
  2. Chemical Validity: Atoms have strict valency rules. Atom-based models often struggle to capture complex features like rings, leading to invalid or unstable structures.
  3. Sparsity: In a molecular graph, most atoms aren't connected to most other atoms. Predicting this sparse connectivity accurately is difficult for standard graph neural networks.

While fragment-based methods exist, they usually rely on small, fixed vocabularies of fragments, limiting the diversity of molecules they can create.

Methods

FragFM uses a hierarchical, "coarse-to-fine" approach to overcome these limitations:

Overview of the FragFM framework
  • Coarse-to-Fine Autoencoder: The model first learns to compress an atom-level molecule into a "coarse" fragment graph, storing fine-grained connectivity details in a latent vector. A decoder then uses the Blossom algorithm—a classic graph theory tool—to perfectly reconstruct the atom-level bonds from the fragment-level plan.
  • Discrete Flow Matching (DFM): Instead of standard diffusion, the authors use flow matching on the discrete states of the fragment graph. This allows the model to "flow" from a random noise state to a structured molecular graph.
  • Stochastic Fragment Bag: To handle a massive library of potential fragments without computational bottlenecks, FragFM uses an Info-NCE loss. During training, it only evaluates a small "bag" of fragments (one correct target and several negatives), allowing the model to scale to virtually any fragment library size.
  • Dual-Level Guidance: The model can be steered to produce molecules with specific properties by re-weighting which fragments it picks from the bag and by guiding the overall flow of the generation.

Datasets

The authors evaluated FragFM on several standard benchmarks, alongside a challenging new dataset:

UMAP plots and examples comparing MOSES, GuacaMol, and the new NPGen dataset
  • MOSES & GuacaMol: Industry standards for drug-like molecule generation.
  • ZINC250k: A common dataset for property-conditioned generation.
  • NPGen (New!): The Natural Product Generation benchmark. Natural products are larger and more complex than typical synthetic drugs. NPGen contains ~650k molecules with an average of 35 heavy atoms, providing a much tougher stress test for generative models.

Key Insights and Results

  • Fragments as Natural Constraints: By using chemically meaningful fragments, the model is physically restricted from generating many types of "impossible" chemistry. It achieves nearly 100% validity without needing explicit hard-coded rules.
  • Robustness to Sampling Steps: Unlike atom-based diffusion models that degrade with fewer steps, FragFM remains highly accurate even with only 10 to 50 denoising steps.
  • Superior Fidelity & Speed: On the MOSES benchmark, FragFM achieved a Fréchet ChemNet Distance (FCD) of 0.58, significantly outperforming the previous state-of-the-art atom-based model (DiGress, 1.19). Furthermore, on the complex NPGen dataset, FragFM was 5x faster at sampling.
  • Better Property Control: When conditioned to generate molecules with specific traits, FragFM maintained high structural validity, whereas atom-based models often produced broken molecules to satisfy the goal.

Limitations and Future Work

The authors acknowledge that fragment-based models face a "scaffold bottleneck." If a specific molecular scaffold is entirely absent from the fragment library, the model cannot generate it. While FragFM's fragment embedding allows it to generalize to similar fragments, it remains somewhat bound by initial fragmentation rules. Future work could explore rule-free fragmentation or extend the framework to generate 3D molecular conformations alongside the 2D graph structure.

Summary updated

BibTeX
@inproceedings{lee2026fragfm,
  author = {Joongwon Lee and Seonghwan Kim and Seokhyun Moon and Hyunwoo Kim and Woo Youn Kim},
  title = {{FragFM: Hierarchical Framework for Efficient Molecule Generation via Fragment-Level Discrete Flow Matching}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=tr6vRn2aPg},
}
Figure