Scientific machine learning
On this page
The problem
A mass spectrum contains evidence about a molecule, but interpreting that evidence as a molecular graph is an inverse problem. Different structures can produce ambiguous observations.
What I’m exploring
Spec2Graph investigates molecular graph prediction from mass spectra using spectral diffusion models. Related projects in chemical-graph-series, mol-modalist and ChemGPT-R examine other ways to represent molecules and use machine learning for chemistry.
Design decisions
My chemistry background gives the problem domain a concrete meaning: a generated graph needs to be chemically meaningful, and a prediction needs evidence beyond a plausible-looking output.
The inverse problem’s ambiguity matters. A model’s prediction should be evaluated under the dataset and task conditions rather than treated as a unique recovered structure.
Evidence and status
The public repositories contain the experimental implementations and project descriptions. The work is experimental; dataset conditions and structural ambiguity are part of the evaluation problem.
Spec2Graph in more detail
Spec2Graph conditions a diffusion model on mass-spectrum peaks to generate a spectral representation of a molecular graph. A transformer and Fourier m/z embeddings encode the observations. The diffusion model denoises a representation related to the eigenvectors of the molecule’s graph Laplacian.
Those targets introduce their own ambiguity: an eigenvector’s sign can change without changing the represented subspace, and degenerate eigenvalues allow rotations within that subspace. Distinct graphs can also share spectral properties. Those issues sit alongside the chemical ambiguity already present in a mass spectrum.
The implementation includes a projection-aware loss using the subspace projection P = V Vᵀ, plus an orthonormality regulariser. This makes the learning objective less dependent on an arbitrary eigenvector orientation. The repository’s demo uses synthetic padded batches, masks and optional fingerprint and atom-count heads.
Chemistry supplies the evaluation questions
A valid-looking representation is an intermediate result. Reconstructing a molecule, checking chemical validity and evaluating against appropriate candidate structures are separate steps. Isomers and the information available in the measurement affect what can be identified.
My interest is in connecting molecular representations to the observations a scientist actually has. EluteDiff approaches that connection through retention-time densities; Spec2Graph approaches it through mass spectra and graph structure.
Related explorations
The linked chemical-graph-series, mol-modalist and ChemGPT-R repositories cover related molecular representation and modelling experiments. They are separate projects, rather than claims that one combined system has recovered molecular structures reliably.
Start with Spec2Graph’s implementation, its target construction and synthetic demo. Read the roadmap for the remaining path from an experimental representation to a validated chemical prediction task.