arXiv:2611.03308cs.LGNov 2026

Manuscript Offprint

arXiv:2611.03308

LLMs Depend on Specialist Tools for Out-of-Distribution Generalization in MS/MS Structural Elucidation

Gabriel Asher, Cailum M. K. Stienstra, Tomo Oga, Devesh Shah Antonio H. de O. Fonseca, Niall O'Connor, Michael Widrich

Abstract

A frontier language model was recently reported to solve 1D NMR structural elucidation without tools. We ask whether this capability transfers to tandem mass spectrometry (MS/MS) in the de novo setting, where the model must propose a structure directly from the spectrum without a candidate list or reference library. To separate reasoning from recall, we build a 100-analyte benchmark from MassSpec-Gym, split by each analyte's textual footprint into in-distribution (well documented in literature) and out-of-distribution (essentially undocumented) arms. We hold the model, harness, and output format fixed and vary only the LLM's access to domain-specific tools. Without tools, a frontier LLM reaches 52% Top-1 accuracy in-distribution but only 2% out-of-distribution. Only access to de novo structure generators improves out-of-distribution accuracy, raising it to as much as 38% Top-1, and the resulting agent outperforms the standalone de novo models both in and out of distribution. These results suggest that LLMs are not effective at de novo MS/MS structural elucidation on their own, and that further gains depend on the specialist tools available to the agent rather than on the LLM itself.

1 Introduction

Tandem mass spectrometry (MS/MS) is the dominant approach for identifying unknown small molecules in complex mixtures. Its sensitivity extends to trace quantities that are inaccessible to nuclear magnetic resonance (NMR) spectroscopy [13, 30]. MS/MS takes an ionized precursor compound and breaks it into fragments, each of which contains a mass and an intensity. Inferring a compound's identity from its spectrum, a process called structural elucidation, is a central problem in the field of mass spectrometry. This task remains largely unsolved, with most spectra detected in a sample never assigned to a structure. These spectra are known colloquially as the “dark matter” of metabolomics [26].

The standard method for structural elucidation is library matching, which compares a query spectrum against a library of experimentally measured reference spectra and ranks the candidate identities by fragmentation-pattern similarity [19]. The coverage of library matching is bounded by the size of its spectral libraries, which typically contain 10410^4-10510^5 distinct structures [5], orders of magnitude fewer than the ∼108\sim 10^8 compounds cataloged in PubChem [7, 18]. Furthermore, library-based approaches cannot identify a compound that has never been measured, a category that includes many novel drug metabolites and environmental transformation products. Identifying these compounds requires a class of structural elucidation named de novo generation. De novo elucidation, a form of inverse structural elucidation, generates a candidate structure directly from an MS/MS spectrum, and is the

40th Conference on Neural Information Processing Systems (NeurIPS 2026). Workshop: ML4Molecules: Agentic Systems for Molecular Sciences.

most challenging formulation of structural elucidation. On MassSpecGym, the community-accepted benchmark for this task, the state-of-the-art de novo Top-1 accuracy is 23.9% [3, 38].

Recent work reports strong zero-shot performance of frontier LLMs on the inverse elucidation problem in NMR spectroscopy. In Making Claude a Chemist [15], Claude Opus 4.7 was given fifteen 1D inverse elucidation problems, each supplying 1^{1}H and 13^{13}C peak lists, molecular formulae, and, for the seven hardest spectra, the reaction's starting material. With no tools and no chemistry-specific fine-tuning, a setting that mirrors de novo elucidation, it returned the published structure on at least two of three attempts for every compound. Because the compounds were taken from preprints posted after the model's training cutoff, the result cannot be attributed to memorization.

This work asks whether the zero-shot structural elucidation performance reported for Claude Opus on NMR [15] translates to MS/MS. This translation is not guaranteed, as chemical shift in NMR reflects each nucleus's local environment and is approximately additive, making the substructure-to-shift mapping compositional [28]. By contrast, MS/MS fragmentation is stochastic and non-local, proceeding through charge migration, rearrangement, and competing dissociation channels [13], so fragments vary with adduct and instrument [5, 33]. Unlike NMR shifts, MS/MS spectra therefore cannot be reliably predicted, or inverted, from substructure rules alone.

We additionally explore whether an LLM with tools, an agent, can improve de novo elucidation performance. In other chemistry domains, tools cover capabilities that a base model lacks [4, 23], but the benefit is task-dependent and can be negative for competent LLMs [37]. No equivalent attribution exists for MS/MS, where published comparisons of agents with and without tools reduce to a single all-or-nothing contrast between the full toolbox and none of it [34]. Furthermore, without a careful ablation of the tools used in an agent, it is challenging to determine whether an agent came to an answer via reasoning over its tool outputs, or memorization (recall) over its training data.

Contributions. To evaluate the de novo MS/MS elucidation capabilities of agentic LLMs, we contribute the following. (a) We construct a 100-spectrum MS/MS benchmark from the MassSpecGym test fold. This benchmark contains two sets of spectra matched on acquisition conditions but with a different literature footprint, separating memorization from reasoning-based elucidation. (b) We show that, without tools, the LLM's accuracy tracks a compound's literature footprint rather than the information in its spectrum. It reaches 52% Top-1 accuracy on well-documented in-distribution (ID) compounds but only 2% on out-of-distribution (OOD) compounds. (c) We attribute performance to individual tools by ablation under a fixed harness, finding that subformula annotation and forward prediction only improve performance on in-distribution analytes, while a de novo generator raises out-of-distribution accuracy to 12–38%. (d) We show that this out-of-distribution gain is bounded by the candidates the generator proposes, with the LLM acting as a better re-ranker.

References (40)