NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

MS-BART: Unified Modeling of Mass Spectra and Molecules for Structure Elucidation

Yang Han, Pengyu Wang, Kai Yu, xin chen, Lu Chen

Introduction

Identifying the structure of small molecules from mass spectrometry (MS) data is a cornerstone of fields ranging from drug discovery to environmental science. However, the field faces a significant "data desert": while there are millions of known molecules, there are very few high-quality, annotated experimental spectra available for training machine learning models.

Furthermore, raw MS signals are notoriously complex and heterogeneous. A single molecule can produce vastly different spectra depending on instrument settings, collision energy, or the specific ions formed during the process. This variability makes it difficult to apply the large-scale pretraining successes seen in Natural Language Processing (NLP) directly to raw spectral data.

To overcome these challenges, researchers have introduced MS-BART, a new Transformer-based framework that treats molecular structure elucidation as a cross-modal translation task. By using molecular fingerprints as a bridge for large-scale pretraining and incorporating a chemical feedback mechanism, MS-BART achieves state-of-the-art performance while running over 50 times faster than current diffusion-based models.

Methodology

MS-BART adapts the BART (Bidirectional and Auto-Regressive Transformer) architecture to chemistry, relying on three key pillars to bridge the gap between spectral data and molecular structures:

1. A Unified Vocabulary

Instead of processing raw, noisy spectra directly, the model uses molecular fingerprints—binary vectors representing the presence of specific chemical substructures—as an intermediate representation. Because these fingerprints are invariant to experimental conditions, they provide a stable bridge. Both these fingerprints and the target molecular structures (represented as SELFIES strings) are converted into tokens within a shared vocabulary. SELFIES are specifically chosen over SMILES because every SELFIES string represents a chemically valid molecule, eliminating syntax errors during generation.

2. Multi-Task Pretraining

To solve the data scarcity issue, the authors computed fingerprints for 4 million unlabeled molecules, creating a massive simulated dataset. They pretrained MS-BART on four distinct tasks: denoising molecular strings, translating fingerprints to molecules, and two hybrid tasks combining both modalities. This allows the model to learn the fundamental "grammar" of chemistry before ever seeing a real mass spectrum.

3. Chemical Feedback Alignment

Even after finetuning on real experimental data, generative models often "hallucinate" molecules that look plausible but are structurally incorrect. To combat this, MS-BART introduces a contrastive rank loss.

Overview of the MS-BART finetuning and alignment pipeline, incorporating MIST fingerprint predictions and the contrastive rank loss.

During finetuning, the model uses an external pretrained spectral inference model (MIST) to predict fingerprints from raw spectra. The rank loss mechanism then provides chemical feedback, forcing the model to assign higher generative probabilities to candidate molecules that share a higher structural similarity (Tanimoto similarity) with the ground truth reference.

Datasets

The model was rigorously evaluated on two major open-source benchmarks:

  • NPLIB1: A curated subset of the GNPS library, frequently used for metabolite identification.
  • MassSpecGym: A newer, larger benchmark containing over 231,000 high-quality spectra.
  • Pretraining Data: A massive corpus of 4 million molecules sourced from MassSpecGym, carefully filtered to ensure no "data leakage" occurred with the test sets.

Key Results and Insights

MS-BART demonstrated significant improvements over existing de novo (generative) methods, proving that "learning chemistry" from unlabeled data is a highly viable path forward for mass spectrometry.

  • State-of-the-Art Performance: MS-BART achieved SOTA results on 5 out of 12 key metrics across the two benchmarks. On NPLIB1, it significantly outperformed previous models in structural similarity metrics (Tanimoto and MCES).
  • Massive Speedup: Inference is roughly 53x faster than the leading diffusion-based model (DiffMS). MS-BART takes about 3 seconds per spectrum on a standard GPU, compared to nearly 3 minutes for its competitors.
  • The Power of Ranking: Ablation studies showed that standard cross-entropy loss (predicting the next token) is insufficient for chemistry. Adding the ranking loss based on chemical similarity ensures the model learns the context of the molecular space.
Ablation study showing progressive improvements in Tanimoto Similarity from pretraining, to finetuning, and finally adding the rank loss.

As seen in the ablation results, moving from the base pretrained model to a finetuned model, and finally to a model utilizing the rank loss, yields progressive and substantial improvements in Top-1 and Top-10 Tanimoto similarity.

Limitations and Future Work

While MS-BART represents a significant leap forward, the authors acknowledge a few key hurdles. Currently, MS-BART relies on an external model (MIST) to predict fingerprints from raw experimental spectra; if MIST makes an error, MS-BART inherits it. Additionally, while the model uses molecular formulas to re-rank candidates post-generation, formula constraints are not yet natively "baked into" the Transformer's internal reasoning.

Future work will explore ways to incorporate chemical formulas directly into the training process and potentially move toward modeling raw spectral fragments directly, which could remove the dependency on external fingerprint predictors entirely.

Summary updated

BibTeX
@inproceedings{han2025ms,
  author = {Yang Han and Pengyu Wang and Kai Yu and xin chen and Lu Chen},
  title = {{MS-BART: Unified Modeling of Mass Spectra and Molecules for Structure Elucidation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=N7Vg94l0gA},
}
Figure