Learning from All Views: A Multiview Contrastive Framework for Metabolite Annotation

Yan Zhou Chen, Soha HassounbioRxiv 2025 · DOI

TL;DR

This paper introduces MultiView Projection (MVP), a novel framework that leverages multiple data types (molecular graphs, fingerprints, and spectra) to improve the challenging task of metabolite annotation. By jointly learning from these diverse "views" using contrastive learning, MVP achieves significantly better accuracy in identifying molecules from mass spectrometry data, particularly when using consensus spectra.

What Problem Does This Paper Address?

Metabolomics, the study of small molecules in biological systems, holds immense promise for understanding diseases, developing drugs, and personalizing medicine. However, a major bottleneck is metabolite annotation: accurately identifying the chemical structure of a molecule based on its mass spectrometry (MS/MS) data. This is difficult because MS/MS spectra can be complex and libraries of known spectra are incomplete. Current methods struggle with low annotation rates, hindering scientific progress. This paper aims to improve these annotation rates by developing a more robust and comprehensive approach.

Methods

The core of MVP is a multiview contrastive learning framework. Instead of treating different data representations of molecules and spectra separately or simply concatenating them, MVP learns a shared joint embedding space. This means it learns to represent molecules and their corresponding spectra in a way that similar molecules and spectra are close together in this abstract space, while dissimilar ones are far apart.

MVP uses four "views" for learning:

  • Molecular Graph: A representation of a molecule's structure as nodes (atoms) and edges (bonds).
  • Molecular Fingerprint: A bit string encoding of molecular features.
  • Individual Spectra: The raw MS/MS data from a single measurement.
  • Consensus Spectra: An aggregated spectrum from multiple measurements of the same molecule, often taken at different collision energies.

The framework employs separate encoders for each view and then uses a contrastive loss function to pull matching molecule-spectrum pairs together and push non-matching pairs apart across all possible pairwise combinations of these views. This allows MVP to capture complementary information from each view and mitigate view-specific artifacts.

Datasets

The primary dataset used for training and evaluation is the MassSpecGym benchmark. This dataset is designed to be challenging for machine learning models by ensuring that molecules across different splits have a significant structural difference (MCES distance of at least 10). The paper also mentions using a subset of MassSpecGym focusing on [M+H]+ adducts to assess performance under specific conditions.

Key Insights and Ideas

  • "All Views are Better Than Some": The paper strongly advocates for the benefit of integrating multiple data modalities (graphs, fingerprints, individual spectra, consensus spectra) rather than relying on a single or limited set of views.
  • Consensus Spectra as Anchors: Using consensus spectra, which aggregate information from multiple measurements, significantly improves annotation performance. This view acts as a more robust representation of a molecule's spectral characteristics.
  • Aggregate-then-Rank Superiority: For molecules with multiple spectra, an "aggregate-then-rank" strategy (creating a consensus spectrum first, then ranking) outperforms a "rank-then-aggregate" strategy (ranking for each spectrum individually and then combining ranks).
  • Graph View's Importance: The molecular graph view consistently outperforms the fingerprint view, suggesting that detailed structural information is more informative for spectral matching.
  • Formulae Enhance Spectra Representation: Using peak formulae as input to spectral encoders leads to more uniform and discriminative spectral representations, especially for mass-based candidate retrieval.

Key Results

MVP demonstrates state-of-the-art performance on the MassSpecGym benchmark:

  • Candidates by Mass: MVP achieves 35.99% rank@1 using the consensus spectrum view (mol-cs), a significant improvement over existing methods like MIST (14.64%) and JESTR (15.13%). This is a 145.83% improvement over MIST and 130.71% over JESTR.
  • Candidates by Formula: MVP achieves 13.96% rank@1 with the consensus spectrum view, outperforming MIST (9.57%) and JESTR (11.85%).
  • Individual Spectra: Even when using individual spectra (mol-s), MVP performs competitively, achieving 26.37% rank@1 for mass candidates and 11.10% for formula candidates.
  • MCES@1: MVP also achieves the lowest MCES@1 scores, indicating that the top-ranked candidates are structurally more similar to the target molecules.

Limitations and Future Work

  • Adduct Dependency: The performance of MVP, particularly when using formula-based spectral representations, can be affected by the accuracy of peak labeling and adduct assignment. The paper suggests that training specialized models or fine-tuning for each adduct might be beneficial.
  • Consensus Spectrum Effectiveness: The benefit of consensus spectra relies on the availability of multiple spectra for a molecule. Molecules with limited spectral data might not benefit as much.
  • Future Directions:
    • Improving representation quality through more accurate peak labeling and exploring additional data views.
  • Developing losses that directly prioritize ranking molecular candidates to further boost performance.
  • Extending MVP to related tasks like ranking molecular scaffolds and identifying analogs.
  • Developing a web interface and making code/models publicly available (which they have done).

Summary updated

Abstract

Metabolomics, enabled by high-throughput mass spectrometry, promises to advance our understanding of cellular biochemistry and guide new discoveries in disease mechanisms, drug development, and personalized medicine. However, as the assignment of molecular structures to measured spectra is challenging, annotation rates remain low and hinder potential advancements. We present MultiView Projection (MVP), a novel framework for learning a joint embedding space between molecules and spectra by leveraging multiple data views: molecular graphs, molecular fingerprints, spectra, and consensus spectra. MVP builds on contrastive multiview learning to capture mutual information across views, leading to more robust and generalizable representations for spectral annotation. Unlike prior approaches that consider multiple views via concatenation or as targets of auxiliary tasks, MVP learns from all views jointly, resulting in improved molecular candidate ranking. Notably, MVP supports annotation using either individual spectra or consensus spectra, enabling flexible use of multiple measurements. On the MassSpecGym benchmark, we show that annotation using query consensus spectra significantly outperforms rank aggregation strategies based on constituent spectrum annotation. Using the consensus spectrum view, MVP achieves 35.99% and 13.96% rank@1 when retrieving candidates by mass and formula, respectively. When ranking using individual spectra, MVP demonstrates performance that is superior to or on par with existing methods, achieving 26.37% and 11.10% rank@1 for candidates by mass and formula, respectively. MVP offers a flexible, extensible foundation for learning from multiple molecule/spectra data views.
BibTeX
@misc{chen2025learning,
  author = {Yan Zhou Chen and Soha Hassoun},
  title = {{Learning from All Views: A Multiview Contrastive Framework for Metabolite Annotation}},
  year = {2025},
  doi = {10.1101/2025.11.12.688047},
  howpublished = {bioRxiv},
}
Figure