betaFeedback

WorksComputer Science

TopoCompile: Molecular Generation with Exact Global Count Constraints

Abstract

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.

Introduction

Designing molecules with specified structural and physicochemical properties is a central problem in drug discovery and materials design. Neural molecular generators address this problem by learning distributions over molecular structures and using them to produce chemically plausible candidates beyond the training set [7, 9, 38, 30, 19]. Recent advances in diffusion, flow, and autoregressive models have further improved molecular generation across graph and sequence representations [34, 35] (Jolicoeur-Martineau et al. 2025).

In practical molecular design, chemically plausible candidates often also need to meet specific structural requirements. Global count constraints provide a direct way to express these requirements: users can specify molecular size, elemental composition, and ring content without prescribing detailed connectivity. Such constraints arise in molecular structure elucidation, where the molecular formula is known but the atom connectivity remains unresolved [32, 2]. They also support controlled comparison libraries for virtual screening and molecular-model evaluation [8], while exact ring counts enable targeted exploration of atypical topologies such as high-cycle-rank molecules. The generator chooses detailed structures from the learned distribution while the user controls global molecular characteristics.

Existing approaches differ in how precisely they control generation and what users must specify. Property-conditioned generators steer generation toward multiple requested attributes but generally do not guarantee exact satisfaction [17, 15] (Jolicoeur-Martineau et al. 2025). Structure-conditioned methods can provide stronger structural control, but require a user-specified scaffold or partial structure, fixing part of the molecule in advance [36, 16]. Spectrum-conditioned methods instead require a mass spectrum and molecular formula [2]. Hard-constraint methods enforce selected rules through projection, search, or symbolic reasoning [29, 20, 28, 6]. Existing approaches therefore do not directly address our setting: satisfying multiple count constraints exactly while leaving the scaffold and partial structure unspecified.

To achieve this, we build molecules from scratch and check before each addition whether the requested counts remain achievable. A locally valid addition can still make these targets unreachable, yet enumerating every possible completion would require a combinatorial search over future molecular structures. We address both difficulties with a lossless component-tree representation. We cut each bridge bond, whose removal disconnects the molecular graph, and treat every intact ring system and every atom outside rings as a component. The resulting component-level graph is a tree. Each supported count is the sum of fixed, non-negative integer contributions from these components. Each component also has attachment ports that identify the local atom and bond type for a connection. Under a fixed component vocabulary and attachment rules, whether the generator can complete a partial molecule depends only on the number of components remaining, unmatched ports by bond type, and remaining target counts. A dynamic program can therefore test for an exact completion using this compact state, without enumerating complete molecular graphs.

Building on this representation, we introduce TopoCompile, which combines an autoregressive Transformer for component-tree generation with a dynamic-programming compiler. At each step, the Transformer scores component and attachment choices, while the compiler removes choices that leave no target-satisfying completion. The generator then samples from the renormalized probabilities, preserving its relative preferences among the remaining choices. Thus, the generator learns to construct plausible molecules, while the compiler ensures that the requested counts remain achievable. Because we apply constraints only during decoding, the same trained generator supports different target values and count combinations without retraining. Within the fixed component vocabulary and attachment rules, constrained decoding guarantees target counts for every molecule.

Our contributions are:

  • Exact-control interface. TopoCompile provides exact control over supported global counts while leaving the scaffold, component identities, and component-tree layout unspecified. The same trained generator supports different target values and combinations of supported counts without retraining.

  • Completion-checking compiler. We derive a dynamic program over the remaining component count, unmatched ports by bond type, and remaining target counts. We prove that it determines exactly whether a target-satisfying completion exists under the fixed vocabulary and attachment rules, enabling exact decoding without rejection or repair.

  • Evaluation. Across four benchmarks, TopoCompile achieves 100% exact-valid yield for both frequently and infrequently observed four-count targets, whereas the strongest baseline in each dataset reaches at most 44.9% on infrequent targets. In unconditional generation, it achieves the highest validity or yield of valid, unique, novel molecules among the compared methods on all four benchmarks.

Related Work

Molecular generation. Neural molecular generators fall into two categories: iterative global-update methods and sequential autoregressive methods. Diffusion models [34, 17, 16] (Jo et al. 2022) and discrete flow-matching models [26, 15] (Feinberg et al. 2024) repeatedly refine a global state represented as a molecular graph, sequence, or fragment graph. Autoregressive models instead construct molecules through local decisions, adding atoms and bonds sequentially [30, 19] or optimizing the generation order [35]. To reduce sequential complexity, several frameworks use trees to organize motifs or guide generation [9, 10, 1]. Grammar-based models constrain generation through syntactic rules [14], semantic attributes [4], or molecular graph grammars [12]. These methods target valid construction; TopoCompile checks whether each partial molecule can meet the requested global counts.

Constrained molecular generation. Existing methods provide different levels of control over generated molecules. Reward-based and property-conditioned approaches bias generation toward desired molecular properties, but generally do not guarantee exact satisfaction of requested values [37, 17] (Jolicoeur-Martineau et al. 2025). Structure-guided methods provide stronger control by conditioning on user-specified scaffolds or topological templates; for example, Tree-Invent enforces user templates through masked generation [36]. However, such methods fix part of the molecular structure in advance, reducing structural freedom. Hard-constraint methods go further by enforcing selected constraints through projection, constraint programming, or symbolic reasoning [29, 20, 28, 6, 23]. Related mechanisms such as valence masks [18] and valid-by-construction representations [13] guarantee aspects of chemical validity, but do not by themselves guarantee exact satisfaction of a user-specified global count vector. TopoCompile targets a different setting: exact control of multiple global counts while leaving the molecular components and their arrangement unspecified.

The TopoCompile Method

Problem formulation. We consider exact constrained molecular generation with a trained generator pθp_{\theta}. Let R:G→N0dR:\mathcal{G}\to\mathbb{N}_{0}^{d} map a supported molecular graph GG to a vector of discrete global counts, and let b⋆∈N0d\mathbf{b}^{\star}\in\mathbb{N}_{0}^{d} be the user-specified target. The task is to generate G∈GG\in\mathcal{G} such that R(G)=b⋆R(G)=\mathbf{b}^{\star}; if the user additionally specifies a total component count MM, the generated graph must contain exactly MM components. The scaffold, component identities, and component-tree layout remain unspecified, and different target values and combinations of supported counts must be handled by the same trained generator without retraining or post-hoc rejection or repair of completed samples.

Overview. § 3.1 introduces the component-tree representation and autoregressive generator. § 3.2 derives a dynamic program for exact completion checking, and § 3.3 uses it to mask infeasible actions during decoding. Figure 1 provides an overview of the complete training and constraint-guided sampling pipeline.

Figure 1. Overview of TOPOCOMPILE. (A) Molecules are encoded as trees of atom and ring-system components to train an autoregressive generator. (B) During sampling, the dynamic program masks additions with no target-satisfying completion; the completed tree is decoded into a molecule.

Offline learning of the component-tree generator

Tree representation of molecular graphs. We represent each molecule as a tree of molecular components. This representation reduces autoregressive generation to adding one component to one parent at each step while retaining enough information to reconstruct the original molecular graph. For a connected molecular graph G=(V,E,x,y)G=(V,E,x,y), an edge is a bridge if removing it disconnects GG. In a molecular graph, bridge edges are exactly the edges that do not belong to any ring. Removing these non-ring edges partitions GG into atom-disjoint components C(G)={C1,…,CM}\mathcal{C}(G)=\{C_{1},\ldots,C_{M}\}. Replacing each component with one node and retaining one edge for each bridge produces a component-level graph T‾(G)\overline{T}(G) that records the connections among components. As shown in Figure 1(A2), its nodes fall into two types: single atoms and ring systems; ring-system nodes include single rings and fused, spiro, or bridged multi-ring structures. By bridge decomposition, T‾(G)\overline{T}(G) is a tree [33].

Component vocabulary and encoding. For each component CiC_i, Pi\mathcal{P}_i lists the ports exposed by removed bridges. Each port records its local atom, bridge-bond type, and symmetry class for equivalent ports. We treat C^i=(Ci,Pi)\widehat{C}_i=(C_i,\mathcal{P}_i) as a port-annotated template and write C^(G)={C^i:Ci∈C(G)}\widehat{\mathcal{C}}(G)=\{\widehat{C}_i:C_i\in\mathcal{C}(G)\}. Canonicalization independent of atom ordering gives V=Unique⁡(⋃G∈DtrainC^(G))\mathcal{V}=\operatorname{Unique}(\bigcup_{G\in\mathcal{D}_{\mathrm{train}}}\widehat{\mathcal{C}}(G)). Each component template τ∈V\tau\in\mathcal{V} stores a complete internal graph and a fixed port set P(τ)\mathcal{P}(\tau), which determines σ(τ)\sigma(\tau). Only canonically identical templates share a vocabulary entry Figure 1(A2).

To encode a molecule, we assign the corresponding template τi∈V\tau_i\in\mathcal{V} to each component CiC_i, with Pi=P(τi)\mathcal{P}_i=\mathcal{P}(\tau_i). The component tree identifies which components connect, but each tree edge must also identify the atoms that form the connection. For every edge (i,j)(i,j), we record ports pi→jp_{i\to j} and pj→ip_{j\to i} on the two components and retain the original bridge attribute yijbridgey_{ij}^{\mathrm{bridge}}. The arrows distinguish the two ends of an undirected bond; they do not indicate bond directions.

For the ring-system–Br connection in Figure 1(A2), the endpoint ports locate the attachment atoms, and yijbridgey_{ij}^{\mathrm{bridge}} records the bond type. The complete encoding is

Enc⁡(G)=({(τi,Pi)}i=1M,{(i,j,pi→j,pj→i,yijbridge)}(i,j)∈ET‾).(1)\operatorname{Enc}(G)=\left(\left\{(\tau_i,\mathcal{P}_i)\right\}_{i=1}^{M},\left\{(i,j,p_{i\to j},p_{j\to i},y_{ij}^{\mathrm{bridge}})\right\}_{(i,j)\in E_{\overline{T}}}\right). \tag*{(1)}

The decoder retrieves component graphs and restores bridges from their ports and bond attributes.

Let Grep\mathcal{G}_{\mathrm{rep}} contain connected graphs after canonicalization that omits stereochemical and isotopic annotations. Their atom states, bond states, and port-local indices must lie in the declared finite encoding sets, and their port-annotated templates must belong to V\mathcal{V}.

Proposition 1 (Lossless component-tree encoding). For every G∈GrepG \in\mathcal{G}_{\mathrm{rep}}, Dec⁡(Enc⁡(G))≃G\operatorname{Dec}(\operatorname{Enc}(G)) \simeq G, where ≃\simeq preserves the stored atom and bond attributes.

Appendix § 9.§ 2 proves the proposition. Generation recombines fixed component templates rather than creating new ring interiors or port configurations; whole-molecule test coverage ranges from 93.3% to 99.3% (Appendix § 14).

Construction sequences. We randomize the root and use parent-before-child traversals to expose the generator to multiple valid construction sequences for each molecule. The traversal also ensures that every non-root component has an existing parent when the model adds it. Each template τ\tau has a bond-type vector σ(τ)=(nsingle,ndouble,ntriple,naromatic)\boldsymbol{\sigma}(\tau) = (n_{\mathrm{single}}, n_{\mathrm{double}}, n_{\mathrm{triple}}, n_{\mathrm{aromatic}}) that counts its attachment ports by bridge-bond type. Let hth_t be the partial tree before step tt. A non-root action at=(pt,σt,τt,qt)a_t = (p_t, \sigma_t, \tau_t, q_t) selects an open parent port ptp_t, a component τt\tau_t with σt=σ(τt)\sigma_t = \boldsymbol{\sigma}(\tau_t), and a child port qtq_t of matching bond type. Adding the component joins the selected ports with a bridge, consumes both ports, and leaves its other ports open. The root action selects only a bond-type vector and component, with p1=q1=nullp_1 = q_1 = \mathrm{null}.

Next-action prediction and training. We train an autoregressive Transformer for pθ(at∣ht,M)p_\theta(a_t \mid h_t, M), where MM is the total component count. Four prediction heads factor each addition, allowing compatibility to narrow successive choices without a separate class for every parent-port, bond-type vector, component, and child-port tuple. The parent-port and bond-vector heads predict where to extend the tree and the new component’s connection requirements. The component head selects from V(σt)={τ∈V:σ(τ)=σt}\mathcal{V}(\sigma_t) = \{\tau\in\mathcal{V} : \boldsymbol{\sigma}(\tau) = \sigma_t\}, and the child-port head selects a port matching the parent bond type. Under teacher forcing, each head predicts its corresponding field of at∗a_t^* from the ground-truth partial tree ht∗h_t^*, using the weighted cross-entropy loss L=Lbond+λcompLcomp+Lparent+Lchild\mathcal{L} = \mathcal{L}_{\mathrm{bond}} + \lambda_{\mathrm{comp}}\mathcal{L}_{\mathrm{comp}} + \mathcal{L}_{\mathrm{parent}} + \mathcal{L}_{\mathrm{child}}, where λcomp>0\lambda_{\mathrm{comp}} > 0 weights component prediction (Appendix § 10.§ 2). At the root, only bond-vector and component losses apply because no parent attachment exists. Unconditional generation draws MM from its empirical training distribution and samples actions autoregressively from pθp_\theta; constrained generation reuses this model with the completion checks.

