MADGEN: Mass-Spec attends to De Novo Molecular generation
Authors: Yinkai Wang
Xiaohui Chen
Liping Liu
Soha Hassoun
Venue: ICLR 2025 Poster (2025)
Keywords: AI4Science
Biology Discovery
Metabolomics
MS/MS spectra
Primary area: applications to physical sciences (physics, chemistry, biology, etc.)
TL;DR: A novel framework for De Novo molecule generation with classifier-free guidance from mass spectra.

Abstract: The annotation (assigning structural chemical identities) of MS/MS spectra remains a significant challenge due to the enormous molecular diversity in biological samples and the limited scope of reference databases.  Currently, the vast majority of spectral measurements remain in the "dark chemical space" without structural annotations.  To improve annotation, we propose MADGEN (Mass-spec Attends to De Novo Molecular GENeration), a scaffold-based method for de novo molecular structure generation guided by mass spectrometry data. MADGEN operates in two stages: scaffold retrieval and spectra-conditioned molecular generation starting with the scaffold. In the first stage, given an MS/MS spectrum, we formulate scaffold retrieval as a ranking problem and employ contrastive learning to align mass spectra with candidate molecular scaffolds. In the second stage, starting from the retrieved scaffold, we employ the MS/MS spectrum to guide an attention-based generative model to generate the final molecule. Our approach constrains the molecular generation search space, reducing its complexity and improving generation accuracy. We evaluate MADGEN on three datasets (NIST23, CANOPUS, and MassSpecGym) and  evaluate MADGEN's performance with a predictive scaffold retriever and with an oracle retriever. We demonstrate the effectiveness of using  attention to integrate spectral information throughout the generation process to achieve strong results with the oracle retriever.

Published as a conference paper at ICLR 2025
MADGEN: MASS-SPEC ATTENDS TO DE Novo
MOLECULAR GENERATION
Yinkai Wang, Xiaohui Chen, Liping Liu, Soha Hassoun" Department of Computer Science Tufts University {yinkai. wwngg xiachui, chen, liping. liu, haw.hhassunn
ABSTRACT
The annotation (assigning structural chemical identities) of MS/MS spectra re- mains significant challenge due the enormous molecular diversity biolog- ical samples and the limited scope of reference databases. Currently, the vast majority of spectral measurements remain in the "dark chemical space" without structural annotations. To improve annotation, propose MADGEN (Mass-spec Attends to De Novo Molecular GENeration), a scaffold-based method for de novo molecular structure generation guided by mass spectrometry data. MADGEN op- erates in two stages: scaffold retrieval and spectra ppectra-conditione molecular gener- ation starting with the scaffold. In the first stage, given MS/MS spectrum, we formulate scaffold retrieval as a ranking problem and employ contrastive learn- ing to align mass spectra with candidate molecular scaffolds. In the second stage, starting from the retrieved scaffold, we employ the MS/MS spectrum to guide an attention- based generative model to generate the final molecule. Our approach constrains the molecular generation search space, reducing its complexity and im- proving generation accuracy. We evaluate MADGEN on three datasets (NIST23, CANOPUS, and MassSpecGym) and evaluate MADGEN's performance with a predictive scaffold retriever and with an oracle retriever. effectiveness of using attention to integrate spectral information throughout the generation process to achieve strong results with the oracle retriever. Our code is available httpss//ggthbbb.omm//aooollaaaad
demonstrate the
INTRODUCTION
Metabolomics, the measurement and identification of small molecules in biological samples, plays critical role in numerous fields, including drug discovery, biomarker discovery, and environmental science. By analyzing the molecular composition of complex biological samples, metabolomics pro- vides insights into cellular processes, metabolic pathways. and the effects of environmental changes on biological systems. Tandem mass spectrometry (MS/MS) has emerged as powerful, widely used analytical technique that can separate and fragment molecules within a biological sample, thus producing rich spectra that can be further analyzed to annotate the measurements within the sample Kind et al. 2018).
Despite the utility of metabolomics, assigning chemical structural identity to measured spec- trum remains significant challenge. Currently, most MS/MS spectra cannot linked known molecular structures due the vast chemical diversity in biological samples and the limited scope of reference databases. Spectral databases that catalogue molecules and their measured spectra, e.g. MoNA (Davis) and GNPS (Wang al. 2016), used for identifying close match to the measured spectra. However, such databases remain relatively small. Molecular databases such as PubChem (Kim et al. 2016) and KEGG (Kanehisa al.) (02I]) are often utilized provide can- didate molecular structures when using computational methods such as SIRIUS (Dührkop et al.) 2019), MLP GNN- approaches (Wei et al. 2019 Zhu al. 2020) to predict the molecular structure that most likely produced the measured spectrum. Despite the success of these tools and the increased size of such databases, the "dark chemical space" of unknown molecules remains large,
"corresponding author

---

Published as a conference paper at ICLR 2025
and hinders the interpretation of metabolomics data. De molecular structure generation from mass spectra is a promising approach to overcome the limitations of database catabuse-dependent methods. Further, de novo generation is crucial for discovering previously unknown molecules that play key roles in health, disease, and environmental processes.
Our insight in addressing this challenge herein is the of scaffolds to simplify the structure gener- ation process. scaffold, or core structure, is used widely in medicinal chemistry to represent core structures of bioactive compounds (Hu al. 2016). Such scaffolds can be modified with the addi- tion of functional groups to enhance medicinal properties. By focusing on scaffold-based molecular generation in the context of annotation, we can reduce the complexity of structure generation and constrain the search space, making it more manageable and improving accuracy. Once scaffold predicted for measured spectrum, it can guide the addition of structural elements (atoms and bonds) to the scaffold to generate the target molecule.
We propose scaffold-based approach to de novo molecular structure generation guided by mass spectrometry data, with focus on evaluating performance both when the scaffold is known and when it is predicted. Our contributions are as follows:
We introduce a two-stage framework that first predicts a scaffold from the MS/MS spec- trum, from which we then generate the target molecular structure. Given the challenges in accurately predicting the scaffold, we report performance under two settings: using the correct scaffold and using the predicted scaffold. This comparison highlights the potential and limitations scaffold prediction in de novo molecular generation.
Our method leverages fragmentation patterns in MS/MS spectra guide scaffold predic- tion. While scaffold prediction is not always accurate, integrating even partially correct scaffolds reduces the complexity of de novo generation and constraints the search space to more plausible molecular structures.
The scaffold-basee design also improves interpretability, as even predicted scaffolds serve structural anchors for understanding the generated molecules. This interpretability is crucial for analyzing potential biological functions and chemical properties in practical applications.
Our approach has broad applicability in metabolomics, drug discovery, and environmental analysis, where the discovery novel metabolites, bioactive molecules, and uncharacter- ized compounds is essential.
2 RELATED WORK
De novo structure generation guided by mass spectra. De novo molecular generation offers a promising alternative to database-dependent methods by directly (without the use of candidate molecules from databases) predicting or generating molecular structures from mass spectrometry data. MSNovelist (Stravs et al. 2022) relics on FinFeeg (Dührkop et al., 2015) to predict molecular fingerprints from the query mass spectrum, and then uses LSTM model to reconstruct molecules. Spec2Mol (Litsa et al. 2023) employs a convolutional neural network to map MS/MS spectra to latent space, generating molecular structures as SMILES strings. MassGenie (Shrivas- tava et al. 2021) uses a transformer-bassee model trained on real and synthetic spectra to generalize unseen compounds, leveraging transformers' strength in handling sequential data. MS2Mol (But- ler et al. 2023) extends these approaches with a transformer- based encoder-decoder. incorporating byte-pair encoding and precursor mass, to improve accuracy. There were no consistent datasets that were used to evaluate these models. For example, MSNovelist is evaluated on 3,863 MS/MS spectra from the GNPS library (Wang al. 2016), while Spec2Mol evaluated on the NIST2020 dataset. Further, not all these tools are available in the public domain. Recently, The MassSpecGGym dataset (Bushuiev et al., 2024) was developed as a benchmark dataset to standardize the evaluation on de novo generation, retrieval, and spectra simulation tasks. We utilize this dataset, and two others, to report the performance of MADGEN. We also compare our results with the best reported results so far the MassSpecGym dataset.
Generative frameworks for molecular generation. Generative models have become essential in molecular generation due to their ability to approximate complex distributions in the chemical space. These models, such as VAEs, GANs, and Diffusion models, treat molecules graphs, enabling
2

