Molecular formula assignment is the first step of metabolite identification from tandem mass spectra, yet deep-learning methods have repeatedly underperformed classical enumeration, reaching usable accuracy only through candidate generation and learned reranking. Here we present MStoic, a mass spectrum encoder that predicts molecular formulas directly and finalizes them with a deterministic, zero-parameter stoichiometric correction that selects a mass-consistent formula against the precursor mass (20 ppm; falling back to the closest-mass candidate when none qualifies). Every peak is embedded by soft Gaussian binning of log(m/z), Fourier features, pairwise-difference embeddings and an intensity embedding, and the encoder is trained with chemically grounded auxiliary tasks, including fragment-level supervision from computational fragmentation trees. On the multi-source Spectraverse benchmark (48,622 held-out spectra) MStoic achieves 77.8% top-1 exact-match accuracy, and 79.6% on the CASMI-2022 challenge, matching or exceeding specialized deep-learning, candidate-ranking, and rule-based baselines on every benchmark evaluated. Applying the same correction to a competing model shows that mass-based correction is a portable physical prior that amplifies rather than substitutes model capability. Factorial ablation shows that the hybrid encoding is selectively beneficial for rare-element-bearing formulas with information-dense spectra. And imposing mass conservation as a soft training loss reduces direct accuracy more than seven-fold, indicating that physical constraints in discrete chemical spaces belong in hard post-processing rather than in the training objective.
No takes yet. Share an insight, caveat, or question.
Zhang et al. (2026) studied this question.
Synapse has enriched 5 closely related papers on similar clinical questions. Consider them for comparative context: