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 miss the exact structure, the obtained candidates can serve as seeds for exploring nearby structures via 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. GEMS employs 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 observed features to the atoms and bonds that generate them, and scores all valid edits in a single forward pass. The policy is trained on shortest edit paths between structures, allowing pretraining on PubChem isomers without spectra and subsequent fine‑tuning with spectrum‑predicted fingerprints. At inference, GEMS searches from multiple initial candidates matching the supplied formula and ranks them 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, surpassing published baselines under comparable settings. End‑to‑end, GEMS identifies targets on NPLIB1 in about 3.3 minutes versus 26.2 hours for our FRIGID run. GEMS also improves identification from generated candidates, including those refined by FRIGID. Experiments with exact target fingerprints reveal fingerprint prediction error as the main bottleneck for target recovery and final ranking. Deeper search recovers additional targets without retraining, yielding larger gains when initial candidates are weaker.
Review