---

Published as a conference paper at ICLR 2025
them to capture the relational properties between atoms and bonds (Zhu et al. constrained molecular design is a key strategy in modifying an existing candidate structure with the goal of attaining improved molecular properties. A common approach is constraining molecular generation to contain a specific scaffold or a molecular fragment, e.g., |Podda et al. (2020), [i et al. (2019), Green al. (202T). These models often allow for arbitrary scaffold as initial structure that captures a desired property. Unlike these models, MADGEN employs Murcko scaffolds (Bemis) & Muuckoo 1996), a standard scaffold used across many chemical and biological studies due to its ability to represent the core backbone of molecules. As there are currently no methods to predict this scaffold for a query spectra, the first step of MADGEN predicts the scaffold from a list of candi- date molecules. Importantly, generative models have shown value in exploring the uncharacterized chemical spaces (Holdijk et al. 2022 Chen et al. 2023 Duan et al., 2024). For example, Retro- Bridge (Igashov et al. (023) models the dependencies between the spaces of substrate and product molecules in the context of chemical reactions as stochastic process between two distributions. RetorBridge uses Markov bridge process to approximate dependencies between these intractable distributions. RetroBridge is adapted for MADGEN's 's second step, where we aim to model the joint distribution of scaffolds and target molecules, and starting with the Murcko scaffold, utilize the mass spectrum to guide the generation process towards the target molecule.
2022 Structure-
METHODS
Direct generation of molecules from mass spectra is hard problem. In this work, we propose to divide the problem into two simpler sub-problems (see Figure I: we first retrieve the molecular scaffold from the mass spectrum and then generate the target molecule conditioned on both the mass spectrum and the scaffold. We conjecture that the scaffold prediction problem is casier than predicting the target molecule because the scaffold usually has simpler structure than the target molecule. Consequently, the molecule generation task becomes easier when the scaffold is known.
3.1 SCAFFOLD RETRIEVAL
The goal of scaffold retrieval is to identify the scaffold of the target molecule. Denote an MS/MS spectrum and its chemical formulate as X (Xm"s, .x Scaffold retrieval takes X as input and retrieves the core scaffold that represents the fundamental backbone the molecule, including its ring systems and central framework. With correct scaffold served as the starting point for further molecular generative process, the complexity of the search space is significantly reduced.
However, predicting the scaffold from spectral data is challenging problem due to the non-linear relationship between fragmentation patterns and the scaffold substructures. In this work, we explore two scaffold retrieval strategies pprdictivee retrieval and oracle retrieval.
Predictive retrieval. We formulate the scaffold retrieval as a ranking problem. Given set of scaffold candidates S, the goal is to use a neural network to score each candidate S E given X such that scaffold with highest score S maximally resembles the correct scaffold 5 We rank on a candidate set from which the target molecules have been removed, introducing the possibility that the true scaffold may not be present in the set.
A straightforward approach is to directly train a binary classifier that tells whether the given pair (X matched or not. However, to fully leverage the relationship between the spectrum and scaffold modalities, we adopt contrastive learning framework similar to CLIP (Radford et al., 202T). In this framework, the spectrum X is treated as one modality, while the scaffold S treated as the other. Contrastive learning aligns the embeddings of these two modalities in a shared latent space, enabling the model to learn a meaningful representation of their relationships.
This paradigm has been widely employed in multimodal information retrieval frameworks (Luo) et al. 2021 Bain et al. 2022 Lei et al., 2021; Fang et al., 2021 Ma et al.] 2022 Hendriksen et al. 2022 where embedding similarity is used to determine the most likely paired item based on a query. Similarly, in our framework, we align the embeddings of mass spectra and scaffolds to facilitate scaffold retrieval. Specifically, we employ contrastive learning techniques inspired by JESTR (Kalia et al, 2004)) which was designed to align the embeddings mass spectra with their corresponding molecules.
3

---

Published as a conference paper at ICLR 2025
MADGEN
Candicates
Panking
2000
Enjeddy
00000
OI0G@
Soom
0
100
000
Stage 1: Scaffold retrieval
Stage generation
(a)
ON
Step O
Step 10
Step 20
Step 30
Step 40
MD
MP
1,0
HP
Step 0
Step 10
Step 20 (b)
Step 30
Step 40
Figure 1: MADGEN overview and example. (a) The overview MADGEN. The mass spectra are used to rank scaffold candidates through contrastive learning. The top-ranked scaffold, with blue edges fixed, serves as a foundation for de novo molecule generation, guided by the spectra at each generation step. (b) Examples of molecular generation process
time steps for Kenalog from from NIST23 dataset (lower). The scaffolds remain fixed, while additional edges are introduced in each step connect free atoms to scaffolds. The complete molecules are shown in step 40.
CANOPUS dataset (upper) and (4
To achieve this alignment, we introduce two separate encoders to project the mass spectra and scaf- fold graphs into shared latent space. Specifically, the mass spectra X projected using multi- layer perceptron (MLP) encoder fx, which maps the spectral data into a d-dimensional latent space. We employ a graph neural network (GNN) fs encode the global representation of the scaffold graph S, also into a d-dimensional space.
The key insight of this approach fold are close to each other in the latent space. Both encoders, fx and fs. are jointly trained using contrastive learning objective. This objective ensures that the embeddings matched spectrum- scaffold pairs are close in the joint embedding space, while mismatched pairs are pushed apart. Specifically, for each spectrum X and scaffold S, we compute similarity score, h h/2g0o = defined as:
ensure that the embeddings of the matched spectrum and scaf-
h( h(2
spect = = exp
211 "spec"
"mol
(1)
2
1 ||
where 2 and zm are the embeddings of the spectrum and molecular scaffold, respectively, and temperature hyperparameter that controls the importance of non-matching pairs.
4

---

Published as a conference paper at ICLR 2025
The contrastive loss contrastive is computed over batch of size & as:
k log
h Appeee mmol
conntrsttvve
(2)
1:
m==1 h( Sppee
2 mot
Here the two embeddings in the numerator are from the same molecule n while the two in the denominator are from two different molecules. This loss encourages the model to assign high values
to matching ppectrum-scaffoll pairs and lower values to non- non-matching pairs, effectively aligning the embeddings in the latent space.
After training, we access the score of each scaffold candidate via cosine similarity between the mass spectra embedding fx (X) and the scaffold embedding (S)) To improve scaffold ranking accu- racy, we introduce frequency-based aggregation approach. For each data point, we first retrieve the top-k ranked candidate scaffolds. The frequency each scaffold appearing in these top candidates then computed, and the most frequently occurring scaffold for each formula is selected the pre- dicted scaffold. This method refines scaffold selection by leveraging consensus among top-ranked candidates, leading to improved scaffold prediction accuracy (SPA).
Oracle retrieval. We maintain a lookup table as an oracle which always yields the correct scaffold given the MS/MS spectrum and the chemical formula. We construct the lookup table by extracting the scaffold from the molecular graph representation using RDKit, This lookup table serves as an idealized oracle, simulating perfect scaffold retrieval. It allows
focus assessing the second stage of molecular generation: the task of adding side chains and functional groups to the scaffold- independently from any potential errors that could occur in scaffold retrieval.
3.2
SCAFFOLD-CONDITIONEN DE Novo MOLECULE GENERATION WITH SPECTRA GUIDANCE
3.2.
NOTATIONS AND PROBLEM FORMULATION
We represent a molecule G as a graph G = (V. Its scaffold S = JyS,E$) is a subgraph of G. Since the atom set V be directly inferred from the chemical formula, the task of molecular generation involves determining the appropriate edge set & \ e that connects the scaffold to the remaining isolated atoms V V While there are combinatorially many valid edge sets that could complete the molecule from the scaffold, we utilize spectral data X to guide the edge generation process and ensure the structure aligns with the observed spectra.
3.2.2
GENERATION VIA MARKOV BRIDGE
We frame the molecule prediction task as generating graphs given scaffold. Specifically, starting from a scaffold S, we are interested modeling the distribution p(G]S) = p(E)E$, vcj with the following Markov decomposition:
T-1 E Eo:Er
(E)ES,19)=
P( (V)) 1=
(3)
where E, = 0 can be considered the case where no bonds are formed from isolated atoms to others, and er E. The sequence of random variables Eo.T can be viewed progressively connecting atoms to form the final molecules.
Let e, be an arbitrary edge entry in E,, e₁ can be represented as D D-dimensional one-hot vector, with 0 class being non-edge and to D-1 classes being the bond types. Following Austin et al. (2021). we formulate the transition probabilities p(et-ile; er) conditioned on the endpoint ey:
p(ect1les, (itelle,,e)) eT) = Categorical Qe(er)es),
(4)
where (er) E DxD is an absorbing transition matrix conditioned on the endpoint data er (lgashov et al. 2023).
With the defined model, we now approximate it with a parameterized distribution:
Pa (Ce+1 lec, Es, e v, Categorical Q.(r)eer) where éT EE,, DG)
(5)
5

---

Published as a conference paper at ICLR 2025
m/z
Gm Ip
0mg
(mg.dg)
Embedking layer
G
Self-Attantion
Sample
Hy
Logit layer
H
Hy
H
Edge- oware MPNN layar
Cross- Atention
Skip connectoon
FC-GNN Layer
Figure 2: Overview of the MADGEN model framework. The input consists m/z peaks and intensities (m, 1), which are passed through an MLP for embedding. These embeddings are pro- cessed through self-attention and combined with the molecular graph's node and edge embeddings via cross mooss-attention. The node and edge embeddings message-passinng neural nePWN))(MPNN) and fully-connected graph neural network (FC-GNN) lay- The final molecular structure is sampled after the last time step via logit layer, aligning with the mass spectral data.
updated iteratively using edge-aware
is the endpoint prediction via a neural network n.o(.). Given pair (S, G)) from the dataset, we train (.) by optimizing the evidence lower bound (ELBO)
KL (p(ectiled er lp) (etta/es, ES vo)]]
(6) Here, plerleo @T) represents the probability of transitioning to arbitrary timestep from T, which can be expressed in a closed form. The detailed derivation of the ELBO and the transition distribu- tions provided in Appendix A.3
Lo(s, G) = -T. Bpte (T)
To obtain pairs (S, G) for training, we first randomly sample a graph G from the data distribution P(G). The scaffold of G is computed using RDKit. This results the joint data distribution P(S,G) = p(G))((S))) where p(S G) is a Dirac delta distribution that assigns all its probability mass to the scaffold S derived from G.
3.2.3 CLASSIFIER GUIDANCE FROM MASS SPECTRUM
We introduce the spectrum m additional conditioning term to refine the search space during the generation of G from S. The neural network nn (.) is designed to condition on X when computing the logits.
To integrate spectrum information throughout the generation process, we utilize classifier-free guid- ance (CFG) (Ho & Salimans 2022). At each inference step, for each edge entry, compute the logit f, conditioned on the spectrum X, and the logit f, without conditioning. The final logit f is then obtained by combining the two using a guidance scale Aς:
ly (1 A.) Xrey.
During training, we randomly remove the spectrum condition with probability of 0.1 to enable CFG. Since CFG tends prioritize generation quality diversity, increasing X, helps reduce the search space and improves the success rate generating target molecules based on the given spectrum.
We provide further details on how the CFG techniques are integrated into our framework (see Fig- ure 2. particularly within the network architecture nno(.). We treat the graph as fully connected,

---

Published as a conference paper at ICLR 2025
per Mol.
per Seaf.
Dataset
#Spec.
#Mol.
#Scaf.
#Free atoms
#Node
#Edge
#Spec.
#Nodc
#Mol.
NIST23
689,358
40,934
13,560
6.6
21.0
22.4
16.84
14.4
3.02
CANOPUS
6,618
6,618
3,137
8.5
28.6
31.0
1.00
20.1
2.11
MassSpecGym 231,104
31,602
15,649
10.9
25.8
27.4
6.60
22.1
2.02
Table I: Statistics on the three datasets, including the number of molecules (Mol.), spectra (Spec.), scaffolds (Scaf.), average number of free atoms, and average statistics per molecule and per scaffold.
where non-edges are considered a specific type edge, and apply a fully connected graph neural network (FC-GNN) to compute this structure. The detailed design of the FC-GNN is provided in the Appendix A.I Two key components to highlight are the encoding of the mass spectrum and the conditioning mechanism.
Mass spectrum encoding as tokenization. We represent the X as set of peaks {P1, .Pi....,PPy where Ps = (Mg, Ix) is the m/z and intensity values. We encode each peak into a embedding vector via an MIP. We then use self-attention module to boost the information flow among the peak representations. The full computation as follow:
H Self- Solf-Attentionnhy... b'),, hyg- concat MLP((+)).
(8)
This approach results in variable-length representation of the mass spectrum, Hx, where each peak representation h2 aligns with potential substructures in the molecule. By retaining these individual peak representations, the model is better able to guide the generation of subgraphs that correspond to molecular fragments consistent with the observed spectral data.
Spectrum conditioning via cross-attention. We map Hx to each message passing layer of FC- GNN via cross-attention. Since there are intermediate representations for both nodes and edges, we explore three cross-attention paradigms: node-only attention, edge-only attention and both. We replace the Hx with learnable embedding when the spectrum data are removed.
4 EXPERIMENTS
4.1 DATASETS
We evaluate the performance of MADGEN on three datasets (Table I. The NIST23 dataset (Na- tional Institute Standards and Technology (NIST) 2023) is curated by the National Institute of Standards and Technology to provide reference spectral data for a wide range of chemical molec- ular standards to support research and development. It is available for purchase. Each molecule is measured using various mass spectrometry instruments, and under various instrument settings, thus contributing to the high number of spectra/molecule. The CANOPUS dataset is the small- dataset, and was designed which predicts compound classes, e.g., alcohols, phenol ethers, and others, from spectra. It has 1:1 spectra molecule ratio. It was used recently benchmark other metabolomics tools such as MIST(Goldman et al.) 2023) and ESP(Li et al., 2024). The newly developed MassSpecGyym bench- mark dataset (Bushuiev al. 2024) is collected from many public reference spectral databases and curated uniformly. The MassSpecCyye is the largest publicly available labeled mass spectra dataset. For all three datasets, few molecules shared the same scaffold.
train and evaluate the CANOPUS tool (Dührkop et al. [202I).
All datasets were preprocessed by normalizing the intensities of the MS/MS spectra and removing low-intensity peaks below a predefined threshold to reduce noise. The NIST23 and CANOPUS datasets were split into training, validation, and test sets based on the scaffold, ensuring that scaffolds are unique to each split. This split prevents data leakage and ensures robust evaluation of model performance. For MassSpecGymm, 2024). which is based on the Maximum Common Edge Substructure (MCES). This split allows assessing the model generalization novel molecules.
utilized the split suggested by the benchmark (Bushuiev al.

---

Published as a conference paper at ICLR 2025
4.2 EXPERIMENTAL SETUP AND EVALUATION METRICS
The model was trained using graph transformer with 5 layers and 50 diffusion steps. We employed the AdamW optimizer with learning rate of x x1055, Full training details and hyperparameters can be found in Appendix A.2 For candidate pool selection, the following approaches were employed:
NIST23 and CANOPUS: all candidate molecules were retrieved from PubChem using the chemical formula as a query, ensuring comprehensive coverage of possible structures.
MassSpeeGym: the candidate pool consists of 256 molecules for each test molecule. These candidates are selected based on the molecular formula provided by the MassSpec- Gym dataset. The target molecule is removed from the candidate pool.
The performance of the model is evaluated using the following metrics endorsed for model evalua- tion for the MassSpecGym benchmark:
Top-k accuracy: Measures the likelihood of the generating the true target structure among the top-k generated molecules. We report the results for k=1,10. The generated molecules are ranked by the probabilistic nature of the model.
Tanimoto Similarity: This metric evaluates the similarity between the generated structures and the ground truth molecules using molecular fingerprints. Higher Tanimoto similarity indicates that the predicted structure closely resembles the correct structure. We extracted fingerprint representations based on the Morgan algorithm (Morgan 1965) using the RDKit toolkit (RDKit, online). The Morgan fingerprints are computed for radius 2 and 2048 bits.
Maximum Common Edge Substructure (MCES): This metric is the edit distance be- tween two molecules, and reflects the similarity of the largest common substructure be- tween generated and ground truth molecules Kreesschee et al.] (023).
Scaffold Prediction Accuracy (SPA): In the scaffold prediction task, we assess how well the model predicts the core scaffold of the molecule compared to the ground truth scaffold.
4.3 RESULTS
Our experiments, summarized in T. evaluate model performance on three datasets: NIST23, CANOPUS, and MassSpecGym, using both predictive and oracle retrievers. For the scaffold pre- diction task, we report Scaffold Prediction Accuracy (SPA) for the predictive retriever ranging from 13.2% to 40.3%. Notably, the NIST23 dataset achieves the highest SPA of 40.3%, reflecting its lower scaffold diversity compared to CANOPUS and MassSpecGym, which have more complex scaffolds.
The metrics for the scaffold-based generation task reveal that the low scaffold prediction accu- racy of the predictive retriever constrains molecular generation performance. For instance, on the NIST23 dataset, the predictive retriever yields top-1 accuracy of 4.6%, while for CANOPUS and MassSpecGym, the top-1 accuracies is 2.10 % and 1.31%. Despite these challenges, the predic- tive retriever demonstrates moderate performance improvements compared to baseline methods like Spec2Mol and random generation.
In contrast, the oracle retriever, which has access the correct scaffold, dramatically boosts per- formance. On NIST23, MADGEN achieves a top-1 accuracy of 49.0% and a top-10 accuracy of 65.5%, demonstrating the model's 's capacity to generate accurate molecular structures if the scaffold is known. Similarly, when using the oracle retriever, the performance on CANOPUS and MassSpec- Gym is significantly higher than the predictive retriever, with top-1 accuracies of 18.7% and 10.5%, respectively, showing the clear advantage of having access to correct scaffold information. Impor- tantly, MADGEN outperforms the best published sfate-of-the-ae performance (last row Table P reported for the MassSpecGym dataset (Bushuiev et al. (024) when using random chemical gen- cration. The high top-1 and Top10 accuracy for the NIST23 dataset can be attributed to its smaller number of free atoms. MADGEN's task of completing the target molecule by adding edges to these free atoms is easier with a smaller number of free atoms. CANOPUS has the highest number of average free atoms, and the lowest t and top- accuracies.
Baseline methods like Spec2Mol and MSNovelist are also included in the comparison. As shown in T MSNovelist results limited to accuracy metrics, other measures not available. The
8

---

Published as a conference paper at ICLR 2025
"." in the table denotes this lack of data, while underlined values highlight the best results achieved by predictive retrievers, serving as a benchmark against the oracle retriever.
Top1
Toplo
Retriever
SPAt
Accuracyt
Similarityt
MCES}
Accuracyt
Similarity
MCES,
NIST
Spec2Mol
0.0%
0.10
20.88
0.0%
0.12
13.66
MSNovelist
0.0%
0.0%
MADGENPar
40.3%
4.6%
0.11
72.38
7.3%
0.18
69.34
MADGEN Onacle
100%
49.0% %
0.63
18.48
65.5%
0.80
3.88
CANOPUS
Spec2Mol
0.0%
0.09
38.97
0.0%
0.14
23.97
MSNovelist
0.0%
0.0%
MADGENPed
17.7%
2.10%
0.22
20.56
2.39%
0.27
12.69
MADGENNoss
100%
18.7%
0.51
9.72
22.2%
0.59
4.44
MassSpe
Rand. Gen.
0.0%
0.08
21.11
0.0%
0.11
18,25
SMILES Transformer
0.0%
0.03
79.39
0.0%
0.10
$2.13
SELFIES Transformer
0.0%
0.08
38.88
0.0%
0.13
26.87
Spec2Mol
0.0%
0.09
45.89
0.0%
0.13
32.60
MSNovellist
0.0%
0.0%
MADGEN
13.2%
1.31%
0.20
27.47
1.54%
0.26
16.84
MADGENomes
100%
10.5%
0.43
16.27
12.4%
0.53
7.08
Table 2: Performance metrics for various datasets using both predictive and oracle retrievers. The table presents top-1 and top-10 10 accuracy, Tanimoto similarity, and Maximum Common Edge Sub- structure (MCES) scores. Best performance for each dataset is bold. The second-best performance for each dataset underlined
4.4 ABLATION STUDY ON CONDITIONING MECHANISM
We conducted an ablation study to assess the impact of different encoding strategies, condition- ing methods, and the use of CFG (Table on the performance of MADGEN. Conditioning using the tokenization + cross-attention mechamism significantly improves the model performance. We believe this is because such mass spectra encoding is more efficient in encoding peak information without further compression. Further, through cross-attention, nodes and edges are able to query peaks of relevant importance. Importantly, upon introducing the self-attention into the mass spec- trum encoder, a dramatic performance gain is observed. The self-attention significantly enhances mass spectra representations. We observed further performance gains using CFG on node or node and edge (both). Node-only CFG yields the best performance among all settings.
Encoding strategy
Conditioning strategy
Accuracy
Similarity
MCES
Binning + MLP Tokenization
Concatenation
4.30%
0.068
87.89
Cross-Attn
13.0%
0.304
55.25
Tokenization Self-Attn
Cross-Attn
42.5%
0.642
23.90
Tokenization Self-Attn
Cross-Attn + CFG (edge)
42.0%
0.632
25.01
Tokenization Self-Attn
Cross-Attn CFG (node)
49.0%
0.694
18.48
Tokenization Self-Attn
Cross-Attn + CFG (both)
45.9%
0.667
21.89
Table Ablation study results comparing different encoding strategies (Binning + MLP, Tokeniza- tion, Tokenization + Self- Self-Attention) and conditioning strategies (Concatenation, Cross-Attention Cross-Attention + CFG). The metrics evaluated are Accuracy (%), Tanimoto Similarity, and Max- imum Common Edge Substructure (MCES). The best results were obtained using Tokenization Self-Attention with Cross-Aticntion CFG (node).

---

Published as a conference paper at ICLR 2025
4.5 SENSITIVITY ANALYSIS OF FREE ATOM NUMBERS ON ACCURACY
We analyze how the number of free atoms will affects the generation accuracy of MADGEN. Fig- ure 3 shows MADGEN's accuracy @ and accuracy @ 10 on different number of free atoms across three datasets. We can observe that having more free atoms yields worse predictive accuracy, which as expected as the learning complexity increases.
100
NIST23 CANOPUS
Accuracy@1 (9%
80
Accuracy@11 (%)
80-
M5Gym
60-
40
40-
20
20-
15
20
5
10
15
20
Number of Free Atoms
Number of Free Atoms
(a) Accuracy @ vs Number of Free Atoms
(b) Accuracy @ 10 vs Number Free Atoms
With more free atoms for MADGEN to connect to the scaffold, the complexity of the generative trajectory increases, leading to a worse predictive accuracy.
Figure 3: Accuracy vs Number of Free Atoms:
CONCLUSION & FUTURE WORK
De novo annotation of mass spectrometry data is notoriously difficult, with current best accuracy of 0% on the MassSpecGym dataset. MADGEN offers a novel two-stage framework for spectra-guided de novo annotation. The first stage, scaffold retrieval, is new problem formulation whose solution can provide partial insight in regard to the molecular backbone of the measured spectra. Such insights may shed light on the molecule's class properties. Our results show that this problem is challenging, achieving a scaffold prediction accuracy of 13.2%%-40.3% for the three datasets. The second stage, de novo generation from existing scaffold showed excellent results when using an oracle scaffold predictor, achieving an accuracy of 10.5%-99% across the three dataset. For the MassSpeeGyy benchmark, we achieved an accuracy of 2. 2.10% and 1.31%. As with other tools, e.g., (Goldman et al.) 2023), we conjecture that performance of MADGEN can be increased by incorporating additional data the form of peak chemical formulae or molecular properties that correlate with fragmentation patterns. Potentially, the scaffold problem can be made easier if larger more distinct scaffold structures were utilized instead the Murcko scaffold used herein. A bigger scaffold can in turn facilitate the de novo generation task. Further, end-to-end MADGEN may reduce the compounding of errors across the two stages.
ACKNOWLEDGMENTS
Research reported in this publication was supported by the National Institute of General Medical Sciences of the National Institutes of Health under award number R35GM148219, The content is solely the responsibility of the authors and does not necessarily represent the official views of the NIH. Chen and Liu are supported by the NSF CAREER Award 2239869.
10

---

Published as a conference paper at ICLR 2025
REFERENCES
Jacob Austin, Daniel D Johnson, Jonathan Ho, Daniel Tarlow, and Rianne Van Den Berg. Structured denoising diffusion models in discrete state-spaces. Advances in Neural Information Processing Systems, 14:17981-17999 2021.
Max Bain, Arsha Nagrani, Gül Varol, and Andrew Zisserman. A clip-hitchhiker's guide to long video retrieval. arXiv preprint (.XXix:205.085000 2022.
Guy W Bemis and Mark A Mureko. The properties of known drugs. 1. molecular frameworks. Journal of medicinal chemistry, 39(15):288722893, 1996.
Roman Bushuiev, Anton Bushuiev, Niek de Jonge, Adamo Young, Fleming Kretschmer, Raman Samusevich, Janne Heirman, Fei Wang, Luke Zhang, Kai Dührkop, Marcus Ludwig, Nils Haupt, Apurva Kalia, Corinna Brungs, Robin Schmid, Russell Greiner, Bo Wang, David Wishart, Liping Liu, Juho Rousu, Wout Bittremieux, Hannes Rost, Tytus Mak, Soha Hassoun, Florian Huber, Justin J.J. van der Hooft, Michael Stravs, Sebastian Böcker, Josef Sivic, and Tomáš Pluskal. Massspecgym: A benchmark for the discovery and identification of molecules. Advances in Neural Information Processing Systems, 2024.
Thomas Butler, Abraham Frandsen, Rose Lightheart, Brian Bargh, James Taylor, TJ Boller- man, Thomas Kerby, Kiana West, Gennady Voronov, Kevin Moon, et al. Ms2mol: A trans- former model for illuminating dark chemical space from mass spectra. ChemRxiv. 2023; 2023.
doi: 1o.224444444chhee 206664//chemmrii-2233ssssm--.-m
Xiaohui Chen, Jiaxing He, Xu Han, and Li-Ping Liu. Efficient and degree-guided graph generation via discrete diffusion modeling, arXiv preprint arX1v:2305.04111, 2023.
UC Davis. MassBank of North America. httts::/nooa. www.ilaa.budvvii...ommmmm wwdavis. edu/ hittps://mona. fiehnlash www.wis..daiicocoooo.........
URL
Chenru Duan, Guan- Moan--Hongg Liu, Yuanqi Du, Tianrong Chen, Qiyuan Zhao, Haojun Jia, Carla Gomes, Evangelos A Theodorou, and Heather J Kulik. React-ot: Optimal transport for generating transition state chemical reactions. arXiv preprint SXXv:24404114533 2024.
Kai Dührkop, Huibin Shen, Marvin Meusel, Juho Rousu, and Sebastian Böcker. Searching molecu- lar structure databases with tandem mass spectra using esi: Fingerid, Proceedings of the National 2015.
Academy of Sciences, (12(41):22500-11
Kai Dührkop, Markus Fleischauer, Mareus Ludwig, Alexander Aksenov, Alexey V Melnik, Mar- vin Meusel, Pieter C Dorrestein, Juho Rousu, and Sebastian Böcker. Sirius 4: rapid tool for turning tandem mass spectra into metabolite structure information. Nature methods, 16(4):299- 302, 2019.
Kai Dührkop, Léuis-Félix Nothias, Markus Fleischauer, Raphael Reher, Marcus Ludwig, Martin A Hoffmann, Daniel Petras, William H Gerwick, Juho Rousu, Pieter C Dorrestein, et al. Systematic classification of unknown metabolites using high-resolution fragmentation mass spectra. Nature biotechnology, 39(4):462-477 2021.
Han Fang, Pengfei Xiong, Luhui Xu, and Yu Chen. Clip2video: Mastering video-text retrieval via image clip. arXiv preprint arXi::2106. 11097, 2021.
Samuel Goldman, Jeremy Wohlwend, Martin Stražar, Guy Haroush, Ramnik J Xavier, and Con- nor W Coley. Annotating metabolite mass spectra with formers. Nature Machine Intelligence, 5(9):965 979, 2023.
chemical formula trans-
Harrison Green, David R Koes, and Jacob D Durrant. Deepfrag: a deep convolutional neural network for fragment-basee based lead optimization. Chemical Science, 12(23):8036-80)) 8047, 2021.
Mariya Hendriksen, Maurits Bleeker, Svitlana Vakulenko, Nanne Van Noord, Ersst Kuiper, and Maarten De Rijke. Extending clip for category-to-image retrieval e-commerce. European Conference Information Retrieval, pp. 289-303. Springer, 2022.

---

Published as a conference paper at ICLR 2025
Jonathan Ho and Tim Salimans. arXiv:2207.12590, 2022.
Classifier-free diffusion
guidance.
arXiv preprint
Lars Holdijk,
Yuanqi Du, Priyank Jaini, Ferry Hooft, Bernd Ensing, and Max Welling. Path inte- gral stochastic optimal control for sampling transition paths. In ICML 2022 2nd Al for Science Workshop, 2022.
Ye Hu, Dagmar Stumpfe, and Jürgen Bajorath. Computational exploration of molecular scaffolds in medicinal chemistry: Miniperspective. Journal of medicinal chemistry, 59(9):4062-4076, 2016.
Ilia Igashov, Arne Schneuing. Marwin Segler, Michael Bronstein, and Bruno Correia. Retrobridge: Modeling retrosynthesis with markov bridges. arXiv preprint arXiv:2308. 16212, 2023.
Apurva Kalia, Dilip Krishnan, and Soha Hassoun. Jestr: Joint embedding space technique for ranking candidate molecules for the annotation of untargeted metabolomics data, arXiv preprint arXiv:2411. 14464, 2024.
Minoru Kanehisa, Miho Furumichi, Yoko Sato, Mari integrating viruses and cellular organisms. Nucleic acids research, 49511):545-DD51, 2021.
and Mao Tanabe. Kegg:
Sunghwan Kim, Paul A Thiessen, Evan Bolton, Jie Chen, Gang Fu, Asta Gindulyte, Lianyi Han, Jane He, Siqian He, Benjamin A Shoemaker, et al. Pubchem substance and compound databases. Nucleic acids research, 440D1).D1022-D1213 2016.
Tobias Kind, Hiroshi Tsugawa, Tomas Cajka, Yan Ma, Zijuan Lai, Sajjan S Mehta, Gert Wohlge- muth, Dinesh Kumar Barupal, Megan R Showalter, Masanori Arita, al. Identification of small molecules using accurate mass ms/ms search. Mass spectrometry reviews, 3114):513-53, 2018.
Fleming Kretschmer, Jan Seipp, Marcus Ludwig, Gunnar W. Klau, and Sebastian Böcker. Small molecule machine learning: All models are wrong, some may not even be useful. bioRxiv, 2023. doi: 10.1 101110200200000 03 27. 1. URthttps:: /www///wwwww.... www.bbooxxi... www.ooiwiiogg/oooooooooooooooooo wwtgg//oneen///erree 2202303/2213
27 534311
Jie Lei, Linjie Li, Luowei Zhou, Zhe Gan, Tamara L Berg. Mohit Bansal, and Jingjing Liu. Less is more: Clipbert for iideo-and-language learning via sparse sampling. In Proceedings of the IEFF/CVF conference on computer vision and pattern recognition, pp. 7331-7341, 2021.
Xinmeng Li, Yan Zhou Chen, Apurva Kalia, Hao Zhu, Li-ping Liu, and Soha Hassoun. An ensemble spectral prediction (esp) model for metabolite annotation. Bioinformatics, 40(8):btae4900 2024.
Yibo Li, Jianxing Hu, Yanxing Wang, Jielong Zhou, Liangren Zhang, and Zhenming Liu. Deep- scaffold: a comprehensive tool for scaffold- based de novo drug discovery using deep learning. Journal of chemical information and modeling. 60(1):77-9) 2019.
Eleni E Litsa, Vijil Chenthamarakshan. Payel Das. and Lydia E Kavraki. An end-to-end deep learn- ing framework for translating mass spectra to de-novo molecules. Communications Chemistry, (1):132, 2023.
Huaishao Luo, Lei Ji. Ming Zhong. Yang Chen, Wen Lei, Nan Duan, and Tianrui Li. Clip4clip: An empirical study of clip for end to end video clip retrieval. arXiv preprint arXiv:2104.0888 2021.
Yiwei Ma, Guohai Xu, Xiaoshuai Sun, Ming Yan, Ji Zhang, and Rongrong Ji. X-clip: End-to- end multi -uati-grained contrastive learning for video-text retrieval. In Proceedings of the 30th ACM International Conference Multimedia, pp. 637-647, 2022.
Harry L Morgan. The generation of a unique machine description for chemical structures-a tech- nique developed chemical abstracts service. Journal of chemical documentation, 1(2) 1965.
National dates to the nist tandem and electron
Institute of Standards and
Technology (NIST). ionization
Nist 23 up-
spectral
libraries,
2023.
URL https: www. nist gww wttp://iis..e..ppoopaaappppppeee
nist233 wwtp2e3-pddase-eeee Accessed: 2024-09-23.
12