Compiling exact global constraints

The learned generator scores plausible component additions, whereas exact control requires knowing whether each addition leaves a target-satisfying completion. Model probabilities alone do not provide this feasibility test. A dynamic program performs the test from a compact summary of the remaining requirements without enumerating future molecular structures.

Targets and component contributions. The user specifies a vector of target counts b⋆\mathbf{b}^{\star}, without specifying components or their tree layout. For a fixed total component count, we write c⋆=(M,b⋆)\mathbf{c}^{\star} = (M,\mathbf{b}^{\star}). When the user omits MM, we check M=1,…,Mmax⁡M = 1,\ldots,M_{\max} and sample among the feasible values using the restricted empirical prior in Appendix § 10.§ 4. Here, Mmax⁡M_{\max} is the generator’s component-count limit.

We call r:V→N0dr : V \to\mathbb{N}_{0}^{d} a supported count map for RR if it assigns each template a non-negative integer contribution, attachment leaves these contributions unchanged, and every constructible molecule satisfies R(G)=∑i=1Mr(τi)R(G) = \sum_{i=1}^{M} r(\tau_i). These conditions allow us to update the remaining targets by subtracting r(τ)r(\tau) after adding a component. Heavy-atom and element counts satisfy them directly. Ring-system count and cycle rank do as well because bridge attachments do not create cycles between components. Appendix § 9.§ 5 derives this additivity. The current compiler supports exact equalities over these non-negative, component-additive integer counts. Quantities that depend on component connections, such as cross-component motifs, require a different state or acceptance rule. The formulation excludes continuous descriptors, inequalities, and optimization objectives.

A compact state for completion checking. A partial tree’s completion feasibility depends on its remaining component budget, open attachment ports, and residual target counts. After root selection, we collect them in z=(k,f,b)\mathbf{z} = (k,\mathbf{f},\mathbf{b}): kk counts the components still to add, f∈N0d\mathbf{f} \in\mathbb{N}_{0}^{d} counts open ports by bond type, and b\mathbf{b} contains the counts that future components must supply. The coordinates of f\mathbf{f} match σ(τ)\boldsymbol{\sigma}(\tau) but summarize the entire partial tree.

The compiler treats two ports as compatible exactly when their bridge-bond types match. Atom locations change the molecule but not compatibility, and each template fixes its count contribution. Partial trees with the same (k,f,b)(k,\mathbf{f},\mathbf{b}) share the same completion-feasibility result.

Grouping additions with the same effect. For an action a=(p,σ,τ,q)a = (p,\sigma,\tau,q), the state update depends only on γ(a)=(σ(τ),r(τ),ℓ(q))\gamma(a) = (\sigma(\tau),r(\tau),\ell(q)), where ℓ(q)\ell(q) is the child port’s bond type. We group actions by this tuple and denote the finite group set by Γ\Gamma. For γ=(σγ,rγ,ℓγ)\gamma= (\sigma_\gamma,r_\gamma,\ell_\gamma), let eℓγ\mathbf{e}_{\ell_\gamma} denote the unit vector for bond type ℓγ\ell_\gamma. The transition is

Next⁡(z,γ)=(k−1,f+σγ−2eℓγ,b−rγ).(2)\operatorname{Next}(\mathbf{z},\gamma) = (k-1,\mathbf{f}+\sigma_\gamma-2\mathbf{e}_{\ell_\gamma},\mathbf{b}-r_\gamma). \tag*{(2)}

The new component supplies rγr_\gamma and its ports; the bridge consumes one existing and one new open port of type ℓγ\ell_\gamma. Grouping shares only feasibility computation: the generator still scores concrete components and attachment sites.

Joint feasibility DP. A feasible continuation must use one sequence of additions to close every open port and reduce every residual count to zero. Let Γ(z)\Gamma(\mathbf{z}) contain groups satisfying fℓγ≥1\mathbf{f}_{\ell_\gamma} \ge1, (σγ)ℓγ≥1(\sigma_\gamma)_{\ell_\gamma} \ge1, and rγ≤br_\gamma\le\mathbf{b} coordinatewise. Define Fc⋆(z)F_{\mathrm{c}}^{\star}(\mathbf{z}) to indicate whether exactly kk further additions can close all ports and supply the remaining counts:

Fc⋆(0,f,b)=1[f=0∧b=0],Fc⋆(z)=⋁γ∈Γ(z)Fc⋆(Next⁡(z,γ)),k>0.(3)F_{\mathrm{c}}^{\star}(0,\mathbf{f},\mathbf{b}) = \mathbf{1}[\mathbf{f} = \mathbf{0} \land\mathbf{b} = \mathbf{0}], \qquad F_{\mathrm{c}}^{\star}(\mathbf{z}) = \bigvee_{\gamma\in\Gamma(\mathbf{z})} F_{\mathrm{c}}^{\star}(\operatorname{Next}(\mathbf{z},\gamma)), \quad k > 0. \tag*{(3)}

For example, with one component left, the same template must close all open ports and supply the residual counts; different templates satisfying these requirements separately do not suffice. Separate structural and count reachability checks may succeed through different continuations, so the compiler uses them only to prune states. It evaluates the joint recurrence on demand and memoizes results across construction histories. Appendix § 9.8 gives the algorithm and pruning rules.

Constrained sampling

Constrained decoding. For fixed c⋆=(M,b⋆)\mathbf{c}^{\star}=(M,\mathbf{b}^{\star}), a root component τ\tau with r(τ)≤b⋆r(\tau)\leq\mathbf{b}^{\star} leaves state zroot(τ)=(M−1,σ(τ),b⋆−r(τ))\mathbf{z}_{\mathrm{root}}(\tau)=(M-1,\sigma(\tau),\mathbf{b}^{\star}-r(\tau)). We retain roots satisfying Fc⋆(zroot(τ))=1F_{\mathbf{c}^{\star}}(\mathbf{z}_{\mathrm{root}}(\tau))=1 and sample from their renormalized model probabilities. When the user does not specify MM, these checks test all allowed values before selecting among feasible roots. At each non-root step, the partial component tree hth_t provides the generator’s molecular context, while zt\mathbf{z}_t specifies the completion requirements. For each queried group, we cache Λc⋆(z,γ)=Fc⋆(Next⁡(z,γ))\Lambda_{\mathbf{c}^{\star}}(\mathbf{z},\gamma)=F_{\mathbf{c}^{\star}}(\operatorname{Next}(\mathbf{z},\gamma)). Provided the retained choices have positive total model probability, we sample from

