Hybrid Deep Learning Model for EI-MS Spectra Prediction
Abstract
1. Introduction
2. Results and Discussion
- random.seed(seed)
- np.random.seed(seed)
- torch.manual_seed(seed)
- torch.cuda.manual_seed_all(seed)
- torch.backends.cudnn.deterministic = True
- torch.backends.cudnn.benchmark = False
- disable_attention—baseline model with disabled cross-attention,
- replace_resnet_with_linear—baseline model with ResNet replaced by a simple linear neural network,
- fix_alpha_forward—baseline model with only forward prediction, reverse prediction disabled in bidirectional prediction mode,
- replace_gnn_with_pool_mlp—baseline model with MPNN (Message Passing Neural Network) encoder replaced by simple aggregator and MLP (Multi-Layer Perceptron),
- disable_mask—baseline model with learnable probabilistic mask disabled.
3. Materials and Methods
3.1. Feature Extraction
3.2. Datasets
3.3. Model’s Architecture
3.3.1. GNN Encoder
3.3.2. ResNet Decoder
3.3.3. Initial Prediction Refinement
3.3.4. Model Training
4. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Hsieh, Y.; Korfmacher, W.A. Increasing Speed and Throughput When Using HPLC-MS/MS Systems forDrug Metabolism and Pharmacokinetic Screening. Curr. Drug Metab. 2006, 7, 479–489. [Google Scholar] [CrossRef]
- Gingras, A.C.; Gstaiger, M.; Raught, B.; Aebersold, R. Analysis of protein complexes using mass spectrometry. Nat. Rev. Mol. Cell Biol. 2007, 8, 645–654. [Google Scholar] [CrossRef]
- Timp, W.; Timp, G. Beyond mass spectrometry, the next step in proteomics. Sci. Adv. 2020, 6, eaax8978. [Google Scholar] [CrossRef]
- Lai, Z.; Tsugawa, H.; Wohlgemuth, G.; Mehta, S.; Mueller, M.; Zheng, Y.; Ogiwara, A.; Meissen, J.; Showalter, M.; Takeuchi, K.; et al. Identifying metabolites by integrating metabolome databases with mass spectrometry cheminformatics. Nat. Methods 2018, 15, 53–56. [Google Scholar] [CrossRef]
- Stein, S.E.; Scott, D.R. Optimization and testing of mass spectral library search algorithms for compound identification. J. Am. Soc. Mass Spectrom. 1994, 5, 859–866. [Google Scholar] [CrossRef]
- Stein, S.E. Chemical substructure identification by mass spectral library searching. J. Am. Soc. Mass Spectrom. 1995, 6, 644–655. [Google Scholar] [CrossRef]
- Linstrom, P.J.; Mallard, W.G. NIST Chemistry WebBook, NIST Standard Reference Database Number 69; National Institute of Standards and Technology: Gaithersburg, MD, USA, 2024. Available online: https://chemdata.nist.gov (accessed on 13 December 2025).
- Bauer, C.A.; Grimme, S. How to Compute Electron Ionization Mass Spectra from First Principles. J. Phys. Chem. A 2016, 120, 3755–3766. [Google Scholar] [CrossRef]
- Baer, T.; Hase, W. Unimolecular Reaction Dynamics: Theory and Experiments; International Series of Monographs on Chemistry; Oxford University Press: New York, NY, USA, 1996. [Google Scholar]
- Stanton, J.F.; Gauss, J. A simple scheme for the direct calculation of ionization potentials with coupled-cluster theory that exploits established excitation energy methods. J. Chem. Phys. 1999, 111, 8785–8788. [Google Scholar] [CrossRef]
- Rosenstock, H.M.; Wallenstein, M.B.; Wahrhaftig, A.L.; Eyring, H. Absolute Rate Theory for Isolated Systems and the Mass Spectra of Polyatomic Molecules. Proc. Natl. Acad. Sci. USA 1952, 38, 667–678. [Google Scholar] [CrossRef] [PubMed]
- Lorquet, J.C. Whither the statistical theory of mass spectra? Mass Spectrom. Rev. 1994, 13, 233–257. [Google Scholar] [CrossRef]
- Baercor, T.; Mayerfn, P.M. Statistical Rice-Ramsperger-Kassel-Marcus quasiequilibrium theory calculations in mass spectrometry. J. Am. Soc. Mass Spectrom. 1997, 8, 103–115. [Google Scholar] [CrossRef]
- Lorquet, J. Landmarks in the theory of mass spectra. Int. J. Mass Spectrom. 2000, 200, 43–56. [Google Scholar] [CrossRef]
- Mayer, I.; Gömöry, A. Use of energy partitioning for predicting primary mass spectrometric fragmentation steps: A preliminary account. Int. J. Quantum Chem. 1993, 48, 599–605. [Google Scholar] [CrossRef]
- Mayer, I.; Gömöry, A. Semiempirical quantum chemical method for predicting mass spectrometric fragmentations. J. Mol. Struct. 1994, 311, 331–341. [Google Scholar] [CrossRef]
- Irikura, K.K. Ab Initio Computation of Energy Deposition During Electron Ionization of Molecules. J. Phys. Chem. A 2017, 121, 7751–7760. [Google Scholar] [CrossRef]
- Ásgeirsson, V.; Bauer, C.A.; Grimme, S. Quantum chemical calculation of electron ionization mass spectra for general organic and inorganic molecules. Chem. Sci. 2017, 8, 4879–4895. [Google Scholar] [CrossRef]
- Koopman, J.; Grimme, S. Calculation of Electron Ionization Mass Spectra with Semiempirical GFNn-xTB Methods. ACS Omega 2019, 4, 15120–15133. [Google Scholar] [CrossRef] [PubMed]
- Wang, S.; Kind, T.; Tantillo, D.J.; Fiehn, O. Predicting in silico electron ionization mass spectra using quantum chemistry. J. Cheminformatics 2020, 12, 63. [Google Scholar] [CrossRef] [PubMed]
- Buchanan, B.G.; Feigenbaum, E.A. Dendral and Meta-Dendral: Their Applications Dimension. In Readings in Artificial Intelligence; Webber, B.L., Nilsson, N.J., Eds.; Morgan Kaufmann: Los Altos, CA, USA, 1981; pp. 313–322. [Google Scholar] [CrossRef]
- Lindsay, R.K.; Buchanan, B.G.; Feigenbaum, E.A.; Lederberg, J. DENDRAL: A Case Study of the First Expert System for Scientific Hypothesis Formation. Artif. Intell. 1993, 61, 209–261. [Google Scholar] [CrossRef]
- Curry, B.; Rumelhart, D.E. MSnet: A Neural Network which Classifies Mass Spectra. Tetrahedron Comput. Methodol. 1990, 3, 213–237. [Google Scholar] [CrossRef]
- Ji, H.; Deng, H.; Lu, H.; Zhang, Z. Predicting a Molecular Fingerprint from an Electron Ionization Mass Spectrum with Deep Neural Networks. Anal. Chem. 2020, 92, 8649–8653. [Google Scholar] [CrossRef]
- Lim, J.; Wong, J.; Wong, M.X.; Tan, L.H.E.; Chieu, H.L.; Choo, D.; Neo, N.K.N. Chemical Structure Elucidation from Mass Spectrometry by Matching Substructures. arXiv 2018, arXiv:1811.07886. [Google Scholar] [CrossRef]
- Tran, N.H.; Zhang, X.; Xin, L.; Shan, B.; Li, M. De novo peptide sequencing by deep learning. Proc. Natl. Acad. Sci. USA 2017, 114, 8247–8252. [Google Scholar] [CrossRef] [PubMed]
- Schoenholz, S.S.; Hackett, S.; Deming, L.; Melamud, E.; Jaitly, N.; McAllister, F.; O’Brien, J.; Dahl, G.; Bennett, B.; Dai, A.M.; et al. Peptide-Spectra Matching from Weak Supervision. arXiv 2018, arXiv:1808.06576. [Google Scholar] [CrossRef]
- Eng, J.K.; McCormack, A.L.; Yates, J.R. An approach to correlate tandem mass spectral data of peptides with amino acid sequences in a protein database. J. Am. Soc. Mass Spectrom. 1994, 5, 976–989. [Google Scholar] [CrossRef] [PubMed]
- Dührkop, K.; Shen, H.; Meusel, M.; Rousu, J.; Böcker, S. Searching molecular structure databases with tandem mass spectra using CSI:FingerID. Proc. Natl. Acad. Sci. USA 2015, 112, 12580–12585. [Google Scholar] [CrossRef]
- Allen, F.; Pon, A.; Wilson, M.; Greiner, R.; Wishart, D. CFM-ID: A web server for annotation, spectrum prediction and metabolite identification from tandem mass spectra. Nucleic Acids Res. 2014, 42, W94–W99. [Google Scholar] [CrossRef] [PubMed]
- Allen, F.; Greiner, R.; Wishart, D. Competitive fragmentation modeling of ESI-MS/MS spectra for putative metabolite identification. Metabolomics 2015, 11, 98–110. [Google Scholar] [CrossRef]
- Allen, F.; Pon, A.; Greiner, R.; Wishart, D. Computational Prediction of Electron Ionization Mass Spectra to Assist in GC/MS Compound Identification. Anal. Chem. 2016, 88, 7689–7697. [Google Scholar] [CrossRef]
- Djoumbou-Feunang, Y.; Pon, A.; Karu, N.; Zheng, J.; Li, C.; Arndt, D.; Gautam, M.; Allen, F.; Wishart, D.S. CFM-ID 3.0: Significantly Improved ESI-MS/MS Prediction and Compound Identification. Metabolites 2019, 9, 72. [Google Scholar] [CrossRef] [PubMed]
- Wang, F.; Liigand, J.; Tian, S.; Arndt, D.; Greiner, R.; Wishart, D.S. CFM-ID 4.0: More Accurate ESI-MS/MS Spectral Prediction and Compound Identification. Anal. Chem. 2021, 93, 11692–11700. [Google Scholar] [CrossRef] [PubMed]
- Wei, J.N.; Belanger, D.; Adams, R.P.; Sculley, D. Rapid Prediction of Electron–Ionization Mass Spectrometry Using Neural Networks. ACS Cent. Sci. 2019, 5, 700–708. [Google Scholar] [CrossRef]
- Zhu, R.L.; Jonas, E. Rapid Approximate Subset-Based Spectra Prediction for Electron Ionization–Mass Spectrometry. Anal. Chem. 2023, 95, 2653–2663. [Google Scholar] [CrossRef]
- Zhou, J.; Cui, G.; Hu, S.; Zhang, Z.; Yang, C.; Liu, Z.; Wang, L.; Li, C.; Sun, M. Graph neural networks: A review of methods and applications. AI Open 2020, 1, 57–81, Erratum in AI Open 2025, 6, 331–332. [Google Scholar] [CrossRef]
- Waikhom, L.; Patgiri, R. Graph Neural Networks: Methods, Applications, and Opportunities. arXiv 2021, arXiv:2108.10733. [Google Scholar] [CrossRef]
- Wang, Y.; Li, Z.; Barati Farimani, A. Graph Neural Networks for Molecules. In Machine Learning in Molecular Sciences; Qu, C., Liu, H., Eds.; Springer International Publishing: Cham, Switzerland, 2023; pp. 21–66. [Google Scholar] [CrossRef]
- Guan, Y.; Shree Sowndarya, S.V.; Gallegos, L.C.; St. John, P.C.; Paton, R.S. Real-time prediction of 1H and 13C chemical shifts with DFT accuracy using a 3D graph neural network. Chem. Sci. 2021, 12, 12012–12026. [Google Scholar] [CrossRef]
- Morgan, H.L. The Generation of a Unique Machine Description for Chemical Structures-A Technique Developed at Chemical Abstracts Service. J. Chem. Doc. 1965, 5, 107–113. [Google Scholar] [CrossRef]
- Zhang, B.; Zhang, J.; Xia, Y.; Chen, P.; Wang, B. Prediction of electron ionization mass spectra based on graph convolutional networks. Int. J. Mass Spectrom. 2022, 475, 116817. [Google Scholar] [CrossRef]
- Young, A.; Wang, F.; Wishart, D.; Wang, B.; Röst, H.; Greiner, R. FraGNNet: A Deep Probabilistic Model for Mass Spectrum Prediction. arXiv 2024, arXiv:2404.02360. [Google Scholar] [CrossRef]
- Park, J.; Jo, J.; Yoon, S. Mass spectra prediction with structural motif-based graph neural networks. Sci. Rep. 2024, 14, 1400. [Google Scholar] [CrossRef]
- Murphy, M.; Jegelka, S.; Fraenkel, E.; Kind, T.; Healey, D.; Butler, T. Efficiently predicting high resolution mass spectra with graph neural networks. arXiv 2023, arXiv:2301.11419. [Google Scholar] [CrossRef]
- Zhu, H.; Liu, L.; Hassoun, S. Using Graph Neural Networks for Mass Spectrometry Prediction. arXiv 2020, arXiv:2010.04661. [Google Scholar] [CrossRef]
- Gilmer, J.; Schoenholz, S.S.; Riley, P.F.; Vinyals, O.; Dahl, G.E. Neural Message Passing for Quantum Chemistry. arXiv 2017, arXiv:1704.01212. [Google Scholar] [CrossRef]
- Duvenaud, D.; Maclaurin, D.; Aguilera-Iparraguirre, J.; Gómez-Bombarelli, R.; Hirzel, T.; Aspuru-Guzik, A.; Adams, R.P. Convolutional Networks on Graphs for Learning Molecular Fingerprints. arXiv 2015, arXiv:1509.09292. [Google Scholar] [CrossRef]
- Wu, Z.; Ramsundar, B.; Feinberg, E.N.; Gomes, J.; Geniesse, C.; Pappu, A.S.; Leswing, K.; Pande, V. MoleculeNet: A benchmark for molecular machine learning. Chem. Sci. 2018, 9, 513–530. [Google Scholar] [CrossRef] [PubMed]
- Xiong, Z.; Wang, D.; Liu, X.; Zhong, F.; Wan, X.; Li, X.; Li, Z.; Luo, X.; Chen, K.; Jiang, H.; et al. Pushing the Boundaries of Molecular Representation for Drug Discovery with the Graph Attention Mechanism. J. Med. Chem. 2020, 63, 8749–8760. [Google Scholar] [CrossRef]
- Yang, K.; Swanson, K.; Jin, W.; Coley, C.; Eiden, P.; Gao, H.; Guzman-Perez, A.; Hopper, T.; Kelley, B.; Mathea, M.; et al. Analyzing Learned Molecular Representations for Property Prediction. J. Chem. Inf. Model. 2019, 59, 3370–3388, Erratum in J. Chem. Inf. Model. 2019, 59, 5304–5305. https://doi.org/10.1021/acs.jcim.9b01076. [Google Scholar] [CrossRef]
- Jaeger, S.; Fulle, S.; Turk, S. Mol2vec: Unsupervised Machine Learning Approach with Chemical Intuition. J. Chem. Inf. Model. 2018, 58, 27–35. [Google Scholar] [CrossRef]
- Maryam; Rehman, M.U.; Hussain, I.; Tayara, H.; Chong, K.T. A graph neural network approach for predicting drug susceptibility in the human microbiome. Comput. Biol. Med. 2024, 179, 108729. [Google Scholar] [CrossRef]
- Aminian-Dehkordi, J.; Parsa, M.; Dickson, A.; Mofrad, M. SIMBA-GNN: Mechanistic graph learning for microbiome prediction. npj Syst. Biol. Appl. 2025, 12, 8. [Google Scholar] [CrossRef] [PubMed]
- Devata, S.; Cleaves, H.J.; Dimandja, J.; Heist, C.A.; Meringer, M. Comparative Evaluation of Electron Ionization Mass Spectral Prediction Methods. J. Am. Soc. Mass Spectrom. 2023, 34, 1584–1592. [Google Scholar] [CrossRef] [PubMed]
- Landrum, G.; Tosco, P.; Kelley, B.; Rodriguez, R.; Cosgrove, D.; Vianello, R.; sriniker; Gedeck, P.; Jones, G.; Schneider, N.; et al. rdkit/rdkit: 2024_03_6 (Q1 2024) Release (Release_2024_03_6). Zenodo, 2024. Available online: https://www.rdkit.org (accessed on 3 May 2025).
- Kim, S.; Chen, J.; Cheng, T.; Gindulyte, A.; He, J.; He, S.; Li, Q.; Shoemaker, B.A.; Thiessen, P.A.; Yu, B.; et al. PubChem 2025 update. Nucleic Acids Res. 2025, 53, D1516–D1525. [Google Scholar] [CrossRef]
- Djoumbou, Y.; Eisner, R.; Knox, C.; Chepelev, L.L.; Hastings, J.; Owen, G.; Fahy, E.; Steinbeck, C.; Subramanian, S.; Bolton, E.E.; et al. ClassyFire: Automated chemical classification with a comprehensive, computable taxonomy. J. Cheminformatics 2016, 8, 61. [Google Scholar] [CrossRef] [PubMed]
- McNaught, A.D.; Wilkinson, A. Compendium of Chemical Terminology, 2nd ed.; IUPAC Nomenclature Books Series; Blackwell Science: Oxford, UK, 1997. [Google Scholar]
- Fey, M.; Lenssen, J.E. Fast Graph Representation Learning with PyTorch Geometric. arXiv 2019, arXiv:1903.02428. [Google Scholar] [CrossRef]







| Model Variation | Training Loss | Test Loss | Test Cosine Similarity | Recall@10 | Recall@5 | Recall@1 |
|---|---|---|---|---|---|---|
| baseline | ||||||
| disable_attention | ||||||
| replace_resnet_with_linear | ||||||
| fix_alpha_forward | ||||||
| replace_gnn_with_pool_mlp | ||||||
| disable_mask |
| Metric | HYBRID | NEIMS | RASSP SubsetNet |
|---|---|---|---|
| RASSP split replib | |||
| Recall@1 | 24.0% | 21.8% | 58.9% |
| Recall@5 | 66.6% | 59.6% | 85.9% |
| Recall@10 | 80.6% | 74.1% | 90.9% |
| Full replib | |||
| Recall@1 | 25.0% | 22.9% | - |
| Recall@5 | 67.0% | 61.3% | - |
| Recall@10 | 80.8% | 75.3% | - |
| Small molecules, RS replib\full replib | |||
| Recall@1 | 19.0%\19.3% | 17.1%\17.6% | 59.5%\- |
| Recall@5 | 62.0%\62.1% | 54.0%\54.6% | 89.0%\- |
| Recall@10 | 79.0%\79.0% | 70.8%\71.3% | 93.8%\- |
| Medium molecules, RS replib\full replib | |||
| Recall@1 | 28.8%\28.6% | 25.5%\26.2% | 62.3%\- |
| Recall@5 | 72.2%\72.1% | 65.3%\66.7% | 87.5%\- |
| Recall@10 | 84.0%\83.7% | 78.1%\79.0% | 91.8%\- |
| Large molecules, RS replib\full replib | |||
| Recall@1 | 26.3%\27.1% | 29.1%\28.9% | 33.5%\- |
| Recall@5 | 61.2%\65.0% | 60.3%\63.8% | 57.7%\- |
| Recall@10 | 71.5%\76.5% | 70.1%\74.7% | 67.1%\- |
| Average cosine similarities of predictions * | |||
| Overall | 0.74 | 0.76 | 0.88 |
| Small molecules | 0.77 | 0.78 | 0.91 |
| Medium molecules | 0.74 | 0.76 | 0.87 |
| Large molecules | 0.64 | 0.70 | 0.68 |
| Feature Type | Description | Size |
|---|---|---|
| Atom Features | ||
| Atomic Number | Atom Number of an atom | 61 |
| Node Degree | Number of adjacent atoms | 7 |
| Valence | Number of explicit valences | 7 |
| Formal Charge | Integer electronic charge | 5 |
| Radical Electrons | Number of radical electrons | 1 |
| Hybridization | Type of hybridization | 6 |
| Aromaticity | Whether an atom is a member of an aromatic ring | 1 |
| Hydrogen | Number of hydrogens | 6 |
| Bond Features | ||
| Bond Type | Single, double, triple, and aromatic | 4 |
| Conjugation | Is bond conjugated | 1 |
| Is in Ring | Is bond in a ring | 1 |
| Chirality | Stereo configuration | 4 |
| Hyperparameter | Value |
|---|---|
| MPNN encoder number of layers | 3 |
| MPNN encoder hidden layers dimension | 256 |
| MPNN encoder dropout probability | 0.25 |
| ResNet decoder input dimension | 256 |
| Number of ResNet blocks | 1 |
| ResNet block number of hidden layers | 1 |
| ResNet block hidden layers dimension | 1024 |
| Dropout probability inside ResNet block | 0.2 |
| ResNet decoder first head layer width | 512 |
| ResNet decoder second head layer width | 256 |
| ResNet decoder output dimension | 500 |
| Number of heads in cross-attention | 4 |
| Query, Keys and Values projection dimension | 256 |
| Projection head | 0.04 |
| Projection head hidden layers dimension | 256 |
| Projection head projection dimension | 128 |
| Total loss function | 0.5 |
| Batch size | 256 |
| Learning rate | 0.001 |
| Epochs | 500 |
| Patience | 50 |
| Optimizer | Adam |
| Scheduler | ReduceLROnPlateau (factor = 0.1, patience = 5) |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Majewski, B.; Łabuda, M. Hybrid Deep Learning Model for EI-MS Spectra Prediction. Int. J. Mol. Sci. 2026, 27, 1588. https://doi.org/10.3390/ijms27031588
Majewski B, Łabuda M. Hybrid Deep Learning Model for EI-MS Spectra Prediction. International Journal of Molecular Sciences. 2026; 27(3):1588. https://doi.org/10.3390/ijms27031588
Chicago/Turabian StyleMajewski, Bartosz, and Marta Łabuda. 2026. "Hybrid Deep Learning Model for EI-MS Spectra Prediction" International Journal of Molecular Sciences 27, no. 3: 1588. https://doi.org/10.3390/ijms27031588
APA StyleMajewski, B., & Łabuda, M. (2026). Hybrid Deep Learning Model for EI-MS Spectra Prediction. International Journal of Molecular Sciences, 27(3), 1588. https://doi.org/10.3390/ijms27031588