---

Published as a conference paper at ICLR 2025
Marco Podda, Davide Bacciu, and Alessio Micheli. A deep generative model for fragment-based baasdd molecule generation. In International conference on artificial intelligence and statistics, pp- 2240-2250 PMLR, 2020.
Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning, pp. 7748-8763, PMLR, 2021.
RDKit, online. RDKit: Open-source cheminformatics, http://wwir /www rrkit.ii......................rr org accessed 11-April-2013].
[Online;
Aditya Divyakant Shrivastava, Neil Swainston, Soumitra Samanta, Ivayla Roberts, Marina Wright Muelas, and Douglas B Kell. Massgenie: A transformer-based deep learning method for identifying small molecules from their mass spectra. Biomolecules, 11((2):1793, 2021.
Michael A Stravs, Kai Dührkop, Sebastian Böcker, and Nicola Zamboni. Msnovelist: de novo structure generation from mass spectra. Nature Methods, 19(7):865-87)) 2022.
Mingxun Wang, Jeremy J Carver, Vanessa Phelan, Laura M Sanchez, Neha Garg, Yao Peng, Don Duy Nguyen, Jeramic Watrous, Clifford A Kapono, Tal Miizatto-Knaan al. Sharing and community curation of mass spectrometry data with global natural products social molecular networking. Nature biotechnology. 34(8):828 837, 2016.
Jennifer N Wei, David Belanger, Ryan P Adams, and D Sculley. Rapid prediction of electron- ionization mass spectrometry using neural networks. ACS central science, 5(4):700-708, 2019.
H Zhu, L Liu, and S Hassoun. Using graph neural networks for mass spectrometry prediction. arxiv. arXiv preprint NXXv:2010.04600 2020.
Yanqiao Zhu, Yuanqi Du, Yinkai Wang, Yichen Xu, Jieyu Zhang, Qiang Liu, and Shu Wu. A survey deep graph generation: Methods and applications. In Learning Graphs Conference, pp- 47-1. PMLR, 2022.
13

