# TopoCompile: Molecular Generation with Exact Global Count Constraints

arXiv: https://arxiv.org/abs/2610.24511 · HTML: https://mlsanity.com/paper/2610.24511/

## Key facts

- No citing papers in the map yet (data through 26 Nov 2026).
- Builds on 24 of its 40 references that are in the map.
- Submitted 17 Oct 2026.

## Builds on (most cited first, 24 of 24)

- [Automatic chemical design using a data-driven continuous representation of molecules](https://mlsanity.com/paper/1610.02415/) (2016)
- [Junction Tree Variational Autoencoder for Molecular Graph Generation](https://mlsanity.com/paper/1802.04364/) (2018)
- [DiGress: Discrete Denoising diffusion for graph generation](https://mlsanity.com/paper/2209.14734/) (2022)
- [Graph Convolutional Policy Network for Goal-Directed Molecular Graph Generation](https://mlsanity.com/paper/1806.02473/) (2018)
- [GraphAF: a Flow-based Autoregressive Model for Molecular Graph Generation](https://mlsanity.com/paper/2001.09382/) (2020)
- [GuacaMol: Benchmarking Models for De Novo Molecular Design](https://mlsanity.com/paper/1811.09621/) (2018)
- [Score-based Generative Modeling of Graphs via the System of Stochastic Differential Equations](https://mlsanity.com/paper/2202.02514/) (2022)
- [Hierarchical Generation of Molecular Graphs using Structural Motifs](https://mlsanity.com/paper/2002.03230/) (2020)
- [Fr'echet ChemNet Distance: A metric for generative models for molecules in drug discovery](https://mlsanity.com/paper/1803.09518/) (2018)
- [Constrained Graph Variational Autoencoders for Molecule Design](https://mlsanity.com/paper/1805.09076/) (2018)
- [MoFlow: An Invertible Flow Model for Generating Molecular Graphs](https://mlsanity.com/paper/2006.10137/) (2020)
- [GraphDF: A Discrete Flow Model for Molecular Graph Generation](https://mlsanity.com/paper/2102.01189/) (2021)
- [Syntax-Directed Variational Autoencoder for Structured Data](https://mlsanity.com/paper/1802.08786/) (2018)
- [Variational Flow Matching for Graph Generation](https://mlsanity.com/paper/2406.04843/) (2024)
- [DeFoG: Discrete Flow Matching for Graph Generation](https://mlsanity.com/paper/2410.04263/) (2024)
- [Molecular Hypergraph Grammar with its Application to Molecular Optimization](https://mlsanity.com/paper/1809.02745/) (2018)
- [GenMol: A Drug Discovery Generalist with Discrete Diffusion](https://mlsanity.com/paper/2501.06158/) (2025)
- [Graph Diffusion Transformers for Multi-Conditional Molecular Generation](https://mlsanity.com/paper/2401.13858/) (2024)
- [DiffMS: Diffusion Generation of Molecules Conditioned on Mass Spectra](https://mlsanity.com/paper/2502.09571/) (2025)
- [Learning-Order Autoregressive Models with Application to Molecular Graph Generation](https://mlsanity.com/paper/2503.05979/) (2025)
- [Generative Modelling of Structurally Constrained Graphs](https://mlsanity.com/paper/2406.17341/) (2024)
- [FragFM: Hierarchical Framework for Efficient Molecule Generation via Fragment-Level Discrete Flow Matching](https://mlsanity.com/paper/2502.15805/) (2025)
- [Any-Property-Conditional Molecule Generation with Self-Criticism using Spanning Trees](https://mlsanity.com/paper/2407.09357/) (2024)
- [MacroGuide: Topological Guidance for Macrocycle Generation](https://mlsanity.com/paper/2602.14977/) (2026)

## Abstract (arXiv)

Molecular generation designs novel molecules with desired structures and properties. Global count constraints specify molecular size, elemental composition, and ring content without prescribing detailed structure. Property-conditioned generators steer generation toward such targets but do not guarantee exact satisfaction. We introduce TopoCompile, which combines an autoregressive component-tree generator with a dynamic-programming compiler for supported component-additive integer counts. TopoCompile represents molecules as trees of intact ring systems and individual atoms, making each supported count additive over components. At each step, an autoregressive Transformer scores component and attachment actions, while the compiler masks actions with no target-satisfying completion. Within the fixed component vocabulary and typed attachment rules, constrained decoding guarantees exact equality for supported non-negative, component-additive integer counts. Applied at inference time, these checks let the same trained generator support different targets and count combinations without retraining. Across four benchmarks, TopoCompile achieves 100% Exact-valid yield for Common and Rare four-count target groups; the strongest baseline within each dataset reaches 44.9% or less on Rare targets. In unconditional generation, it achieves the highest validity or valid-unique-novel (V.U.N.) among the compared methods across all four benchmark datasets.
