LipiDetective
Summary¶
LipiDetective is a transformer model that identifies molecular lipid species in tandem mass spectrometry (MS2) spectra as a sequence-to-sequence task, predicting shorthand lipid names (headgroup, acyl chains, adduct) directly from ranked m/z peaks rather than matching against a spectral library. Trained on 268,720 spectra spanning 2,306 lipid species across 31 lipid classes, it generalizes learned fragmentation patterns to lipid species and instruments unseen during training, and its integrated-gradients attributions align with known diagnostic fragments, making its predictions human-interpretable [1].
Motivation¶
Standard lipid identification pipelines match measured MS2 spectra against in-house spectral reference libraries, a process that is highly sensitive to the software, database, and instrument used, producing poor reproducibility across labs — an interlaboratory comparison of NIST plasma reference material SRM 1950 by 31 labs found only 339 of 1,527 identified lipids reported by five or more labs [1]. LipiDetective instead trains a neural network to learn characteristic lipid fragmentation patterns, so identification no longer depends on a fixed reference library and can extend to lipid species with no reference spectrum at all.
Architecture¶
LipiDetective adapts the transformer encoder-decoder architecture (implemented via PyTorch) to lipid identification:
- Input: the top-n m/z values of a spectrum, ordered by decreasing intensity and truncated to a configurable decimal precision, each mapped to a learned embedding plus positional encoding (peak rank substitutes for explicit intensity).
- Output: a tokenized lipid shorthand name (headgroup, fatty-acyl chains, adduct), generated via greedy or beam search decoding.
- The model is compact (~616,000 parameters, ~2.5 MB on disk) and predicts on the order of 100 spectra in under five seconds, making it suitable for deployment on or near the mass spectrometer.
Training Data¶
The training set combines four sources, harmonized to the updated LIPID MAPS shorthand nomenclature:
| Source | Content |
|---|---|
| GNPS (PNNL, HCE, IOBA-NHC libraries) | 47,037 MS2 spectra, mixed matrices and polarities |
| MITOMICS | Lipidome of >200 CRISPR-knockout HAP1 cell lines, identified with LipiDex |
| Thermo storage-stability dataset | Multi-tissue mouse spectra, sum-species IDs refined to fatty-acyl composition via the Alex123 fragment database |
| Phospholipid standards | 54 standards measured on three instruments (Agilent 6560 IM QTOF, Sciex X500R QTOF, Bruker maXis UHR-TOF) at stepped collision energies, generated for this study |
After preprocessing and noise filtering (2,002 blank/no-lipid spectra retained so the model learns to emit nothing), the merged dataset is heavily class-imbalanced: over 50% of spectra are phosphatidylcholine (PC), phosphatidylethanolamine (PE), or triacylglycerol (TG).
Evaluation¶
Because of the class imbalance, the authors evaluated on 36 validation splits (three random splits, four splits balanced by species spectrum-count, and per-lipid-class splits) rather than a single held-out set, always excluding all spectra of a validation species from training.
- Total prediction accuracy (all output tokens must match) ranged from 29.7–50.8% across random splits and rose with spectra-per-species (9.7% at 10 spectra/species to 39.9% at 1000 spectra/species).
- Lipid component accuracy (fraction of correct tokens — headgroup, two acyl chains, adduct) was consistently higher, averaging 60–80%, indicating near-miss predictions are common (e.g., predicting one double bond off).
- Per-class accuracy was highest for phosphatidylglycerol (67.3%), followed by PE, PC, and phosphatidylserine; diacylglycerol (DG) species were predicted well despite few training spectra, apparently by transferring patterns learned from the structurally similar TG class.
- UMAP visualization of encoder embeddings showed spectra clustering by ionization polarity but largely overlapping across data source and instrument, evidence that the model abstracts fragmentation patterns rather than memorizing per-instrument spectral quirks.
- Integrated-gradients attributions on correct predictions highlighted known diagnostic fragments (e.g., the PC headgroup loss and precursor peaks); on a misprediction, the attributed peak matched a near-isobaric fragment from a different, more common fatty acid, revealing a training-data frequency bias (e.g.,
16:0occurs far more often than22:5at the same nominal m/z with two-decimal precision).
Limitations and Planned Work¶
- Reported accuracy is bounded by the relatively small (268,720-spectrum) and unevenly manually-curated training set, and by two-decimal m/z precision, which conflates near-isobaric fragments; increasing decimal precision reduced accuracy given current dataset size.
- The authors plan precursor-mass-constrained beam search (discarding predictions whose token masses do not sum to the observed precursor mass) and retention-time-aware filtering.
- The model returns a top-3 prediction list with a confidence probability per prediction (e.g., 0.9970 for a correct call vs. 0.4747 for a misprediction), intended as a user-facing quality check.
- Unlike general small-molecule structure generators such as MSNovelist, LipiDetective is scoped to lipids, is not limited to sub-1000 Da molecules (so it covers TGs and cardiolipins), and outputs standardized lipid shorthand rather than de novo chemical structures.
Availability¶
Source code is available at github.com/LipiTUM/lipidetective. The model can be retrained on additional data, and new lipid class or adduct tokens can be added to its vocabulary without architectural changes.