arXiv:2610.23617cs.AIOct 2026

Manuscript Offprint

arXiv:2610.23617

GEMS: Molecular Structure Elucidation as Learned Search over Isomer Graphs

Utku Umur Acikalin, Yingheng Wang, Goncalo J. Gouveia, Tyler J. Schwertfeger, Frank C. Schroeder, Carla P. Gomes

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Identifying small-molecule structures from molecular formulas and tandem mass spectra remains a bottleneck in untargeted metabolomics and natural-product discovery. Even when database retrieval or de novo prediction does not identify the exact molecular structure, the resulting candidates can provide starting points for exploring nearby structures through a few bond edits. We introduce GEMS (Guided Editing of Molecular Structures), which refines candidates through learned 2-switch bond edits that preserve the molecular formula and each atom's total valence. Molecular fingerprints encode local structural features and can be computed directly from candidate structures. GEMS uses MIST, a pretrained spectrum-to-fingerprint model, to predict fingerprint probabilities once per spectrum. A neural policy compares each candidate's fingerprint with these predictions, links present features to the atoms and bonds that generate them, and scores all valid edits in one forward pass. The policy is trained on shortest edit paths between structures, so it can be pretrained on PubChem isomers without spectra and then fine-tuned with spectrum-predicted fingerprints. At inference, GEMS searches from multiple initial candidates matching the supplied molecular formula and ranks candidates by fingerprint agreement and multi-start consensus. With the target structure excluded from PubChem initialization, three edit rounds achieve Hit@1/Hit@10 of 29.64%/50.81% on NPLIB1 and 30.22%/41.33% on MassSpecGym, exceeding published baselines under comparable settings. On NPLIB1, GEMS achieves higher identification accuracy in about 3.3 minutes end to end, compared with 26.2 hours for our FRIGID run. GEMS also improves identification from generated candidates, including those refined by FRIGID. Experiments with exact target fingerprints identify fingerprint prediction error as a bottleneck in target recovery and final ranking. Deeper search recovers additional targets without retraining, with larger gains from weaker initial candidates.

1 INTRODUCTION

Identifying unknown small molecules is a central challenge in untargeted metabolomics and natural-product discovery. Many measured spectra remain unassigned to structures, limiting what experiments reveal about a sample's chemistry (Bushuiev et al., 2024). Tandem mass spectrometry (MS/MS) measures the mass-to-charge ratios and intensities of fragment ions, providing clues about substructures whose arrangement can remain ambiguous. We study the known-formula setting, which fixes elemental composition while leaving connectivity to be determined. Even then, many isomers can be consistent with the observed spectrum.

Database retrieval ranks existing structures, so success requires the target to be in the database (Dührkop et al., 2015; Goldman et al., 2023). Generative methods can propose new structures, but recovering exact connectivity remains difficult (Stravs et al., 2022; Bohde et al., 2025; Zhao et al., 2026). Yet even when these methods miss the target, their candidates are often only a few bond edits away. For each NPLIB1 spectrum, we remove the target from PubChem and retrieve up to five isomers whose fingerprints best match the one predicted from the spectrum. For at least 72.85% of spectra, one of these isomers lies within three bond edits of the target (Appendix I.2). FRIGID, a recent de novo method (Bohde et al., 2026), shows a similar pattern in its initial candidate pool: among spectra with no correct selected starting candidate, at least 47.79% have a starting candidate within three bond edits of the target (Appendix H.3).

(a) Seed retrieval

Figure

(b) Fingerprint-guided editing

(c) Search and ranking

Figure 1: GEMS: fingerprint-guided search over molecular isomers. (a) MIST predicts fingerprint probabilities qq once from the MS 2^2 spectrum and molecular formula F\mathcal{F}. Fingerprint likelihood selects five same-formula seeds, excluding the target. (b) Supported present bits have xi=1x_i = 1 and high qiq_i, unsupported present bits have xi=1x_i = 1 and low qiq_i, and likely missing bits have xi=0x_i = 0 and high qiq_i. Present bits are mapped to the atoms and bonds that generate them, while missing bits have no local occurrence. One policy evaluation scores all valid 2-switch edits. For Seed 5, the four highest-ranked edits receive 96.4% of policy probability, and each begins a shortest three-edit path to the reference structure. The illustrated path (purple) starts with a2a_2. (c) Initial and retained states are pooled and ranked by s(m;q)+16log⁡(1+c(m))s(m; q) + 16 \log(1 + c(m)), where s(m;q)s(m; q) measures fingerprint agreement and c(m)c(m) counts the distinct seeds whose searches reach mm, including through their initial states. The target ranks first among 33 distinct candidate structures. Panel (c) omits Seeds 3 and 4, which still vote. NPLIB1 query CCMSLIB00001058451. The example uses K=5K = 5 starts, proposal and beam widths P=B=4P = B = 4, and depth D=3D = 3. The main experiments use P=B=16P = B = 16.

