FRIGID: Scaling Diffusion-Based Molecular Generation from Mass Spectra at Training and Inference Time
Abstract
Tandem mass spectrometry is prominent in scientific discovery workflows for identifying unknown small molecules, yet high-throughput structural elucidation remains challenging. While recent autoregressive and graph diffusion models have shown promise in de novo elucidation, performance remains limited by poor scalability during both training and inference time. In this work, we present FRIGID, a framework with a novel diffusion language model that generates molecular structures conditioned on mass spectra via intermediate fingerprint representations and determined chemical formulae, training at the scale of hundreds of millions of unlabeled structures. We then demonstrate how forward fragmentation models enable inference-time scaling by identifying spectrum-inconsistent fragments and refining them through targeted remasking and denoising. While FRIGID already achieves strong performance with its diffusion base, inference-time scaling significantly improves its accuracy, surpassing 18% Top-1 accuracy on the challenging MassSpecGym benchmark and tripling the Top-1 accuracy of the leading methods on NPLIB1. Further empirical analyses show that FRIGID exhibits log-linear performance scaling with increasing inference-time compute, opening a promising new direction for continued improvements in de novo structural elucidation. FRIGID code is publicly available at https://github.com/coleygroup/FRIGID.
Lay Summary
Identifying unknown small molecules is an important step in many areas of science, including medicine, biology, drug discovery, and environmental monitoring. Scientists often use tandem mass spectrometry for this task: a molecule is broken into pieces, and the masses of those pieces form a spectrum that contains clues about the original structure. However, working backward from this spectrum to the full molecule is difficult, because many molecules can produce similar signals and many possible structures may never appear in existing reference libraries. We introduce FRIGID, a machine learning method that builds molecular structures from a mass spectrum and a chemical formula. At its core, FRIGID uses a diffusion language model: it starts from a mostly blank molecular string and gradually fills in the missing pieces, guided by information predicted from the spectrum. FRIGID then uses a forward spectrum simulation model to check whether the generated molecule would break into fragments matching the observed spectrum. During test time, mismatched parts of the molecule are repeatedly masked and regenerated, allowing FRIGID to iteratively refine the proposed structure and improve its accuracy. Across standard benchmarks for molecular structure identification, FRIGID recovers the correct molecule more often than previous methods and can improve further when given more computation time. These results suggest a practical path toward faster and more accurate identification of unknown molecules in scientific discovery workflows.