---

Published as a conference paper at ICLR 2025
A APPENDIX
A.1 MODEL ARCHITECTURES AND ALGORITIIMS
In this section, describe the architecture of proposed scaffold-conditioned molecular genera- tion guided by mass spectra data. The process consists of two main stages: scaffold retrieval (Stage 1) and scaffold-conditioned molecular generation (Stage 2). The model integrates node, edge, and spectral features, updated iteratively through cross-attention and self-attention mechanisms.
A.1.1 STAGE 1: SCAFFOLD RETRIEVAL
The first stage of the process involves predicting scaffold that is most consistent with the input MS/MS spectrum. This stage utilizes a contrastive learning framework that aligns molecular graphs with their corresponding mass spectra. We use the 'MLP BIN model for encoding the spectral data.
Molecular encoder. We employ Graph Neural Network (GNN) to encode the molecular struc- tures:
Node Features:
The molecular graph nodes (atoms) are encoded using GNN layers, where each node is associated with a feature vector that encodes atom type and other properties.
Edge Features: Bonds between atoms are represented by edge features, which are also encoded by the GNN.
The output node embeddings from the GNN are pooled using a MaxPool- ing layer create graph-level representation.
Graph Pooling:
Spectral encoder (MLP BIN). For encoding the MS/MS spectra, we use the 'MLP_BI BBBN' en- coder:
The input spectra are represented as bins mass-to-charge (m/z) ratios and intensities.
The 'MLP_BIN- model processes these binned inputs through multiple fully connected layers, where each layer applies ReLU activation and dropout to prevent overfitting.
The output the 'MLP_BIN' encoder is a vector representing the spectral data in an em- bedding space suitable for contrastive learning.
Interaction model. Once the molecular and spectral embeddings are computed, they are con- catenated and passed through interaction MIP, which predicts the interaction between the molecule and the scaffold. The interaction score used to rank candidate scaffolds. The molecular encoder and spectral encoder are trained jointly in contrastive learning framework, where the goal is to align the embeddings of correct molecular-scaffold pairs.
A.1.2 STAGE 2:
MOLECULAR GENERATION
In Stage 2, the retrieved scaffold is used as the foundation for generating the full molecular structure, guided by the mass spectra data. This stage employs a Graph Transformer to integrate node, edge, and spectral features iteratively across multiple layers.
Input representation. The inputs to the Graph Transformer in this stage consist of:
Node Features (V): Each node represents an atom in the molecular scaffold, and the feature vector encodes atom type and properties.
Edge Features (E): Bonds between atoms in the scaffold are represented edge features.
Spectral Features (S): The MS/MS spectra provide pairs tons-to (m/z) ratios and intensities.
14

