DreaMS
Summary¶
DreaMS (Deep Representations Empowering the Annotation of Mass Spectra) is a transformer-based foundation model trained on millions of unannotated mass spectra using self-supervised learning. It produces high-dimensional embeddings that capture structural relationships between peaks, which can be fine-tuned for downstream tasks such as molecular fingerprint prediction, spectral library matching, and property prediction.
Methodology¶
DreaMS represents a shift towards foundation models in metabolomics: - Self-Supervised Pre-training: Trained on large-scale datasets (like GNPS/GeMS) using auxiliary objectives such as predicting masked spectral peaks and chromatographical retention orders. - Learnable Fourier Features: Utilizes learnable Fourier features to encode peak masses (m/z values) and capture higher-order relationships. - Downstream Fine-tuning: The pre-trained embeddings are fine-tuned using paired spectra-fingerprint datasets for specific structure annotation tasks.
Performance and Evaluation¶
In a comparative study by Khoo & Barzilay (2026), DreaMS was evaluated against MIST and a nearest-neighbour baseline: - Random Split Performance: Achieves a Jaccard score of 0.830 on NPLIB1, 0.966 on MassSpecGym, and 0.991 on the NIST2023 LC-MS/MS Dataset, outperforming both MIST and the nearest-neighbour baseline. - Scaffold Split Performance: Drops to 0.293 on NPLIB1, 0.470 on MassSpecGym, and 0.638 on NIST2023, showing poor generalization to unseen chemical scaffolds despite pre-training.
The GeMS Pre-training Dataset¶
DreaMS is pre-trained on GeMS (GNPS Experimental Mass Spectra), a dataset the authors mined from the MassIVE GNPS repository: 250,000 LC-MS/MS experiments yielding ~700 million MS2 spectra, filtered by experiment- and spectrum-level quality criteria into three progressively larger, lower-quality tiers (GeMS-A, -B, -C), then deduplicated via locality-sensitive-hashing clustering into nine size/quality variants (e.g., the highest-quality GeMS-A10 used for pre-training). This is orders of magnitude larger than the standard annotated training libraries MoNA and NIST20, which cover only a small fraction of known molecular structures.
Pre-training Objective and Architecture¶
DreaMS uses BERT-style masked spectrum modeling: each spectrum is represented as a set of continuous (m/z, intensity) peak tokens, 30% of which (sampled proportionally to intensity) are masked and must be reconstructed as a probability distribution over a binned mass range (framing masked m/z prediction as classification, not regression). An unmasked "precursor token" aggregates spectrum-level information, analogous to a sentence-level token. A second objective — retention-order prediction — pairs partially-masked spectra from the same LC-MS/MS run and trains the model to predict which eluted first chromatographically. The backbone is a 7-layer, 8-head-per-block transformer encoder (116 million parameters, 1,024-dimensional peak embeddings) using mass-tolerant Fourier features to encode m/z values and a Graphormer-style mechanism that feeds pairwise m/z differences directly into self-attention, letting the model attend to neutral losses without extra tokens.
Linear-probing analysis (predicting MACCS keys fingerprints from frozen precursor embeddings across training) showed MACCS-bit recall rising as the self-supervised loss fell, indicating the model progressively discovers molecular substructure purely from the masked-peak and retention-order objectives; attention-head analysis showed DreaMS learns to prioritize high-intensity, structurally-informative peaks over noise; and PCA/UMAP of precursor embeddings showed linear clustering by molecular structure that is robust to ionization adduct and collision energy.
Transfer Learning Results (Primary Paper)¶
Fine-tuned from the self-supervised backbone, DreaMS reached state-of-the-art or competitive performance across several annotation tasks, evaluated against held-out molecules with different Murcko scaffolds than the training set:
- Spectral similarity: even zero-shot (no fine-tuning), cosine similarity between DreaMS embeddings outperformed the supervised MS2DeepScore model at predicting Tanimoto/MCES molecular similarity. A short contrastive fine-tuning step (5,500 MoNA molecules, hard triplets differing by ≤0.05 Da) further improved library-retrieval AUC to 0.85 (vs. 0.82 for spectral entropy, 0.78 for MS2DeepScore) and analog-search AUC to 0.77 (vs. 0.74 MS2DeepScore, 0.71 modified cosine).
- Molecular fingerprint prediction: fine-tuned DreaMS predicts Morgan fingerprints directly from raw spectra in a single forward pass (unlike MIST, which requires per-peak chemical formula assignment) and performs on par with MIST on the MIST compound-retrieval benchmark.
- Molecular property prediction: state-of-the-art performance predicting Lipinski's-Rule-of-Five-relevant properties and Bertz molecular complexity directly from spectra.
- Fluorine detection: DreaMS achieved roughly 2x the precision of SIRIUS at fixed 57% recall (90% precision) for detecting fluorinated molecules in a 17,000-spectrum in-house test set, with 95% of predictions classifiable as high-confidence.
- DreaMS Atlas: fine-tuned embeddings were used to build a 201-million-spectrum molecular network (a k-nearest-neighbor graph over MS2 spectra), released as a public resource for repository-scale metabolomics.
Citations¶
- Bushuiev, R., Bushuiev, A., Samusevich, R., Brungs, C., Sivic, J., & Pluskal, T. (2025). Self-supervised learning of molecular representations from millions of tandem mass spectra using DreaMS. Nature Biotechnology, 44, 630–640. DOI: 10.1038/s41587-025-02663-3. Source paper: s41587-025-02663-3.pdf
- Khoo, L.M.S., & Barzilay, R. (2026). Why machine learning fails at mass spectrometry for small molecules. Nature Metabolism, 8, 1247–1249. DOI: 10.1038/s42255-026-01544-6. Source paper: s42255-026-01544-6.pdf