p~θ(a∣ht,zt,c⋆)=pθ(a∣ht,M)Λc⋆(zt,γ(a))∑a′pθ(a′∣ht,M)Λc⋆(zt,γ(a′)).(4)\widetilde{p}_{\theta}(a\mid h_t,\mathbf{z}_t,\mathbf{c}^{\star})= \frac{p_{\theta}(a\mid h_t,M)\Lambda_{\mathbf{c}^{\star}}(\mathbf{z}_t,\gamma(a))} {\sum_{a'}p_{\theta}(a'\mid h_t,M)\Lambda_{\mathbf{c}^{\star}}(\mathbf{z}_t,\gamma(a'))}. \tag*{(4)}

This preserves probability ratios among retained actions. It does not in general equal the original model distribution conditioned on the targets because Boolean feasibility records the existence of a matching continuation, not its model probability. Thus, exactness here refers to satisfaction of the requested counts, not exact sampling from pθ(⋅∣R=b⋆)p_{\theta}(\cdot\mid R=\mathbf{b}^{\star}). After sampling, we attach the component, update zt\mathbf{z}_t using Equation (2), and continue until k=0k=0. We then decode the completed component tree into a molecular graph.

Theorem 1 (Prefix safety and exact completion). Fix a finite vocabulary V\mathcal{V}, the bond-type matching attachment rules defined above, a supported count map r:V→N0r:\mathcal{V}\to\mathbb{N}_0, and a target c⋆=(M,b⋆)\mathbf{c}^{\star}=(M,\mathbf{b}^{\star}). Assume that the feasible roots have positive total model probability and that the retained actions do so at every nonterminal state reached during sampling. Then every sampled partial tree admits a target-satisfying continuation, and sampling can continue until k=0k=0. Every terminal sample has exactly MM components, all ports matched, and R(G)=b⋆R(G)=\mathbf{b}^{\star}.

Proof sketch. The root check starts from a feasible state, and each retained action preserves completion feasibility. At k=0k=0, the terminal condition f=b=0\mathbf{f}=\mathbf{b}=0 gives port closure and exact target counts. Appendix § 9.7 gives the full proof.

Scope and failure behavior. The guarantee is relative to the component vocabulary and the bond-type matching rules above. The compiler certifies infeasibility only if every allowed MM compiles and none admits a feasible root. A joint-DP state-limit error makes no infeasibility claim. Zero model probability across retained choices leaves the sampling distribution undefined despite DP feasibility. Exact count satisfaction and port closure do not establish chemical validity or synthesizability; § 4 evaluates validity separately.

Time complexity. Let dd count controlled quantities, SS all DP states evaluated during compilation or sampling, and Gmax⁡G_{\max} the maximum groups examined per state. Tdec(M)T_{\mathrm{dec}}(M) covers model prediction, candidate processing, cached checks, and reconstruction. After preprocessing, compiling one target and generating BB molecules costs O(dSGmax⁡+BTdec(M))O(dSG_{\max}+BT_{\mathrm{dec}}(M)). All outputs share the compiled table, giving an amortized compilation cost of O(dSGmax⁡/B)O(dSG_{\max}/B) per molecule. Its pseudo-polynomial dependence on target values can make large joint requests expensive. Appendix § 9.§ 3 derives the bound and covers the case where the user does not specify MM.

Experiments

We evaluate whether TopoCompile delivers exact counts while preserving generation quality and practical cost. We study four questions: RQ1: How reliably does TopoCompile generate molecules with requested counts? RQ2: What do joint completion checking and learned preferences contribute? RQ3: How competitive is TopoCompile in unconditional generation? RQ4: How do methods compare in exact-output delivery efficiency?

Experimental Setup

Datasets and tasks. We evaluate on MOSES ([24]), ZINC250K ([31]), GuacaMol ([3]), and NPGen ([15]). TopoCompile supports different combinations of component-additive count constraints. We evaluate eight constraint schemas over heavy-atom count NN, cycle rank β\beta, oxygen count NON_{\mathrm{O}}, and ring-system count RsysR_{\mathrm{sys}}. A four-count request specifies target values for all four quantities (N,β,NO,Rsys)(N, \beta, N_{\mathrm{O}}, R_{\mathrm{sys}}), whereas the other schemas specify only one, two, or three of them. The user does not specify the component count MM; TopoCompile instead considers supported MM values and selects among those admitting a feasible completion. The main text focuses on the four-count schema, while results for the subset schemas are reported in Appendix § 11. For unconditional generation, where no count targets are given, TopoCompile samples MM directly from its empirical training distribution and generates autoregressively. Detailed task settings and evaluation protocols are provided in Appendices § 10.§ 4 and § 11.

Baselines. For exact-control generation, we compare TOPOCOMPILE with Graph DiT [17], STGG+ (Jolicoeur-Martineau et al., 2025), FragFM+Guidance [15], GenMol+Filter [16], and STGG+ Count Mask under the same target requests and attempt budgets. Appendix § 10.§ 3 details baseline implementations and configurations. For unconditional generation, Table 2 lists the established molecular generators compared with TOPOCOMPILE.

MethodGuacaMolMOSESNPGenZINC250K
V.U.N. ↑FCD score ↑V.U.N. ↑FCD ↓V.U.N. ↑FCD ↓Validity ↑FCD ↓
DiGress ([34])85.168.081.41.1985.12.0594.983.482
DeFoG ([26])97.973.885.41.9583.84.4699.221.425
GraphAF ([30, 15])–85.20.52348.125.1167.9216.128
Tree-Invent ([36])86.258.1OOM75.38.2095.435.999
FragFM ([15])95.085.886.90.5892.61.3499.810.630
TopoCompile (ours)98.280.892.50.8897.40.841100.000.520

Table 2. Unconditional molecular generation. GuacaMol reports FCD score (↑); other datasets report FCD distance (↓). Bold indicates the best result in each column.

Evaluation metrics. For exact-control generation, Valid measures chemical validity, while Exact-valid additionally requires every requested count to be satisfied exactly. Novelty and internal diversity assess whether exact outputs are new and structurally diverse. In the sampling-policy ablation, where all compared policies use the same exact completion check, conditional FCD measures how closely their exact outputs match the target-specific reference distribution. For unconditional generation, we follow each benchmark’s standard Validity, valid-unique-novel (V.U.N.) yield, and FCD protocol. Appendices § 10.§ 4 and § 11 detail the settings.

RQ1: How reliably does TopoCompile meet requested count constraints?

Overall performance. For each dataset, observed four-count tuples with Rsys≥1R_{\mathrm{sys}} \ge1 are Common at or above the 75th percentile of training frequency and Rare at or below the 25th. We select up to 32 targets per group. Table 1(A) reports Exact-valid yield over 32 attempts per target. Table 1(B) compares novelty and internal diversity using equal numbers of exact-valid molecules per Common target from each reported method’s first 100 attempts; targets with fewer than two from any method are excluded (Appendix § 10.§ 4). Figure 2(A) ranks tuples by frequency, divides them into quartiles, and evaluates eight targets per quartile; Figure 2(B) shows Common and high-cycle-rank outputs.

MethodMOSES CommonMOSES RareZINC250K CommonZINC250K RareGuacaMol CommonGuacaMol RareNPGen CommonNPGen Rare
Graph DiT56.645.5743.368.400.494.30OOM
STGG+80.8629.0079.5937.5034.8613.8716.893.71
FragFM+Guidance22.070.2011.040.004.980.001.560.00
GenMol+Filter1.860.001.460.001.660.000.000.00
STGG+ Count Mask83.5935.5582.7144.9246.8815.5327.4414.06
TopoCompile (ours)100.00100.00100.00100.00100.00100.00100.00100.00
MethodMOSES Novelty ↑MOSES Div. ↑ZINC250K Novelty ↑ZINC250K Div. ↑GuacaMol Novelty ↑GuacaMol Div. ↑NPGen Novelty ↑NPGen Div. ↑
STGG+0.9460.8451.0000.8600.9940.8670.9780.883
FragFM+Guidance0.8990.8460.9870.8520.9880.8580.6890.860
STGG+ Count Mask0.9520.8471.0000.8610.9940.8690.9780.883
TopoCompile (ours)0.9900.8621.0000.8721.0000.8820.9560.900

Table 1. Exact four-count generation (NN, β\beta, NON_{\mathrm{O}}, RsysR_{\mathrm{sys}}). (A) Exact-valid yield on Common and Rare targets. (B) Novelty and internal diversity of matched Common exact outputs.

Figure 2. Exact control across target frequencies and representative outputs. (A) Exact-valid yield across training-frequency quartiles. (B) Representative Common and high-cycle-rank outputs.

As shown in Table 1, TOPOCOMPILE achieves 100% Exact-valid yield on both Common and Rare four-count targets across all four datasets, whereas the strongest baseline in each dataset reaches only 14.1–44.9% on Rare targets. On matched Common exact outputs, TOPOCOMPILE also maintains high novelty and achieves the highest internal diversity on all four datasets. Figure 2(A) shows that baseline Exact-valid yield generally increases with frequency, while TOPOCOMPILE remains at 100% across all four quartiles. Figure 2(B) shows that competing methods can produce valid molecules while missing target counts, whereas TopoCompile satisfies all four, including a high-cycle-rank request beyond the MOSES training maximum.

RQ2: What do joint checks and learned preferences contribute?

We conduct two ablations on MOSES and ZINC250K across five constraint schemas, pooling Common and Rare requests. First, with the generator and sampling policy fixed, we vary the completion check: Local rejects immediate structural or count violations; Factorized additionally checks structural and count completion separately, potentially using different continuations; Joint requires one continuation satisfying both. Second, with Joint fixed, Uniform assigns equal probabilities to legal options for each action field, Frequency uses their training frequencies, and Learned uses Transformer probabilities. Figure 3(a,Figure 3b) reports Exact-valid yield, and Figure 3(c,Figure 3d) reports conditional FCD. Appendix E provides details.

Figure 3. Schema-level ablations on MOSES and ZINC250K with Common and Rare requests pooled. (a,b) Exact-valid yield under Local, Factorized, and Joint completion checks. (c,d) Conditional FCD under Uniform, Frequency, and Learned sampling with Joint checking fixed.

As shown in Figure 3(a,Figure 3b), Joint achieves 100% Exact-valid yield across all evaluated settings, versus 67.1–86.2% for Factorized and 12.4–56.2% for Local, showing that separate feasibility checks cannot replace joint completion checking. Under Joint, all three sampling policies retain 100% Exact-valid yield, but Learned achieves the lowest conditional FCD in every schema (Figure 3(c,Figure 3d)). Learned therefore improves alignment with target-specific references, although Uniform has higher internal diversity in some settings (Appendix E).

RQ3: How competitive is TopoCompile in unconditional generation?

As shown in Table 2, TopoCompile achieves the highest V.U.N. yield on GuacaMol, MOSES, and NPGen, and the highest validity on ZINC250K. On MOSES and NPGen, it improves V.U.N. over the strongest reported baseline by 5.6 and 4.8 percentage points, respectively. Distributional alignment shows a more mixed picture: TopoCompile achieves the best reported FCD on NPGen and ZINC250K, while FragFM performs better on GuacaMol and MOSES. These results also separate the two roles in TopoCompile: the component-tree generator remains competitive without constraint checks, while the compiler is responsible for exact control.

RQ4: How do methods compare in exact-output delivery efficiency?

Figure 4(a) measures the number of exact-valid molecules generated within a fixed five-minute budget. Figure 4(b) compares the cost of adapting to a new target and the resulting Exact-valid yield. Figure 4(c) measures the benefit of reusing cached compilation results, and Figure 4(d) examines how generating multiple molecules for the same target amortizes the one-time compilation cost.

Efficiency of exact constrained generation

Figure 4. Efficiency of exact constrained generation. (a) Exact-valid molecules generated within a fixed time budget. (b) Target adaptation cost and Exact-valid yield. (c) Cold and cached request time. (d) Amortized time per exact-valid molecule as the number of samples per target increases.

As shown in Figure 4, TopoCompile generates more exact-valid molecules within the fixed time budget, demonstrating higher end-to-end efficiency (a). For new targets, its main advantage is that adaptation only requires compilation, with no retraining or tuning of the generator, while filtering avoids adaptation at the cost of much lower exact-valid yield (b). Cache reuse further reduces latency for repeated requests by reusing previously solved feasibility states (c). Finally, more molecules amortize a target’s one-time compilation cost, but one-off requests pay the full cost (d). A fixed-MM ablation shows that grouping equivalent actions reduces median compilation time by 12.212.2–13.9×13.9\times without changing the DP state count (Appendix § 13).

Conclusion

We introduce TopoCompile for molecular generation under exact global count constraints. Its autoregressive component-tree generator ranks plausible additions, while dynamic-programming completion checks retain only additions that can reach the requested counts. TopoCompile satisfies counts exactly while retaining molecular quality and diversity, and its trained generator also produces high-quality molecules without constraints. Future work will extend exact control to connection-dependent constraints through richer completion states and broaden component support to enlarge the reachable molecular space while preserving the current exact completion guarantees.

Reproducibility Statement

Appendix B documents the data preprocessing, model configuration, and evaluation protocols needed to reproduce the reported results.

Ethics Statement

This work is computational and does not involve human subjects or private data. We acknowledge that molecular generation may have downstream biomedical applications and should be used with appropriate experimental validation.

AI Use Statement

Generative AI tools were used only to assist with writing and language polishing, including improving clarity, grammar, and presentation. All technical content, methods, experiments, results, analyses, and conclusions were developed and verified by the authors. The authors take responsibility for the final code, experiments, claims, citations, figures, and text.

Proofs and Implementation Details

Bridge-component tree

Proof. Let G=(V,E)G=(V,E) be connected, let B\mathcal{B} be its bridges, and let C1,…,CMC_1,\ldots,C_M be the connected components of (V,E∖B)(V,E\setminus\mathcal{B}). Construct T‾(G)\overline{T}(G) with one vertex per component and one edge per bridge. Contracting connected subgraphs preserves connectivity, so T‾(G)\overline{T}(G) is connected. Suppose T‾(G)\overline{T}(G) contained a cycle and choose an edge on that cycle corresponding to bridge (u,v)(u,v). The other cycle edges correspond to a sequence of components connected by bridges without using (u,v)(u,v). Paths inside these components then connect uu to vv without that edge, contradicting that (u,v)(u,v) is a bridge. Hence T‾(G)\overline{T}(G) is acyclic and connected, and therefore is a tree with M−1M-1 edges.

Exact inverse

Proof. The components CiC_i partition VV. For each CiC_i, template τi\tau_i stores one atom state for every v∈Civ\in C_i and one bond state for every edge whose endpoints both lie in CiC_i. Every remaining edge is a bridge. Its tree-edge record stores the two component indices, one port slot per endpoint, and the bridge-bond state; each port slot stores the component-local endpoint atom. The decoder first creates disjoint copies of all template atoms and internal bonds, then adds exactly one bridge for each tree-edge record between the atoms named by its ports. Thus every source vertex and edge is created exactly once, and no additional vertex or edge is introduced. The source-to-decoded local index maps define a feature-preserving graph isomorphism.

This argument applies to connected inputs after non-isomeric canonicalization when all atom states, bond states, and port-local indices belong to the declared representation. Stereochemical and isotopic identity is not stored. The implementation uses RDKit 2025.09.2; different RDKit versions can assign different component identities and are therefore outside the reproducibility claim.

Time complexity and computational efficiency

We analyze inference for a fixed component vocabulary and resource map. Integer coordinates are assumed to fit in machine words, and table access is constant-time after constructing the key. The cost of constructing a state key is included in the vector-processing cost below.

DP compilation. Let SS count the structurally admissible DP states evaluated, including one additional state for root selection, and let Gmax⁡≥1G_{\max}\ge1 bound the number of groups examined at any state. States rejected by an immediate structural check are charged to the transition that produces them.

Each transition updates four port counts and dd resource counts. For d≥1d\ge1, this takes O(d)O(d) time, including compatibility checks and construction of the successor key. Memoization evaluates each state once, and each evaluation examines at most Gmax⁡G_{\max} groups. The total DP time is therefore

TDP=O(dSGmax⁡).T_{\mathrm{DP}}=O(dSG_{\max}).

This bound includes states first evaluated during sampling if compilation is performed lazily. Such evaluations contribute to SS rather than being charged as a new search at every generation step.

To bound the state count, consider a partial tree with kk components left to add. Each currently open port must eventually connect to a new component. Since one addition connects a new component to only one existing port, a structurally feasible state must satisfy

∑ℓ=14fℓ≤k\sum_{\ell=1}^{4} f_{\ell}\le k

There are (k+44)\binom{k+4}{4} non-negative four-dimensional vectors satisfying this inequality. Each residual resource coordinate also satisfies 0≤bj≤bj⋆0 \le b_j \le b_j^{\star}. Consequently,

S≤1+∑k=0M−1(k+44)∏j=1d(bj⋆+1)=1+(M+45)∏j=1d(bj⋆+1).(5)S \le1 + \sum_{k=0}^{M-1} \binom{k+4}{4} \prod_{j=1}^{d}(b_j^{\star}+1) = 1 + \binom{M+4}{5} \prod_{j=1}^{d}(b_j^{\star}+1). \tag*{(5)}

The leading one accounts for root selection. Thus, for fixed dd, the bound is polynomial in MM and the numerical target values, but not in their binary encoding lengths. The product over target coordinates also explains why increasing the number of jointly controlled counts can be expensive.

This is a worst-case bound, not the number of states necessarily visited. The actual computation follows reachable transitions and uses the pruning rules in Appendix § 9.8. Grouping reduces repeated work across actions with the same effect, while memoization reduces repeated work across construction histories that reach the same state. Neither guarantees a small state space for every target.

Generation with cached completion checks. At generation step tt, let Cθ(t)C_{\theta}(t) be the cost of computing the candidate probabilities used by the sampler, including the prediction heads. Let AtA_t be the number of concrete candidate scores processed at that step.

Once the feasibility results are cached and indexed, checking one candidate takes constant time. Constructing the mask, normalizing the retained scores, and sampling therefore take O(At)O(A_t) time in total, not O(1)O(1). Updating the selected DP state adds O(d)O(d) work. After MM additions, reconstructing the atom–bond graph takes O(∣V∣+∣E∣)O(|V|+|E|) time. Hence, the decoding cost is bounded by

Tdec(M)=O(∑t=1M(Cθ(t)+At+d)+∣V∣+∣E∣).T_{\mathrm{dec}}(M)=O\left(\sum_{t=1}^{M}\left(C_{\theta}(t)+A_t+d\right)+|V|+|E|\right).

The bound covers graph construction, not chemical sanitization or benchmark evaluation.

For a fixed vocabulary, component sizes are bounded, so ∣V∣+∣E∣=O(M)|V|+|E|=O(M). For fixed dd, state updates also take O(M)O(M) time across the trajectory. These terms can therefore be absorbed into the candidate-processing cost, since at least one candidate is processed at every step. The substantial decoding costs are model evaluation and handling its candidate scores.

Importantly, Gmax⁡G_{\max} and AtA_t describe different computations. The former bounds the grouped Boolean feasibility checks; the latter counts the exact choices processed by the sampler. Sharing a feasibility result does not remove the cost of scoring different components and attachment sites. We also retain Cθ(t)C_{\theta}(t) explicitly because model evaluation may depend on the growing prefix. Having MM generation steps does not, by itself, imply O(M)O(M) total neural computation.

Preprocessing and total cost. Let TpreT_{\mathrm{pre}} include construction of the grouped vocabulary index and auxiliary pruning tables when these are not already available. These structures can be reused while the vocabulary, count definitions, and supported component horizon remain unchanged.

Given the template annotations, forming the grouped index takes O(d∣V∣)O(d|\mathcal{V}|) time with hashing. The auxiliary table costs follow from their recurrences. Let HH be the number of distinct bond-type vectors, UU the set of distinct resource vectors, and let PfP_f and PbP_b count the frontier and resource-sum entries expanded across all table levels. A recurrence-based construction takes

Tpre=O(d∣V∣+HPf+d∣U∣Pb).T_{\mathrm{pre}}=O(d|\mathcal{V}|+HP_f+d|U|P_b).

Each frontier entry is extended through the available bond-type vectors, while each resource-sum entry is extended through UU. Optional table limits can reduce this preprocessing work; disabling a pruning table does not change the exact joint recurrence.

For BB molecules sharing a target, Tdec(M)T_{\mathrm{dec}}(M) upper-bounds each decoding trajectory:

Ttotal(B)=Tpre+O(dSGmax⁡+BTdec(M)).T_{\mathrm{total}}(B)=T_{\mathrm{pre}}+O(dSG_{\max}+BT_{\mathrm{dec}}(M)).

The main-text expression assumes the reusable preprocessing is already available. If it must be repeated for a new count definition or a larger supported horizon, its cost must be included.

When the user does not specify MM, we compile the candidate component counts separately. Writing SmS_m for the states evaluated for component count mm, a conservative bound on the total DP work is

O(dGmax⁡∑m=1Mmax⁡Sm)O\left(dG_{\max}\sum_{m=1}^{M_{\max}} S_m\right)

Generation then pays the decoding cost for each selected component count. This bound does not assume additional sharing between the fixed-MM compilations.

Which costs dominate. For a new target with few requested samples, compilation can dominate. Its cost depends on how many distinct states and transitions are explored, and the state-space bound grows multiplicatively with the resource ranges. Low resource dimension helps, but does not alone guarantee a cheap target.

For repeated sampling, the DP computation is shared across outputs. Its amortized contribution is O(dSGmax⁡/B)O(dSG_{\max}/B), while the decoding cost must be paid for every molecule. With lazy compilation, SS may increase as new states are encountered, but previously solved states are not recomputed. Once the relevant cache is populated, further generation requires model prediction and candidate processing rather than another search through possible completions.

This differs from count-based rejection sampling. If independent unconstrained attempts satisfy a requested target with probability phit>0p_{\mathrm{hit}} > 0, rejection requires 1/phit1/p_{\mathrm{hit}} attempts on average for one matching output. TopoCompile avoids this repetition due to count mismatches, provided compilation succeeds and feasible choices have positive model probability. Its advantage is therefore reusable exact completion checking, not a guarantee of faster generation for every target. Expensive compilation with little reuse can outweigh the savings from avoiding rejection.

Relation to measured efficiency. The reported MOSES scaling experiments illustrate both costs. First compilation takes 0.034 seconds in the one-count configuration and 19.011 seconds in the three-count configuration. Their generation throughputs are respectively 7.12% and 28.96% below the corresponding port-only decoder. These results show that compilation latency and the remaining sampling overhead must be considered separately. Figure 4(c) assigns sampler/compiler setup, target compilation, reachability, and cached parent-option checks to DP. The Model category combines model execution, reconstruction, and final exactness checks; Other overhead contains the remaining action/state processing and delivery bookkeeping. Cache reuse reduces DP time from 0.515 to 0.181 seconds on MOSES and from 0.670 to 0.261 seconds on ZINC250K, corresponding to 2.85× and 2.57× speedups. Total request time falls from 0.671 to 0.337 seconds and from 0.831 to 0.421 seconds, respectively. The measured cold/cache Other overhead estimates differ by less than 1% within each dataset, so the figure uses their request-weighted pooled value and moves the compensating difference to DP, preserving every measured total.

Representation implementation and verification

The implementation first applies the pinned non-isomeric RDKit canonicalization and serializes atom states, internal bond states, bridge-bond states, component-local endpoint indices, and port symmetry classes. We independently recompute depth-first-search bridges ([33]) and checks agreement with the RDKit-derived component partition, the bridge–port bijection, and reconstruction of all stored atom and bond attributes. Thus the validation does not rely on one ring-perception routine. Disconnected inputs and bond states outside the representation are excluded.

Additivity of cycle rank

Proof. The components are atom-disjoint, and assembling their bridge tree adds exactly M−1M-1 inter-component edges. Hence ∣V∣=∑i∣Vi∣|V|=\sum_i |V_i| and ∣E∣=∑i∣Ei∣+M−1|E|=\sum_i |E_i|+M-1, which gives

β(G)=∣E∣−∣V∣+1=∑i(∣Ei∣−∣Vi∣+1)=∑iβ(τi).(6)\beta(G)=|E|-|V|+1=\sum_i\left(|E_i|-|V_i|+1\right)=\sum_i\beta(\tau_i). \tag*{(6)}

Thus bridge attachment creates no cross-component cycle, making cycle rank component-additive.

Structural frontier reachability

Let σ(τ)∈N4\boldsymbol{\sigma}(\tau) \in\mathbb{N}^{4} count the attachment ports of each bridge-bond type on template τ\tau. Starting from R0={0}\mathcal{R}_{0} = \{0\}, define

f∈Rr+1⟺∃ℓ,τ: fℓ,σℓ(τ)≥1,f′=f+σ(τ)−2eℓ∈Rr.(7)\mathbf{f} \in\mathcal{R}_{r+1} \Longleftrightarrow\exists\ell,\tau:\ f_{\ell},\sigma_{\ell}(\tau) \ge1,\quad\mathbf{f}' = \mathbf{f} + \boldsymbol{\sigma}(\tau) - 2\mathbf{e}_{\ell} \in\mathcal{R}_{r}. \tag*{(7)}

Lemma 1 (Frontier reachability). f∈Rr\mathbf{f} \in\mathcal{R}_{r} if and only if exactly rr legal child actions can consume f\mathbf{f} and terminate at the empty frontier.

Proof. We prove the lemma by induction on rr. For r=0r = 0, no child action is available and the frontier can finish if and only if it is 00. Assume the result for rr. If f∈Rr+1\mathbf{f} \in\mathcal{R}_{r+1}, the recurrence supplies a type ℓ\ell and template τ\tau whose attachment reaches f′∈Rr\mathbf{f}' \in\mathcal{R}_{r}; the inductive hypothesis supplies the remaining rr actions. Conversely, any legal first child action that admits an rr-action completion reaches such a f′\mathbf{f}', which the inductive hypothesis places in Rr\mathcal{R}_{r}. The recurrence therefore places f\mathbf{f} in Rr+1\mathcal{R}_{r+1}.

Joint feasibility DP: soundness and relative completeness

Fix a finite vocabulary V\mathcal{V}, the typed-port transition system in Equation (2), and an admissible map r:V→Ndr:\mathcal{V}\to\mathbb{N}^{d}. Equation (3) defines Fc⋆F_{c}^{\star} by its terminal condition and Boolean recurrence.

Soundness. For soundness, induct on kk. The k=0k = 0 state accepts only (0,0)(0,0). For k>0k > 0, every retained action subtracts exactly r(τ)r(\tau) and takes the state to a reachable (k−1)(k-1) suffix. The induction hypothesis closes that suffix with zero frontier and resource residual. Telescoping the transitions therefore consumes the initial frontier and sums the selected component contributions to the initial b\mathbf{b}. Applying the root check with b=b⋆−r(τ1)\mathbf{b} = \mathbf{b}^{\star} - r(\tau_{1}) proves exact target equality and structural completion for every sequence accepted by the joint DP.

Relative completeness. For relative completeness, consider a feasible kk-component suffix in the grammar. Its first component and attachment induce a legal non-negative successor, whose remaining k−1k-1 components form a feasible suffix. Induction gives Fc⋆=1F_{c}^{\star} = 1 for that successor, so the recurrence retains the first action; repetition retains the whole sequence. The result is relative to the finite catalog and transition language. It assumes that every admissible resource is component-local, non-negative and integer-valued, and unchanged by bridge attachment. It neither creates support for unseen component interiors nor guarantees sanitization, synthesis, or learned probability mass. We report infeasible catalog targets before sampling.

Joint feasibility DP: full algorithm

For implementation, let Γcomp\Gamma_{\mathrm{comp}} collect the distinct (σ(τ),r(τ))(\boldsymbol{\sigma}(\tau), r(\tau)) pairs, Γℓ\Gamma_{\ell} those with an available type-ℓ\ell port, and U\mathcal{U} the unique resource vectors used below:

B0={0},Bk={z+u:z∈Bk−1, u∈U}.(8)\mathcal{B}_{0} = \{0\}, \qquad\mathcal{B}_{k} = \{\mathbf{z} + \mathbf{u} : \mathbf{z} \in\mathcal{B}_{k-1},\ \mathbf{u} \in\mathcal{U}\}. \tag*{(8)}

Algorithm 1 gives the complete execution order for terminal checks, structural and resource pruning, compatible-group enumeration, and memoization. If the auxiliary exact-sum cache reaches its cap, SumReach conservatively returns TRUE.

Algorithm 1: Joint feasibility DP with safe pruning

Data: target $(M, \mathbf{b}^{\star})$; catalog index $\mathcal{I} = (\Gamma_{\mathrm{tok}}, \{\Gamma_{\ell}\}_{\ell=1}^{M}, r_{\min}, r_{\max})$; structural tables $\{\mathcal{R}_{k}\}_{k=0}^{M-1}$
Result: feasible root groups $\Gamma_{\mathrm{root}}$

1  memo $\leftarrow \varnothing$
2  Function CanFinish$(k, f, \mathbf{b})$:
3      $z \leftarrow (k, f, \mathbf{b})$
4      if $z \in \text{memo}$ then
5          return memo$[z]$
6      if $k = 0$ then
7          memo$[z] \leftarrow [f = 0 \land \mathbf{b} = 0]$
8          return memo$[z]$
9      if $k < 0 \lor f \notin \mathcal{R}_{k}$ then
10         memo$[z] \leftarrow \text{FALSE}$; return FALSE
11     if $k r_{\min} \npreceq \mathbf{b} \lor \mathbf{b} \npreceq k r_{\max}$ then
12         memo$[z] \leftarrow \text{FALSE}$; return FALSE
13     if $\neg\operatorname{SumReach}(k, \mathbf{b})$ then
14         memo$[z] \leftarrow \text{FALSE}$; return FALSE
15     memo$[z] \leftarrow \text{FALSE}$
16     foreach $\ell$ such that $f_{\ell} > 0$ do
17         foreach $\gamma \in \Gamma_{\ell}$ do
18             $\mathbf{b}' \leftarrow \mathbf{b} - r_{\gamma}$
19             if $\mathbf{b}' \not\succeq 0$ then
20                 continue
21             $f' \leftarrow f + \sigma_{\gamma} - 2e_{\ell}$
22             if $f' \not\succeq 0 \lor f' \notin \mathcal{R}_{k-1}$ then
23                 continue
24             if CanFinish$(k - 1, f', \mathbf{b}')$ then
25                 memo$[z] \leftarrow \text{TRUE}$; return TRUE
26     return FALSE
27 $\Gamma_{\mathrm{root}} \leftarrow \varnothing$
28 foreach $\gamma \in \Gamma_{\mathrm{tok}}$ do
29     $\mathbf{b}' \leftarrow \mathbf{b}^{\star} - r_{\gamma}$
30     if $\mathbf{b}' \succeq 0 \land \sigma_{\gamma} \in \mathcal{R}_{M-1} \land$ CanFinish$(M - 1, \sigma_{\gamma}, \mathbf{b}')$ then
31         $\Gamma_{\mathrm{root}} \leftarrow \Gamma_{\mathrm{root}} \cup \{\gamma\}$
32 return $\Gamma_{\mathrm{root}}$

If the auxiliary cache reaches 1,000,000 states at any level, the implementation disables only this optional pruning check and continues with the exact joint DP; this can increase computation but does not remove feasible actions. Reaching the 2,000,000-state limit of the joint DP instead raises an explicit compilation error rather than returning an incomplete feasible set. Let FkF_k be the possible frontier vectors with kk components remaining. The target-conditioned state count satisfies

S≤∑k=0M∣Fk∣∏j=1d(bj⋆+1),(9)S \leq\sum_{k=0}^{M} |F_k| \prod_{j=1}^{d}(b_j^{\star}+1), \tag*{(9)}

so the joint DP uses O(SGmax⁡d)O(SG_{\max}d) worst-case time and O(S)O(S) memo memory, where Gmax⁡G_{\max} is the maximum number of compatible groups examined at one state. Its dependence on target magnitudes and resource dimension is pseudo-polynomial.

Additional experimental settings

Datasets and preprocessing

We evaluate TOPOCOMPILE on MOSES ([24]), ZINC250K, GuacaMol ([3]), and NPGen ([15]). For TOPOCOMPILE, preprocessing uses RDKit 2025.09.2 and retains connected molecules within the supported non-isomeric atom–bond domain.

Stereochemical and isotopic identities are not represented. The component vocabulary is constructed from training molecules only, while representation coverage is evaluated separately on the test sets. Before selecting exact-control targets, we remove cross-split molecular overlaps. Molecular identity in the exact-control evaluation is defined by canonical non-isomeric connected SMILES, consistently with the training-exclusion set.

Model architecture and training

Architecture. The action Transformer has eight layers, eight attention heads, hidden size 256, and feed-forward size 1,024. Atom and bond embeddings have dimensions 256 and 128, respectively, and component encoding uses a five-layer fragment encoder. Four prediction heads model the bond-type vector, exact component, parent port, and child port.

Training. We use AdamW with coefficients (0.9, 0.999), learning rate 5×10−45 \times10^{-4}, 10,000 warm-up updates, no weight decay, exponential moving average decay 0.999, and gradient clipping at 8. Each model is trained for 30,000 updates with an effective batch size of 256 and eight data workers. All local training runs reported in this paper use a single Tesla H800 PCIe GPU, and all experiments report averages over three runs with seeds 123, 456, and 789.

Each randomized rooted traversal produces a ground-truth action sequence. Under teacher forcing, the model receives the ground-truth partial tree and predicts the corresponding next action. Parent candidates are unused ports in the partial tree, component candidates are restricted to the selected bond-type vector, and child ports must match the parent bond type. The loss weights for the bond vector, component, parent port, and child port are (1, 5, 1, 1); only bond-vector and component losses apply at the root. Structural reachability masks are used during both training and sampling.

Unconditional and constrained generation. For unconditional generation, TOPOCOMPILE first samples the component count MM from its empirical distribution over the training molecules and then generates a molecule autoregressively conditioned on MM. Exact constrained generation reuses the same checkpoint and applies the joint DP during sampling, without retraining the generator.

Baseline implementations

Graph DiT. We use the released conditional diffusion checkpoint of Graph DiT ([17]) and provide the active resource counts as conditioning inputs for the primary exact-control comparison. When a request specifies heavy-atom count NN, we use the requested node count to constrain graph size; otherwise, we retain the model’s learned node-count distribution. We preserve the released connection repair, valence repair, and largest-component handling before converting the output to a molecule. The resulting molecule is assessed by the shared external validity and exact-count evaluator. Each target uses the fixed attempt budget, including generation, repair, and count-mismatch failures. Graph DiT receives requested counts without stepwise completion checks.

STGG+ and STGG+ Count Mask. We use the released property-conditional spanning-tree generator STGG+ ((Jolicoeur-Martineau et al., 2025)), conditioning on the active counts in the primary comparison. Unspecified properties are handled by its native miss-property mask, and its structural and valence masks are retained. Guidance strength is selected on separate validation targets. Each attempt uses one internal candidate, without best-of-kk selection or additional resampling.

STGG+ Count Mask uses the same checkpoint, conditions, guidance, and sampling budget, adding only a process-local, token-level count mask around the decoder. After each accepted token, the mask updates the accumulated heavy-atom count, oxygen count, and cycle rank. Candidate tokens that would exceed any active target count are masked, and EOS is allowed only when these three counts match their targets. This mask is combined with the native structural and valence masks; it performs local count control without checking future completion feasibility. An empty action set terminates the attempt as a failure. Both variants use the shared external evaluator.

FragFM+Guidance. We use the released FragFM molecular generator ([15]) with a scalar property predictor for each active resource count. For a requested target, predictor deviations are normalized using validation-set scales, and the resulting prediction energies are combined to guide both fragment-bag generation and molecular graph generation. Bag and graph guidance strengths are selected separately for each dataset using validation targets. We retain the official fragment reconstruction procedure without prescribing a component count, tree layout, or exact completion check. The shared external validity and exact-count evaluator then assesses each molecule.

GenMol+Filter. We use the GenMol V2 unconditional de novo checkpoint [16] without supplying target counts to the model. For each target, GenMol independently proposes molecules, and the shared validity and count checks determine which proposals are exact-valid. There is no retraining, guidance, or target-specific decoding. Each proposal counts as one attempt, including invalid outputs and filter rejections; we do not generate replacement proposals to fill a quota of valid or exact outputs. This implements generation followed by filtering under a fixed proposal budget.

Tree-Invent. For unconditional generation, we use the paper-designated RBFS traversal of Tree-Invent [36]. The GuacaMol row is taken from the original paper’s 50,000-sample evaluation, with V.U. and V.U.N. derived from its reported validity, uniqueness, and novelty. For MOSES, ZINC250K, and NPGen, we train the released implementation from scratch for up to six passes over a deterministic 95% partition of the training set, reserving the remaining 5% for validation. Batch sizes are 320, 144, and 64, respectively, instead of the released default of 1,000. Each run has an eight-hour training limit and a four-hour generation-and-evaluation limit. ZINC250K and NPGen complete, whereas MOSES fails before the first optimizer update and is reported as OOM. Unconditional-generation tables distinguish local reproductions from published results.

Other unconditional-generation baselines. The unconditional-generation tables also include published results for DiGress [34], DeFoG [26], GraphAF [30], and other cited generators. These entries retain their source attributions and are distinguished from our local Tree-Invent reproductions.

Guidance selection. We select configurations on 32 fixed validation triples disjoint from the final evaluation targets, using 32 attempts per target. Selection maximizes exact-valid yield, with validity and exact-output diversity as tie breakers. For STGG+, we search guidance strengths {1.0, 1.2, 1.5, 2.0} at temperature 1. The selected strength is 1.5 on MOSES and GuacaMol and 2.0 on ZINC250K and NPGen; Count Mask uses the same setting. For FragFM+Guidance, we search bag/graph strength pairs (0, 2), (0.2, 2), (0.4, 2), and (1, 20). Dataset-specific selection yields (1, 20) on all four datasets. No data from final evaluation target is used to tune these configurations.

Shared comparison protocol. All exact-control methods use the same Common/Rare target lists, main attempt budgets, external validity and exact-count evaluator, and denominator rules. Each variant retains its native generation mechanism with only the control adaptations described above. The comparison therefore measures exact-valid yield under shared requests and sampling budgets rather than imposing the same internal architecture or constraint mechanism on every method.

Evaluation protocols

Metric definitions. For fixed attempts, Valid is the fraction of chemically valid molecules, and Exact-valid additionally requires every requested count. For an exact-output pool, Novelty is the fraction of unique canonical identities absent from training; internal diversity is one minus the pairwise Tanimoto similarity of radius-2, 1024-bit Morgan fingerprints [27]. Conditional FCD is the Fréchet ChemNet distance [25] between matched exact outputs and target-matched references. For unconditional generation, Validity is the valid fraction under each benchmark denominator, and V.U.N. is validity ×\times uniqueness ×\times novelty. FCD compares ChemNet embeddings of valid outputs with the benchmark reference set; GuacaMol reports the corresponding score, where higher is better.

Unconditional-generation budgets and replication. MOSES and ZINC250K each use 25,000 generation attempts, and NPGen uses 30,000. GuacaMol uses an 11,000-molecule pool to construct its 10,000-molecule report. ToPoComPLe results on MOSES, ZINC250K, GuacaMol, and NPGen average three independently trained models. Each table or caption states its repetition unit.

Benchmark-specific evaluation. Validity on MOSES, ZINC250K, and NPGen uses all attempts. GuacaMol validity uses the first 10,000 attempts; its FCD uses the first 10,000 pooled-valid molecules, while KL, novelty, and V.U.N. use the first 10,000 pooled unique molecules. Other FCD and ring metrics use valid canonical molecules. MOSES FCD/TestSF uses the 176,225-molecule scaffold test split, and GuacaMol uses its training reference and published score definition. ZINC250K uses the final 5,000 test molecules with a local implementation of the benchmark evaluator. NPGen uses its released test embedding.

Exact-control requests and yields. The primary comparison evaluates (N,β,NO,Rsys)(N, \beta, N_{\mathrm{O}}, R_{\mathrm{sys}}) without supplying MM; lower-dimensional schemas are reported in the appendix. TOPOCOMPILE checks supported candidate component counts, retains those admitting a compiler-feasible completion, and samples from the restricted empirical prior p(M∣N)p(M \mid N) when NN is given, or p(M)p(M) otherwise. Exact-control experiments use frozen checkpoints and fixed sampling streams, with K=32K = 32 attempts per target unless stated otherwise.

Exact-valid yield (Exact) is the fraction of attempts producing valid molecules that satisfy all requested counts. Novel unique exact yield (NUE) counts the exact-valid canonical molecules that are absent from training and deduplicated within each target and sampling run, using the same attempt denominator. We average target yields by schema and tier, then macro-average schemas.

Matched-output quality. For the main exact-control quality comparison, we use preselected Common targets and the first 100 attempts per target. Compared methods contribute equal-sized exact-output pools for each target, with survivors selected in attempt order. A target is excluded when any compared method provides fewer than two exact outputs. Novelty is the fraction of unique matched identities absent from training. Internal diversity is one minus the mean pairwise Tanimoto similarity of radius-2, 1024-bit Morgan fingerprints. Graph DiT and GenMol+Filter are unreported where their exact outputs do not support a compatible matched pool.

Ring-based metrics. For a parsed molecular graph, cycle rank is ∣E∣−∣V∣+c|E| - |V| + c, where cc is the number of connected components and equals one in the supported compiler domain. Ring systems follow the maximal non-bridge component definition used by the representation, and ring size is the multiset of RDKit atom-ring sizes. The topology signature comprises nonexclusive fused, spiro, and bridgehead indicators: fused denotes a bond belonging to multiple perceived atom rings, while spiro and bridgehead indicators use RDKit’s canonical counters. Core identity is the port-free canonical component SMILES, and a core pair is an unordered pair of core identities within one molecule. For each of these six statistics, we compute Sk=1−JSD⁡nats(Pk,Qk)/log⁡2S_k = 1 - \operatorname{JSD}_{\mathrm{nats}}(P_k,Q_k)/\log2; RingsFI is their mean.

NPGen proxy metrics. NPGen’s NP-score and classifier outputs are learned proxies. Its released classifier KLD discards generated-only labels and renormalizes on reference support. We retain this definition for benchmark compatibility and also report KLD over the union support after probability normalization, together with generated-only mass. The reported benchmark proxy values reproduce within 10−610^{-6} using the released weights and source files.

Representation and compiler verification

We verify the implementation on all 4,243,193 connected records retained after preprocessing the training, validation, and test splits of the four datasets. Independent Tarjan bridge detection [33] is checked against RDKit-derived ring grouping. The checks cover component-node types, component-tree connectivity and edge count, cycle localization, the bridge–port bijection, template identity, feature-preserving graph reconstruction, and catalog consistency. No violations are found. Testing 4,096 atom-order permutations confirms preservation of topology, ports, and reconstruction.

The joint DP is independently checked against exhaustive enumeration on five small vocabularies for each resource dimension d∈{1,2,3}d \in\{1,2,3\}. These comparisons remove no feasible completions and retain no infeasible completions. Independent recounting finds no count mismatch in 10,000 MOSES and 10,000 ZINC250K molecules.

Exact-Control Settings and Schema-Specific Results

This section specifies how we construct exact-control requests, configure the compared methods, and compute the reported success and quality metrics. It then presents the schema-specific results and examines how exact-control performance changes with target frequency.

Requests and target groups. Each request specifies a subset of heavy-atom count NN, cycle rank β\beta, oxygen count NON_{\mathrm{O}}, and ring-system count RsysR_{\mathrm{sys}}, but does not specify the component count MM. TopoCompile therefore enumerates candidate values of MM, retains those with a compiler-feasible completion, and samples from p(M∣N)p(M \mid N) when the request specifies NN or from p(M)p(M) otherwise. We remove cross-split molecular overlaps before selecting targets, so the resulting Common and Rare groups preserve their observed target identities without sharing molecules across splits. For the frequency analysis, we assign equal-frequency tuples their average rank among all distinct targets. Figure 2(A) divides these ranks into four percentile ranges and selects eight four-count tuples, spaced uniformly by rank, from each range.

Baselines and configuration selection. We compare TopoCompile with Graph DiT, STGG+, FragFM+Guidance, GenMol+Filter, and STGG+ Count Mask under a shared external count check. Graph DiT forces the requested node count only for requests that specify NN and retains its released connection/valence repair and largest-component handling. STGG+ retains its missing-property and structural/valence masks, whereas FragFM+Guidance applies normalized predictor energies for the active properties during bag and graph generation. GenMol+Filter instead generates unconditional candidates and filters them independently. Finally, STGG+ Count Mask reuses the STGG+ checkpoint and blocks count overshoots and premature EOS; an exhausted action set terminates as a failed attempt. Because guidance strength directly affects these comparisons, we select STGG+ guidance from {1.0,1.2,1.5,2.0}\{1.0, 1.2, 1.5, 2.0\} at temperature 1 and FragFM bag/graph strengths from (0,2)(0, 2), (0.2,2)(0.2, 2), (0.4,2)(0.4, 2), and (1,20)(1, 20) on separate validation targets. Selection maximizes exact-valid yield at a fixed candidate budget, using validity and exact-output diversity as tie breakers. We select one configuration per dataset, and STGG+ uses one internal candidate per attempt. This procedure selects STGG+ guidance 1.5 for MOSES and GuacaMol and 2.0 for ZINC250K and NPGen; STGG+ Count Mask uses the corresponding STGG+ setting. FragFM uses bag/graph strengths 1/20 on every dataset, selected using 32 attempts on each of 32 fixed validation triples disjoint from the final requests.

Metrics, denominators, and aggregation. We first evaluate every generated molecule with the same external validity and count checks. Valid yield is the fraction of attempts that produce a valid molecule, while Exact-valid yield is the fraction that are both valid and exact; both metrics use the full attempt count as their denominator. Consequently, an invalid output remains in the denominator, whereas a request that cannot finish compilation produces no sampled candidates; we record it separately as request noncompletion. We also distinguish state-limit exhaustion, timeout, and certified infeasibility. Molecular identity throughout is canonical non-isomeric connected SMILES, consistent with the training exclusion set. After computing the joint events per output, we average targets within each schema and macro-average schemas where reported. For matched quality, we use the same preselected Common targets and the first 100 attempts per target. Every method contributes the same number of exact survivors in attempt order, and we exclude a target when any compared method supplies fewer than two. Novelty is then the fraction of unique matched identities absent from training, and internal diversity is one minus mean pairwise Tanimoto similarity using radius-2, 1024-bit Morgan fingerprints. Graph DiT and GenMol+Filter remain unreported when their exact-output counts do not support a compatible pool.

All selected TopoCompile requests entered sampling and completed the full evaluation pipeline. Tables S2a–S2c provide lower-dimensional complements to the main four-count comparison for three schemas with near-complete comparison grids. The sparser NON_{\mathrm{O}}, (N,β)(N,\beta), and (N,NO)(N,N_{\mathrm{O}}) grids are not repeated as standalone tables. All four tables use the fixed sampling protocol. Panel A reports Valid and Exact-valid in percent for the first K=32K = 32 Common and Rare attempts. In Tables S2a–S2c, Panel B reports Novelty and internal diversity from matched exact outputs among the first 100 Common attempts; Table S2d uses the same budget. For the four-count table, the MOSES/ZINC250K/GuacaMol/NPGen comparable-target and matched-sample counts are 32/690, 32/374, 32/172, and 15/45, respectively. In MOSES/ZINC250K/GuacaMol/NPGen order, dashes denote missing entries and the comparable target/sample counts are 6/122, 9/104, 20/127, and 23/127 for NN; 5/434, 5/396, 5/257, and 7/345 for β\beta; and 18/1,179, 21/1,177, 32/840, and 32/429 for (β,NO)(\beta, N_{\mathrm{O}}).

DatasetNNβ\betaNON_{\mathrm{O}}(N,β)(N,\beta)(N,NO)(N,N_{\mathrm{O}})(β,NO)(\beta,N_{\mathrm{O}})(N,β,NO)(N,\beta,N_{\mathrm{O}})
MOSES6/65/46/626/2632/3218/1832/32
ZINC250K9/95/46/532/3232/3221/2232/32
GuacaMol21/215/58/832/3232/3232/3232/32
NPGen25/257/713/1332/3232/3232/3232/32

Table S1a. Numbers of shared Common and Rare targets by dataset and constraint schema.

MethodMOSES Common ValidMOSES Common E.VMOSES Rare ValidMOSES Rare E.VZINC250K Common ValidZINC250K Common E.VZINC250K Rare ValidZINC250K Rare E.VGuacaMol Common ValidGuacaMol Common E.VGuacaMol Rare ValidGuacaMol Rare E.VNPGen Common ValidNPGen Common E.VNPGen Rare ValidNPGen Rare E.V
Graph DiT67.1967.1931.7731.7761.8161.8146.1846.1812.8012.808.488.4844.6344.6335.8835.88
STGG+100.0093.06100.0021.01100.0092.71100.0030.90100.0077.98100.007.14100.0061.6399.8810.88
FragFM+Guidance97.9226.8240.894.43100.0015.9797.221.7493.305.5191.670.1598.255.1392.500.13
GenMol+Filter100.0016.67100.000.00100.0011.11100.000.00100.005.80100.000.00100.003.88100.000.00
STGG+ Count Mask96.3596.3524.4824.4893.4093.4046.5346.5383.1883.1825.1525.1570.0070.0027.1327.13
TopoCompile (ours)100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00

Table S2a. Valid and E.V (Exact-valid) yields (%) for heavy-atom count NN.

MethodMOSES Novelty ↑MOSES Div. ↑ZINC250K Novelty ↑ZINC250K Div. ↑GuacaMol Novelty ↑GuacaMol Div. ↑NPGen Novelty ↑NPGen Div. ↑
STGG+0.9100.8540.9900.8700.9840.8760.9920.882
FragFM+Guidance0.8930.8630.9810.8700.9370.8760.8660.886
STGG+ Count Mask0.9100.8541.0000.8720.9840.8770.9920.883
TopoCompile (ours)0.9510.8640.9900.8680.9920.8780.9840.889

Table S2a. Matched exact-output novelty and diversity

MethodMOSES Common ValidMOSES Common E.VMOSES Rare ValidMOSES Rare E.VZINC250K Common ValidZINC250K Common E.VZINC250K Rare ValidZINC250K Rare E.VGuacaMol Common ValidGuacaMol Common E.VGuacaMol Rare ValidGuacaMol Rare E.VNPGen Common ValidNPGen Common E.VNPGen Rare ValidNPGen Rare E.V
Graph DiT54.1741.2540.625.2145.0029.5835.4210.6823.125.6369.381.2541.529.3815.620.00
STGG+100.0094.38100.0032.55100.0095.00100.0065.63100.0098.75100.004.38100.0095.54––
FragFM+Guidance98.7588.4465.2315.23100.0086.2594.5326.5690.0049.3871.252.5096.8853.5741.070.45
GenMol+Filter100.0018.75100.000.00100.0016.88100.000.00100.0020.00100.000.00100.0014.29100.000.00
STGG+ Count Mask96.2595.6333.5932.8195.0095.0071.8867.9798.7598.7575.0065.0095.5495.5441.0727.23
TopoCompile (ours)100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00

Table S2b. Valid and E.V (Exact-valid) yields (%) for cycle rank β\beta.

MethodMOSES Novelty ↑MOSES Div. ↑ZINC250K Novelty ↑ZINC250K Div. ↑GuacaMol Novelty ↑GuacaMol Div. ↑NPGen Novelty ↑NPGen Div. ↑
STGG+0.9380.8711.0000.8790.9960.8780.8550.882
FragFM+Guidance0.8960.8640.9950.8720.9570.8810.9130.884
STGG+ Count Mask0.9310.8710.9970.8800.9960.8780.8550.882
TopoCompile (ours)0.9750.8680.9950.8780.9960.8840.9770.896

Table S2b. Matched exact-output novelty and diversity

MethodMOSES Common ValidMOSES Common E.VMOSES Rare ValidMOSES Rare E.VZINC250K Common ValidZINC250K Common E.VZINC250K Rare ValidZINC250K Rare E.VGuacaMol Common ValidGuacaMol Common E.VGuacaMol Rare ValidGuacaMol Rare E.VNPGen Common ValidNPGen Common E.VNPGen Rare ValidNPGen Rare E.V
Graph DiT57.5236.6953.241.2753.3224.3161.933.2221.001.3735.350.0035.162.2535.840.00
STGG+100.0097.51100.009.14100.0096.43100.0014.77100.0096.09100.000.68100.0089.5592.091.17
FragFM+Guidance99.7466.1575.785.90100.0055.8091.485.6891.1126.2770.510.1098.1414.4566.110.00
GenMol+Filter100.005.03100.000.00100.005.36100.000.00100.003.13100.000.00100.001.37100.000.00
STGG+ Count Mask97.4097.2244.7939.0697.4797.3249.5747.1697.0796.8867.1814.4593.7594.5652.5055.57
TopoCompile (ours)100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00–

Table S2c. Valid and E.V (Exact-valid) yields (%) for cycle rank and oxygen count (β,NO)(\beta,N_{\mathrm{O}}).

MethodMOSES Novelty ↑MOSES Div. ↑ZINC250K Novelty ↑ZINC250K Div. ↑GuacaMol Novelty ↑GuacaMol Div. ↑NPGen Novelty ↑NPGen Div. ↑
STGG+0.9330.8650.9970.8780.9920.8820.9440.887
FragFM+Guidance0.9220.8600.9960.8730.9890.8780.9110.880
STGG+ Count Mask0.9320.8650.9980.8810.9920.8820.9440.887
TopoCompile (ours)0.9900.8711.0000.8830.9980.8830.9950.894

Table S2c. Matched exact-output novelty and diversity

Table S2d: Valid and E.V (Exact-valid) yields (%) for the four-count request (NN, β\beta, NON_{\mathrm{O}}, RsysR_{\mathrm{sys}}).

Dashes in the STGG+ Count Mask row denote Valid values not retained by the compact export; its exact-valid values are complete.

MethodMOSES Common ValidMOSES Common E.VMOSES Rare ValidMOSES Rare E.VZINC250K Common ValidZINC250K Common E.VZINC250K Rare ValidZINC250K Rare E.VGuacaMol Common ValidGuacaMol Common E.VGuacaMol Rare ValidGuacaMol Rare E.VNPGen Common ValidNPGen Common E.VNPGen Rare ValidNPGen Rare E.V
Graph DiT69.3456.6441.605.5766.0243.3651.078.403.610.4949.514.30100.00OOM
STGG+100.0080.86100.0029.00100.0079.59100.0037.50100.0034.86100.0013.87100.0016.89100.003.71
FragFM+Guidance97.8522.0769.340.2099.1211.0497.460.0093.164.9890.530.0098.341.5697.460.00
GenMol+Filter100.001.86100.000.00100.001.46100.000.00100.001.6699.900.00100.000.00100.000.00
STGG+ Count Mask–83.59–35.55–82.71–44.92–46.88–15.53–27.44–14.06
TopoCompile (ours)100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00100.00

Table S2d.

B. Matched exact-output novelty and diversity from the first 100 attempts

MethodMOSES Novelty ↑MOSES Div. ↑ZINC250K Novelty ↑ZINC250K Div. ↑GuacaMol Novelty ↑GuacaMol Div. ↑NPGen Novelty ↑NPGen Div. ↑
STGG+0.9460.8451.0000.8600.9940.8670.9780.883
FragFM+Guidance0.8990.8460.9870.8520.9880.8580.6890.860
STGG+ Count Mask0.9520.8471.0000.8610.9940.8690.9780.883
TopoCompile (ours)0.9900.8621.0000.8721.0000.8820.9560.900

Table S2d.

Figure S2. Exact-valid yield for the β\beta schema on MOSES and ZINC250K.

Figure S3. Exact-valid yield for the NON_{\mathrm{O}} schema on MOSES and ZINC250K.

Figure S4. Exact-valid yield for the (N,β)(N,\beta) schema on MOSES and ZINC250K.

Figure S5. Exact-valid yield for the (N,NO)(N,N_{\mathrm{O}}) schema on MOSES and ZINC250K.

Figure S6. Exact-valid yield for the (β,NO)(\beta,N_{\mathrm{O}}) schema on MOSES and ZINC250K.

Results analysis. Tables Tables S2a–S2d show a consistent separation between molecular validity and exact delivery. TopoCompile attains 100.00% exact-valid yield in every reported dataset–tier cell for NN, β\beta, (β,NO)(\beta, N_{\mathrm{O}}), and (N,β,NO,Rsys)(N, \beta, N_{\mathrm{O}}, R_{\mathrm{sys}}), whereas baseline yields generally decrease from Common to Rare targets. Across the four available matched-quality panels, TopoCompile retains novelty of 0.951–1.000 and internal diversity of 0.864–0.896. The completion check preserves exactness across count vectors while the learned policy distinguishes feasible completions.

The schemas differ in how strongly they restrict baseline success and novel output multiplicity. Size-only control remains broadly accessible to the learned baselines, whereas Rare cycle-rank and joint cycle–oxygen requests produce sharper yield losses, especially on GuacaMol and NPGen. For the four-count Rare requests on NPGen, STGG+ remains 100.00% Valid but reaches 3.71% Exact-valid, while FragFM+Guidance remains 97.46% Valid and reaches 0.00% Exact-valid. This gap shows that validity alone does not establish constraint satisfaction. Figure S1–Figure S7 provide a complementary frequency breakdown: baseline yields often increase from the lowest to the highest training-frequency ranges, while TopoCompile remains at 100% across the observed schema–frequency cells.

Figure S1. Exact-valid yield for the NN schema on MOSES and ZINC250K.

Figure S7. Exact-valid yield for the (N,β,NO)(N, \beta, N_{\mathrm{O}}) schema on MOSES and ZINC250K.

Application: High-Rank Molecule Generation

Here, high rank refers to a large molecular cycle rank β\beta. Generating molecules in this regime expands the tested topology beyond the frequencies commonly observed during training and requires multiple ring-forming decisions to satisfy one global structural request. TopoCompile supports this application because cycle rank is additive over components and the joint DP removes partial constructions that cannot complete to the requested β\beta; the user does not need to specify molecular size NN or component count MM.

The experiments request only β=4,…,11\beta= 4, \ldots, 11; no method receives NN or MM. They test whether each method continues to satisfy larger cycle-rank requests and whether its valid outputs become larger as β\beta increases. All requests completed with 1,000 attempts per method–rank cell.

Figure S8. Exact-valid yield (a) and valid-output size (b) by cycle rank for MOSES and ZINC250K.

TopoCompile maintains 100.0% exact-valid yield across all eight requested cycle ranks in both datasets. The baseline yields fall sharply over the same range, with small nonmonotone fluctuations once they approach zero. Within the unobserved range β=9,10,11\beta= 9, 10, 11, the highest baseline yield is 5.0% on MOSES and 2.9% on ZINC250K, both attained by FragFM+Guidance.

TopoCompile’s median heavy-atom count increases from 26 to 53 on MOSES and from 28 to 51 on ZINC250K, while its median component count remains 10 and 11, respectively. Across these tested requests, higher cycle rank is therefore associated with larger TopoCompile outputs without an increase in their median component count. Smaller baseline medians at high β\beta generally coincide with zero or near-zero exact-valid yield; because the size curves include all valid outputs, they do not indicate more compact exact solutions.

Figure S9 shows that the same high cycle-rank request admits visibly different component arrangements. Across the eight fixed examples, heavy-atom count ranges from 41 to 53 and ring-system count from 3 to 5 while every molecule realizes the requested β∈{9,11}\beta\in\{9, 11\}. These examples illustrate structural variation among exact high-rank outputs; they do not estimate the output distribution.

TopoCompile examples for unobserved high-cycle requests on MOSES and ZINC250K

Figure S9. TopoCompile examples for unobserved high-cycle requests on MOSES and ZINC250K, with recomputed structural counts.

Additional Results for Ablation Studies

Experimental Settings

We ablate three decisions: the completion check, the sampling policy over feasible actions, and the compiler’s computational reductions. The completion-checking and policy studies use MOSES and ZINC250K with five schemas: (N,β)(N, \beta), (N,No)(N, N_{\mathrm{o}}), (β,No)(\beta, N_{\mathrm{o}}), (N,β,No)(N, \beta, N_{\mathrm{o}}), and (N,β,No,Rsys)(N, \beta, N_{\mathrm{o}}, R_{\mathrm{sys}}).

For completion checking, we fix the checkpoint, vocabulary, requests, component count MM, target identities, attempt order, Learned policy, and 32 attempts per target. Local enforces immediate structural and count consistency; Factorized adds exact count reachability independently of structural reachability; Joint requires one continuation to satisfy both. Exact-valid yield and novel unique exact yield (NUE) retain all attempts in their denominators, while NUE removes training identities and deduplicates within each target.

For the policy study, we fix Joint checking and compare Uniform, Frequency, and Learned over the first 100 attempts per target. Uniform assigns equal probability to legal values of each predicted action field, Frequency uses their training frequencies, and Learned uses the Transformer probabilities. FCD, internal diversity, scaffold diversity, Filters, and NSPDK use exact-output pools matched across policies by target and attempt order. The compiler study compares full compilation with grouping, optional-bound, count-sum, and structural-pruning ablations on fixed-MM cases.

Each compiler variant has three fresh-process repeats; the table reports median time, states, and transitions, together with peak process memory and completed compilations.

DatasetSchemaLocalFactorizedJoint
MOSES(N,β)(N,\beta)41.35 / 39.9072.66 / 70.43100.00 / 95.79
(N,NO)(N,N_{\mathrm{O}})30.42 / 29.9383.84 / 83.01100.00 / 99.12
(β,NO)(\beta,N_{\mathrm{O}})56.16 / 55.5683.25 / 82.20100.00 / 98.78
(N,β,NO)(N,\beta,N_{\mathrm{O}})34.08 / 33.6483.06 / 82.18100.00 / 98.83
(N,β,NO,Rsys)(N,\beta,N_{\mathrm{O}},R_{\mathrm{sys}})15.04 / 14.8471.68 / 69.82100.00 / 97.66
ZINC250K(N,β)(N,\beta)28.03 / 27.7367.14 / 66.60100.00 / 98.78
(N,NO)(N,N_{\mathrm{O}})30.27 / 30.1382.67 / 82.18100.00 / 99.51
(β,NO)(\beta,N_{\mathrm{O}})50.00 / 50.0074.27 / 74.20100.00 / 99.93
(N,β,NO)(N,\beta,N_{\mathrm{O}})23.68 / 23.2986.23 / 84.62100.00 / 97.17
(N,β,NO,Rsys)(N,\beta,N_{\mathrm{O}},R_{\mathrm{sys}})12.40 / 11.9680.27 / 77.59100.00 / 93.51

Table S4a. Completion-checking ablation results for exact-valid yield and novel unique exact yield on MOSES and ZINC250K. Exact / NUE (%).

Results

Completion checking. Table S4a reports the completion-checking results.

The table also reports NUE. Its close agreement with Exact-valid yield for Local and Factorized shows that most exact outputs are absent from training and unique within their targets.

Sampling policy. Figure S10 and Table S4c compare sampling policies under Joint checking.

Figure S10. Joint ablations: NUE (a,b) and matched-output internal diversity (c,d).

DatasetSchemaMetricUniformFrequencyLearned
MOSES(N,β)(N, \beta)Filters (%) ↑\uparrow66.3973.9797.51
(N,NO)(N, N_{\mathrm{O}})Filters (%) ↑\uparrow66.9176.2795.66
(β,NO)(\beta, N_{\mathrm{O}})Filters (%) ↑\uparrow65.0077.8494.74
(N,β,NO)(N, \beta, N_{\mathrm{O}})Filters (%) ↑\uparrow64.6675.1996.16
(N,β,NO,Rsys)(N, \beta, N_{\mathrm{O}}, R_{\mathrm{sys}})Filters (%) ↑\uparrow69.6174.7796.38
ZINC250K(N,β)(N, \beta)NSPDK ↓\downarrow0.07390.03730.0239
(N,NO)(N, N_{\mathrm{O}})NSPDK ↓\downarrow0.08080.02070.0046
(β,NO)(\beta, N_{\mathrm{O}})NSPDK ↓\downarrow0.06660.01810.0045
(N,β,NO)(N, \beta, N_{\mathrm{O}})NSPDK ↓\downarrow0.07910.04120.0242

Table S4c. Dataset-specific Filters and NSPDK results under different sampling policies.

Dataset / variantTime (s)StatesTransitionsPeak (GiB)Complete / total
moses/full0.0441.35e+031.35\mathrm{e}{+03}2.18e+042.18\mathrm{e}{+04}4.044314/4314
moses/without grouping0.6111.35e+031.35\mathrm{e}{+03}3.84e+053.84\mathrm{e}{+05}4.044314/4314
moses/without optional bounds0.04731.35e+031.35\mathrm{e}{+03}2.18e+042.18\mathrm{e}{+04}4.044314/4314
moses/without count sum1.513.88e+033.88\mathrm{e}{+03}1.06e+061.06\mathrm{e}{+06}4.044314/4314
moses/without structural pruning9.43.32e+043.32\mathrm{e}{+04}5.56e+065.56\mathrm{e}{+06}4.043722/4314
zinc250k/full0.04881.5e+031.5\mathrm{e}{+03}2.22e+042.22\mathrm{e}{+04}1.365448/5448
zinc250k/without grouping0.5961.5e+031.5\mathrm{e}{+03}3.44e+053.44\mathrm{e}{+05}1.365448/5448
zinc250k/without optional bounds0.05221.5e+031.5\mathrm{e}{+03}2.22e+042.22\mathrm{e}{+04}1.365448/5448
zinc250k/without count sum1.84.37e+034.37\mathrm{e}{+03}1.26e+061.26\mathrm{e}{+06}1.365442/5448
zinc250k/without structural pruning0.4955.64e+035.64\mathrm{e}{+03}2.57e+052.57\mathrm{e}{+05}1.365058/5448

Table S6. Compiler-computation ablation results on matched fixed-MM conditions.

Compiler computation. The compiler ablation distinguishes reductions that change the reachable state set from those that avoid repeated work. Without grouping, the state count does not change, but transitions increase by 17.6×17.6\times on MOSES and 15.5×15.5\times on ZINC250K, explaining the corresponding 13.9×13.9\times and 12.2×12.2\times time increases. Removing count-sum or structural pruning also expands the state and transition sets and can prevent completion within the resource limits. Removing optional bounds leaves states, transitions, and completion unchanged and increases median time by at most 7.5%7.5\%, so these bounds have a limited effect under the tested conditions.

Vocabulary Support and Component Recombination

DatasetVocabulary sizeMol. cov.Component cov.WholeMean M/NM/NCore occ./unique
MOSES14,79899.2999.930.00230.45499.88/82.56
ZINC250K10,65197.7699.790.02000.47699.67/94.52
GuacaMol57,66297.3399.790.05820.45399.65/81.58
NPGen70,59193.2599.640.13970.51898.80/83.21

Table S8a. Component-vocabulary coverage results on the four test sets.

DatasetRing systemsβ\betaRing sizeTopologyCoreCore pairTop core (%)Distinct cov. (%)Valid/attempts
MOSES0.96340.93540.99920.99760.97780.891233.8519.7725000/25000
ZINC250K0.95450.99460.99980.99900.96890.835136.0435.6225000/25000
GuacaMol0.99700.99730.99880.99730.92620.815743.678.2910000/10000

Table S8b. Ring-distribution results for TopoCompile on MOSES, ZINC250K, and GuacaMol.

Singleton component types account for 43.1%, 43.8%, 52.0%, and 51.2% of the MOSES, ZINC250K, GuacaMol, and NPGen vocabularies, respectively. The 1,000 most frequent types cover 98.9%, 98.3%, 97.2%, and 97.4% of training component occurrences. Occurrence coverage and type-level coverage therefore describe different aspects of the support boundary. Component coverage defines the support of the representation. New molecules can combine known components in previously unobserved multisets and bridge attachments; this does not create a cyclic interior absent from the vocabulary. For the MOSES sample, 23,146 of 24,978 distinct generated canonical SMILES are absent from training. Among all 25,000 valid generated molecules, 76.61% use a new component multiset and 97.96% a new attachment-bag signature. The latter records endpoint slots and bond types while ignoring connectivity among multiple instances of the same component template.

Supplementary Molecules

Figure S11. MOSES examples from unconditional generation and shared exact-control requests.

Relation to Hard-Constrained Molecular Generation

TopoCompile addresses a restricted but exact problem: equalities over non-negative component-additive integer counts under a finite component vocabulary and typed attachment grammar. Table S10 separates this contribution from exact constrained generation in general. Projection methods enforce supported graph properties during diffusion; CP-based methods solve or propagate symbolic sequence models; and SMT-based methods assemble neural proposals under logical constraints. TopoCompile instead specializes completion reasoning to the aggregate state (k,f,b)(k, f, \mathbf{b}) and queries exact suffix existence before every concrete component-and-attachment action. Its claim is therefore not the first use of hard constraints or neuro-symbolic generation, but an exact and reusable prefix-completion test induced by the component-tree representation.

MethodSpecificationEnforcement pointRelation to TopoCompile
PRODiGY / ConStruct ([29, 20])Supported hard graph propertiesProjection during diffusionExactness depends on a suitable property-specific projector or closure condition, rather than suffix feasibility for an additive count vector
Saikali & Pesant ([28])SMILES grammar with physicochemical and structural constraintsCP construction and search, guided by belief propagationGeneral symbolic search rather than a compact component-tree completion state
GeAI-BLAnC ([22])Fixed-length sequence constraints, including SMILES grammar and molecular-weight rangesCP/BP modifies the next-token distributionNon-backtracking generation may fail to complete; full completion can use backtracking
Geng et al. ([6])Chemical, structural, and user logical constraintsSMT assembly from neural proposalsThe solver guarantees assembled outputs rather than every neural construction prefix
TopoCompileMultiple component-additive count equalitiesExact DP on (k,f,b)(k, f, \mathbf{b}) before every actionEvery retained prefix is completable relative to the vocabulary and grammar, without trajectory backtracking or completed-sample rejection/repair

Table S10. Mechanistic comparison of hard-constrained generators.

Classical constraint programming constructs molecular graphs with required and forbidden fragments ([23]). Beyond molecules, Ctrl-G combines a distilled hidden Markov model with deterministic finite automata to guarantee logical constraints during text generation ([39]). TopoCompile instead derives a Boolean completion test directly from molecular count and attachment requirements, without a distilled sequence model. MacroGuide uses persistent-homology guidance to promote macrocycle generation, addressing a different topological objective from exact cycle-rank control ([21]).

The published evaluations of these methods are not numerically interchangeable with Table 1. GeAI-BLAnC studies fixed-length SMILES under a molecular-weight interval, projection methods use their own constraint families and diffusion checkpoints, and Geng et al. (Geng et al., [6] evaluate SMT-backed logical constraints. We therefore compare these systems mechanistically and reserve Table 1 for methods evaluated under the shared four-count requests and attempt budgets.

References

  1. [1]Sungsoo Ahn, Binghong Chen, Tianzhe Wang, and Le Song. Spanning tree-based graph generation for molecules. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=w60btE_8T2m.
  2. [2]Montgomery Bohde, Mrunali Manjrekar, Runzhong Wang, Shuiwang Ji, and Connor W. Coley. DiffMS: Diffusion generation of molecules conditioned on mass spectra. In Proceedings of the 42nd International Conference on Machine Learning, volume 267 of Proceedings of Machine Learning Research, pp. 4737–4756. PMLR, 2025. URL https://proceedings.mlr.press/v267/bohde25a.html.arxiv.org/abs/2502.09571
  3. [3]Nathan Brown, Marco Fiscato, Marwin H. S. Segler, and Alain C. Vaucher. GuacaMol: Benchmarking models for de novo molecular design. Journal of Chemical Information and Modeling, 59(3): 1096–1108, 2019. doi: 10.1021/acs.jcim.8b00839.DOI
  4. [4]Hanjun Dai, Yingtian Tian, Bo Dai, Steven Skiena, and Le Song. Syntax-directed variational autoencoder for structured data. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id=SyqShMZRb.
  5. [6]Chuqin Geng, Li Zhang, Mark Zhang, Haolin Ye, Ziyu Zhao, and Xujie Si. Neural proposals, symbolic guarantees: Neuro-symbolic graph generation with hard constraints. arXiv preprint arXiv:2602.16954, 2026. doi: 10.48550/arXiv.2602.16954. URL https://arxiv.org/abs/2602.16954.
  6. [7]Rafael Gómez-Bombarelli, Jennifer N. Wei, David Duvenaud, José Miguel Hernández-Lobato, Benjamín Sánchez-Lengeling, Dennis Sheberla, Jorge Aguilera-Iparraguirre, Timothy D. Hirzel, Ryan P. Adams, and Alán Aspuru-Guzik. Automatic chemical design using a data-driven continuous representation of molecules. ACS Central Science, 4(2):268–276, 2018. doi: 10.1021/acscentsci.7b00572.DOI
  7. [8]Fergus Imrie, Anthony R. Bradley, and Charlotte M. Deane. Generating property-matched decoy molecules using deep learning. Bioinformatics, 37(15):2134–2141, 2021. doi: 10.1093/bioinformatics/btab080.DOI
  8. [9]Wengong Jin, Regina Barzilay, and Tommi S. Jaakkola. Junction tree variational autoencoder for molecular graph generation. In Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 2323–2332, 2018. URL https://proceedings.mlr.press/v80/jin18a.html.
  9. [10]Wengong Jin, Regina Barzilay, and Tommi S. Jaakkola. Hierarchical generation of molecular graphs using structural motifs. In Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pp. 4839–4848, 2020. URL https://proceedings.mlr.press/v119/jin20a.html. Jaehyeong Jo, Seul Lee, and Sung Ju Hwang. Score-based generative modeling of graphs via the system of stochastic differential equations. In Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Research, pp. 10362–10383. PMLR, 2022. URL https://proceedings.mlr.press/v162/jo22a.html.
  10. [12]Hiroshi Kajino. Molecular hypergraph grammar with its application to molecular optimization. In Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 3183–3191, 2019. URL https://proceedings.mlr.press/v97/kajino19a.html.arxiv.org/abs/1809.02745
  11. [13]Mario Krenn, Florian Häse, AkshatKumar Nigam, Pascal Friederich, and Alan Aspuru-Guzik. Self-referencing embedded strings (SELFIES): A 100% robust molecular string representation. Machine Learning: Science and Technology, 1(4):045024, 2020. doi: 10.1088/2632-2153/aba947.DOI
  12. [14]Matt J. Kusner, Brooks Paige, and José Miguel Hernández-Lobato. Grammar variational autoencoder. In Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 1945–1954, 2017. URL https://proceedings.mlr.press/v70/kusner17a.html.arxiv.org/abs/1703.01925
  13. [15]Joongwon Lee, Seonghwan Kim, Seokhyun Moon, Hyunwoo Kim, and Woo Youn Kim. FrgFM: Hierarchical framework for efficient molecule generation via fragment-level discrete flow matching. In International Conference on Learning Representations, 2026. URL https://proceedings.iclr.cc/paper_files/paper/2026/hash/92f556b408ecac2943fb228207487967-Abstract-Conference.html.arxiv.org/abs/2502.15805
  14. [16]Seul Lee, Karsten Kreis, Hristijan P. Vechev, Meng Liu, Danny Reidenbach, Yuxing Peng, Saee Gopal Paliwal, Weili Nie, and Arash Vahdat. GenMol: A drug discovery generalist with discrete diffusion. In Proceedings of the 42nd International Conference on Machine Learning, volume 267 of Proceedings of Machine Learning Research, pp. 33205–33226. PMLR, 2025. URL https://proceedings.mlr.press/v267/lee25o.html.arxiv.org/abs/2501.06158
  15. [17]Gang Liu, Jiaxin Xu, Tengfei Luo, and Meng Jiang. Graph diffusion transformers for multi-conditional molecular generation. In Advances in Neural Information Processing Systems, volume 37, pp. 8065–8092, 2024. doi: 10.52202/079017-0260.DOI
  16. [18]Qi Liu, Miltiadis Allamanis, Marc Brockschmidt, and Alexander L. Gaunt. Constrained graph variational autoencoders for molecule design. In Advances in Neural Information Processing Systems, volume 31, 2018. URL https://proceedings.neurips.cc/paper/2018/hash/b8a03c5c15fca8dae0b3351eb1742f-Abstract.html.
  17. [19]Youzhi Luo, Keqiang Yan, and Shihui Ji. GraphDF: A discrete flow model for molecular graph generation. In Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 7192–7203, 2021. URL https://proceedings.mlr.press/v139/luo21a.html.
  18. [20]Manuel Madeira, Clément Vignac, Dorina Thanou, and Pascal Frossard. Generative modelling of structurally constrained graphs. In Advances in Neural Information Processing Systems, volume 37, pp. 137218–137262, 2024. doi: 10.52202/079017-4360.
  19. [21]Alicja Maksymiuk, Alexandre Duplessis, Michael Bronstein, Alexander Tong, Fernanda Duarte, and Ismail Ilkan Ceylan. MacroGuide: Topological guidance for macrocycle generation. In Proceedings of the 43rd International Conference on Machine Learning, 2026. URL https://arxiv.org/abs/2602.14977.
  20. [22]Virasone Manibod, David Saïkali, and Gilles Pesant. Constrained sequential inference in machine learning using constraint programming. In Proceedings of the Thirty-Fourth International Joint Conference on Artificial Intelligence, pp. 2628–2636, 2025. doi: 10.24963/ijcai.2025/293.DOI
  21. [23]Mohamed Amine Omrani and Wady Naanaa. Constraints for generating graphs with imposed and forbidden patterns: An application to molecular graphs. Constraints, 25(1–2):1–22, 2020. doi: 10.1007/s10601-019-09305-x.DOI
  22. [24]Daniil Polykovskiy, Alexander Zhebrak, Benjamin Sanchez-Lengeling, Sergey Golovanov, O ktai Tatanov, Stanislav Belyaev, Rauf Kurbanov, Aleksey Artamonov, Vladimir Aladinskiy, Mark Veselov, Artur Kadurin, Simon Johansson, Hongming Chen, Sergey Nikolenko, Alán Aspuru-Guzik, and Alex Zhavoronkov. Molecular sets (MOSES): A benchmarking platform for molec- ular generation models. Frontiers in Pharmacology, 11:565644, 2020. doi: 10.3389/fphar.2020.565644.
  23. [25]Kristina Preuer, Philipp Renz, Thomas Unterthiner, Sepp Hochreiter, and Günter Klambauer. Fréchet ChemNet distance: A metric for generative models for molecules in drug discovery. Journal of Chemical Information and Modeling, 58(9):1736–1741, 2018. doi: 10.1021/acs.jcim.8b00234.DOI
  24. [26]Yiming Qin, Manuel Madeira, Dorina Thanou, and Pascal Frossard. DeFoG: Discrete flow matching for graph generation. In Proceedings of the 42nd International Conference on Machine Learning, volume 267 of Proceedings of Machine Learning Research, pp. 50269–50326, 2025. URL https://proceedings.mlr.press/v267/qin25d.html.arxiv.org/abs/2410.04263
  25. [27]David Rogers and Mathew Hahn. Extended-connectivity fingerprints. Journal of Chemical Information and Modeling, 50(5):742–754, 2010. doi: 10.1021/ci100050t.DOI
  26. [28]David Saikali and Gilles Pesant. Constrained molecule generation modelled using the grammar constraint. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 40, pp. 14313–14321, 2026. doi: 10.1609/aaai.v40i17.38446.DOI
  27. [29]Kartik Sharma, Srijan Kumar, and Rakshit S. Trivedi. Diffuse, sample, project: Plug-and-play controllable graph generation. In Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pp. 44545–44564. PMLR, 2024. URL https://proceedings.mlr.press/v235/sharma24b.html.
  28. [30]Chence Shi, Minkai Xu, Zhaocheng Zhu, Weinan Zhang, Ming Zhang, and Jian Tang. GraphAF: a flow-based autoregressive model for molecular graph generation. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id=S1esMkHYPr.
  29. [31]Teague Sterling and John J. Irwin. ZINC 15: Ligand discovery for everyone. Journal of Chemical Information and Modeling, 55(11):2324–2337, 2015. doi: 10.1021/acs.jcim.5b00559.DOI
  30. [32]Michael A. Stravs, Kai Dührkop, Sebastian Böcker, and Nicola Zamboni. MSNovelist: De novo structure generation from mass spectra. Nature Methods, 19(7):865–870, 2022. doi: 10.1038/s41592-022-01486-3.DOI
  31. [33]Robert Endre Tarjan. A note on finding the bridges of a graph. Information Processing Letters, 2(6):160–161, 1974. doi: 10.1016/0020-0190(74)90003-9.DOI
  32. [34]Clément Vignac, Igor Krawczuk, Antoine Siraudin, Bohan Wang, Volkan Cevher, and Pascal Frossard. DiGress: Discrete denoising diffusion for graph generation. In International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=UaAD-Nu86WX.arxiv.org/abs/2209.14734
  33. [35]Zhe Wang, Jiaxin Shi, Nicolas Heess, Arthur Gretton, and Michalis K. Titsias. Learning-order autoregressive models with application to molecular graph generation. In Proceedings of the 42nd International Conference on Machine Learning, volume 267 of Proceedings of Machine Learning Research, pp. 64282–64301. PMLR, 2025. URL https://arxiv.org/abs/2503.05979.
  34. [36]Mingyuan Xu and Hongming Chen. Tree-Invent: A novel multipurpose molecular generative model constrained with a topological tree. Journal of Chemical Information and Modeling, 63(22):7067–7082, 2023. doi: 10.1021/acs.jcim.3c01626.DOI
  35. [37]Jiaxuan You, Bowen Liu, Zhitao Ying, Vijay Pande, and Jure Leskovec. Graph convolutional policy network for goal-directed molecular graph generation. In Advances in Neural Information Processing Systems, volume 31, 2018. URL https://proceedings.neurips.cc/paper/2018/hash/d60678e8f2ba9c05479e8bbde3117e8e-Abstract.html.arxiv.org/abs/1806.02473
  36. [38]Chengxi Zang and Fei Wang. MoFlow: An invertible flow model for generating molecular graphs. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 617–626. ACM, 2020. doi: 10.1145/3394486.3403104.DOI
  37. [39]Honghua Zhang, Po-Nien Kung, Masahiro Yoshida, Guy Van den Broeck, and Nanyun Peng. Adaptable logical control for large language models. In Advances in Neural Information Processing Systems, volume 37, 2024. doi: 10.52202/079017-3670.DOI

Paper details

vlnc:W_a7e9xrwd
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Generative AI tools

View statement
Looking for related papers…
Contents