DiffMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
Authors: Montgomery Bohde
Mrunali Manjrekar
Runzhong Wang
Shuiwang Ji
Connor W. Coley
Venue: ICML 2025 poster (2025)
Keywords: AI4Science
Mass Spectra
Diffusion
Graph Neural Networks
Primary area: applications->chemistry_physics_and_earth_sciences
TL;DR: DiffMS incorporates discrete graph diffusion for de novo generation from mass spectra and reaches state-of-the-art performance.

Abstract: Mass spectrometry plays a fundamental role in elucidating the structures of unknown molecules and subsequent scientific discoveries. One formulation of the structure elucidation task is the conditional *de novo* generation of molecular structure given a mass spectrum. Toward a more accurate and efficient scientific discovery pipeline for small molecules, we present DiffMS, a formula-restricted encoder-decoder generative network that achieves state-of-the-art performance on this task. The encoder utilizes a transformer architecture and models mass spectra domain knowledge such as peak formulae and neutral losses, and the decoder is a discrete graph diffusion model restricted by the heavy-atom composition of a known chemical formula. To develop a robust decoder that bridges latent embeddings and molecular structures, we pretrain the diffusion decoder with fingerprint-structure pairs, which are available in virtually infinite quantities, compared to structure-spectrum pairs that number in the tens of thousands. Extensive experiments on established benchmarks show that DiffMS outperforms existing models on *de novo* molecule generation. We provide several ablations to demonstrate the effectiveness of our diffusion and pretraining approaches and show consistent performance scaling with increasing pretraining dataset size. DiffMS code is publicly available at https://github.com/coleygroup/DiffMS.

DifMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
Montgomery Bohde 12
Mrunali Manjrekar'
Runzhong Wang'
Shuiwang Ji Connor W. Coley'
Abstract
intensity
Mass spectrometry plays a fundamental role in elucidating the structures of unknown molecules and subsequent scientific discoveries. One for- mulation of the structure elucidation task is the conditional de novo generation of molecular struc- ture given a mass spectrum. Toward more accu- rate and efficient scientific discovery pipeline for small molecules, we present DiffMS, a formula- restricted encoder-decoder generative network that achieves state-of-the performance on this task. The encoder utilizes transformer archi- tecture and models mass spectra domain knowl- edge such as peak formulae and neutral losses, and the decoder is a discrete graph diffusion model restricted by the heavy-atom composition of known chemical formula. To develop ro- bust decoder that bridges latent embeddings and molecular structures, we pretrain the diffusion decoder with fingerrinn-structure pairs, which are available in virtually infinite quantities, com- pared to structure-pecctrum pairs that number in the tens of thousands. Extensive experiments on established benchmarks show that DifIMS outper- forms existing models on de novo molecule gen- eration. We provide several ablations to demon- strate the effectiveness of our diffusion and pre- training approaches and show consistent perfor- mance scaling with increasing pretraining dataset size. DifIMS code is publicly available at ht tps: EMS.
1.0
de novo generation
Leucine
0.9
OR?
1.0
Isoleucine
0.0
0.0
100
Figure I. De novo structure generation from LC-MS/MS faces ambiguity when isobaric isomeric compounds yield similar frag- mentation spectra. In this case, the experimental spectra for leucine and isoleucine from NIST (2023) essentially indistinguishable. It is one of many examples demonstrating that the identification of the exact structure desirable challenging.
Tandem mass spectrometry (MS/MS) in combination with liquid chromatography (LC) enables information-richt high- throughput profiling of compounds, wherein complex exper- imental mixtures are separated in two dimensions, first by retention time (from chromatography) and then by molecule m/z (mass-to-charge ratio) in the first MS (MSI) stage. Each "precursor" molecule is then individually passed through the second MS stage (MS2) where it undergoes collision- induced dissociation and is split into a set of charged molec- ular fragments, each with a corresponding m/z and an in- tensity. Modern LC-MS/MS has enabled the discovery of many new compounds of interest, such identifying novel bile acids in microbiome study (Quinn al., 2020), uncov- ering tire rubber-derived chemical that is toxic to coho salmon (Tian et al., 2021). There is also growing inter- est in increased throughput with MS technologies, such as high- thghhhhhouuhput analysis of chemical reactions (Hu et al., 2024) and a systematic discovery pipeline for human metabolites (Gentry al., 2024).
//github.....//// /ow
1. Introduction
Mass spectrometry (MS) a fundamental part of the analyt- ical chemistry toolkit that assist in the identification of unknown compounds of interest collected from experiments.
'Massachusetts Institute of Technology, Cambridge, MA, United States "Texas A&M University, College Station, TX, United States. Correspondence to: Connor W. Coley <ccolcy@ @ mit.edu>.
From MSI and MS2 data alone, elucidation of the chemical structure(s) present in the original experimental sample re- mains challenging. Many ti--to-be-dscooveee metabolites have structures that do not exist in standard virtual chem- ical libraries (PubChem. Human Metabolome Database, etc.). The majority of observed spectra in MS-based
Proceedings of the ndnd International Conference Machine Learning. Vancouver, Canada. PMLR 267, 2025. Copyright 2025 by the author(s).

---

DiMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
Q
intensity
Precursor formala
miz
Mass Spec Encoder
A'
A
M X.y.
Y
A2 Pa(A'AA,, y,)
Figure 2. DiffMS tackles de novo molecular generation from mass spectra. We embed mass spectrum features with transformer encoder, and assume the chemical formula is determined by off- off-the-shelf tools (Goldman et al., 2023c; Böcker & Dührkop, 2016) so that the numbers and types of heavy atoms (i.c. nodes in the molecular graph) is constrained. The molecular structure is represented an adjacency matrix with one encoded bond types, which in this example are single (blue), double (yellow), aromatic bonds (red) and no bond (white). The target molecular structure is generated starting from randomly initialized adjacency matrix, which is denoised through a discrete diffusion process (Vignac et al., 2023). The trajectory used for training is created by randomly disturbing the true structure t times.
metabolomics campaigns remain unidentified and are char- acterized as "metabolite dark matter" (Bittremieux et al., 2022). The difficulty of the elucidation task comes from both computation and chemistry. terms of computation, there is large set of possible substructures to explain each measurement, creating an exponential number of structure candidates for the overall mass spectrum, i.e., NP-hard combinatorial optimization. From the chemistry perspec- tive, a standalone mass spectrum may be insufficient to determine a unique structure because of the ionization and fragmentation mechanisms of the instrument; as shown in Fig. 1, the spectra of two isomeric amino acids are nearly identical. While we would like to be able to determine the exact structure, from an application perspective, generating similar but not exactly matching structures is still useful to domain experts to narrow down the chemical space.
intensities as inputs to SMILES strings as outputs (Butler et al., 2023; Litsa et al., 2023); however, these autoregressive language models do not capture the permutation-invant invariant nature of mass spectra and molecules, nor do they incorpo- rate chemical formula constraints as helpful prior knowl- edge. Another family of approaches utilizes intermediate representations such scaffolds (Wang et al., 2025) or fingerprints (Stravs et al., 2022) before generating chemi- cal structures, which are arguably more chemically inter- pretable and leverage additional amounts of structure-only data available, but have not necessarily led to significant performance improvement on benchmarks. Compared to the complete structural elucidation challenge of the "in- verse" MS problem, the chemical formula of the unknown molecule is usually easier to determine by off-the-shele tools from MS1 and MS2 data, utilizing tools such as SIRIUS (Böcker & Dührkop, 2016), BUDDY (Xing et al., 2023), or MIST-CF (Goldman et al., 2023c). One insight of our work is use those available tools by taking the chemical formula as given and developing formula-constrained (i.e., heavy atom-constrained) generation pipeline. We also find it beneficial to exploit intermediate chemical representations to enable a scaled-up up pretraining stage with theoretically unlimited fingerprint-structure pairs.
Machine learning methods have recently taken root in this space to address two key challenges in particular: 1) to learn how to fragment a given molecule, and predict the resultant mass spectrum, known as "forward" MS simulation (Mur- phy et al., 2023; Goldman et al., 2023a; 2024; Young al., 2024b;a; Nowatzky et al., 2024) and 2) to take an experi- mental spectrum and predict the corresponding structure or a description thereof, typically as a fingerprint, SMILES, or graph representation, known as "inverse" methods (Dthhkkop al., 2015; Stravs et al., 2022; Butler et al., 2023; Litsa al., 2023; Goldman al., 2023b).
To this end, we present DiftMS, a permutation-invariin diffusion model trained end-to-end for molecule genera- tion conditioned on mass spectra (Fig. 2). DiffMS has an encoder-decoder architecture that builds upon modern trans- formers (Vaswani et al., 2017) and discrete graph diffu- sion (Vignac et al., 2023). For the encoder, we adopt the for- mula transformer from MIST (Goldman et al., 2023b) with pairwise modeling of neutral losses as a domain-informed inductive bias. For the decoder, we build upon the DiGress graph diffusion model (Vignac et al., 2023) using chem- ical formula constraints and embeddings extracted from the formula transformer as the condition to generate target
In this paper, we focus on the "inverse" MS problem and develop a novel machine learning framework for chemical structure generation given a mass spectrum, sometimes also deseribed as de novo generation. A recent study of de novo generation from MS shows that all of the methods tested suffer from near-zero structural accuracy (Bushuiev al., 2024). Among prior approaches to this task are language models that are trained to convert tokenized m/z values and
2

---

DiMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
molecules. We provide empirical validation of our end-to- end model established mass spectra de novo generation benchmarks (Dührkop et al., 202 Bushuiev et al., 2024). Additional ablation studies demonstrate the effectiveness of our pretraining- finiiininninnnnnnggggg framework.
Recently, Vignac al. (2023) developed DiGress, non- autoregressive generative model based on discrete graph diffusion. The target spaces of these generative models are generally unconditioned or loosely conditioned, for exam- ple, to generate drug-like molecules (Luo et al., 2021) or molecules with certain conformations (Roney et al., 2022).
Our contributions are summarized as follows:
In the context of de novo structural generation, however, molecular generation must be strongly conditioned on the spectral information, i.e., the fragmentation pattern itself and an inferred chemical formula. There are some efforts that try to generate structures from molecular fingerprints, which is another form of strong structural condition, in- cluding Neuraldecipher (Le et al., 2020) that learns how to decode SMILES strings from molecular fingerprints, as well as MSNovellit (Stravs et al., 2022), which proposes fingerprint- -SSLLEE long short-term memory (LSTM) network.
1. We present DiffMS, the first conditional molecular generator with formula constraints for structural eluci- dation from mass spectra. We demonstrate discrete dif- fusion as natural methodology for conditional molec- ular generation that natively handles predefined heavy- atom composition and accounts for the underspecifi- cation of conditioning (i.e., the one-to-many mapping from spectrum to structure illustrated by Fig. 1).
2.
We propose pretraining-finetniigg framework for training DiffMS that makes use of virtual chemical libraries with self-labeled structural conditions. Specif- ically, the diffusion decoder is trained on a large-scale dataset with 2.8M fingerprint-structure pairs. Our abla- tion studies show that downstream performance scales well with increasing fnnerprinn--struetur pretraining dataset size, providing a promising avenue to scale the performance. We also pretrain the spectrum encoder to predict fingerprints from spectra embeddings to further boost performance of the end-to-end finetuned model.
Both of these methods use autoregressive models that can- not strietly enforce formula constraints, while in MS, the chemical formula of the target molecule is an important inductive bias that limits the target space. In this paper, we identify discrete graph diffusion porate formula constraints and improve Vignac et al. (2023), expanding the suite of methods in conditional molecular generation.
natural choice incor-
2.2. Inverse models for structure elucidation from spectra
3. On established benchmarks for de novo structure elu- cidation, DiffMS demonstrates superior performance compared to all existing baselines, achieving improved annotation accuracy and better structural similarity to the true molecule. While de novo generation of the exact molecular structure remains challenging. struc- turally close matches can offer valuable insights for domain experts (Butler et al., 2023). The broad ap- plicability of MS underscores the potential impact of DifIMS in advancing research in chemical and biologi- cal discovery.
Inverse models take an experimental spectrum as input and predict relevant representation of the structure: typically, the molccular graph itself, a SMILES string, or a molecular fingerprint. DENDRAL, arguably the first expert system that applied AI to science, focuses on structural elucidation from mass spectrometry data (Lindsay et al., 1980). Recent years have seen the adoption of machine learning for new class of inverse MS models, such as for spectrum- to-fingerprint predictions, involving either support vector machines, as in FingerlD (Dührkop et al., 2015); or deep learning with transformers, as in MIST (Goldman et al., 2023b). The fingerprint, which is a binary encoding of the structure, can be further used rank candidate structures from a chemical library. Similar elucidation goals have been pursued with other types of analytical spectra such as nuclear magnetic resonance (NMR) (Alberts et al., 2023).
2. Background and Related Work
2.1. Conditional generative molecular design
Unconditional molecular generation has been well-explored in the context of Al for chemistry (Zhang et al., 2023), with methods such as K66mez-Bombardu et al. (2018): Segler et al. (2018) leveraging autoregressive sampling with lan- guage decoders to generate SMILES representations of molecules as well as GNN architectures that generate molec- ular graphs atom-by bomoooy-toom for either 2-dimensional (Liu et al., 2018; Li et al., 2018; Simonovsky & Komodakis, 2018) or 3-dimensional Tlam-Shheheerd et al., 2022; Adams & Coley, 2022; Luo& & Ji, 2022; Liu et al., 2022) graphs.
However, the elucidation of structures that do not neces- sarily exist in any virtual chemical library requires gen- erative techniques rather than retrieval- MSNovelist (Stravs et al., 2022) builds an autoregressive fingerprint- molollull model that takes fingerprint pre- dictions returned by CSI- "Si-FingerLD and generates SMILES strings, with a decoding process that utilizes the molecular formula of the candidate compound as inferred from tools
techniques.
3

---

DiMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
such as SIRIUS(Böcker & Dührkop, 2016) or MIST-CF (Goldman al., 2023c). Spec2Mol (Litsa et al., 2023) de- velops SMILES autoencoder and trains a spectrum CNN encoder model, with up to four spectral channels to ac- cept spectra collected in low or high energy and positive or negative mode, that tries to predict the corresponding SMILES embedding from the spectrum. MassGenie (Shri- vastava al., 2021) is an orthogonal effort that uses forward MS models (Allen et al., 2015; Goldman al., 2024) to augment training datasets with in silico reference spectra. Toward an end-to-end pipeline for molecular generation from mass spectra, which is the most relevant to our work, Butler et al. (2023) build MS2Mol,, an end-to-end language model that encodes m/z values and intensities as tokenized text input and outputs an inferred chemical formula and SMILES string in an autoregressive manner. However, their implementation is not currently available the time of writing, preventing direct comparison. Most recently, MAD) GEN (Wang et al., 2025) presents a diffusion generator of chemical structures from scaffolds as a two-stage genera- tive process, scemingly bottlenecked in terms of accuracy by scaffold prediction. In this paper, we improve upon this thread of end-to-end approaches by encoding inductive biases via spectral transformers and utilizing a pretraining- finetuning framework for an MS- -SSciindt diffusion gen- erator. DiffMS has two stages like MADGEN, but is trained end-to-end during its final training step, and is heavy-atom constrained.
Many works have also studied conditional generation with diffusion. Conditional diffusion models typically fall into two categories: classifier guidance (Dhariwal & Nichol, 2021) and classifier free guidance (Ho & Salimans, 2022). Classifier guidance uses the gradients of the log likelihood of a classifier function Pp ) to guide the diffusion towards samples with class y. On the other hand, classifier- guidance trains the denoising network directly to generate samples conditioned on class y and does not require any external classifier function. DifIMS falls under classifier- free guidance.
While diffusion models were originally designed to operate in continuous spaces, recent works have adapted denoising diffusion for discrete data modalities (Austin et al., 2023; Lou et al., 2024) and graph structured data (Vignac et al., 2023; Chen et al., 2023), both of which are relevant for molecule generation. Here, we follow the discrete diffusion settings of Austin et al. (2023) and Vignac et al. (2023).
3. Methodology
3.1. Formula-constrained molecular generation
We represent atructure-ppectrum pairs as (M,S), where M is the graph representation of the molecule with correspond- ing spectrum S. The goal of de novo generation is to recon- struct the molecular graph M from S. Because the molecu- lar structure is typically underspecified given the spectrum, it is more natural to formulate de novo generation pre- dicting a ranked list of & molecules M2 = (MM....,Ma, that most closely match the given spectra.
2.3. Diffusion generative models
Denoising diffusion (Sohl-Dickstein et al., 2015; Ho et al., 2020) has been shown to be widely effective across many tasks such as image (Song et al., 2021; Saharia al., 2022; Karras et al., 2022) and text (Li et al., 2022: Austin al., 2023) generation. More recently, diffusion has been applied to solve molecual generative tasks (Corso et al., 2023; Watson et al., 2023; Zeni et al., 2024).
One insight in this work is that chemical formulae represent an important physical prior that can significantly reduce the molecular search space. Formulae can be inferred from high-resolution MSI data and isotopic traces with sufficient accuracy using tools like SIRIUS (Böcker & Dührkop, 2016) or MIST-CF (Goldman et al., 2023c), though the latter does not consider isotope distributions. To that end, we develop formula-restricted generation using graph diffusion. In practice, we find it sufficient to model only the heavy- in the graph and infer hydrogen atom placement implicitly; thus DIffMS generated molecules may differ in formula from the true molecule in hydrogen atom count.
Broadly speaking, diffusion models are generative models defined by a forward process that progressively adds noise to a sample from data distribution q=2") such that q(=7|29) converges to known prior distribution p(=") ) as T co. We additionally require that the noising process be Marko-
vian such that g(2) ....; x- 2²)²²) II ((="|2²=1) Fi-
nally, we select the forward process such that we can effi-
ciently sample from g<=1(=0).
3.2. DifIMS discrete diffusion
A neural network is then trained to reverse this noising pro- cess. However, instead of predicting p=(2==122)) as long as
Let a molecular graph M = (A, with one-hot en- coded adjacency matrix A E {0, 10.11axxxx node features x E xxd such as atom types, and graph-level structural features y E R to condition the molecule generation such as molecular fingerprint number of heavy atoms in the molecule; k = 5, the number of bond types (no bond, single, double. triple, and aromatic
= J ( |2', (2,22) 20)dpa(22) (=²) is tractable, we can train the model to directly predict the denoised sample pa )= To generate new samples from the model, we sample random noise from the prior distribution p(="), and iteratively sample from po(z"_1(z') until reaching 20.
mass spectra. Here, n is the
4

---

DiMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
A) Spectrum Encoder
B) Graph Decoder
C) DifMMS
Formula: CaHaNO
Intensity
CoNO
miz
A
Spectrum Encoder
CgHO
CeHlsO
X
Graph Embedding
Node Embedding
Edge Embeddiin
Formala Transformer
Graph
Graph Transformer
X
Po (o(A
Po
Figure 3. Model architecture of DifIMS. A) The spectrum encoder first assigns chemical formulae peaks in an experimental spectrum and then learns an embedding vector through formula transformer. The encoder is pretrained to predict Morgan fingerprints (Morgan, 1965) from spectra. B) The graph decoder generates the target adjacency matrix by discrete diffusion conditioned on the spectrum embedding and node (atom) features. The graph decoder is pretrained with pairs of structures and fingerprints from virtual chemical libraries. We scale up the decoder pretraining exploit the -ittuall--iffiitt number of available engerprint-structuen pairs relative to the small number of available spectrum--trucuuu pairs, mitigating the challenge of engerprint-to-molccae generation found non-trivial by Le al. (2020). C) DifIMS integrates the spectrum encoder and graph decoder generate the structure annotation denoising process applied to graph with randomly generated edges. It is finetuned end-to-end on labeled molecule- data.
bonds); d, the dimension of atom features; and the di- mension of the conditional features. Because we obtain atom types from the formula, we can fix X and generate the adjacency matrix A conditioned on X and y.
x(1/T + 2(1 +
2
ā' = cos
(4)
with ,00 = - á.. We then define a neural network Øy that learns to predict the denoised adjacency matrix A Let M
We define discrete diffuusion process on A. Let A' denote the value of A time Let A A, the molecular adjacency matrix. At each time step, = ,,..., T. apply noise to each edge independently of others. Specifically, we Q²) such that
(A'.X.y) be the noised molecule at time t. de takes M as input and predicts probabilities po II'M (o(")) Raxaxk i.e., it learns de- noise A' conditioned on X, y. We optimize this network using cross-entropy loss L between the true adjacency ma- trix A and the predicted probabilities A (e(M'):
define forward transition matrices
Qum (a = n|a²-1 m). Thus:
q( -
A(A,
Σ 1SiKiSn
CE (aij aig)
(5)
Because the noise described by Markov transition pro- cess, we can directly sample A' given A as:
To sample new graphs, we need to compute po (M').
1( A) AQ'
(2)
We do so by marginalizing over the network predictions:
Where Q' = ='= Q2'Q2...000 Q Because molecular graphs are undirected, we apply noise only to the upper triangle of A and symmetrize the matrix. We follow the noise schedule of Vignac et (2023) and select
po (M²) = Σ po (a laij az M') po (ax)
(6)
using po (o 1-1 asj = av. M³) (aij'las laa, ag aty) if
Φ' - = + 3d 1mmm
q (aty laij ax) 0, otherwise O. We can then generate new graphs by sampling an initial A T ~ m and iteratively sampling from po (A'-1 MM²) until we obtain o
where m is the marginal distribution of edge types in the training dataset and m is the transpose of m. This choice of Q' converges to prior distribution that is closer to the data than a uniform distribution over bond types, enabling easier training. We further select the cosine noise schedule proposed by Nichol & Dhariwal (2021):
3.3. Model parametrization and pretraining
We use an encoder-decoder architecture to enable separate pretraining for the encoder and decoder before finetuning
5

---

DiMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
the end-to-end generative model. Specifically, spectrum encoder infers structural information from S and the encoder embeddings are used as the structural condition y for the graph diffusion decoder (Fig. 3).
4. Experiments
4.1. Evaluation metries
We adopt the de novo generation metrics from Bushuiev et al. (2024):
For the encoder module, we use the MIST formula trans- former of Goldman et al. (2023b). The encoder treats a spectrum as set of (m/z, intensity) peaks. It embeds each peak using a predicted chemical formula assignment from SIRIUS and applies a set transformer that implicitly models pairwise neutral losses between fragments. We extract the final embedding corresponding to the precursor peak as the structural condition y for the diffusion decoder.
Top-k accuracy: measures whether the true molecule is in the top-k model predictions.
Top-k maximum Tanimoto similarity: the structural similarity of the closest molecule to the true molecule in the top-k predictions
Top-k minimum MCES (maximum common edge sub- graph): the graph edit distance of the closest molecule the true molecule in the top-k predictions using the distance metric proposed by Kretschmer et al. (2023).
We pretrain our encoder on the same datasets used for fine- tuning (i.e., I (CANOPUS) or MassSpeeGym) but
now train the encoder to predict molecular fingerprints. We find that this pretraining enables the encoder to extract im- plicit structural information from the spectra and ensures that the encoder learns physically meaningful representa- tions. We provide an ablation of the encoder pretraining in Sec. 4.4.
We report metrics for k- = 1, 10 with additional results in Appendix C. To obtain a ranked list of DifIMS predictions, we sample 100 molecules for each spectrum, remove invalid or disconnected molecules, and identify the top-k molecules based on frequeney. This post-pree post-processing is also applied to baseline methods for fairest comparison.
For the decoder network Φ9 that predicts the denoised ad- jacency matrix, we use Graph Transformer (Dwivedi & Bresson, 2021). Specifically, encode edge features A node features X, and structural condition y. We then apply several Graph Transformer lay- ers before using an MLP to predict the denoised adjacency matrix A.
4.2. Datasets and baselines
use separate MLPs to
We evaluate DiftMS on two common open-source de novo generation benchmark datasets, NPLIB1 (Dührkop et al., 2021a) and MassSpeeGym (Bushuiev et al., 2024). The NPLIB1 dataset is the subset of GNPS data used to train the CANOPUS tool; this term is used to disambiguate the data from the method. In order to have a fair evaluation of all methods considered, we c--implemnnt several baseline meth- ods to be trained only on these datasets, with modifications to the codebase if they did not have a working open-source implementation. While some papers have historically also benchmarked on the NIST20 or NIST23 datasets (NIST, 2023), this dataset is not publicly available without pur- chase of a license.
We pretrain our diffusion decoder on a dataset of fingerprint- molecule pairs. Instead of using the spectrum encoder embeddings as the structural condition y, we directly use the molecular fingerprint to condition the molecule gen- eration. This is closely aligned with the mass spectra de novo generation task, as the decoder learns to gen- erate molecules subject to strong structural constraints. Fingerprit-molleuuee datasets are essentially infinite in size, providing promising path forward to further improve model performance by increasing the pretraining dataset size. To this end, we build pretraining dataset consisting of 2.8M fingerprint-molcau pairs sampled from DSSTox (CCTE, 2019), HMDB (Wishart et al., 2021), COCONUT (Sorokina et al., 2021), and MOSES (Polykovskiy et al., 2020) datasets. Critically, we remove all NPLIB1 and MassSpecGym test and validation molecules from our de-
MSNovelist (Stravs et al., 2022) builds a fingerprint-to SMILES LSTM decoder to predict SMILES strings from the SIRIUS URRIUS-generated CSI-FingerID fingerprint. The origi- nal implementation of MSNovelist is not readily retrainable, and furthermore relies on the closed-source CSI-FingerID fingerprint. The recently developed MIST model offers an open-source replacement with reported comparative per- formance to CSI-FingerID (Goldman et al., 2023b). Ac- cordingly, we re-implement baseline model that retains the main contributions of MSNovelist, adopting the code from Zhao al. (2024), with 4096-bit Morgan fingerprint spectral encoder using MIST alongside formula-guided fingerprint-to-SMin ---SSMS LSTM. This fingerprint- -o-MIL decoder is trained on the same 2.8M dataset used to pretrain our diffusion decoder; therefore, unlike the original MSNov- elist implementation, both the spectral encoder and LSTM decoder never see any test structures. We use the ranking
coder pretraining dataset so that our evaluation the end- to-end generation task represents a setting where the model is generating truly novel structures. Bushuiev et al. (2024) provide their own dataset of 4M molecules, but use a differ- ent exclusion criteria to prevent data leakage. We provide an ablation and analysis of performance scaling with respect to pretraining dataset size in Sec. 4.4.
6

---

DIMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
Table De structural clucidation performance NPLIB1 (Dührkop et al., 2021b) and MassSpecClym (Bushuiev al., 2024) datasets. The best performing model for each metric is bold and the second best is underlined. $ indicates results reproduced from MassSpecGym. indicates our implementations baseline approaches. Methods are approximately ordered by performance.
Top-1
Top-10
Model
Accuracy 1
MCES +
Tanimoto
Accuracy t
MCES +
Tanimoto
NPLIBI
Spec2Mol*
0.00%
27.82
0.12
0.00%
23.13
0.16
MADGEN
2.10%
20.56
0.22
2.39%
12.64
0.27
MIST + Neuraldecipher"
2.32%
12.11
0.35
6.11%
9.91
0.43
MIST + MSNovelist"
5.40%
14.52
0.34
11.04%
10.23
0.44
DiffMS
8.34%
11.95
0.35
15.44%
9.23
0.47
MassSpecGyyn
SMILES Transformer
0.00%
79.39
0.03
0.00%
52.13
0.10
MIST + MSNovelist
0.00%
45.55
0.06
0.00%
30.13
0.15
SELFIES Transformer
0.00%
38.88
0.08
0.00%
26.87
0.13
Spec2Mol"
0.00%
37.76
0.12
0.00%
29.40
0.16
MIST + Neuraldecipher" 0.00%
33.19
0.14
0.00%
31.89
0.16
Random Generation
0.00%
21.11
0.08
0.00%
18.26
0.11
MADGEN
1.31%
27.47
0.20
1.54%
16.84
0.26
DiffMS
2.30%
18.45
0.28
4.25%
14.73
0.39
methodology from MSNovelist, wherein beam search (with width of 100) and subsequently computed log-likelihoods are used for ranking- Similarly, Spec2Mol (Litsa et al., 2023) was also retrained on the NPLIB and MassSpecGym datasets for fair evaluation, with only one spectral channel instead of four used for training, to alleviate restrictions on collision energy or adduct. The same ranking for candidate molecules used for DIfIMS is applied.
4.3. Results
As seen in Table DiffMS outperforms baseline methods both datasets, including more than doubling the accuracy on MassSpecGyym compared to the next best method, MAD- GEN. While there are several baseline methods that achieve non-zero prediction accuracy on NPIIB1, only MADGEN and DifIMS generate any correct structures on MassSpec- Gym. NPLIB1 is inherently less challenging dataset than MassSpecGym: given the lack of scaffold-bar bbsed split, the CANOPUS test set contains many molecules that are nearly identical (Tanimoto similarity > 0.85) to molecules in the train set (Bushuiev et al., 2024). This also explains the competitive performance of MIST Neuraldecipher and MIST + MSNovelist, which both benefit from their ability to pretrain on these highly similar structures and learn to gen- erate realistic structures as SMILES strings; the MSNovelist more given its formula-aware decoder. In contrast, MassSpecGym ensures that no molecules in the test set have an MCES < 10 compared to any training molecule. As such, MassSpecGym evaluation represents a more challenging and more realistic out of distribution de novo generation setting, which illustrates robust perfor- mance of DifIMS across all evaluation metrics, Examples of DiffMSS-eenratee sampled Appendix E. In Appendix B. we show that even in cases where DIfMMS does not recover the correct structure, it is consistently able to generate "close match" structures that are still useful to domain experts.
We also introduce raldecipher, that replaces the diffusion decoder in DifMMS with Neuraldecipher. Neuraldecipher encodes molecule into a CDDD representation (Winter et al., 2019), and uses pretrained I.STM decoder to reconstruct the SMILES string. Similar to DiffMS, we pretrain the MIST en- coder ppectrum-toofiingrrpiin predictions, and pre- train Neuraldecipher tngerprint-to-moleese generation. Since MIST Neuraldecipher uses the same pretraining- finetuning approach as DifMMS, this new baseline addition- ally serves as an empirical justification for our graph diffu- sion decoder over an LSTM- -bssed approach.
baseline method, MIST + Neu-
generation
Finally, we include a comparison to MADGEN (Wang et al., 2025). The MADGENonek entry in Wang al. (2025) feeds in the ground-truth scaffold which does not fall within the setting of complete de novo generation, and is thus not included in our evaluation. Because MADGEN uses RD- KFingerprints for evaluation, as opposed to the traditional Morgan fingerprint, we exclude their Tanimoto similarities.
shown in Figure 4 and

---

DIMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
Ground Truth
Top-1 Tan. Sim 100,, MCES
Top-2 Tan. 0.47. MCES
Top-3 Tan. Sim 0.42, MCES
Top-4 Tar. Sim 0.42 MCES
Ground Truth
Top-1 Tan. Sin 100, MCES
Tan. Sim = 0.38, MCES
Top-2
Top-3 Tan. 5m 0.47 MCES
Top-4 Tan, Sim 0.42, MCES =
Top-1 Tan. Sim 0.17, MCES 30
Top-2
Top-3
Top-4
Ground Truth
Tan. Sim 0.20. MCES 32
Tan. Sim 0.17. MCES 36
Tan. Sim 0.14, MCES 36
Top-1 Tan. Sim 0.88, MCES 2
Top-2
Top-3 Tan. Sim 0.71, MCES
Top-4 Tan, Sim 0.24 MCES
Ground Truth
Tan. Sim 0.73, MCES
Figure Ground truth molecules (left column) and DifMMS predictions (right columns) test samples from the MassSye dataset (Bushuiev et al., 2024). Tanimoto similarity and MCES metrics listed for each top-k prediction. From top to bottom, the spectra IDSs M5sSSpeeGymII00205 184, fassSpeecGyllD0005933, MasSSpeccimmID00885555 and MasSpeeCyymID0152455 The top rows show cases where DifMMS successfully reconstructs the true molecule the top-1 prediction. In the bottom two rows, DIffMS does reconstruct the correct molecule. Additional examples be found in Appendix
4.4. Pretraining Ablations
To highlight the performance gains from pretraining the DiffMS encoder and decoder, we provide several ablations. Note that comparisons in Table 1 to MIST Neuraldeci- pher and MIST + MSNovelist already serve empirical justification for DifIMS' discrete graph decoder.
Table 2. DiffMS performance on NPLIB1 with without pre- training the MIST encoder the spectrum-to-fingerriia task. The best performing model for each metric is bold.
Pretrain? Accuracy t MCES +
Tanimoto t
Encoder Pretraining Ablation. We train DiffMS without pretraining the MIST encoder on the spectra-to -o-nggrrpritt task. As demonstrated Table 2, encoder pretraining pro- vides significant performance gains on the NPLIB1 dataset, nearly doubling the top-1 accuracy. Additionally, that even without pretraining the encoder, DifMMS generates realistic, plausible structures as indicated by the MCES and Tanimoto metrics. Nonetheless, the encoder pretraining im- proves the ability of the decoder to condition the diffusion on spectra and obtain an exact match.
Top-1
4.36%
12.34
0.31
see
8.34 %
11.95
0.35
Top-10
11.46%
9.31
0.44
15.44 %
9.23
0.47
Decoder Pretraining Ablation. We train DiffMS with in- creasing decoder pretraining dataset size, starting from 0
8

---

DIMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
Table DIfMMS nove structural elucidation performance on NPLIBI (Dührkop al., 2021b) and MassSpecGym (Bushuiev al.,
2024) datasets using MIST-CF annotated formulae and ground truth formulae. The best performing model for each metric is bold.
Top-1
Top-10
Formulae
Accuracy
MCES + Tanimoto f
Accuracy
MCES
Tanimoto 1
NPLIB1
MIST-CF Formulae
7.03%
11.81
0.36
14.98% 15.44%
9.39
0.48
True Formulae
8.34%
11.95
0.35
9.23
0.47
MassSpecGym
MIST-CF Formulae
1.86%
17.83
0.27
4.10%
13.71
0.40
True Formulae
2.30%
18.45
0.28
4.25%
14.73
0.39
annotation tools (Goldman et al., 2023c; Xing et al., 2023; Böcker & Dührkop, 2016). In this section, we broaden the structural elucidation challenge and investigate the ability of DifIMS to rely on MIST-CF (Goldman et al., 2023c) for- mula predictions to test its performance in settings where the true chemical formula is unknown.
0.150
0.125
Accuracy
0.100
For each spectrum, predict the top 5 most likely formu- lae using MIST-CF. We then generate candidate structures for each of the predicted formulae. To have fair compari- son, we still generate 100 total molecules, split across the predicted formulae. As shown in Table 3, DiffMS still has strong performance even when relying on formula an- notation tools supply the formula. While the elucidation accuracy is slightly lower, the MCES and Tanimoto met- rics are actually better in some cases using the MIST-CF predicted formulae. Intuitively, sampling molecules with different formulae gives us higher diversity and thus a better chance of getting "close" structure.
Pretraining Samples
2.8M
0.8M
0.025
0.000
10
30
Top-K
Figure 5. NPLIB1 top-k accuracy for DifMMS pretrained on in- creasingly large fingepprin-to-mmoecuue datasets. Additional met- rics available in Table 5 in the Appendix.
molecules (i.e., no pretraining) up the full pretraining dataset of 2.8M molecules. As shown in Fig. 5, any amount of decoder pretraining offers a significant increase in perfor- mance. Additionally, we observe good performance scaling with increasing pretraining dataset size. Since fingerprint- to-molecule datasets are essentially infinite in size, this pro- vides an avenue to continue scaling DiffMS' performance by building even larger and more chemically comprehensive pretraining datasets.
5. Conclusion
In this work, propose DiffMS, conditional molecule generative model with formula constraints for structural clucidation from mass spectra. We develop a pretraining- finetuning framework for separate spectra encoder and graph diffusion decoders that makes use of extensive fingerprint- molecule datasets and ensures the spectrum encoder learns to extract physically meaningful representations from mass spectra. We show that DiffMS achieves state-of- state-of-the-an the-art art results across common de novo generation benchmarks, and provide several ablations to demonstrate the effectiveness of our contributions and the potential to further improve performance by scaling pretraining.
Additional results and figures for encoder and decoder pre- training ablations can be found in Appendix C.
4.5. Formula Inference Ablation
In many real-world elucidation settings, chemists may know the true chemical formula of the target compound a priori or be able to determine the true formula using auxiliary meth- ods. However, chemical formulae can also predicted from the spectrum with high accuracy by out-of-the-hhe -ho--ox- formula
Acknowledgmentss
This work was partly sponsored by DSO National Labo- ratories in Singapore (to C.W.C.), the MIT Summer Re-

---

DiMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
search Program (MSRP), National Science Foundation der grant IIS-2243850 (to S.J.), and ARPA-H under grant IAYIAX000053 (to S.J.).
CCTE, E.
Distributed Sinuttre-Searchaal
Tox-
icity (DSSTox) Database. 4 2019.
doi:
102234455ppccomp0x.555556666
URL
http://icc/caaaetaaoo.e.oeoc ottaset/hhheristtyyaassboorrrddd
attps://apa..iisharee.com
Impact Statement
The advancement of computational tools for structure eluci- dation will aid in the identification of unknown molecules, including metabolites biomarkers for diagnostic appli- cations or improving understanding of biology. There are many potential heneficial societal consequences of our work and very few potential negative ones, none of which warrant elaboration here.
Numberss_and__aamee///55
Chen, X., He, J., Han, X., and Liu, L.-P. Efficient and degree-guided graph generation via discrete diffusion modeling. 2023. URL https://arxiv..t/
Corso, G., Stärk, H., Jing, B., Barzilay, R., and Jaakkola, T. Diffdock: Diffusion steps, twists, and turns for molec- ular docking. In International Conference on Learning Representations (ICLR), 2023.
References
Adams, K. and Coley, C. W. Equivariant shape-conditions generation of 3d molecules for ligand-basee based drug design. arXiv preprint arXiv:2210.0445
Dhariwal, P. and Nichol, A. Diffusion models beat gans on image synthesis. Advances in neural information processing systems, 34:8780-8794, 2021.
2022.
Alberts, M., Zipoli, F., and Vaucher, A. C. Learning the language of nmr: Structure elucidation from nmr spectra using transformer models. In NeurlPS 2023 Workshop, 2023.
Dührkop, K., Shen, H., Meusel, M., Rousu, J., and Böcker, S. Searching molecular structure databases with tandem mass spectra using esi: Fingerid. Proceedings of the National Academy of Sciences, 112(41):12500-1555 2015.
Allen, F., Greiner, R., and Wishart, D. Competitive fragmen- tation modeling of csi-ms/ms spectra for putative metabo- lite identification. Metabolomics, 11:98-100 110, 2015.
Dührkop. K., Nothias, L.-F., Fleischauer, M., Reher, R., Ludwig. M., Hoffmann, M. A., Petras, D., Gerwick, W. H., Rousu, J., Dorrestein, P. C., and Böcker, Systematic classification of unknown metabolites us- ing high-resolution fragmentation mass spectra. Nature Biotechnology, 39(4))462 Apr 2021a. ISSN 1546- 1696. doi: 10. 10.1103//415877000000 01003////41188702-0000000
Austin, J., Johnson, D. D., Ho, J., Tarlow, D., and van den Berg, R. Structured denoising diffusion models in dis- crete state-spaces, 2023. htts::::: UtL.httss:/arxiiv.om /ttp///xxxvv/ro//////
abs/2107. 03006.
URL https:
Bittremieux, W., Wang, M., and Dorrestein, P. C. The critical role that spectral libraries play capturing the metabolomies community knowledge. Metabolomics, (12):94, 2022.
/ //ddi.org//11.
8.
Dührkop, K., Nothias, L.-F., Fleischauer, M., Reher, R., Lud- wig, M., Hoffmann, M. A., Petras, D., Gerwick, W. H., Rousu, J., Dorrestein, P. C., et al. Systematic classi- fication of unknown metabolites using high-resolution fragmentation mass spectra. Nature biotechnology, 39(4): 462 471, 2021b.
Böcker, and Dührkop, K. Fragmentation trees reloaded. Journal of cheminformatics, 8:1-26, 2016.
Bushuiev, R., Bushuiev, A., de Jonge, N. F., Young, A., Kretschmer, F., Samusevich, R., Heirmam, J., Wang, F., Zhang, I.., Dührkop, K., Ludwig, M., Haupt, A., Kalia, A., Brungs, C., Schmid, R., Greiner, R., Wang, B., Wishart, D. S., Liu, L.-P., Rousu, J., Bittremieux, W. Rost, H., Mak, T. D., Hassoun, S., Huber, F., van der Hooft, J. J. J., Stravs, M. A., Böcker, S., Sivic, J., and Pluskal, T. Massspecgym: A benchmark for the dis- covery and identification of molecules, 2024. URL https: /aarxiv// org/ abs//bb/////// /bss/2100 23326..
Dwivedi, V. and Bresson, X. former networks graphs. AAAI Workshop Deep Learning Graphs; Methods and Applications, 2021.
A generalization of trans-
Flam- Whem-Shepherd, D., Zhigalin, A., and Aspuru-Guzik, A. Scalable fragment-based 3d molecular design with rein- forcement learning. arXiv preprint urXiv:2202.00658 2022.
Gentry, E. C.,, Collins, S. L.,, Panitchpakdi, M., Belda- Ferre, P., Stewart, A. K., Carrillo Terrazas, M. Lu, H.- h., Zuffa, S., Yan, T., Avila-Pacheco, J., et al. Reverse metabolomics for the discovery chemical structures from humans. Natwre, 626(7998):419 426, 2024.
Butler, T., Frandsen, A., Lightheart, R., Bargh, B., Taylor, J., Bollerman, T., Kerby, T., West, K., Voronov, G., Moon, K., et al. Ms2mol: transformer model for illuminating dark chemical space from mass spectra. ChemRxiv, 2023.
10

---

DiMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
Goldman, S., Bradshaw, J., Xin, and Coley, C. Prefix- tree decoding for predicting mass spectra from molecules. Advances in Neural Information Processing Systems, 36: 48548-40 48572,, 2023a.
Li, X., Thickstun, J., Gulrajani, I., Liang, P. S., and Hashimoto, 'T B. Diffusion-lm improves controllable text generation. Advances in Neural Information Process- ing Systems, 35:4328 33:4328-4343, 2022.
Goldman, S., Wohlwend, J., Stražar, M., Haroush, G., Xavier, R. J., and Coley, C. W. Annotating metabo- lite mass spectra with domain-inspired chemical formula transformers. Nature Machine Intelligence, 5(9):965 2023b.
Li, Y., Vinyals, O., Dyer, C., Pascanu, R., and Battaglia, P. Learning deep generative models of graphs arXiv preprint AXiv:1803.03322. 2018.
Lindsay, R. K., Buchanan, B., Feigenbaum, E.,, and Leder- berg. J. Applications of artificial intelligence for organic chemistry: the DENDRAL project. McGraw-Hill Compa- nies, 1980.
Goldman, S., Xin, J., Provenzano, J., and Coley, C. W. Mist-cf: Chemical formula inference from tandem mass spectra, Journal of Chemical Information and Modeling, 64(7):2421-2431, 2023c.
Litsa, E. E., Chenthamarakshan, V., Das, P., and Kavraki, L. E. An end-to-end deep learning framework for translat- ing mass spectra to de-novo molecules. Communications Chemistry, 6(1): 132, 2023.
Goldman, S., Li, J., and Coley, C. W. Generating molecu- lar fragmentation graphs with autoregressive neural net- works. Analytical Chemistry, 9693)3341,,3428 2024.
Liu, L., Jiang, H., He, P., Chen, W., Liu, X., Gao, J., and Han, On the variance of the adaptive learning rate and beyond. Proceedings of the Eighth International Conference on Learning Representations (ICLR 2020). April 2020.
Gómez-Bombarelli, R., Wei, N., Duvenaud, D., Hernanezz-Lobtto, J. M., Sånchez-Lengelingg B., She- berla, D., qquilera--parraguirre J., Hirzel, T. D., Adams, R. P., and Auzir, A. Automatic chemical de- sign using data-driven continuous representation of molecules. ACS central science, 4(2):268-276, 2018.
Liu, M., Luo, Y., Uchino, K., Maruhashi, K., and Ji, Generating 3d molecules for target protein binding. In International Conference on Machine Learning, 2022.
Ho, J. and Salimans, Classifier-free diffusion guidance. arXiv preprint arXiv:2207.12553 2022.
Liu, Q., Allamanis, M., Brockschmidt, M., and Gaunt, Constrained graph variational autoencoders for molecule design. Advances in neural information processing sys- tems, 31, 2018.
Ho, J., Jain, A., and Abbeel, P. Denoising diffusion proba- bilistic models. In Proceedings of the 34th International Conference on Neural Information Processing Systems, NIPS 200 Red Hook, NY, USA, 2020. Curran Associates Inc. ISBN 9781713829546.
Loshehilov, and Hutter, F. Sgdr: Stochastic gradient descent with warm restarts, 2017.
Hu, M., Yang, L., Twarog, N., Ochoada, J., Li, Y., Vrettos, A. X., Martinez. J. B., Bhatia, J., Young, B. M., et al. Continuous collective analysis of chemical reactions. Nature, 636(8042):374-379 2024.
Loshchilov, I. and Hutter, F. Decoupled weight decay reg- ularization. In Proceedings of the Seventh International Conference Learning Representations (ICLR 2019), 2019. Lou, A., Meng. C., and Ermon, S. Discrete diffusion model- ing by estimating the ratios of the data distribution, 2024. URL https:
E. I.,
Karras, T., Aittala, M., Aila, T., and Laine, S. Elucidating the design space of diffusion-basse based generative models. Advances in neural information processing systems, 35: 26565-26577 2022.
wwwpxiioorrggooo. abs 22.1.3310.. 1383.. 16834.
Luo, S., Guan, J.. Ma, J., and Peng. J. A 3d generative model for structure- based drug design. Advances in Neural Information Processing Systems, (446229-6229, 2021.
Kretschmer, F,, Seipp. J., Ludwig M., Klau, G. W., and Bäcker, S. Small molecule machine learning: All models are wrong, some may not even be useful.
Luo, Y. and Ji, S. An autoregressive flow model for 3d molecular geometry generation from scratch. In Inter- national conference on learning representations (ICLR), 2022.
bioRxiv, 2023. doi: 10.1101/2023.0322.554111 URL hetpp::/www.biorree wwwp://wwwwwwooooo/eeeeeeeeeee/e Barly/2023/03/27/22222 211.
Le, T. Winter, R., Noć, F, and Clevert, D.-
Morgan, H. L. The generation of unique machine de- scription for chemical structures-a technique developed at chemical abstracts service. Journal of chemical docu- mentation, 1(2):107-113 1965.
A. Neuraldecipher--eeers--- enweese-enggineriig extended- connectivity fingerprints (ecfps) to their molecular struc- tures. Chemical science, 1 11388)10378810338 2020.

---

DiMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
Murphy, M., Jegelka, S., Fraenkel, E., Kind, T., Healey, D., and Butler, T. Efficiently predicting high resolution mass spectra with graph neural networks. In International Con- ference on Machine Learning, pp. 25549-25560 PMLR, 2023.
In Artificial Neural Networks and Machine Learning- ICANN 2018: 27th International Conference on Artificial Neural Networks, Rhodes, Greece, October 4-7, 2018, Proceedings, Part 1 27, pp. 412 Springer, 2018.
Sohl-Dickstein, J., Weiss, E., Maheswaranathan, N., and Ganguli, Deep unsupervised learning using nonequi- librium thermodynamics. In Bach, F. and Blei, D. (eds.), Proceedings of the 32nd International Conference chine Learning, volume 37 of Proceedings of Machine Learning Research, pp. 2256-2265, Lille, France, 07- 09 Jul 2015. PMLR. URL ht http:tttts/p/rcccediiiiee m r. wwwpppresss/333 w wiwhhhlddccccttteteceeee
Nichol, Q. and Dhariwal, P. Improved denoising diffu- sion probabilistic models. In International conference on machine learning, pp.
PMLR, 2021.
Ma-
NIST. NIST standard reference database. National Institute of Standards and Technology, 2023. URL https:// www. nist. gov/ srd.
html.
Nowatzky, Y., Russo, F., Lisec, J., Kister, A., Reinert, K., Muth, T., and Benner, P. Fiora: Local neighborhood- based prediction of compound mass spectra from single fragmentation events. bioRxiv, pp. 2024-04 2024.
Song, Y., Sohl-Dickstein, J.. Kingma, D. P., Kumar, A., Ermon, S., and Poole, B. Score-based generative mod- eling through stochastic differential equations. In In- lernational Conference on Learning Representations, 2021. URL https: / /ttp///ppeeeeee....e..// .ttpiieewwee/ooumn forum? i id=PXTIG12RRES.
Polykovskiy, D., Zhebrak, A., Sanchez-Lengeling, B., Golo- vanov, S., Tatanov, O., Belyaev, S., Kurbanov, R., Arta- monov, A., Aladinskiy, V., Veselov, M., Kadurin, A., Jo- hansson, S., Chen, H., Nikolenko, S., Aspuru-Guziii Guzik, A., and Zhavoronkov, A. Molecular sets (moses): A bench- marking platform for molecular generation models, 2020. BRLhttp:: /ttp/aaaivvvv..//..v//..e/a..av. htapgg/bbs//1// 1atp.////11.... 12823.
Sorokina, M., Merseburger, P., Rajan, K., Yirik, M. A., and
Steinbeck, C. Coconut online: Collection of open natural products database. Journal of Cheminformaties, 13(1), Jan 2021. doi: 10.1186/13321--0000000
Stravs, M. A., Dührkop, K., Böcker, S., and Zamboni, N. Msnovelist: de novo structure generation from mass spec- tra. Nature Methods, 19(7):865-88) 8700, 2022.
Quinn, R. A., Melnik, V., Vrbanac, A., Fu, T., Patras, K. A., Christy, M. P., Bodai, Z., Belda- P., Tripathi, A., Chung, L. K., et al. Global chemical effects of the microbiome include new bile-acid conjugations. Nature, 579(7797):123- 129, 2020.
Tian, Z., Zhao, H., Peter, K. T., Gonzalez, M., Wetzel, J., Wu, C., Hu, X., Prat, J., Mudrock, E., Hettinger, R., et al. A ubiquitous tire rubber-derived chemical induces acute mortality in coho salmon. Science, 371(6555):11851188 2021.
Roney, J. P., Maragakis, P., Skopp, P., and Shaw, D. E. Generating realistic 3d molecules with an equivariant conditional likelihood model. 2022.
Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L.,, Gomez, A. N., Kaiser, E.., and Polosukhin, Atten- tion is all you need. In Neural Info. Process. Systems, volume 30, 2017.
Saharia, C., Chan, W., Saxena, S., Li. L.. Whang, J., Denton, E. L., Ghasemipour, K., Gontijo Lopes, R., Karagol Ayan, B., Salimans, T., et al. Photorealistic text-to-image dif- fusion models with deep language understanding. Ad- vances in neural information processing systems, 35: 14479-36494, 2022.
Vignac, C., Krawezuk, I., Siraudin, A., Wang. B., Cevher, V., and Frossard, P. Digress: Discrete denoising diffusion for graph generation. In International Conference on Learning Representations (ICLR), 2023.
Segler, M. H. Kogej, T., Tyrchan, C., and Waller, M. P. Generating focused molecule libraries for drug discovery with recurrent neural networks. ACS central science, 4 (1):120-131, 2018.
Wang. Y., Chen, X., Liu, L., and Hassoun, S. MADGEN: Mass-spec attends to de novo molecular generation. In The Thirteenth International Conference on Learning Representations, 2025. URL httph:://///// httttttt///pprreeeee http:///eeereeee.ee/eee net/ worffoorudi---- 7ati:dddd7773t33 C3EiUNN.
Shrivastava, A. D., Swainston, N., Samanta, S., Roberts, I. Wright Muelas, M., and Kell, D. B. Massgenie: A transformer- based deep learning method for identifying small molecules from their mass spectra. Biomolecules, 11(12):1793, 2021.
Watson, J. L., Juergens, D., Bennett, N. R., Trippe, B. L., Yim, J., Eisenach, H. E., Ahern, W., Borst, A. J., Ragotte, R. J., Milles, L. F., Wicky, B. I. M., Hanikel, N., Pellock, S. J., Courbet, A., Sheffler, W., Wang, J., Venkatesh, P., Sappington, I., Torres, S. V.,
Simonovsky, M. and Komodakis, N. Graphvae: Towards generation of small graphs using variational autoencoders.
12

---

DiMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
Lauko, A., Bortoli, V. D., Mathieu, E., Ovchinnikov, S., Barzilay, R., Jaakkola, T., DiMaio, F., Baek, M., and Baker, D. De novo design of protein structure and function with rfdiffusion. Nature, 620:1089 1 1100, 2023. URL https: https://appp...aam... commanttcccccllll org/ http/orrpuII::22000 2711613322
Conference on Bioinformatics and Biomedicine (BIBM),
pp. 817-822, IEEE, December 2024.
Winter, R., Montanari, F., Noé, F., and Clevert, D.-
A. Learning continuous and data-driven molecular de- scriptors by translating equivalent chemical represen- tations. Chem. Sci., 10:1692-1701 2019. doi: 10.
1039/C85C04155L, URL htwp: //xp:////.///// doi org/10. 1039/C8SC0417501
Wishart, D. S., Guo, A., Oler, E., Wang, F., Anjum, A., Peters, H., Dizon, R., Sayeeda, Z., Tian, S., Lee, B., Berjanskii, M., Mah, R., Yamamoto, M., Jovel, J., Torres- Calzada, C., Hiebert- Gittb, M., Lui, V., Varshavi, D., Varshavi, D., Allen, D., Arndt, D., Khetarpal, N., Sivakumaran, A., Harford, K., Sanford, S., Yee, K., Cao, X., Budinski, Z., Liigand, J., Zhang, L., Zheng, J.. Mandal, R., Karu, N., Dambrova, M., Schiöth, H., Greiner, R., and Gautam, V. Hmdb 5.0: the human metabolome database for 2022. Nucleic Acids Research, 50(D1))D622-D631 11 2021. ISSN 0305-1048. doi: 10. 10.1099/nar/gkab1006. URL https::t//// /ww. org/10. 1093/nar/gkabl06.
Xing, S., Shen, S., Xu, B., Li, X., and Huan, T. BUDDY: molecular formula discovery via bottom-up MS/MS in- terrogation. Nat. Methods, 20(6):888188) 1890, June 2023.
Young, A., Röst, H., and Wang, B. Tandem mass spectrum prediction for small molecules using graph transformers. Nature Machine Intelligence, 6(4):404-416, 2024a.
Young, A., Wang, F. Wishart, D., Wang, B., Röst, H., and Greiner, R. Fragnnet: A deep probabilistic model for mass spectrum prediction. arXiv preprint arXiv:2404.02366. 2024b.
Zeni, C., Pinsler, R., Zügner, D., Fowler, A., Horton, M., Fu, X., Shysheya, S., Crabbé, J., Sun, L.., Smith, J., Nguyen, B., Schulz, H., Lewis, S., Huang, C.-W,, Lu, Z., Zhou, Y., Yang. H., Hao. H., Li, J., Tomioka, R., and Xie, T. Mattergen: a generative model for inorganic materials de- sign, 2024. URL https: arxiv. org/ abs/2312. 03687.
Zhang, X., Wang, L., Helwig. J., Luo, Y., Fu, C., Xie, Y., and Ji, S. Artificial intelligence for science in quan- tum, atomistic, and continuum systems. arXiv preprint arXiv:2307.0844 084400 2023.
Zhao, K., Liu, Y., Dian, L., Sun, S., and Cui, X. How to train your neural network for molecular structure gener- ation from mass spectra? In 2024 IEEE International
13

---

DiMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
Table Additional evaluation of molecule validity, and percentage above domain--xper--defined Tanimoto thresholds on NPL.B (Dührkop et al.. 2021b) and MassSpecGym (Bushuiev et al., 2024) de nove generation datasets. The best performing model for each metric bold and second best is underlined. Definitions of meaningful match (Tanimoto similarity 2 0.4) and close match (Tanimoto similarity 2 0.675) are taken from Butler et al. (2023).
OVERALL
TOP-1
ToP-10
MODEL
% VALID 7
% MEANINGFUL MATCH 1 % CLOSE MATCH
% MEANINGFUL MATCH
% CLOSE MATCH
NPLIB1
SPEC2MOL
66.5%
0.00%
0.00%
0.00%
0.00%
MIST NEURALDECIPHER
91.11%
29.30%
7.33%
41.39%
12.82%
MIST MSNOVELIST
98.60%
32.90% %
11.78%
44.79%
19.02%
DIFFMS
100.0% %
27.40%
12.83 %
46.45 %
22.04% %
MASSSPECGYM
SPEC2MOL
68.5%
0.0%
0.0%
0.0%
0.0%
MIST DEURALDECIPHER
81.78%
0.29%
0.01%
0.39%
0.09%
MIST MSNOVELIST
98.58%
0.66%
0.00%
1.92%
0.00%
DIFMMS
100.0%
12.41 %
3.78 %
32.47% %
6.73%
A. Experimental Details
For node features X, we use one-hot encoding of atom types, X E Raxd where d the number of different atom types in the dataset.
For pretraining the decoder, we use 2048-bit Morgan fingerprints with radius 2 for the structural conditioning E 2048 We use the same training objective as the end-to-end finetuning, i.e., minimizing the cross-entropy loss between the denoised adjacency matrix Å and the true adjacency matrix, A. We build a decoder pretraining datset consisting of 2.8M mingeelrint-molecule pairs sampled from DSSTox (CCTE, 2019), HMDB (Wishart al., 2021), COCONUT (Sorokina et al., 2021), and MOSES (Polykovskiy et al., 2020) datasets. We pretrain the decoder for 100 epochs using the AdamW optimizer (Loshchilov & Hutter, 2017) and cosine annealing learning rate scheduler (Loshchilov & Hutter, 2019).
We pretrain the encoder on the same dataset used for finetuning (i.e. NPLIB1, MassSpecGym), which are orders of magnitude smaller than the decoder pretraining dataset. For encoder pretraining, we use the multi-objective loss settings of Goldman al. (2023b). We pretrain the encoder for 100 epochs using the RAdam optimizer (Liu al., 2020).
We finetune the end-to-end model using cross-entropy loss and auxiliary training objectives, i.e. only the denoising diffusion objective. We use the AdamW optimizer with cosine annealing learning rate schedule for finetuning. We finetune DiffMS for 50 epochs on NPLIB1 and 15 epochs on MassSpecGyy.
DifIMS is relatively lightweight model, and all experiments were run on NVIDIA 2080ti GPUs with 12 GB of memory. On these GPUs, finetuning DifiMS takes 1.45 minutes per epoch on CANOPUS and 46 minutes per epoch on MassSpecGyym. takes minutes on average to generate 100 samples from DifIMS.
B. Additional Results
As an addendum to the evaluations in Table 1, we provide some additional metrics to further contextualize DiffMS performance. Firstly, we evaluate the percentage of model samples that correspond to valid molecules. Additionally, we adopt the domain-expert thresholds put forth by MS2Mol (Butler et al., 2023), where we evaluate whether candidate molecules were a "meaningful" match in structural similarity, having Tanimoto similarity of 0.4 or greater; or a "close match" in structural similarity, having a Tanimoto similarity of 0.675 or greater. We omit MADGEN and the baseline methods from Bushuiev et al. (2024) as they do not report these metries.
As shown in Table 100% of DiffMS samples valid molecules. This is directly enforced because of our graph-based representation. In contrast, SMILES strings generated by baseline methods may not correspond to valid structure. We find that DifIMS consistently achieves higher meaningful and close match rates than baseline methods. Impressively, DifIMS achieves over 32 times more meaningful matches in the top-10 predictions than the next best baseline on MassSpecGym. These results show that while generating exact matches continues to be a challenging task for de novo structural elucidation, DiffMS is able to generate meaningful structural matches at a high rate.
14

---

DIMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
0.5
0.175
0.4
Tanimoto Sim.
Apouracy
0.3
0.100
0.075
Pretraining Samples
0.2
Pretraining
Samples
0.050
2 AM
2M
0.025
BBM
0.9M
0.2M
0.000
10
Top-K
Top-K
Figure 6. Annotation accuracy (left) and Tanimoto similarity (right) on the NPLIB1 dataset for DiffMS pretrained on increasingly large pretraining datasets.
Table DifIMS performance NPLIBI for DifMMS pretrained increasingly large fingerprint-to-molecule datasets. The best performing model for each metric bold and second best is underlined.
ToP-1
TOP-10 10
# PRETRAINING STRUCTURES
ACCURACY f
MCES 4
TANIMOTO 1
ACCURACY t
MCES 4
TANIMOTO t
0
2.22%
15.37
0.22
4.86%
12.06
0.34
0.2M
3.61%
13.22
0.28
10.71%
9.85
0.41
0.8M
5.60%
13.02
0.30
12.70%
9.86
0.44
1.2M
7.22%
11.63
0.33
14.69%
9.23
0.43
2.8M
8.34%
11.95
0.35
15.44%
9.23
0.47
C. Ablations
C.1. Additional Pretraining Ablation Results
In this section, provide additional results for the ablation studies in Sec. 4.4. Table and Fig. 7 demonstrate DiffMS' performance scaling with respect to increasingly large decoder pretraining datasets, and Fig shows the impact of pretraining the spectra encoder.
C.2. Prior Distribution Ablations
In this section provide an additional ablation study justify the choice of the marginal prior distribution. Specifically, compare with two alternative prior distributions: the "empty" distribution, consisting of no bonds, and the "fully connected" distribution, consisting of all single bonds. As shown in Table 6, the marginal distribution performs best, though the empty distribution is not far behind. Intuitively, the empty distribution is close to the marginal distribution as molecular graphs are typically very sparse, These results support our intuitions that having a prior distribution that is closer to the data distribution results in better performance.
D. Formulae Annotation Study
In this section, we provide additional experiments using MIST-CF (Goldman et al., 2023b) and BUDDY (Xing et al., 2023) for formula annotation on the NPLIB I and MassSpecGym datasets. Specifically, we use BUDDY and MIST-CF to predict the 5 most likely formulae for each spectra in the test sets and measure the accuracy of these formula annotations.
As shown in Table MIST-CF and BUDDY both achieve good performance on NPLIB1, where MIST-CF achieves over
15

---

DIMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
0.150
0,4
0.125
Tanimoto Sim.
Accuracy
0.075
0.2
0.050
0.025
Pretrain Encoder
Pretrain Encoder
Yes
Yes
No
No
0.000
0.0
10
20
30
40
60
10
20
30
40
50
Top-K
Top-K
Figure Annotation accuracy (left) Tanimoto similarity (right) on the NPLIBI dataset
DIfIMS with and without encoder
pretraining.
Table DifMS performance on NPLIBI with different prior distributions. The best performing model for each metric is bold and second best is underlined.
TOP-1
TOP-10
PRIOR DISTRIBUTION
ACCURACY f
MCES 4
TANIMOTO 1
ACCURACY f
MCES 4
TANIMOTO f
FULLY CONNECTED
3.36%
12.67
0.28
7.60%
9.56
0.4
EMPTY
6.60%
11.55
0.34
14.94%
9.07
0.47
MARGINAL
8.34%
11.95
0.35
15.44%
9.23
0.47
90% top-5 accuracy. However, both methods struggle on MassSpecGymm, underscoring the difficulty of this dataset. It important to note that neither NPLIB1 nor MassSpecGym include MS1 data, such as precursor m/z, which can aid in deriving accurate formula annotations. As such, these formula annotation accuracies are likely lower than what could be achieved in end-to-end elucidation workflows.
Table Formula annotation accuracy for MIST-CF (Goldman al., 2023c) and BUDDY BUDDY(Xing al., 2023) the NPLIB1 (Böcker Dührkop, 2016) and MassSpecGym (Bushuiev et al., 2024) datasets. The best performing method for cach metric is bold.
NPLIB1
MASSSPECGYM
MODEL
TOP-1 Acc.
TOP-5 Acc.
TOP-1 Acc.
TOP-5 ACC.
BUDDY
78% 84 %
83%
59 %
71 %
MIST-CF
92 %
48%
69 %
16

---

DIMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
E. DifIMS Generated Molecules
E.I. NPLIBI Molecules
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3 3
Top-4
OH
NH
NH
NII
Ground Truth
Top-1
Top-2
Top-3
Top-4
Figure Negative (failure) test samples from NPLIB1 dataset (Dührkop et al., 2021b), Ground truth molecules (left column) and DifIMS predictions (right columns).
17

---

DIMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
Ground Truth
Top-1
Top-2
Top-3
Top-4
AN
OH Top-3
Ground Truth
Top-1
Top-2
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4 4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Figure Positive (correct) test samples from the NPLIBI dataset (Dührkop et al., 2021b). Ground molecules (left column) DiftMS predictions (right columns).
18

---

DIMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
E.2. MassSpeeGym Molecules
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Figure 10. Positive (correct) samples from the MassSpecGym dataset (Bushuiev al., 2024). Ground truth molecules (left column) and DifIMS predictions (right columns).
19

---

DIMMS: Diffusion Generation of Molecules Conditioned on Mass Spectra
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Ground Truth
Top-1
Top-2
Top-3
Top-4
Figure 11. Negative (failure) test samples from the MassSpecGym dataset (Bushuiev et al., 2024). Ground truth molecules (left column)
and DiffMS predictions (right columns).
20


Reviews:
[{"review_id": "ds5QFBgjDH", "reviewer": "Reviewer_udS8", "summary": "The paper introduces DiffMS, a diffusion-based model for generating molecular structures from mass spectra, addressing the \"inverse\" MS problem. It uses a pretraining-finetuning framework with large-scale fingerprint-structure datasets and achieves state-of-the-art performance on benchmarks like CANOPUS and MassSpecGym. The model incorporates chemical formula constraints and discrete graph diffusion, enabling accurate and diverse molecular generation.", "questions": "", "limitations": "", "rating": 3, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We appreciate the reviewer’s thoughtful feedback and for highlighting the novelty of our discrete diffusion method and pretraining strategies. Below, we have addressed the reviewer’s concerns about the applicability of DiffMS and shown DiffMS performs comparatively well without formula annotations:\n\n>DiffMS struggles with predicting molecules [with high accuracy]… this limits its applicability in real-world scenarios.\n\nThough exact matches prove to be a universally challenging task for *de novo* structural elucidation, the chemical similarity metrics including MCES and Tanimoto similarity indicate that the candidates DiffMS proposes are of strong structural value in the analytical chemistry pipeline. Table 3 in the Appendix demonstrates further similarity metrics that another elucidation method, MS2Mol [1], established. These “close match” and “meaningful match” metrics were derived from an empirical scoring study where chemists were asked to rate predicted and actual structures as one of these two labels, or not similar. These labels provide an understanding of what expert practitioners find to be structurally useful candidates, as they might take these structurally similar candidates and conduct further filtering or refinement steps using orthogonal information collected. Altogether, obtaining similar but not exact structural matches is still valuable to the elucidation pipeline, and DiffMS is able to generate molecules with high meaningful and close match percentages. Specifically, DiffMS is able to generate over 16x more meaningful matches on MassSpecGym compared to the best baseline model. \n\nAdditionally, we agree it is too early to claim that de novo generation is “solved”. We believe DiffMS proves a feasible technical pathway towards *de novo* generation, whereas other baselines are struggling with near-zero accuracies on the challenging MassSpecGym benchmark. We believe this paper, together with training and testing code to be released, will also attract more attention from the machine learning community on studying mass spectrometry, a growing field that has great potential for scientific impact.\n\n>The model relies on accurate chemical formula inference, which may fail in low-resolution spectra or complex mixtures.\n\nWe thank the reviewer for raising an important question about the difficulty of chemical formula inference. Firstly, we would like to point out that the top performing baseline models on CANOPUS, MIST + Neuraldecipher and MIST + MSNovelist, also require the chemical formula to be known. However, to show that this precondition is not restrictive, we provide a new experiment on the CANOPUS dataset which shows that DiffMS achieves state-of-the-art performance even without the ground truth formulae. Specifically, we use MIST-CF [2], a formula prediction tool, to label chemical formulae from spectra, where we find that it achieves 92% top-5 formula annotation accuracy on CANOPUS. To have a fair comparison, we still sample 100 molecules, but split across the top-5 candidate formulae. As before, we order the generated molecules by frequency to obtain the top-10 DiffMS predictions. Below are the results, where we find that DiffMS performance does not significantly deteriorate without access to ground truth formulae:\n\n| Model | ACC@1 | MCES@1 | Tanimoto@1| ACC@10 | MCES@10 | Tanimoto@10|\n|--|--|--|--|--|--|--|\n| DiffMS: Predicted Formulae | 7.03% | **11.81** | **0.36** | 14.98% | 9.39 | **0.48**|\n| DiffMS: True Formulae | **8.34%** | 11.95 | 0.35 | **15.44%** | **9.23** | 0.47 |\n\nAltogether, we demonstrate that DiffMS can recover true molecules using established formula inference tools; and, under parallel formula strategies, DiffMS can still yield molecules with high structural similarities even when the true formula is not highly ranked. We will include these new results in the revised manuscript.\n\n[1] MS2Mol: A transformer model for illuminating dark chemical space from mass spectra, Butler et al., https://chemrxiv.org/engage/chemrxiv/article-details/6492f28ea2c387fa9ab2a465\n\n[2] MIST-CF: Chemical Formula Inference from Tandem Mass Spectra, Goldman et al., https://pubs.acs.org/doi/10.1021/acs.jcim.3c01082", "claims_and_evidence": "Yes", "methods_and_evaluation_criteria": "Yes", "theoretical_claims": "None", "experimental_designs_or_analyses": "Yes, all", "relation_to_broader_scientific_literature": "The Discrete diffusion model is proposed by Digress (ICLR 23).", "essential_references_not_discussed": "None", "other_strengths_and_weaknesses": "Strengths:\n\n- DiffMS is the first to apply discrete diffusion for molecular generation from mass spectra, handling permutation invariance and formula constraints effectively. This approach generates chemically plausible molecules, even when spectra underspecify the exact structure.\n\n-  The model leverages large-scale fingerprint-structure datasets (2.8M pairs) for pretraining, improving performance with increased data. This scalable approach allows for future enhancements by expanding the pretraining dataset.\n\nWeaknesses:\n- DiffMS struggles with predicting high-accuracy molecules, as seen in its lower performance. This suggests the limited ability to use in real scenarios.\n\n\n- The model relies on accurate chemical formula inference, which may fail in low-resolution spectra or complex mixtures. This dependency could limit its applicability in real-world scenarios.", "other_comments_or_suggestions": "see above", "questions_for_authors": "None", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "DrvClbkWN9", "reviewer": "Reviewer_iMA4", "summary": "The paper introduces DiffMS, a novel diffusion-based generative model for de novo molecular structure prediction from mass spectra. This work addresses the inverse mass spectrometry (MS) problem, which involves reconstructing molecular structures based on experimental mass spectra data.", "questions": "", "limitations": "", "rating": 4, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We appreciate the reviewer’s thoughtful feedback and suggestions, and respond accordingly below: \n\n>While the DiffMS encoder leverages transformers for mass spectrum embeddings, no ablation is performed on the impact of different conditioning strategies. Does spectral conditioning significantly impact generation, or would a MLP-based conditioning method work just as well?\n\nRegarding the effectiveness of utilizing transformers to produce a spectral embedding, MIST [1] has been established as a powerful model for extracting structural information from mass spectra. Additionally, the MIST paper compares with an MLP model (denoted by FFN in their paper), where they observe that MLPs perform significantly worse than MIST across all metrics. In Section 4.4, we demonstrate that DiffMS benefits from a powerful pretrained encoder, thus given the findings in [1], simpler MLP-based spectra conditioning is not expected to perform well. \n\n>How's the performance of fingerprint prediction influence the final generation accuracy? The authors show the ablation study on different number of pre-train samples, but didn't report the performance of ms encoder, which may give some insights.\n\nAs stated above, MIST has shown to outperform simple MLP baselines on general, fingerprint-relevant tasks. In [1], the MIST encoder achieves state-of-the-art results on Tanimoto similarity, cosine similarity, and log likelihood for predicted fingerprints. We demonstrate in Section 4.4 that pretraining the encoder on spectra to fingerprint prediction improves the performance of the end-to-end finetuned DiffMS model. Ultimately, given the results shown by the MIST paper, and the empirical success of DiffMS leveraging MIST to help generate chemical matches, we think the MIST architecture is a well-suited choice of encoder for this task.  \n\n>However, it would be great to contain the NIST dataset but the current benchmark datasets is also making sense. \n\nWe plan not to prioritize training DiffMS on NIST at this time as NIST is not publicly available without purchase of a license. \n\n>I would suggest authors adding the experiments for different initialization of graph edges, how the performance will be influenced by empty graph, fully-connected graph.\n\nWe thank the reviewer for asking this important question. We provide some experiments below on the CANOPUS dataset with different graph initialization strategies:\n\n| Model | ACC@1 | MCES@1 | Tanimoto@1| ACC@10 | MCES@10 | Tanimoto@10|\n|--|--|--|--|--|--|--|\n| DiffMS: Fully Connected Initialization | 3.36% | 12.67 | 0.28 | 7.60% | 9.56 | 0.4 |\n| DiffMS: Empty Graph Initialization | 6.60% | **11.55** | 0.34 | 14.94% | **9.07** | **0.47** |\n| DiffMS | **8.34%** | 11.95 | **0.35** | **15.44%** | 9.23 | **0.47** |\n\nWe observe that fully-connected initialization performs poorly. Empty graph initialization performs similarly to random initialization using the marginal prior distribution on Tanimoto similarity and MCES–which aligns with the intuition that bond connectivity is inherently sparse and thus closer to an empty graph compared to a fully connected one–though the accuracies are worse, suggesting that the marginal prior distribution is still optimal. We will include these additional experiments in the revised manuscript.\n\n>The authors utilized MIST in the first stage to label the peaks' formula. How's the performance on that? Should it considered oracle function? Some reference or discussion would be great.\n\nMIST labels the peaks’ formulae using a combinatorial enumeration of possible substructures. It is reasonable to consider this as an oracle function given the formula of the full molecule, and as mentioned in our response to reviewer udS8, the overall molecular formulae can be annotated with over 90% accuracy. \n\n>  The authors stated \"We extract the final embedding corresponding to the precursor peak as the structural condition y for the diffusion decoder.\" It's not make sense if the diffusion is pre-trained with the 0/1 condition (fingerprint), but train with float value (final embedding).\n\nWe thank the reviewer for raising this point and will clarify this wording in the revised manuscript. When finetuning the end-to-end model, we initialize decoder input to be the predicted (binary) fingerprints from the encoder, however, we do not have any auxiliary losses to enforce that the encoder submodule continues to output 0/1 fingerprints; thus, the end-to-end model can ultimately learn different intermediate representations. \n\n[1] Annotating Metabolite Mass Spectra with Domain-Inspired Chemical Formula Transformers, Goldman et al, https://www.nature.com/articles/s42256-023-00708-3", "claims_and_evidence": "The authors did the claims well, however, there are some points may need stronger address:\n\n1. While the DiffMS encoder leverages transformers for mass spectrum embeddings, no ablation is performed on the impact of different conditioning strategies. Does spectral conditioning significantly impact generation, or would a MLP-based conditioning method work just as well? \n\n2. How's the performance of fingerprint prediction influence the final generation accuracy? The authors show the ablation study on different number of pre-train samples, but didn't report the performance of ms encoder, which may give some insights.", "methods_and_evaluation_criteria": "1. CANOPUS and MassSpecGym are widely used in mass spectrometry applications, making them reasonable choices. However, it would be great to contain the NIST dataset but the current benchmark datasets is also making sense.\n\n2. No ablation study on alternative conditioning strategies (e.g., how much the transformer-based spectrum encoder improves performance).\n\n3. How's the performance on different initialization of molecule graph.", "theoretical_claims": "I didn't see any issues.", "experimental_designs_or_analyses": "1. I would suggest authors adding the experiments for different initialization of graph edges, how the performance will influenced by empty graph, fully-connected graph.\n2. The authors utilized MIST in the first stage to label the peaks' formula. How's the performance on that? Should it considered oracle function? Some reference or discussion would be great.\n3. The graph decoder is pre-trained with the condition on fingerprints. So I assumed that in the end-to-end framework, the fingerprints prediction of the ms encoder (fingerprints) is feed as condition of decoder. But the authors stated \"We extract the final embedding corresponding to the precursor peak as the structural condition y for the diffusion decoder.\". It's not make sense if the diffusion is pre-trained with the 0/1 condition (fingerprint), but train with float value (final embedding).", "relation_to_broader_scientific_literature": "It is importance in the molecule de novo generation by the guidance of mass spectra.", "essential_references_not_discussed": "No", "other_strengths_and_weaknesses": "See above.", "other_comments_or_suggestions": "No.", "questions_for_authors": "No.", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "mOlmfOiXE5", "reviewer": "Reviewer_12q7", "summary": "The paper introduces DiffMS, a diffusion-based framework for generating molecular structures from mass spectra. DiffMS combines existing approaches in discrete graph diffusion (DiGress), with a pretraining framework in encoder-decoder transformer architecture. The authors conducted experiments and evaluations on two generation datasets, CANOPUS and MassSpecGym.", "questions": "", "limitations": "", "rating": 3, "confidence": null, "soundness": null, "presentation": null, "contribution": null, "strengths": "", "weaknesses": "", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We appreciate the reviewer’s thoughtful feedback and for highlighting the novelty of our discrete diffusion method and pretraining strategies. Below, we have addressed the concerns regarding exact accuracy of annotation:\n\n> Reliance on external tools for formula determination: The method relies on using external tools (e.g., SIRIUS) for formula determination, which could lead to some errors in the predicted formula. While the paper argues that chemical formulae can be determined with sufficient accuracy, it does not address the potential errors from these tools or where they might fail.\n\nWe thank the reviewer for raising an important question about the difficulty of chemical formula inference. Firstly, we would like to point out that the top performing baseline models on CANOPUS, MIST + Neuraldecipher and MIST + MSNovelist, also require the chemical formula to be known. However, to show that this precondition is not restrictive, we provide a new experiment on the CANOPUS dataset which shows that DiffMS achieves state-of-the-art performance even without the ground truth formulae. Specifically, we use MIST-CF [1], a formula prediction tool, to label chemical formulae from spectra, where we find that it achieves 92% top-5 formula annotation accuracy on CANOPUS. To have a fair comparison, we still sample 100 molecules, but split across the top-5 candidate formulae. As before, we order the generated molecules by frequency to obtain the top-10 DiffMS predictions. Below are the results, where we find that DiffMS performance does not significantly deteriorate without access to ground truth formulae:\n\n| Model | ACC@1 | MCES@1 | Tanimoto@1| ACC@10 | MCES@10 | Tanimoto@10|\n|--|--|--|--|--|--|--|\n| DiffMS: Predicted Formulae | 7.03% | **11.81** | **0.36** | 14.98% | 9.39 | **0.48**|\n| DiffMS: True Formulae | **8.34%** | 11.95 | 0.35 | **15.44%** | **9.23** | 0.47 |\n\nAltogether, we demonstrate that DiffMS can recover true molecules using established formula inference tools; and, under parallel formula strategies, DiffMS can still yield molecules with high structural similarities even when the true formula is not highly ranked. We will include these new results in the revised manuscript.\n\n>Lack of discussion on computational requirements; The paper lacks a discussion on the runtime or computational requirement of the proposed method. The paper did not mention the resource/ time requirements of the proposed method.\n\nWe thank the reviewer for asking this important question about the computational requirements. DiffMS is a relatively lightweight model. All DiffMS experiments were run on NVIDIA 2080ti GPUs which have 12GB of memory. On these GPUs, training DiffMS takes around 1.5 minutes per epoch on CANOPUS and 45 minutes per epoch on MassSpecGym. We train DiffMS for 50 epochs on CANOPUS and 15 epochs on MassSpecGym, for a total training time of 1.25 and 11.25 hours, respectively. Sampling from DiffMS takes around 4 minutes to sample all 100 molecules used to rank the top-10 predictions. We will include a table describing DiffMS computational requirements in the revised manuscript.\n\n>Can the chemical formula derived using tools like SIRIUS be ambiguous or incorrect (e.g., due to low-resolution spectra)? If so, are there mechanisms to mitigate or improve such inaccurate formulae?\n\nWe run a sample experiment which demonstrates the usage of MIST-CF [1], which achieves high formula accuracy and outperforms SIRIUS by a considerable margin. MIST-CF and other formula annotation tools are not perfect, and additional information from the MS1 data collection, such as isotope information and higher resolution of the precursor peak, can greatly further improve annotation. In cases where formula inference is not accurate, MIST’s subformula annotation module, even with incorrect formula, can still allow plausibly accurate subformula annotation for individual peaks; accordingly, we would expect the fingerprints output by MIST even under incorrectly provided subformula will still provide informative substructural knowledge. Indeed, this is reinforced by the performance on unrestricted formula DiffMS inference, where though exact match accuracies slightly worsen, structural similarities are still largely preserved. We hope to explore further mitigating strategies for formula misannotation in future iterations of the method. \n\n[1] MIST-CF: Chemical Formula Inference from Tandem Mass Spectra, Goldman et al, https://pubs.acs.org/doi/10.1021/acs.jcim.3c01082", "claims_and_evidence": "Yes.", "methods_and_evaluation_criteria": "Yes.", "theoretical_claims": "No.", "experimental_designs_or_analyses": "Yes.", "relation_to_broader_scientific_literature": "The method is built on discrete graph diffusion (DiGress) but integrates a pretraining strategy and molecular formula as additional constraint.", "essential_references_not_discussed": "No.", "other_strengths_and_weaknesses": "**Strengths**:\n\n- Strong performance: The authors show strong performance and outperform the previous approaches in the two benchmarks (CANOPUS and MassSpecGym). \n- Effectiveness of pretraining strategy: The paper includes ablation studies that demonstrate the effectiveness of the pretraining strategy on overall performance, indicating that pretraining on a large number of molecules is crucial for achieving high performance.\n\n**Weaknesses**:\n\nThe method still has some weaknesses. \n\n- Reliance on external tools for formula determination: The method relies on using external tools (e.g., SIRIUS) for formula determination, which could lead to some errors in the predicted formula. While the paper argues that chemical formulae can be determined with sufficient accuracy, it does not address the potential errors from these tools or where they might fail.\n- Lack of discussion on computational requirements; The paper lacks a discussion on the runtime or computational requirement of the proposed method. The paper did not mention the resource/ time requirements of the proposed method.", "other_comments_or_suggestions": "No.", "questions_for_authors": "Can the chemical formula derived using tools like SIRIUS be ambiguous or incorrect (e.g., due to low-resolution spectra)? If so, are there mechanisms to mitigate or improve such inaccurate formulae?", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}]

Author rebuttal:

Meta-review: This paper presents a diffusion model for generating molecular graphs conditioned on mass spectra. The authors proposed several architectural contributions to this problem to encode the domain knowledge in mass spectra, as well as using a discrete graph diffusion models. Results show that the proposed model outperforms previous approaches on de novo molecule generation.
Decision: Accept (poster)