---

Published as a conference paper at ICLR 2025
Multi-head attention. Each layer of the Graph Transformer applies a Node-Edge Block, where both node and edge features are updated using attention mechanisms.
Self-Attention:
The model computes queries, keys, and values for each node and edge, allowing it to focus relevant parts of the molecular graph during the update process.
Cross-Attention:
Cross-attention between the node/edge features and the spectral features enables the generation process to be conditioned on the spectral data, ensuring that the generated molecular structure aligns with the spectra.
Feedforward networks. After the attention layers, a FeedFdrward Network processes the up- dated node and edge features, further refining the representations.
Layer normalization and residual connections. Each attention block is followed by Layer Nor- malization and residual connections to stabilize training and maintain information flow across the layers.
Final output. After the final transformer layer, the updated node and edge features are passed through an output MLP to generate the final molecular structure. This process ensures that the generated molecule consistent with both the scaffold and the spectral data.
A.2 TRAINING HYPERPARAMETERS
The model is trained with batch size of 64 and employed 47 workers for data loading. The learning rate is set to 2 10-1, while weight decay is configured at x 10-12, Training proceeds for 2000 epochs, with the model logging progress every 40 steps.
A Markov bridge process with 100 steps is employed during training, and cosine noise schedule is employed.
The model consists of 5 layers, with node, edge, and spectral features set at 64 dimensions each. The MLP hidden dimensions are configured to 256 for nodes, 128 for edges, and 256 for spectral features. The model also employs 8 attention heads for cross-attention and self-attention mecha- nisms. The feedforward dimensions are set to 256 for nodes, 128 for edges, and 128 for global features. This architecture enables efficient handling of both molecular structure and spectral data during training.
A.3 VARIATION DISTRIBUTION AND ELBO
We first show the full derivation the ELBO, which introduces a forward transition distribution p(er+1 let, er) the variational distribution. Then we discuss the formulation of the variational
15

