Abstract
Characterizing biological and environmental samples at a molecular level primarily uses tandem mass spectroscopy (MS/MS), yet the interpretation of tandem mass spectra from untargeted metabolomics experiments remains a challenge. Existing computational methods for predictions from mass spectra rely on limited spectral libraries and on hard-coded human expertise. Here we introduce a transformer-based neural network pre-trained in a self-supervised way on millions of unannotated tandem mass spectra from our GNPS Experimental Mass Spectra (GeMS) dataset mined from the MassIVE GNPS repository. We show that pre-training our model to predict masked spectral peaks and chromatographic retention orders leads to the emergence of rich representations of molecular structures, which we named Deep Representations Empowering the Annotation of Mass Spectra (DreaMS). Further fine-tuning the neural network yields state-of-the-art performance across a variety of tasks. We make our new dataset and model available to the community and release the DreaMS Atlas—a molecular network of 201 million MS/MS spectra constructed using DreaMS annotations.
Introduction: Addressing the Bottleneck in Metabolomics
In the field of metabolomics, researchers utilize Liquid Chromatography-Tandem Mass Spectrometry (LC-MS/MS) to identify small molecules in biological or environmental samples. While this technique generates vast amounts of data, current methods can only identify approximately 2% to 10% of the signals. This bottleneck stems from a heavy reliance on curated "reference libraries"—databases of known molecules and their associated spectra—which are significantly limited compared to the vast "chemical dark matter" of the natural world.
Existing machine learning tools are often constrained by these small libraries or rely on hard-coded rules about molecular fragmentation. To overcome these limitations, we developed DreaMS (Deep Representations Empowering the Annotation of Mass Spectra), a transformer-based foundation model that learns the underlying "language" of molecular fragmentation directly from raw, unannotated experimental data.
Methods: The DreaMS Architecture and Pre-training
DreaMS is built on a transformer encoder architecture that treats spectral peaks (mass-to-charge ratio and intensity) as tokens. To accommodate high-resolution mass data, we employed mass-tolerant Fourier features, decomposing mass values into sine and cosine frequencies.
The model's strength lies in its self-supervised pre-training on two pretext tasks using raw data:
- Masked Peak Prediction: The model predicts the mass of 30% of the peaks that have been hidden in a spectrum.
- Retention Order Prediction: Given two spectra from the same experiment, the model predicts their relative elution order during chromatography.
Furthermore, we integrated a Graphormer-style attention mechanism to explicitly model the differences between peak masses (neutral losses), a key heuristic used by human experts to interpret spectra.
Datasets and Scalability
The model was trained on the GeMS (GNPS Experimental Mass Spectra) dataset, a massive collection of 714 million unannotated MS/MS spectra mined from the MassIVE GNPS repository. For fine-tuning and benchmarking, we utilized standard curated libraries such as MoNA and NIST20. The resulting DreaMS Atlas provides a molecular network of 201 million MS/MS spectra, organized using DreaMS-derived annotations. The model is highly efficient, capable of processing 1 million spectra per hour on a single high-end GPU.
Key Results: Emergent Knowledge and State-of-the-Art Performance
Through self-supervision alone, DreaMS demonstrated the ability to "discover" molecular fragments. Linear probing showed that as the model improved at predicting masked peaks, it internally learned to recognize specific chemical substructures (e.g., benzene rings, hydroxyl groups) without explicit labels.
Performance Benchmarks
- Spectral Similarity: DreaMS significantly outperformed 44 other methods in retrieving structurally similar molecules, particularly in "hard" cases where molecules share similar masses but different structures.
- Property Prediction: The model achieved state-of-the-art results in predicting 11 molecular properties, including drug-likeness (QED) and Bertz complexity.
- Fluorine Detection: DreaMS achieved 91% precision, nearly doubling the precision of the current industry standard, SIRIUS (51%), in identifying fluorinated compounds.
Conclusion and Future Work
DreaMS represents a significant advancement in the use of foundation models for mass spectrometry. While the current version is optimized for positive ionization and singly charged ions, future work will focus on incorporating negative mode data and MS1 isotopic patterns. The ultimate goal is to leverage these representations for de novo structure generation, enabling the identification of entirely unknown molecules from their spectral signatures.
Summary updated