GEMS: Molecular Structure Elucidation as Learned Search over Isomer Graphs
Organizations: Department of Computer Science, Cornell University · Department of Chemistry and Chemical Biology, Cornell University · Boyce Thompson Institute, Cornell University
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 misses the exact 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. 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.
Figures & tables
| Method | H@1 | MCES@1 | Tani.@1 | H@10 | MCES@10 | Tani.@10 |
|---|---|---|---|---|---|---|
| NPLIB1 | ||||||
| MIST + MolForge | 2.24 | 14.16 | 0.40 | 5.11 | 10.96 | 0.47 |
| DiffMS | 8.34 | 10.46 | 0.35 | 15.44 | 8.54 | 0.47 |
| FRIGID-base | 19.80 | 7.88 | 0.54 | 24.41 | 6.20 | 0.61 |
| FRIGID | 25.03 | 7.10 | 0.58 | 33.37 | 5.56 | 0.64 |
| MS-GPT † | 21.05 | 18.49 | 0.50 | 28.64 | 17.79 | 0.54 |
Appendix figures & tables22 assets
Supplementary material from the paper’s appendix.
Appendix
| Identity | Representations merged | Use |
|---|---|---|
| Literal integer-bond graph | Atom renumberings preserving elements, bond orders, and attached hydrogens. The chosen Kekulé assignment is retained. | Training path joins and distance labels |
| Canonical stereo-free aromatic SMILES | Atom renumberings and alternative Kekulé assignments. Tautomers remain distinct. | Search deduplication and consensus votes |
| InChIKey14 | Structures assigned the same connectivity block by InChI, including some tautomeric forms | Target exclusion, recovery, and final connectivity ranking |
| Method | H@1 | MCES@1 | Tani.@1 | H@10 | MCES@10 | Tani.@10 |
|---|---|---|---|---|---|---|
| Spec2Mol | 0.00 | 48.57 | 0.12 | 0.00 | 17.58 | 0.16 |
| MADGEN | 2.10 | 20.56 | 0.22 | 2.39 | 12.69 | 0.27 |
| MIST + Neuraldecipher | 2.32 | 10.26 | 0.35 | 6.11 | 8.53 | 0.43 |
| MIST + MolForge | 2.24 | 14.16 | 0.40 | 5.11 | 10.96 | 0.47 |
| MIST + MSNovelist | 5.40 | 13.10 | 0.34 | 11.04 | 8.57 | 0.44 |
| MS-BART | 7.45 | 9.66 | 0.44 | 10.99 | 8.31 | 0.51 |
| Method | H@1 | MCES@1 | Tani.@1 | H@10 | MCES@10 | Tani.@10 |
|---|---|---|---|---|---|---|
| MIST + MSNovelist | 0.00 | 39.84 | 0.06 | 0.00 | 18.83 | 0.15 |
| Spec2Mol | 0.00 | 36.78 | 0.12 | 0.00 | 36.02 | 0.16 |
| MIST + Neuraldecipher | 0.00 | 22.93 | 0.14 | 0.00 | 21.76 | 0.16 |
| MADGEN | 1.31 | 27.47 | 0.20 | 1.54 | 16.84 | 0.26 |
| MS-BART | 1.07 | 16.47 | 0.23 | 1.11 | 15.12 | 0.28 |
| DiffMS | 2.30 | 13.96 | 0.28 | 4.25 | 11.68 | 0.39 |
| Dataset | Policy | H@1 | H@10 | Reach |
|---|---|---|---|---|
| NPLIB1 | Random weights | |||
| NPLIB1 | RL from scratch (exact-FP reward) | 24.78 | 42.59 | 47.20 |
| NPLIB1 | Supervised from scratch | 28.02 | 47.45 | 52.80 |
| NPLIB1 | Pretrained only | 28.89 | 46.82 | 50.06 |
| NPLIB1 | Pretrained + fine-tuned | 29.64 | 50.81 | 57.78 |
| MassSpecGym | Supervised from scratch | 29.14 | 39.46 | 44.20 |
| NPLIB1 | MassSpecGym | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Search (Params.) | H@1 | H@10 | Reach | Search (s) | Runtime (s) | H@1 | H@10 | Reach | Search (s) | Runtime (s) |
| E&S, | 25.40 | 43.84 | 44.21 | 770.01 | 802.88 | 28.03 | 37.98 | 38.57 | 25,250.45 | 25,351.17 |
| E&S, | 25.65 | 47.57 | 50.19 | 1,364.69 | 1,397.98 | 28.18 | 39.25 | 41.55 | 47,022.92 | 47,131.94 |
| E&S, | 26.03 | 49.07 | 54.17 | 2,491.07 | 2,524.59 | 28.16 | 39.05 | 44.24 | 87,247.68 | 87,372.32 |
| GEMS, | 27.65 | 47.07 | 49.07 | 47.14 | 81.11 | 29.18 | 39.39 | 41.35 | 1,333.48 | 1,456.71 |
| GEMS, | 29.64 | 50.81 | 57.78 | 129.28 | 200.12 | 30.22 | 41.33 | 46.88 | 3,869.90 | 4,091.00 |
| Initialization | MIST | Exact FP (oracle) | |||||
|---|---|---|---|---|---|---|---|
| H@1 | H@10 | Reach | H@1 | H@10 | Reach | ||
| Full-catalog MIST, up to 5 | 3 | 29.64 | 50.81 | 57.78 | 68.99 | 72.73 | 72.85 |
| 5 | 29.76 | 50.56 | 58.78 | 73.23 | 77.58 | 77.96 | |
| 10 | 29.64 | 50.81 | 59.90 | 79.45 | 84.43 | 84.93 | |
| Sampled-250 MIST, up to 5 | 3 | 26.15 | 43.46 | 50.44 | 61.15 | 64.38 | 64.51 |
| 5 | 27.90 | 46.20 | 53.80 | 68.99 | 73.23 | 73.60 | |
| NPLIB1 | MassSpecGym | |||||
|---|---|---|---|---|---|---|
| Starts removed | H@1 | H@10 | Reach | H@1 | H@10 | Reach |
| Target only (reported) | 29.64 | 50.81 | 57.78 | 30.22 | 41.33 | 46.88 |
| Tanimoto | 29.39 | 50.44 | 57.04 | 29.94 | 40.62 | 46.07 |
| Tanimoto | 29.27 | 49.07 | 55.79 | 28.49 | 38.29 | 42.61 |
| Tanimoto | 27.90 | 46.45 | 52.18 | 23.93 | 31.75 | 34.64 |
| Tanimoto | 25.16 | 42.84 | 47.95 | – | – | – |
| FRIGID-base | FRIGID after refinement | MS-GPT (ours) | ||||
|---|---|---|---|---|---|---|
| Maximum edits | Queries | % | Queries | % | Queries | % |
| D0 | 192 | 23.91 | 242 | 30.14 | 221 | 27.52 |
| D1 | 319 | 39.73 | 377 | 46.95 | 344 | 42.84 |
| D2 | 420 | 52.30 | 453 | 56.41 | 410 | 51.06 |
| D3 | 484 | 60.27 | 517 | 64.38 | 461 | 57.41 |
| Dataset | Initializer | Stage | H@1 | H@10 | Reach |
|---|---|---|---|---|---|
| NPLIB1 | FRIGID-base | Selected (D0) | 20.42 | 23.91 | 23.91 |
| NPLIB1 | FRIGID-base | GEMS (D3) | 28.02 | 43.34 | 46.20 |
| NPLIB1 | FRIGID | Original ranking | 24.03 | 33.13 | – |
| NPLIB1 | FRIGID | Selected (D0) | 22.54 | 30.14 | 30.14 |
| NPLIB1 | FRIGID | GEMS (D3) | 28.27 | 46.82 | 50.31 |
| NPLIB1 | MS-GPT (ours) | Original ranking | 21.05 | 28.64 | – |
| Dataset | Initializer | Stage | H@1 | H@10 | Reach |
|---|---|---|---|---|---|
| NPLIB1 | FRIGID-base | GEMS (D3) | 57.91 | 59.90 | 60.15 |
| NPLIB1 | FRIGID | GEMS (D3) | 61.52 | 64.38 | 64.38 |
| NPLIB1 | MS-GPT (ours) | Selected (D0) | 27.27 | 27.52 | 27.52 |
| NPLIB1 | MS-GPT (ours) | GEMS (D3) | 55.17 | 57.41 | 57.41 |
| MassSpecGym | MS-GPT (ours) | Selected (D0) | 26.13 | 26.68 | 26.68 |
| MassSpecGym | MS-GPT (ours) | GEMS (D3) | 41.05 | 42.87 | 42.92 |
| Initialization | Fingerprints | |||||
|---|---|---|---|---|---|---|
| MIST-ranked, up to 5 | MIST | 1 | 23.54 / 32.38 | 25.16 / 36.74 | 25.78 / 37.24 | 26.03 / 37.48 |
| 3 | 26.03 / 40.35 | 28.02 / 45.58 | 28.39 / 45.95 | 29.02 / 47.07 | ||
| 5 | 26.15 / 43.09 | 28.52 / 47.95 | 28.89 / 48.32 | 28.89 / 48.19 | ||
| 10 | 26.65 / 45.70 | 29.89 / 49.56 | 29.76 / 50.06 | 30.14 / 50.56 | ||
| 16 | 27.02 / 46.82 | 29.64 / 50.81 | 29.76 / 50.56 | 29.64 / 50.81 | ||
| MIST-ranked, up to 5 | Exact FP | 1 | 54.55 / 55.29 | 66.00 / 68.12 | 68.99 / 71.61 | 74.10 / 76.71 |
| Starts | Guidance | |||||
|---|---|---|---|---|---|---|
| MIST-ranked, up to 5 | MIST | 1 | 13.94 | 22.25 | 23.84 | 24.31 |
| 3 | 19.19 | 32.43 | 34.93 | 37.22 | ||
| 5 | 21.01 | 35.75 | 38.32 | 40.82 | ||
| 10 | 23.61 | 38.79 | 41.67 | 43.96 | ||
| 16 | 25.10 | 41.31 | 44.14 | 45.99 | ||
| MIST-ranked, up to 5 | Exact FP | 1 | 25.51 | 48.20 | 54.48 | 59.95 |
| Dataset | Guidance | Queries | D1 | D2 | D3 | D5 | D10 |
|---|---|---|---|---|---|---|---|
| NPLIB1 | MIST | 803 | 51.56 | 56.66 | 57.78 | 58.78 | 59.90 |
| NPLIB1 | Exact FP | 803 | 59.03 | 69.49 | 72.85 | 77.96 | 84.93 |
| MassSpecGym | MIST | 17556 | 43.30 | 45.94 | 46.88 | 47.30 | 47.82 |
| MassSpecGym | Exact FP | 17556 | 48.18 | 53.86 | 56.07 | 58.40 | 65.03 |
| NPLIB1 | MassSpecGym | |||||||
|---|---|---|---|---|---|---|---|---|
| Navigation | Ranking | H@1 | H@10 | Reach | H@1 | H@10 | Reach | |
| MIST | MIST | 0 | 28.02 | 50.56 | 57.78 | 29.47 | 40.94 | 46.88 |
| MIST | MIST | 16 | 29.64 | 50.81 | 57.78 | 30.22 | 41.33 | 46.88 |
| MIST | Exact FP | 0 | 55.54 | 57.66 | 57.78 | 44.76 | 46.74 | 46.88 |
| MIST | Exact FP | 16 | 56.66 | 57.53 | 57.78 | 45.12 | 46.79 | 46.88 |
| Exact FP | MIST | 0 | 29.39 | 58.78 | 72.85 | 31.19 | 47.10 | 56.07 |
| Ranking | NPLIB1 | MassSpecGym |
|---|---|---|
| GEMS | 29.64 | 30.22 |
| GEMS + ICEBERG | 31.88 | 31.60 |
| Gain [95% interval] | +2.24 [0.62, 3.96] | +1.38 [0.40, 2.80] |
| Component | NPLIB1 (s) | MassSpecGym (s) |
|---|---|---|
| Spectrum preprocessing | 0.57 | 0.40 |
| Peak annotation | 0.61 | 3.04 |
| MIST prediction | 0.40 | 4.91 |
| Build fingerprint database from SMILES | 28.01 | 77.41 |
| Retrieve top-5 seeds | 0.32 | 1.50 |
| GEMS search | 129.28 | 3,869.90 |
Mass Spectrometry
Mass spectrometry measures ion mass-to-charge patterns to identify and quantify molecules, with AI linking spectra to structures, peptides, and biological signals.
See all 33 papers