These near misses suggest correcting candidates locally rather than discarding them. Two recent methods do this with ICEBERG, a structure-to-spectrum model (Goldman et al., 2024). FRIGID remasks and regenerates candidate regions (Bohde et al., 2026), and FOAM mutates candidates and selects them by predicted spectra (Manjrekar et al., 2026). We instead supply candidate–fingerprint correspondences directly to a learned policy, which learns to select bond edits from this evidence without simulating spectra.

We introduce GEMS (Guided Editing of Molecular Structures), which formulates structure elucidation as learned search over molecular isomers (Figure 1). Each search step applies a 2-switch edit, which removes one bond unit from each of two bonds and reconnects their endpoints. One bond may be to a hydrogen. These edits preserve the molecular formula and each atom's total valence. MIST, a pretrained spectrum-to-fingerprint model, predicts the target fingerprint probabilities once per spectrum (Goldman et al., 2023). The policy compares these probabilities with the candidate's fingerprint and links the candidate's present features to their generating atoms and bonds. A present feature with low predicted probability, for example, points to where an edit may help. A candidate can admit hundreds or thousands of valid edits, all scored in one forward pass without fingerprinting every possible product. GEMS runs beam searches from several initial candidates, then ranks the retained molecules by fingerprint agreement and by how many independent searches reach them.

We train the policy on shortest edit paths between molecular structures. Several edits can be equally good first steps toward the target, so rather than picking one as the label, we maximize the total probability of all edits that begin a shortest path. Both this supervision and the exact target fingerprint can be computed from structures alone, so we pretrain the policy on pairs of PubChem isomers without any spectra, then fine-tune it on benchmark training spectra with MIST-predicted fingerprints. Because the best next edit depends only on the current molecule and the target, the policy is Markovian:

its inputs, including the fingerprint correspondence, are computed from the current molecule and predicted fingerprint, with no trajectory history or depth index. The same policy can therefore search at greater depths and refine retrieved or generated candidates without retraining or changing the generator architecture.

Our contributions are: (1) We formulate known-formula structure elucidation as search over an isomer graph whose edges are formula- and valence-preserving 2-switch edits, allowing retrieved or generated candidates to be corrected locally. Because one close start is enough, we search from several starts, and even a simple Enumerate & Score (E&S) search, which scores every valid one-edit product by fingerprint agreement without a learned policy, matches or exceeds the compared published baselines on the same splits in Hit@1 and Hit@10. (2) We introduce GEMS, whose policy links present fingerprint features to the atoms and bonds that generate them and scores all valid edits in one forward pass. Even from PubChem starts that exclude every isomer with Tanimoto similarity of at least 0.7 to the target, GEMS exceeds all Table 1 baselines in Hit@1 and Hit@10 on both datasets. It ranks more targets first than E&S at matched width, and outperforms it at wider width with 13–21-fold lower runtime. From FRIGID's initial NPLIB1 candidates, without database retrieval, GEMS also outperforms FRIGID's refinement of the same pool. (3) We introduce a pretraining strategy that uses all shortest edit paths between pairs of structures as supervision, so it requires no spectra. A policy pretrained only on PubChem isomers, without training on any spectra, already exceeds all Table 1 baselines on NPLIB1 in Hit@1 and Hit@10 (28.89% Hit@1). When both are trained from scratch on experimental NPLIB1 spectra, this supervision also outperforms REINFORCE with exact-fingerprint rewards. (4) We study how start quality, search width and depth, and fingerprint accuracy shape recovery and identification. Deeper search helps most from weak starts but raises recovery more than identification, while exact fingerprints improve both.

References (100)

Couldn't load all references. Reload the page to try again.