---

Published as a conference paper at ICLR 2025
distribution.
The derivation of the ELBO is follow:
T-1
log (o(G))) = log
Σ
Il
po
po(ectz 8
E V()
(9)
c1:er
1=
T-1
MeIr--1leu eT)
log
Σ
II po (ettallee, ES DC))
(10)
p(E1:T-1 co, ET)
e1:e7-1
I po poleettler, ES (C)
2 Bp(ersen-ilo.er)
log
(11)
p( (T)
Po polettales, ce, E VC)
(eo))))
log
(12)
plet+1les (T)
L=
po po(eetile,, E5)
Epter.essx
log
(13)
p(extiler,ET)
po E ES, V0)
Spteeleo.er)
(pte log
(14)
(1t
Σ Epice (c).er)
- KL (p(pleealle, er) (pa en, E v9o)
(15)
KL (p(eeeetleen eT) po (ett1 ee, E ]
(16)
= L)
(17)
The forward distribution defines a distribution of trajectories 61771 between eo and er. Note that eo is always 0 (non-edge) and is independent from eT, so we have
p(eorT-iler) = pleu.r--leo. eT).
(18)
This also satisfies the Markov property
T-1
T-1
p(corr-ler)
II ((ettle,,ee) = II Categorical(et:::Q((()) t=
(19)
t=
The transition matrices Qo...., Qr-1 are x D matrices, where
Q = a,I + (1 - a1)a)_11
(20)
ag....,, -1 are scheduling parameters similar to Austin et al. (202T). And Ip is a D identity matrix. With the defined transition matrices, the one-step transition probability p(eeleo, er) also has the closed form
plealen,er) eT) = Categorical(essi
Qi(eT) (
(21)
7=0
Now that both p(erleo, eT) and p(er+1le,,eT) can be derived in closed-form directly opti- mize the ELBO (S.
A.4 OVERALL WORKFLOW
The two stages work together form scaffold-conditionel molecular generation system. In the first stage, the model retrieves scaffold using contrastive learning and the 'MLP BIN spectral encoder, and in the second stage, the Graph Transformer uses this scaffold to generate a complete molecule, conditioned on the spectral data. This two-step approach ensures that the molecular gen- eration process is both accurate and guided by experimentally observed spectra.
16


Reviews:
[{"review_id": "jNv8lBjRUi", "reviewer": "Reviewer_H3Zi", "summary": "This study presents MADGEN, a two-stage framework for generating molecular structures from MS/MS data. In the first stage, MADGEN retrieves a scaffold using either predictive retrieval or oracle retrieval. In predictive retrieval, MADGEN treats scaffold selection as a ranking task, using contrastive learning to align embeddings of mass spectra and scaffold candidates in a shared latent space, scoring each scaffold to identify the best match. Oracle retrieval, by contrast, directly uses RDKit to extract the correct scaffold from a molecular graph. In the second stage, starting from the retrieved scaffold, MADGEN generates the full molecular structure through a Markov bridge-based expansion, sequentially adding atoms and bonds with classifier-free guidance to integrate spectral information. Evaluations were performed on datasets NIST23, CANOPUS, and MassSpecGym, underscoring its potential in metabolomics and drug discovery applications.", "questions": "* How is the candidate scaffold pool determined for predictive retrieval? There can be a huge number of scaffold candidates.\n* How does the contrast learning work for aligning the embeddings of mass spectra with their corresponding molecule? Some explanations are needed. \n* Regarding molecular generation in Phase 2, the absorbing transition matrix only applies to isolated atoms, strictly enforcing scaffold structure. Will such a hard constraint be problematic especially when the chosen scaffold is incorrect?\n* Oracle retrieval requires both the MS/MS spectrum and the chemical formula (molecular graphs). If chemical formula is known, what are the remaining challenging in solving the molecular structures?", "limitations": "", "rating": 6, "confidence": 4, "soundness": 3, "presentation": 3, "contribution": 3, "strengths": "* The two-stage idea is interesting.\n* The oracle retrieval method is more effective.", "weaknesses": "* The SPA of the predictive retrieval is very low.\n* The predictive retrieval approach yields poor molecule generation in Phase 2, where the generated structures fail to align with target properties, underscoring a critical limitation.\n* The conditioning of molecular generation on mass spectrometry data is largely based on classifier-free guidance, a well-established technique. The novelty is not well articulated.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "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": "SFV6bjqskS", "reviewer": "Reviewer_t2EJ", "summary": "This paper introduces MADGEN, a method for de novo molecular generation using mass spectrometry data. MADGEN simplifies the structure generation process by retrieving molecular scaffolds and building complete molecules upon them. The experimental results on three datasets demonstrate that MADGEN can effectively generate accurate molecular structures when the scaffold is known.", "questions": "- I would appreciate it if you could include a comparison of MADGEN with other prediction methods.", "limitations": "", "rating": 6, "confidence": 2, "soundness": 3, "presentation": 3, "contribution": 3, "strengths": "- The use of scaffolds for simplifying molecular generation is a novel and effective strategy that reduces complexity.\n- The paper is clear and easy to understand.", "weaknesses": "- The method lacks a comparison with other baselines.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "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": "z0N895MdVc", "reviewer": "Reviewer_RWgk", "summary": "The paper introduces MADGEN, a framework for de novo molecular structure generation from mass spectrometry data. MADGEN employs a two-stage approach: first, it retrieves a molecular scaffold, and second, it completes the molecule conditioned on both the scaffold and the MS/MS spectra. Evaluated on datasets like NIST23, CANOPUS, and MassSpecGym, MADGEN effectively reduces search complexity and enhances accuracy.", "questions": "1. In Section 3.2.1, the authors state, “Since the atom set V can be directly inferred from the chemical formula.” However, it is unclear where the chemical formula is derived from. Could the authors clarify this, as in real-world scenarios, the input typically does not contain the chemical formula?\n2. For the MassSpecGym dataset, what is the “best published state-of-the-art performance” referred to? Are there baseline performance metrics reported for the other two datasets as well?", "limitations": "", "rating": 6, "confidence": 3, "soundness": 3, "presentation": 4, "contribution": 3, "strengths": "1. The two-stage approach of scaffold retrieval followed by scaffold-conditioned molecular generation presents a novel solution for de novo molecular structure prediction.\n2. The paper is well-written and easy to follow.\n3. The model is evaluated on multiple datasets, and a detailed ablation study is provided.", "weaknesses": "1. The scaffold retrieval performance, especially when using a predictive retriever, remains relatively low (e.g., NIST23).\n2. The discussion of baselines is unclear.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "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": "nxcAItyqtB", "reviewer": "Reviewer_HW4z", "summary": "The paper presents MADGEN, a method for de novo molecular structure generation using MS/MS data to address challenges in spectral annotation. MADGEN operates in two stages: scaffold retrieval via contrastive learning and attention-based generation using the MS/MS spectrum. Evaluated on NIST23, CANOPUS, and MassSpecGym datasets, MADGEN shows strong performance, particularly with an oracle retriever, improving annotation by leveraging spectral data effectively.", "questions": "See the weakness above.", "limitations": "", "rating": 6, "confidence": 3, "soundness": 3, "presentation": 3, "contribution": 3, "strengths": "1. The task of de novo generation of molecular structure from mass spectrum is important and challenging.  However, the AI community has not paid enough attention to this task.       \n2. The two-stage molecule structure generation method is novel.", "weaknesses": "1. The authors have not compared with previous de novo molecular elucidation methods from MS such as MSNovelist [1], Spec2Mol [2], MIST [3], etc.\n2. manuscript’s presentation requires significant improvement for publication readiness:\n    (1) Line 14 - Line 50: Double quotation marks should be directional.            \n    (2) Line 242 - Line 243: Why the word 'Following' is underlined?       \n    (3) Why there is $T$ in Eq. (6)?              \n    (4) \\citep is used for parenthetical citations while \\citet is used for textual citations, where the citation is part of the sentence. The authors are suggested to use these two commands appropriately to ensure clarity in their references and maintain consistency in citation formatting.             \n    (5) Line 102: The “F” in “Generative Frameworks for molecular generation” should be lowercase.             \n3. The code is not provided for reproducing the results.     \n\n[1]. MSNovelist: de novo structure generation from mass spectra (Nature Methods)    \n[2]. An end-to-end deep learning framework for translating mass spectra to de-novo molecules (Communications Chemistry)  \n[3]  Annotating metabolite mass spectra with domain-inspired chemical formula transformers (Nature Machine Intelligence)", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "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:

Decision: Accept (Poster)