Abstract
Identifying molecular structures from tandem mass spectrometry (MS/MS) data is a critical yet challenging task in drug discovery and metabolomics. Traditional cross-modal retrieval methods struggle with the "modality barrier" between physical fragmentation patterns and chemical connectivity. We present GLMR (Generative Language Model-based Retrieval), a two-stage framework that bridges this gap by first identifying candidate priors and then using a generative language model to refine the retrieval. GLMR achieves a significant performance leap, improving top-1 retrieval accuracy by over 40% on standard benchmarks.
Introduction
The identification of unknown chemical compounds is fundamental to fields like drug discovery and metabolomics. Tandem mass spectrometry (MS/MS) serves as the primary tool for this purpose, breaking molecules into fragments to measure their mass-to-charge ratios ($m/z$) and creating a unique "spectral fingerprint." However, translating these physical fingerprints back into precise molecular structures is notoriously difficult.
Existing methods typically rely on library matching, which is limited to known compounds, or deep learning-based cross-modal alignment. The latter attempts to map spectra and molecular strings (SMILES) into a shared latent space. This approach often fails due to the modality barrier: mass spectra represent physical fragmentation behavior, while SMILES strings describe chemical connectivity. This fundamental difference leads to modality misalignment, where models struggle to accurately match disparate data types.
The GLMR Framework
To overcome the modality barrier, the authors propose GLMR (Generative Language Model-based Retrieval). This framework shifts the paradigm from direct cross-modal matching to a generative refinement process.
The GLMR process consists of three main stages:
- Pre-retrieval (Filtering): Using contrastive learning (similar to CLIP), the model encodes the input spectrum and a molecular database to identify the top-K (e.g., 40) most likely candidates. These serve as "contextual priors."
- Generative Retrieval (Refinement): This core innovation utilizes a Generative Language Model (based on ChemFormer). The model takes the input spectrum and the top-K candidates to generate a "refined" molecular structure.
- Re-ranking: The initial candidates are re-ranked based on their similarity to the generated "ideal" molecule. This transforms the difficult cross-modal task (Spectrum $\leftrightarrow$ Molecule) into a simpler unimodal task (Molecule $\leftrightarrow$ Molecule).
Experimental Evaluation
GLMR was evaluated on two major benchmarks:
- MassSpecGym: A large-scale dataset containing approximately 230,000 high-quality mass spectra.
- MassRET-20k: A challenging new dataset introduced by the authors, featuring 20,000 spectrum-molecule pairs with 12 types of ionization adducts and complete experimental metadata to reflect real-world conditions.
Results and Analysis
GLMR demonstrates a massive improvement over existing state-of-the-art (SOTA) models. On the MassSpecGym benchmark, GLMR achieved a Top-1 accuracy of 64.1%, a staggering increase from the 17.6% achieved by the previous best model, JESTR.
Key insights from the results include:
- Bridging the Gap: The "modality gap" between spectral and molecular representations narrows significantly after the pre-retrieval stage and nearly vanishes after generative retrieval.
- Structural Fidelity: Even in cases where the exact molecule was not retrieved, GLMR found structures with much higher similarity to the ground truth (measured by Maximum Common Edge Subgraph, MCES) compared to other methods.
- Robustness: GLMR maintained high performance (54% Top-1 accuracy) on the diverse MassRET-20k dataset, where baselines struggled to exceed 17%.
Conclusion and Future Directions
While GLMR sets a new standard for accuracy, it introduces some computational overhead. The generative stage takes approximately 1.1 seconds per instance—slower than simple vector lookups but competitive with complex baselines like MIST. Future work will focus on optimizing inference speed through lightweight fusion modules and incorporating explicit chemical constraints to ensure the generation of valid, stable SMILES strings. GLMR represents a significant step forward in automating chemical structure identification, potentially accelerating discovery in metabolomics and beyond.
Summary updated