Manuscript Offprint
arXiv:2611.01352FACET: Feasibility-Automaton Complete Enumeration and Truncation-Free Scoring of Molecular Formulas from MS/MS
Abstract
Determining the neutral molecular formula of a precursor ion from its tandem mass (MS/MS) spectrum is the first step in identifying an unknown small molecule. Existing methods trade recall, whether the correct formula is among the candidates, against the cost of examining each candidate. Methods that examine each candidate in depth must first shorten the list, by limiting element counts or truncating it, and that is where the correct formula is lost. End-to-end regressors are fast but guarantee neither validity nor recall. We present FACET, which separates deciding which formulas to consider from deciding which one to choose. A feasibility automaton builds a formula one element count at a time and admits exactly the formulas that fit the precursor mass and satisfy the ring-and-double-bond and valence constraints. Run as an exhaustive search, it enumerates the complete feasible set, so every candidate is valid and recall is fixed by the chemical constraints rather than by a trained model. A small neural scoring head then ranks every feasible formula from one pass of a pretrained spectrum encoder, so no candidate is discarded. On the NPLIB1 benchmark FACET reaches top-1 accuracies of 0.859 with the adduct known and 0.729 with it unknown, compared with 0.766 and 0.660 for the strongest established method, and its recall is the highest. On the external CASMI 2022 set its recall is 1.000, and with the adduct unknown it is the most accurate of the methods compared.
1 Introduction
Untargeted metabolomics and natural-product discovery routinely produce millions of tandem mass spectra of unknown small molecules, and only a small fraction of them can be annotated by matching against reference spectral libraries. For the remainder, identification has to begin from the spectrum itself, and the first question to answer is the molecule's neutral molecular formula, for example , inferred from the mass-to-charge ratio () of the precursor ion and from the fragment peaks it produces. An unequivocal formula is itself a reported level of identification confidence, and it is the starting point of almost every later step. Structure databases are queried with the formula, compound classes are predicted from fragmentation trees computed for it, and de novo structure generators are almost always given the formula and build the molecule on the atom set it fixes, so that a wrong formula becomes a wrong atom set. The way a formula identifier fails therefore matters as much as how often it succeeds, and its failure modes are best excluded by construction.
Three properties make the problem hard. The first is validity. A candidate formula is chemically possible only if its mass, corrected for the ion's adduct, matches the precursor within the instrument's mass accuracy; if its ring-and-double-bond equivalent (RDBE), the number of rings and double bonds the formula implies, is not negative ; and if its atoms carry enough valences to be joined into a single connected molecule . The adduct is the species added to or removed from the neutral molecule M when it is ionized, such as a proton in , a sodium ion in , or a proton together with the loss of a water molecule in . Plausibility criteria of this kind are standard filters in formula annotation . The second property is recall. Many formulas fit a given mass, even at sub-ppm accuracy , and the correct one has to be among the candidates that are considered before any scoring can choose it. A precursor at m/z 335.222 observed as and measured to within 30 ppm, for instance, admits 145 distinct formulas inside its mDa window, and heavier precursors admit far more. Across the test spectra of the NPLIB1 benchmark, 72% have more than 256 feasible formulas, and above 800 Da the median feasible set holds about 360,000. The third property is near-isobaric ambiguity. The strongest competitors differ from the correct formula by an exchange of atoms of almost the same mass, so that mass alone cannot tell them apart and only the fragment spectrum can. In the example, and lie 1.34 mDa apart. In practice the most frequent of these exchanges are compound ones. Exchanging for changes the mass by only 2.68 mDa, and exchanging for by 1.34 mDa, whereas the textbook exchange of N for changes it by 12.6 mDa. Some pairs are closer still: and differ by 0.49 mDa.
Existing methods handle these properties in different ways, and they share a weakness that we call the recall-cost tension: the more information a method extracts from the spectrum for each candidate, the more each candidate costs to score, and the fewer candidates the method can afford to consider. Combinatorial tools score candidates with expert-designed models of fragmentation, from heuristic rules combined with isotope-pattern matching to hydrogen-rearrangement rules for annotating fragments . SIRIUS , the most widely used of them, decomposes the precursor mass into every formula that fits, using the Round-Robin algorithm for the money-changing problem . It ranks the candidates by isotope-pattern analysis and by fragmentation trees , which explain each fragment peak as a subformula of the candidate and must be computed separately for every candidate. ZODIAC then re-ranks the candidates jointly across all spectra of a data set . BUDDY works bottom-up instead, assembling precursor formulas from the formulas that explain individual fragments and neutral losses and ranking them with machine-learned features and a false-discovery-rate estimate, and current versions of SIRIUS combine this bottom-up generation with decomposition. In all of these tools the candidate list is kept manageable by tight mass tolerances and by heuristic limits on element counts of the kind codified by Kind and Fiehn .
Learned scoring reduces the hand-tuning but not the cost per candidate. MIST-CF , the most direct precedent for the present work, extends a spectrum Transformer into an energy-based ranker of (formula, adduct) pairs supplied by an external decomposer. Its authors list this reliance on the decomposition of SIRIUS among the limitations of the method. MIST-CF dispenses with the fragmentation tree but still assigns subformulas to the fragment peaks of every candidate, and this is expensive enough that the candidate list is shortened twice before scoring: the decomposer admits at most one atom of each halogen, and a fast pre-filter keeps only 256 candidates. A formula removed at either step can never be ranked first, however good the scorer is. On NPLIB1, the halogen limit alone excludes the correct formula for 4.0% of the test spectra. End-to-end regressors avoid candidate lists altogether. FIDDLE predicts the formula directly with a network trained on about one million spectra and is fast and accurate at that scale, but nothing constrains its output to be chemically valid, and nothing ensures that the correct formula was ever considered.
Table 1 summarizes where each approach obtains its candidates, what it scores, and what it guarantees. The method we present, FACET, removes the recall-cost tension by separating two decisions that the methods above couple: which formulas to consider, and which of them to choose.
Table 1: How the compared methods generate and score candidate formulas. “Valid” means that every returned formula fits the precursor mass and satisfies an RDBE bound by construction.
| Method | Candidates | Scoring | Valid | Recall guarantee |
|---|---|---|---|---|
| SIRIUS 6 | mass decomposition below 400 and bottom-up assembly from fragment formulas at every mass | a fragmentation tree for each candidate, of which the best 50 are kept | yes | no |
| BUDDY | formulas retrieved by mass from a bundled database of 4.19 million, and formulas assembled from fragment and neutral-loss formulas | machine-learned features of each candidate's fragment explanations | yes | no |
| MIST-CF | external decomposition by SIRIUS, at most one atom of each halogen | subformula-annotated peaks for the 256 candidates kept by a learned formula filter | yes | no |
| FIDDLE | none, as the formula is regressed directly | refinement of the predicted formula | no | no |
| FACET | complete enumeration of the feasible set by the feasibility automaton | every feasible formula, scored by a small head on one shared spectrum encoding | yes | yes |
A feasibility automaton makes the first decision. It builds a formula one element count at a time, discards at each step only counts that can no longer be completed into a valid formula, and accepts a finished formula only if it is valid. Because it never accepts an invalid formula and never discards a completable count, running it as an exhaustive search returns the complete set of valid formulas, and the correct formula belongs to that set whenever it is valid. FACET is database-independent: it considers every formula that the constraints admit, whether or not the formula occurs in a known compound. A neural network makes the second decision, and it is kept cheap per candidate: a spectrum encoder reads the spectrum once, and a scoring head about 450 times smaller than the encoder ranks every formula in the set from that single encoding. Scoring the whole set, which for heavy precursors runs to millions of formulas, then becomes affordable, so FACET needs neither tight element limits nor truncation. The encoder is DreaMS³, which was pretrained on spectra alone and never sees a candidate formula, so the correct formula cannot leak into the spectrum representation.
Restricting what a generative model may output by means of a grammar or an automaton is an established technique in natural-language processing³⁴⁻³⁷, and in mass spectrometry a pruning rule on heavy-atom mass that provably never removes the true molecule already steers de novo structure generation toward the precursor mass¹⁵. The feasibility automaton applies the idea to formula identification with a constraint set that is exact, and it is this exactness that turns masking into a guarantee on recall. The contributions of this work are the following.
-
Validity by construction. Every formula FACET emits satisfies the mass, RDBE and valence constraints without any filtering after the fact.
-
A recall guarantee. The same automaton enumerates the entire feasible set, so the correct
formula is a candidate whenever it is feasible, however the candidates are later scored.
-
Truncation-free scoring. All candidates share one encoder pass, and the cost per candidate is that of a small scoring head, so FACET ranks the complete feasible set rather than a shortened list.
-
A self-contained predictor. FACET runs no external decomposition tool during training or inference, and even the negative examples it learns from come from its own enumeration.
On the NPLIB1 benchmark FACET ranks the correct formula first more often than any of four established methods when the adduct is known, and more often than the three that can run without the adduct when it has to be inferred. With the adduct known, its top-1 accuracy is 0.859, compared with 0.766 for the strongest of them. In both settings it also keeps the correct formula among its candidates more often. It keeps this lead for every adduct type and instrument represented by more than a handful of spectra, and its ranking advantage widens above 300 Da, where feasible sets become large. Its decomposer produces 160,000 formulas per CPU second on a single thread, scales across processor cores, and runs inside the model. On the external CASMI 2022 challenge set the recall guarantee carries over unchanged.
2.1 Problem Formulation
A tandem mass spectrum consists of the precursor mass-to-charge ratio and fragment peaks with values and intensities . All spectra in this work are of singly charged positive ions, so an value is an ion mass. The ion is formed from the neutral molecule by an adduct , and each adduct shifts the mass by a known amount , which for is the mass of a proton.
We fix an ordered set of elements , with carbon first and hydrogen last. Element has monoisotopic mass , valence and an upper bound on its count. A molecular formula is a vector of element counts , and its neutral monoisotopic mass is
Given and , the formula has to reproduce the neutral target mass within the tolerance ,
where is the mass accuracy in parts per million (ppm). At and Da, for example, is 10 mDa. The ring-and-double-bond equivalent counts the rings and double bonds a formula implies,
For it is 6.
Definition 1 (Feasible set). For precursor and adduct , the feasible set is
The RDBE condition is Senior's connectivity condition in another form. Senior's theorem requires that the valences of a molecule's atoms suffice to join them into one connected graph,
, and rearranging eq 3 gives , so the two conditions coincide. Senior's second condition, that an even-electron molecule has an even total valence, is deliberately not imposed. Permanently charged cations, such as quaternary ammonium and pyridinium compounds like the phosphocholine , are recorded with the formula of the cation, whose valence sum is odd and whose RDBE is a half-integer, so imposing parity would remove them from and void the recall guarantee below. Parity is instead left to the scoring model as a soft signal. The feasible set that results, the mass window intersected with and the element bounds, is the filter that combinatorial decomposers apply, except that SIRIUS also admits an RDBE of -0.5. The recall comparisons in this work are therefore like for like.
We write for the correct formula. Candidate-generation recall is the fraction of spectra whose correct formula is in the candidate set, and top-k accuracy is the fraction whose correct formula is among the highest-ranked candidates. The aim is a map , or when the adduct is unknown, that maximizes top-1 accuracy while guaranteeing that is valid.
2.2 Overview of FACET
FACET has two parts, illustrated in Figure 1 for the precursor at m/z 335.222. The first part generates candidates and carries the guarantees, and the second ranks them.
Generation, shown in Figure 1a, builds a formula one element count at a time in the fixed order E. At each step the feasibility automaton decides which counts are still admissible, discarding those that can no longer lead to a feasible formula. In the example, carbon may take any count from 0 to 27, because 28 carbon atoms alone would exceed the target mass of 334.215 Da. Once 20 carbon atoms are chosen, nitrogen may take 0 to 6 atoms, and after no nitrogen, oxygen may take 0 to 5. With 20 carbon and 4 oxygen atoms in place, the 30 Da that remain leave no room for phosphorus, sulfur, chlorine, bromine or iodine, whose masses all exceed it, but allow one fluorine atom. Hydrogen comes last, and its count is fixed by the mass that remains, here 30 atoms. Running the automaton as an exhaustive search visits every admissible path and returns all 145 feasible formulas. No trained model is involved in this part: generation reads only the precursor m/z, the adduct and the mass tolerance, and it never looks at the fragment peaks.
Ranking, shown in Figure 1b, is where the spectrum enters. A spectrum encoder reads the fragment peaks once. A small scoring head then assigns each of the 145 formulas a score computed from that single encoding, and the highest-scoring formula is the prediction. In the example, and are only 1.34 mDa apart, so their order has to come from the fragments rather than from the mass.
The two parts decide different things: the automaton decides which formulas are considered, and the scoring head decides which of them wins. Recall does not depend on the scorer, and because the scorer is cheap it can afford to look at every candidate. When the adduct is unknown, both parts are repeated under every allowed adduct and the resulting (adduct, formula) pairs are ranked together, as Figure 1c illustrates and the section on adduct-unknown inference below describes.
2.3 The Feasibility Automaton
A formula is generated as the sequence of counts in the order . After the first counts have been chosen, the state of the automaton is

(c) adduct unknown (a) and (b) under every allowed adduct, then fused

Figure 1: FACET separates which formulas to consider from which to choose, illustrated for one precursor at 335.222. (a) Generation: the feasibility automaton admits element counts step by step and enumerates the 145 formulas of the feasible set, shown as dots at their mass errors. (b) Ranking: one encoder pass is shared by a small scoring head that scores every feasible formula. (c) Adduct unknown: generation and ranking are repeated under every allowed adduct, and the (adduct, formula) pairs are ranked by a fused score.
that is, the mass accumulated so far and the accumulated contribution to the RDBE. Let be the largest mass that the elements from onward can still add. The mass test admits the count at a step if and only if
In words, the running mass must not overshoot the upper end of the window, and it must not fall so far short of the lower end that even the heaviest possible completion could not reach it. Counts are also capped at , and a second test, equally conservative, discards a count only when no completion could bring the RDBE back to zero or above. This test removes, for example, prefixes that already carry more halogen atoms than the chosen carbon, nitrogen and phosphorus atoms could bond.
Hydrogen, the last and lightest element, is closed deterministically: is the integer that brings closest to , and it is accepted only if the resulting formula lies within and has . Because the tolerance is far smaller than half the mass of a hydrogen atom, at most one hydrogen count can fall inside the window, so this closure loses nothing. The counts admitted at each step form a Boolean mask, which FACET also applies to the outputs of its autoregressive decoder, described below.
Proposition 1 (Validity by construction). Every complete formula accepted by the automaton lies in . Consequently every formula FACET outputs is chemically valid, without any filtering after
Algorithm 1 Feasible enumeration Enum()
Input: precursor , adduct and element data
Output: the feasible set
1: compute by eq 2; set 2: DFS: 3: if (hydrogen) then 4: close deterministically; if satisfies eq 4 then add to 5: else 6: for all admitted by eq 6 and by the RDBE test do 7: DFS 8: end for 9: end if 10: return
the fact.
Proof sketch. The tests of eq 6 and the count caps keep every prefix completable within and within , and the hydrogen closure enforces the mass window exactly and accepts a formula only when . An accepted formula therefore satisfies every condition of eq 4.
The tests at the non-final steps prune only prefixes that cannot be completed, and they never decide the exact RDBE, which the hydrogen closure settles. A feasible formula, the correct one included, is therefore never rejected along its own prefix, and this is what makes the enumeration of the next section lossless. Appendix B proves this proposition and the next one in full, and Appendix C traces the automaton through the example of Figure 1.
2.4 Exhaustive Enumeration and the Recall Guarantee
Running the automaton as a depth-first search and keeping every accepted leaf enumerates the feasible set exactly, as Algorithm 1 sets out. FACET computes the same set with the Round-Robin algorithm for the money-changing problem, the decomposition that SIRIUS also uses, implemented inside the model so that no external program is called. The algorithm scales the masses to integers and builds an extended residue table over the lightest element, hydrogen, which decides in constant time whether a partial sum can still be completed. Every solution is then checked against the exact masses and the RDBE condition. The two procedures return the same set.
Proposition 2 (Recall guarantee). . Therefore, if then is in the candidate set, and candidate-generation recall equals , independently of the scoring model and of any truncation.
Proof sketch. Soundness is Proposition 1. For completeness, neither the tests of eq 6 nor the conservative RDBE test ever prunes a prefix that can still be completed into a feasible formula, so every is reached along its own prefix and accepted at its leaf.
Proposition 2 makes recall a property of the chemical constraints rather than of the scoring model.
Feasible sets vary enormously in size, from a handful of formulas for light precursors to millions for heavy ones. FACET enumerates and scores them in full, at a cost that eq 10 below makes precise. Enumeration runs under a fixed budget, and for the few spectra whose feasible set is estimated to exceed it, FACET falls back to constrained beam search under the same mask, which keeps validity but not completeness. Proposition 2 applies to every spectrum decoded on the exhaustive route.
2.5 A Formula-Free Spectrum Encoder
FACET encodes the spectrum with DreaMS , a Transformer pretrained by self-supervision on millions of unannotated tandem mass spectra. DreaMS treats each of the 60 most intense peaks, and the precursor, as a token described by its m/z and intensity, and it returns an embedding for every peak and a pooled embedding of the whole spectrum,
The encoder sees only the peak list and never a candidate formula, so the correct formula cannot leak into the representation. FACET fine-tunes the encoder end to end together with the rest of the model.
2.6 Scoring the Complete Feasible Set
A small scoring head assigns each candidate a score computed from the pooled spectrum embedding, a learned embedding of the candidate's element counts, and two inexpensive features,
where embeds the count vector and is the candidate's mass error. The head is a three-layer perceptron with 0.21 million parameters. Its mass features cannot separate near-isobars: two candidates that differ by an exchange of for have almost the same mass error and similar RDBE. What separates them is the interaction between the spectrum embedding and the composition embedding , through which the head learns whether a composition is consistent with the fragmentation it observes. The prediction is
The score of eq 8 is evaluated for every candidate, and no candidate is discarded. The cost of ranking splits into two parts,
The encoder, with 96 million parameters, runs once per spectrum, however many candidates there are. The only cost per candidate is the scoring head, about 450 times smaller, which assigns no subformulas to peaks. This is the structural difference from two-stage pipelines: they annotate the fragment peaks of each candidate separately and must prune or truncate the list, whereas FACET keeps every candidate at no extra encoder cost.
2.7 The Autoregressive Decoder
FACET also contains an autoregressive decoder, a four-layer Transformer that predicts the element counts one at a time, in the order , while attending to the per-peak embeddings , with the automaton's mask applied at every step, so every formula it proposes is valid. The decoder extends FACET beyond the enumeration budget. For the rare spectra whose feasible set exceeds the budget, it supplies candidates by constrained beam search, and when the adduct is unknown, its log-likelihood also enters the fused ranking score. Because it shares the encoder pass with the scoring head, it adds little to the cost of training.
2.8 Training Objective
With the adduct known, FACET is trained end to end on four terms,
is the cross-entropy of the decoder's predicted counts under the automaton mask, computed with teacher forcing, in which the decoder sees the correct counts of the preceding elements at every step. Because the mask then depends only on the correct prefix, it is fixed for each training spectrum, and the unmasked outputs remain differentiable. is minus the logarithm of the probability the decoder places on the admissible counts. It matters only early in training, while the mask is applied softly before it is annealed to a hard one. Teacher forcing is mixed with scheduled sampling, which increasingly replaces the correct prefix by the decoder's own choices, so that the decoder also learns to continue from its own mistakes. regresses three coarse properties of the formula from the pooled embedding, namely the total number of atoms, the monoisotopic mass and the H/C ratio, which gives the encoder a dense training signal from the start.
The ranking loss trains the scoring head. It is a softmax cross-entropy of the correct formula against a set of negatives, and the negatives are drawn from FACET's own enumeration of the training spectrum's feasible set, so they are near-isobaric formulas of the kind the head will face at inference. Half of them are the formulas closest in mass to the correct formula and half are sampled from the rest of the set, and no external decomposition tool takes part. When the adduct is unknown, a fifth term, the cross-entropy of the adduct head described below, is added with the same weight as . Checkpoints are selected by top-1 accuracy over the enumerated feasible sets of held-out validation spectra.
2.9 Inference When the Adduct Is Unknown
The adduct is often not known, for instance when MS1-level annotation leaves a feature unresolved. FACET then infers it jointly with the formula, as Figure 1c illustrates. An adduct head on the pooled embedding gives a posterior over the allowed adducts. FACET enumerates the feasible set under every allowed adduct, so the recall guarantee of Proposition 2 holds for the union of the sets, and it ranks (adduct, formula) pairs by the fused score
where is the decoder's log-likelihood of the formula and is a deterministic, parameter-free adduct-plausibility prior that equals for the two in-source water-loss adducts, and , and 0 for every other adduct. The prior expresses a preference for the simpler, intact reading of a spectrum. A water-loss adduct of one formula is the same ion as the protonated adduct of that formula minus H₂O, so the two readings always compete at exactly the same mass, and in-source loss is better treated as the exception than as the rule ⁴³. In the example of Figure 1, the reading of the precursor as C₂₀H₃₂O₅ with [M−H₂O+H]⁺ has the same mass error as C₂₀H₃₀O₄ with [M+H]⁺, and the prior demotes it. The three weights and a temperature for the adduct posterior are calibrated on the validation split, and the fused score is evaluated for the 80 formulas that the scoring head ranks highest under each adduct. The neutral formula is finally obtained by maximizing over adducts, .
3 Experimental Section
3.1 Data Sets
We evaluate on NPLIB1 , a benchmark of 10,709 positive-mode MS/MS spectra annotated with their formula and adduct, covering 8,553 distinct structures and 5,433 distinct formulas. Seven adducts occur. The most common is , with 75% of the spectra, followed by , , , , and . Just over half of the spectra come from quadrupole time-of-flight (Q-ToF) instruments, 14% from Orbitrap instruments and a few from ion traps, and a third carry no instrument annotation. Senior’s parity condition would exclude the annotated formulas of 172 of the 10,702 spectra within FACET’s element space, permanently charged cations recorded with the formula of the cation but annotated as or another even-electron adduct. We use the standard split into 7,727 training, 777 validation and 2,205 test spectra. The split partitions formulas rather than spectra, so no test formula and no test structure occurs in the training data, and every prediction on the test split concerns a formula the model has never seen. Eleven test spectra are excluded for every method: five whose formulas contain silicon or boron, outside the ten elements FACET decodes, and six whose peak lists the spectrum preprocessing could not convert into encoder input. All comparisons are paired over the remaining 2,194 spectra.
For external validation we use CASMI 2022 , a round of the blind CASMI identification challenge . Its 304 positive-mode spectra were all acquired on Orbitrap instruments, with , or adducts. We evaluate 295 of them for every method. The other nine have precursors above 1,000, beyond the input range of the spectrum encoder. CASMI 2022 differs markedly from the NPLIB1 training data, which are 53% Q-ToF and only 13% Orbitrap. For the experiment with additional training data we add 70,022 Orbitrap spectra of 16,476 structures from the NIST 23 tandem library to the NPLIB1 training set. None of them carries a formula of the NPLIB1 test split, which is held out unchanged.
3.2 Baselines
We compare FACET with four methods that represent the approaches of Table 1. All are evaluated on the same spectra against the same annotations. MIST-CF and FIDDLE are trained on the same NPLIB1 split as FACET, and SIRIUS and BUDDY are used as distributed. Appendix G gives every setting.
SIRIUS 6.5.4 is run at its shipped settings, with the true adduct when the adduct is known and with the seven adducts of the data set when it is not. These settings generate candidates in two ways. A bottom-up search assembles formulas from fragment formulas at every precursor mass, without element restrictions, and below m/z 400 a de novo decomposition adds formulas over carbon, hydrogen, nitrogen, oxygen and phosphorus, with sulfur as a fallback when no isotope pattern is available. Other elements, such as chlorine or bromine, enter the decomposition only on isotope-pattern evidence, which these MS1-free spectra cannot provide. SIRIUS scores the candidates by fragmentation trees and reports the best 50, so its recall is the recall of that list. MIST-CF, which scores up to 256 SIRIUS decompositions per spectrum, is the stronger comparison built on SIRIUS.
The adduct-unknown setting is degenerate for SIRIUS. SIRIUS chooses the adduct from MS1 evidence, and without such evidence every adduct reading of one fragmentation tree receives the same score. For 77% of the spectra, the best score is shared by several neutral formulas. SIRIUS breaks these ties by listing first, which gives the right adduct for 65% of the spectra, because three quarters of the split is .
BUDDY is run through msbuddy 0.3.14, its maintained implementation, with the model the package ships and with halogens enabled. It is the only machine-learned baseline not retrained here, so its scorer was trained on its authors' corpus rather than on our split. msbuddy does not decompose the precursor mass. It retrieves candidates by mass from a bundled database of 4.19 million formulas, which contains 98.1% of the correct formulas evaluated here, and adds the formulas it assembles from those that explain the fragments and neutral losses. BUDDY thus draws on knowledge of which formulas occur in known compounds, which the enumerating methods do not have and which, if anything, favors it. Its recall of 0.789 is limited by the length of its own candidate list and lies well below that coverage.
MIST-CF runs its published pipeline. SIRIUS decomposes the precursor under the known adduct within 10 ppm and with its common element limits, which allow at most five sulfur, three phosphorus and one atom of each halogen. A learned filter that reads only the formula then keeps 256 candidates, and the MIST-CF model scores them from their subformula-annotated fragment peaks. In the adduct-unknown setting SIRIUS decomposes the precursor under all seven adducts, and the filter keeps 256 (formula, adduct) pairs across them.
FIDDLE takes the adduct and the collision energy as inputs, so it is evaluated with the adduct known only. NPLIB1 does not record collision energy, so a fixed 35 eV is supplied and the model runs without an input it was designed around. Its adduct scheme has no place for the and spectra, which, together with ten spectra its encoder rejects, leaves 7,662 of the 7,727 training spectra. FIDDLE returns a formula for 2,154 of the 2,194 test spectra, so its low recall reflects the method rather than missing output: FIDDLE regresses one formula and refines it, instead of enumerating candidates.
Two inputs differ across methods and bear on how the numbers read. The first is the precursor value. For 1,410 test spectra, almost two thirds, NPLIB1 records the precursor as the theoretical m/z of the annotated ion, and for 750 it records a measured value. For the remaining 34, the recorded value is inconsistent with the annotated formula and adduct. FACET and FIDDLE read the measured value where one is recorded, SIRIUS and BUDDY read the parent mass of the spectrum file, and MIST-CF reads the precursor of its published benchmark, the theoretical m/z with simulated noise of ppm. The second is the mass window. FACET enumerates within 30 ppm, and SIRIUS, BUDDY and MIST-CF within 10 ppm. On the precursor each method reads, the narrower window excludes seven correct formulas for SIRIUS and BUDDY, lowering their recall by 0.003, and one for MIST-CF.
3.3 Implementation
FACET decodes ten elements in the order C, N, O, P, S, Cl, F, Br, I and H, with per-element maxima set from the training data. Silicon, boron and selenium are not decoded. The encoder is the self-supervised DreaMS model applied to the 60 most intense peaks and fine-tuned end to end at one tenth of the decoder's learning rate. The decoder is a four-layer Transformer decoder with a model width of 512, eight attention heads, a feed-forward width of 2,048 and a dropout rate of 0.2. The mass tolerance is 30 ppm for every spectrum, twice the largest instrument tolerance in the data, 15 ppm, and it is widened to 50 ppm only for an adduct under which no formula fits. Training uses Adam with a learning rate of , a weight decay of and batches of 16 spectra, for at most 60 epochs with early stopping. At inference the feasible set is enumerated exhaustively whenever its estimated size is at most formulas, and constrained beam search of width 64 serves as the fallback. Each model is trained and evaluated on a single NVIDIA L40S GPU. Appendix E lists the remaining settings, including the loss weights, the mask schedule, the construction of the negatives and the calibrated fusion weights.
3.4 Evaluation
We report top- accuracy for and 3, extended to and 10 in Appendix H, and candidate-generation recall. We also report the validity rate, the fraction of returned formulas that lie in the feasible set of the adduct used, and conditional top-1 accuracy, the top-1 accuracy over the spectra whose correct formula is among the candidates, which separates ranking quality from recall. A formula counts as correct only if every element count equals that of the annotated formula. Because all methods are evaluated on the same spectra, two methods are compared with McNemar's paired test, which considers only the spectra on which exactly one of them is correct, and accuracies by precursor mass are shown with Wilson score intervals.
4 Results and Discussion
4.1 FACET Is More Accurate and More Complete on NPLIB1
Table 2 compares FACET with the four baselines on the 2,194 test spectra. With the adduct known, FACET reaches a top-1 accuracy of 0.859, and the strongest baseline, MIST-CF, reaches 0.766. The comparison with MIST-CF can be made spectrum by spectrum: FACET is right where MIST-CF is wrong on 315 spectra, and wrong where MIST-CF is right on 112, a difference that McNemar's test places at . The lead persists at deeper ranks, where FACET's top-3 accuracy is 0.914 and that of MIST-CF 0.879. FACET also has the highest recall of any method, 0.982 compared with 0.959 for MIST-CF, and every formula it returns is valid.
Table 2: Top- accuracy and candidate-generation recall on the NPLIB1 test split ().
| Adduct | Method | Top-1 | Top-2 | Top-3 | Recall |
|---|---|---|---|---|---|
| Known | SIRIUS | 0.599 | 0.721 | 0.780 | 0.912 |
| FIDDLE | 0.641 | 0.667 | 0.675 | 0.678 | |
| BUDDY | 0.736 | 0.767 | 0.776 | 0.789 | |
| MIST-CF | 0.766 | 0.847 | 0.879 | 0.959 | |
| FACET | 0.859 | 0.896 | 0.914 | 0.982 | |
| Unknown | SIRIUS | 0.448 | 0.540 | 0.574 | 0.905 |
| BUDDY | 0.299 | 0.524 | 0.677 | 0.789 | |
| MIST-CF | 0.660 | 0.779 | 0.838 | 0.951 | |
| FACET | 0.729 | 0.867 | 0.893 | 0.994 |
The recall column needs a word of interpretation, because the methods generate candidates so differently. SIRIUS's recall is that of its 50 best candidates after fragmentation-tree scoring, BUDDY's that of its own candidate list, and FIDDLE's that of its refined predictions, which is why FIDDLE's top-3 accuracy and its recall nearly coincide. MIST-CF's recall is limited by its decomposer and its filter, and FACET's only by the few spectra, discussed below, whose recorded precursor places the correct formula outside the mass window or whose feasible set exceeds the enumeration budget.
With the adduct unknown, every method has to infer the adduct as well, and all accuracies drop. FACET still leads, with a top-1 accuracy of 0.729 compared with 0.660 for MIST-CF, a difference that McNemar's test again places far beyond chance, at . Its top-2 accuracy of 0.867 shows that the correct formula is usually its first or second choice. Its recall rises to 0.994, higher than with the adduct known, because enumerating under every adduct also recovers spectra whose recorded precursor matches a different adduct than the annotated one, as discussed below. SIRIUS and BUDDY lose the most accuracy without the adduct, SIRIUS for the reason given in the Experimental Section.
4.2 The Lead Holds on Measured Precursors
NPLIB1 records the precursor of most test spectra as the theoretical of the annotated ion rather than as a measured value, and a theoretical precursor makes ranking unusually easy, because the correct formula then has a mass error of essentially zero. Ranking each enumerated feasible set by mass error alone puts the correct formula first for 1,397 of the 1,403 theoretical-precursor spectra whose correct formula is enumerated, but for only 127 of the 748 measured-precursor spectra. The measured-precursor spectra are therefore the fairest test of ranking quality, and on these 750 spectra FACET still leads MIST-CF. With the adduct known, FACET reaches a top-1 accuracy of 0.771 and MIST-CF 0.723, a difference that is significant at p = 0.005. With the adduct unknown, FACET leads by a similar margin, at 0.745 compared with 0.711 for MIST-CF. Appendix J gives the accuracy of every method by precursor type.
4.3 The Lead Holds Across Adducts, Instruments and Elements
Table 3 breaks the known-adduct accuracy down by adduct type, instrument and elemental composition. FACET’s advantage over MIST-CF holds across the data. It holds for every adduct type with at least 35 spectra, by margins from 0.066 for to 0.286 for , and for each instrument group in the table, including the third of the spectra that carry no instrument annotation. All of these differences are significant on a paired test, and Appendix H gives the test statistics. Orbitrap spectra, which make up only 13% of the training data, still show a wide margin, with FACET at 0.805 and MIST-CF at 0.683.
Elemental composition shows the recall guarantee at work. On the 87 test spectra whose formula contains two or more atoms of one halogen, MIST-CF's decomposer cannot produce the correct formula at all, so its accuracy and recall are zero. FACET keeps every one of these formulas among its candidates and ranks 45% of them first. Over all 221 spectra with a halogenated formula, FACET's recall is 1.000 and that of MIST-CF 0.606. For formulas containing sulfur, FACET is the most accurate method, at 0.704.
4.4 Recall Holds and the Ranking Advantage Widens Above 300 Da
Feasible sets grow steeply with precursor mass. Figure 2 plots their size for the NPLIB1 test spectra: the median set holds 22 formulas below 200 Da and about 360,000 above 800 Da, and it
Table 3: Top-1 accuracy on subsets of the NPLIB1 test split, adduct known. All methods are scored on the same spectra, and the best value in each row is in bold.
| Subset | n | SIRIUS | FIDDLE | BUDDY | MIST-CF | FACET |
|---|---|---|---|---|---|---|
| All spectra | 2,194 | 0.599 | 0.641 | 0.736 | 0.766 | 0.859 |
| 1,650 | 0.630 | 0.614 | 0.702 | 0.751 | 0.833 | |
| 185 | 0.427 | 0.670 | 0.751 | 0.768 | 0.897 | |
| 150 | 0.393 | 0.873 | 0.847 | 0.833 | 0.973 | |
| 167 | 0.695 | 0.760 | 0.940 | 0.892 | 0.958 | |
| 35 | 0.571 | 0.314 | 0.914 | 0.657 | 0.943 | |
| Bruker Q-ToF | 714 | 0.633 | 0.856 | 0.838 | 0.882 | 0.966 |
| Q-ToF, other | 407 | 0.553 | 0.528 | 0.828 | 0.715 | 0.853 |
| Orbitrap | 334 | 0.656 | 0.464 | 0.623 | 0.683 | 0.805 |
| Not annotated | 718 | 0.564 | 0.572 | 0.630 | 0.719 | 0.781 |
| Containing sulfur | 250 | 0.500 | 0.004 | 0.652 | 0.416 | 0.704 |
grows by a factor of 3.6 for every additional 100 Da. With a budget of two million formulas, the exhaustive route handles 99.6% of the test spectra when the adduct is known, and Proposition 2 applies to all of them. The other nine spectra all have precursors above 888 Da and go to beam search. Heavier precursors are therefore where truncation hurts most and where a ranker has the most candidates to tell apart.
Truncating these sets would cost recall that FACET keeps. Keeping only the 256 feasible formulas closest in mass to the precursor would discard 4.6% of the enumerated correct formulas, and 13.1% of those whose precursor is a measured value. Even a list of 1,024 candidates would lose 1.6% and 4.7%, respectively. Limiting element counts, the other way to keep a list short, costs recall as well: it removes the correct formula of all 87 multi-halogen spectra from the candidates of MIST-CF. FACET scores the complete feasible set and so keeps every enumerated correct formula.
Figure 3 compares FACET with MIST-CF in four mass ranges. Panel a shows top-1 accuracy. FACET is ahead in every range, and its margin is largest above 300 Da. Below 300 Da the margin is 0.03, too small to be significant. It rises to 0.11 from 300 to 600 Da and to 0.12 from 600 to 800 Da, and both differences are significant on the paired test. Above 800 Da the margin is again 0.11, but the 64 spectra in that range are too few to establish it.
Panel b separates ranking from recall. It shows the conditional top-1 accuracy, which measures only how well each method ranks the candidates it has. FACET ranks better in every range, and here the margin is much wider above 300 Da, from 0.01 below 300 Da to 0.10, 0.19 and 0.16 in the three heavier ranges. The margin is significant everywhere except in the lightest range, where both methods are close to their ceiling.
The recall guarantee holds on every spectrum it covers. Every spectrum that FACET enumerates exhaustively and whose correct formula lies in its mass window has that formula in its candidate set, 2,151 of 2,151, as Proposition 2 requires, and across the whole of NPLIB1 the automaton admits at every step of its prefix the annotated formula of each of the 10,539 spectra whose formula is feasible, as Appendix B shows. On spectra with a consistent precursor, FACET's recall is therefore 1.000 in every range below 800 Da, whereas that of MIST-CF lies between 0.951 and 0.989, and almost all of its misses are multi-halogen formulas that its decomposer excludes. FACET misses a correct formula only where a spectrum lies outside the guarantee: in five of the nine spectra above 888 Da whose feasible sets exceed the enumeration budget, and in the 34 spectra whose recorded precursor is inconsistent with the annotated formula and adduct. The latter

Figure 2: Feasible sets grow by orders of magnitude with precursor mass. Size of the feasible set against precursor , one point per NPLIB1 test spectrum, with the running median as a solid line. The dashed line marks 256 candidates, the length of the list a pre-filter of that size would keep, and the dotted line marks the enumeration budget. Triangles mark the spectra whose sets exceed the budget.


precursor mass (Da)
Figure 3: FACET's ranking advantage widens above 300 Da. Accuracy of FACET and MIST-CF by precursor mass on NPLIB1, adduct known. (a) Top-1 accuracy. (b) Conditional top-1 accuracy, over the spectra whose correct formula is among the candidates. Points give each method's accuracy with its Wilson 95% interval, and bars and labels give FACET's paired margin with its 95% confidence interval for paired proportions (n.s., not significant).
include 29 permanently charged cations, 26 of them phospholipids, annotated as although their precursor is the mass of the cation, and the 18 of them between 600 and 800 Da lower FACET's recall in that range. MIST-CF recovers most of these spectra because its benchmark derives the precursor from the annotation, and FACET recovers 27 of the 34 when it also enumerates under with the adduct unknown, which is why its recall is higher without the adduct than with it. The comparison is thus decided by ranking, which carries FACET's top-1 accuracy above that of MIST-CF in every range.
4.5 Most Remaining Errors Are Ones That Mass Cannot Resolve
Most of the errors FACET still makes could not have been resolved by mass. We call a top-1 error mass-indistinguishable when the predicted and the correct formula both lie inside the same mass window, so that mass could not have separated them and only the spectrum could. With the adduct known, FACET ranks 310 of the 2,194 spectra wrongly, and 276 of these errors are mass-indistinguishable, so what enumeration and ranking leave behind is almost entirely near-isobaric ambiguity. The exchanges behind these errors are compound and small. The most frequent, C₃N for O₃H₂, accounts for a tenth of them and changes the mass by 2.68 mDa, and the next two, C₂OH₂ for N₃ and CN₄ for O₄H₄, change it by only 1.34 mDa.
Of the 594 errors FACET makes with the adduct unknown, 362 assign the wrong adduct, and most of the others, 203, confuse near-isobars under the correct adduct. Without the adduct, accuracy is thus limited mainly by the assignment of the adduct rather than by the ranking of formulas.
4.6 Enumeration Is Fast and Scoring Stays Affordable
Decomposition is where FACET and SIRIUS can be compared directly, because both implement the Round-Robin algorithm. Table 4 measures both on 120 neutral target masses from the test split, with identical element bounds and a 30 ppm window, on one otherwise idle compute node. On a single thread, FACET's enumerator produces 160,000 formulas per CPU second, and SIRIUS running on sixteen cores produces 125,000. The two take about the same wall-clock time, 51 and 48 s. Given the same sixteen cores, FACET finishes in 16 s, three times faster than SIRIUS, because its enumerator splits the mass window across threads, whereas the wall-clock time of SIRIUS does not respond to the number of cores it is given. FACET's enumerator also runs inside the model and passes its candidates straight to the scoring head, so decoding needs no external program. For the same window SIRIUS returns 11% more formulas, mostly because it admits an RDBE of -0.5 where FACET requires zero or more. Appendix K describes the benchmark in full.
Table 4: Decomposition cost of FACET and SIRIUS 6.5.4 on 120 neutral target masses from the NPLIB1 test split, with identical element bounds and a 30 ppm window.
| FACET (in-process) | SIRIUS 6.5.4 | ||
|---|---|---|---|
| 1 thread | 16 threads | 16 cores | |
| Formulas returned | 8.2M | 8.2M | 9.1M |
| Formulas per CPU second | 160k | 120k | 125k |
| Wall-clock time | 51 s | 16 s | 48 s |
The cost of ranking grows more slowly than the number of candidates, because the encoder pass is shared. Figure 4 plots FACET's decoding time per spectrum against the number of candidates it scores. Below about 190 candidates, scoring costs less than the single encoder pass of 4.6 ms, so a list of the size a top-256 pre-filter would keep costs FACET about as much as encoding the spectrum. Beyond that point the latency grows more slowly than the number of candidates, in proportion to . Scoring candidates takes a median of 3.4 s, and the largest feasible set of the split, 2.0 million formulas, takes 18 s. A per-candidate subformula scorer has to cut any list longer than a few hundred candidates, and such lists are common: 72% of the test spectra have more than 256 feasible formulas.

Figure 4: Scoring every feasible formula stays affordable. FACET's decoding latency per spectrum against the number of candidates scored, NPLIB1 test split. Each point is one spectrum and the solid line is the running median. The dotted line is the cost of one encoder pass, and the dashed line marks 256 candidates.
4.7 Ablations
Table 5 isolates the components behind these results. The first block concerns the enumeration budget. Lowering it from two million to 200,000 formulas, with the same trained model, routes more heavy spectra to beam search and lowers recall from 0.982 to 0.969 and top-1 accuracy from 0.859 to 0.853. The budget, not the scorer, therefore decides how many spectra the recall guarantee covers.
Table 5: Ablations on the NPLIB1 test split.
| Variant | Top-1 | Recall |
|---|---|---|
| Enumeration budget, adduct known | ||
| FACET, formulas | 0.859 | 0.982 |
| formulas | 0.853 | 0.969 |
| Fusion, adduct unknown | ||
| FACET, trained on NPLIB1 | 0.729 | 0.994 |
| without the prior | 0.719 | 0.994 |
| FACET, trained on NIST 23 and NPLIB1 | 0.777 | 0.995 |
| without the prior | 0.731 | 0.995 |
The second block concerns the fusion used when the adduct is unknown. The adduct-plausibility prior raises the top-1 accuracy of the model trained on NIST 23 and NPLIB1 from 0.731 to 0.777, and that of the model trained on NPLIB1 alone from 0.719 to 0.729, and both gains are significant on the paired test. Every spectrum that the prior corrects had been read as an in-source water-loss adduct without it. All variants emit only valid formulas, as Proposition 1 guarantees.
4.8 Recall Transfers Unchanged to CASMI 2022
CASMI 2022 tests FACET under a change of instrument: its spectra are all from Orbitrap instruments, whereas the NPLIB1 training spectra are mostly Q-ToF, and every method reads the same measured precursor. Table 6 reports top-1 accuracy in and out of domain. Its upper block compares the methods as trained on NPLIB1, with SIRIUS and BUDDY as distributed. Its lower block retrains FACET and MIST-CF on NPLIB1 together with the 70,022 Orbitrap spectra from NIST 23, holding out the same NPLIB1 test split, so that the two are compared under matched training. FIDDLE is left out of the table. Its released code does not train the rescoring model that orders its refined candidates, so here they remain in order of mass error, and on measured precursors that order puts a near-isobar first.
Table 6: Top-1 accuracy in domain on NPLIB1 and out of domain on CASMI 2022. Upper block: training on NPLIB1, with SIRIUS and BUDDY as distributed. Lower block: FACET and MIST-CF retrained on NIST 23 and NPLIB1. Best in each column in bold, second best underlined.
| Method | Training set | NPLIB1 (in domain) | CASMI 2022 (external) | ||
|---|---|---|---|---|---|
| known | unknown | known | unknown | ||
| SIRIUS | distributed | 0.599 | 0.448 | 0.780 | 0.620 |
| BUDDY | distributed | 0.736 | 0.299 | 0.790 | 0.414 |
| MIST-CF | NPLIB1 | 0.766 | 0.660 | 0.820 | 0.651 |
| FACET | NPLIB1 | 0.859 | 0.729 | 0.814 | 0.766 |
| MIST-CF | NIST+NPLIB1 | 0.832 | 0.681 | 0.881 | 0.736 |
| FACET | NIST+NPLIB1 | 0.889 | 0.777 | 0.847 | 0.810 |
The two halves of FACET respond to the shift in different ways, as the design predicts. The recall guarantee does not depend on training data at all: FACET's candidate-generation recall on CASMI is 1.000 in both adduct settings and with either training set, the highest of any method. MIST-CF, whose decomposer and filter still discard correct formulas, reaches 0.976 with the adduct known and 0.966 without it, SIRIUS reaches 0.966 in both settings, and FIDDLE, whose recall does not depend on how its candidates are ordered, reaches 0.766. The learned ranker transfers as well, although it benefits from training data closer to the test domain. Trained on NPLIB1 alone, FACET reaches a CASMI top-1 accuracy of 0.814 with the adduct known, close to the 0.820 of MIST-CF, and 0.766 with the adduct unknown, the best of any method in that block.
Under matched training on NIST 23 and NPLIB1, the comparison shows two things. First, FACET leads in the adduct-unknown setting both in and out of domain. Its top-1 accuracies are 0.777 on NPLIB1 and 0.810 on CASMI, compared with 0.681 and 0.736 for MIST-CF, so its accuracy with the adduct unknown does not degrade across the shift in instrument. Second, with the adduct known the ranking advantage depends on the domain. FACET leads in domain, where it reaches 0.889 and MIST-CF 0.832, whereas MIST-CF leads on CASMI, where it reaches 0.881 and FACET 0.847. With the adduct given, this comparison is pure near-isobar discrimination, and
MIST-CF's explicit subformula assignment for each candidate transfers better to a new instrument than FACET's shared encoding, at the price of the correct formulas its filter removes.
4.9 Limitations and Outlook
FACET's advantage is carried by ranking and is largest where feasible sets are large, and so is its cost. Above 888 Da a feasible set can exceed the enumeration budget, and the nine spectra sent to beam search are the only ones whose candidate set falls short of the full feasible set. A larger budget, which the parallel enumerator makes affordable, would extend the guarantee to them. The guarantee is also bounded by the element space: it holds over the ten elements FACET decodes, so a molecule containing silicon, boron or selenium lies outside it. Extending the element space costs enumeration time but no change of method.
The external validation draws a clear line between the two halves of FACET. The recall guarantee, being a property of the constraints, transfers across instruments unchanged, whereas the learned ranker is sensitive to its training domain and improves with training data from the instrument of interest. More generally, the recipe of pairing an exhaustive candidate generator that carries a guarantee with a cheap scorer amortized over the whole candidate set applies to other identification problems with hard constraints.
5 Conclusions
Separating the decision of which formulas to consider from the decision of which to choose resolves the recall-cost tension that shapes current formula identification. Once candidate generation is exact and complete, recall is determined by the chemical constraints alone: it can be checked on every spectrum, and it carries over unchanged to new instruments. Once the expensive part of scoring is shared across candidates, ranking an entire feasible set of millions of formulas becomes affordable, and the correct formula is never removed before it is scored. On NPLIB1 the guarantees cost no accuracy: FACET is both more accurate and more complete than the methods that truncate. The errors that remain are near-isobaric exchanges that mass cannot resolve and, without the adduct, adduct misassignments, so further gains are to be found in reading the fragments more finely and in inferring the adduct. Because no feasible formula is lost, structure elucidation can start from a ranked list of formulas that contains the correct atom set whenever the chemistry admits it.
Acknowledgments
The authors thank Dr. Stephen Stein at the National Institute of Standards and Technology for providing the SDF version of the NIST 23 spectral library for this work. The work was made possible by UNC Charlotte internal funding.
References
[1] Wang, M. et al. Sharing and community curation of mass spectrometry data with Global Natural Products Social Molecular Networking. Nat. Biotechnol. 2016, 34, 828-837, DOI: 10.1038/nbt.3597. [2] Nothias, L.-F. et al. Feature-based molecular networking in the GNPS analysis environment. Nat. Methods 2020, 17, 905-908, DOI: 10.1038/s41592-020-0933-6.
[3] Bushuiev, R.; Bushuiev, A.; Samusevich, R.; Brungs, C.; Sivic, J.; Pluskal, T. Self-supervised learning of molecular representations from millions of tandem mass spectra using DreaMS. Nat. Biotechnol. 2026, 44, 630–640, DOI: 10.1038/s41587-025-02663-3.
[4] da Silva, R. R.; Dorrestein, P. C.; Quinn, R. A. Illuminating the dark matter in metabolomics. Proc. Natl. Acad. Sci. U.S.A. 2015, 112, 12549–12550, DOI: 10.1073/pnas.1516878112.
[5] Horai, H. et al. MassBank: a public repository for sharing mass spectral data for life sciences. J. Mass Spectrom. 2010, 45, 703–714, DOI: 10.1002/jms.1777.
[6] Che, X.; Xu, D.; Du, X. Comparative Analysis of Formula and Structure Prediction from Tandem Mass Spectra. In Data Science: Foundations and Applications (PAKDD 2026), Part II; Wong, R. C.-W., Tong, H., Lu, H., Kwok, J., Salim, F., Song, Y., Yiu, M. L., Eds.; Lecture Notes in Computer Science; Springer: Singapore, 2026; pp 215–227, DOI: 10.1007/978-981-92-1947-6_18.
[7] Kind, T.; Tsugawa, H.; Cajka, T.; Ma, Y.; Lai, Z.; Mehta, S. S.; Wohlgemuth, G.; Barupal, D. K.; Showalter, M. R.; Arita, M.; Fiehn, O. Identification of small molecules using accurate mass MS/MS search. Mass Spectrom. Rev. 2018, 37, 513–532, DOI: 10.1002/mas.21535.
[8] Blaženović, I.; Kind, T.; Ji, J.; Fiehn, O. Software Tools and Approaches for Compound Identification of LC-MS/MS Data in Metabolomics. Metabolites 2018, 8, 31, DOI: 10.3390/metabo8020031.
[9] Schymanski, E. L.; Jeon, J.; Gulde, R.; Fenner, K.; Ruff, M.; Singer, H. P.; Hollender, J. Identifying Small Molecules via High Resolution Mass Spectrometry: Communicating Confidence. Environ. Sci. Technol. 2014, 48, 2097–2098, DOI: 10.1021/es5002105.
[10] Dührkop, K.; Shen, H.; Meusel, M.; Rousu, J.; Böcker, S. Searching molecular structure databases with tandem mass spectra using CSI:FingerID. Proc. Natl. Acad. Sci. U.S.A. 2015, 112, 12580–12585, DOI: 10.1073/pnas.1509788112.
[11] Ruttkies, C.; Schymanski, E. L.; Wolf, S.; Hollender, J.; Neumann, S. MetFrag relaunched: incorporating strategies beyond in silico fragmentation. J. Cheminf. 2016, 8, 3, DOI: 10.1186/s13321-016-0115-9.
[12] 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.; Böcker, S. Systematic classification of unknown metabolites using high-resolution fragmentation mass spectra. Nat. Biotechnol. 2021, 39, 462–471, DOI: 10.1038/s41587-020-0740-8.
[13] Stravs, M. A.; Dührkop, K.; Böcker, S.; Zamboni, N. MSNovelist: de novo structure generation from mass spectra. Nat. Methods 2022, 19, 865–870, DOI: 10.1038/s41592-022-01486-3.
[14] Che, X.; Du, X.; Xu, D. Unlocking High-Fidelity Molecular Generation from Mass Spectra via Dual-Stream Line Graph Diffusion. arXiv 2026, DOI: 10.48550/arXiv.2605.07048.
[15] Che, X.; Du, X.; Xu, D. MARLIN: De Novo Molecular Structure Elucidation from Tandem Mass Spectra without a Ground-Truth Formula. arXiv 2026, DOI: 10.48550/arXiv.2607.04774.
[16] Pellegrin, V. Molecular formulas of organic compounds: the nitrogen rule and degree of unsaturation. J. Chem. Educ. 1983, 60, 626, DOI: 10.1021/ed060p626.
[17] Senior, J. K. Partitions and Their Representative Graphs. Am. J. Math. 1951, 73, 663–689, DOI: 10.2307/2372318.
[18] Kind, T.; Fiehn, O. Seven Golden Rules for heuristic filtering of molecular formulas obtained by accurate mass spectrometry. BMC Bioinf. 2007, 8, 105, DOI: 10.1186/1471-2105-8-105.
[19] Kind, T.; Fiehn, O. Metabolomic database annotations via query of elemental compositions: Mass accuracy is insufficient even at less than 1 ppm. BMC Bioinf. 2006, 7, 234, DOI: 10.1186/1471-2105-7-234.
[20] Pluskal, T.; Uehara, T.; Yanagida, M. Highly Accurate Chemical Formula Prediction Tool Utilizing High-Resolution Mass Spectra, MS/MS Fragmentation, Heuristic Rules, and Isotope Pattern Matching. Anal. Chem. 2012, 84, 4396–4403, DOI: 10.1021/ac3000418.
[21] Tsugawa, H.; Kind, T.; Nakabayashi, R.; YukiHIRA, D.; Tanaka, W.; Cajka, T.; Saito, K.; Fiehn, O.; Arita, M. Hydrogen Rearrangement Rules: Computational MS/MS Fragmentation and Structure Elucidation Using MS-FINDER Software. Anal. Chem. 2016, 88, 7946–7958, DOI: 10.1021/acs.analchem.6b00770.
[22] Dührkop, K.; Fleischauer, M.; Ludwig, M.; Aksenov, A. A.; Melnik, A. V.; Meusel, M.; Dorrestein, P. C.; Rousu, J.; Böcker, S. SIRIUS 4: a rapid tool for turning tandem mass spectra into metabolite structure information. Nat. Methods 2019, 16, 299–302, DOI: 10.1038/s41592-019-0344-8.
[23] Böcker, S.; Lipták, Z. A Fast and Simple Algorithm for the Money Changing Problem. Algorithmica 2007, 48, 413–432, DOI: 10.1007/s00453-007-0162-8.
[24] Dührkop, K.; Ludwig, M.; Meusel, M.; Böcker, S. Faster Mass Decomposition. In Algorithms in Bioinformatics (WABI 2013); Darling, A., Stoye, J., Eds.; Lecture Notes in Computer Science; Springer: Berlin, Heidelberg, 2013; pp 45–58, DOI: 10.1007/978-3-642-40453-5_5.
[25] Böcker, S.; Letzel, M. C.; Lipták, Z.; Pervukhin, A. SIRIUS: decomposing isotope patterns for metabolite identification. Bioinformatics 2009, 25, 218–224, DOI: 10.1093/bioinformatics/btn603.
[26] Böcker, S.; Rasche, F. Towards de novo identification of metabolites by analyzing tandem mass spectra. Bioinformatics 2008, 24, i49–i55, DOI: 10.1093/bioinformatics/btn270.
[27] Rasche, F.; Svatoš, A.; Maddula, R. K.; Böttcher, C.; Böcker, S. Computing Fragmentation Trees from Tandem Mass Spectrometry Data. Anal. Chem. 2011, 83, 1243–1251, DOI: 10.1021/ac101825k.
[28] Böcker, S.; Dührkop, K. Fragmentation trees reloaded. J. Cheminf. 2016, 8, 5, DOI: 10.1186/s13321-016-0116-8.
[29] Ludwig, M.; Nothias, L.-F.; Dührkop, K.; Koester, I.; Fleischauer, M.; Hoffmann, M. A.; Petras, D.; Vargas, F.; Morsy, M.; Aluwihare, L.; Dorrestein, P. C.; Böcker, S. Database-independent molecular formula annotation using Gibbs sampling through ZODIAC. Nat. Mach. Intell. 2020, 2, 629–641, DOI: 10.1038/s42256-020-00234-6.
[30] Xing, S.; Shen, S.; Xu, B.; Li, X.; Huan, T. BUDDY: molecular formula discovery via bottom-up MS/MS interrogation. Nat. Methods 2023, 20, 881–890, DOI: 10.1038/s41592-023-01850-x.
[31] Goldman, S.; Xin, J.; Provenzano, J.; Coley, C. W. MIST-CF: Chemical Formula Inference from Tandem Mass Spectra. J. Chem. Inf. Model. 2024, 64, 2421–2431, DOI: 10.1021/acs.jcim.3c01082.
[32] Goldman, S.; Wohlwend, J.; Stražar, M.; Haroush, G.; Xavier, R. J.; Coley, C. W. Annotating metabolite mass spectra with domain-inspired chemical formula transformers. Nat. Mach. Intell. 2023, 5, 965–979, DOI: 10.1038/s42256-023-00708-3.
[33] Hong, Y.; Li, S.; Ye, Y.; Tang, H. FIDDLE: a deep learning method for chemical formulas prediction from tandem mass spectra. Nat. Commun. 2025, 16, 11102, DOI: 10.1038/s41467-025-66060-9.
[34] Anderson, P.; Fernando, B.; Johnson, M.; Gould, S. Guided Open Vocabulary Image Captioning with Constrained Beam Search. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, Copenhagen, Denmark; Association for Computational Linguistics: Stroudsburg, PA, 2017; pp 936–945, DOI: 10.18653/v1/D17-1098.
[35] Scholak, T.; Schucher, N.; Bahdanau, D. PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Models. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, Online and Punta Cana, Dominican Republic; Association for Computational Linguistics: Stroudsburg, PA, 2021; pp 9895–9901, DOI: 10.18653/v1/2021.emnlp-main.779.
[36] Willard, B. T.; Louf, R. Efficient Guided Generation for Large Language Models. arXiv 2023, DOI: 10.48550/arXiv.2307.09702.
[37] Geng, S.; Josifoski, M.; Peyrard, M.; West, R. Grammar-Constrained Decoding for Structured NLP Tasks without Finetuning. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, Singapore; Association for Computational Linguistics: Stroudsburg, PA, 2023; pp 10932–10952, DOI: 10.18653/v1/2023.emnlp-main.674.
[38] Hokamp, C.; Liu, Q. Lexically Constrained Decoding for Sequence Generation Using Grid Beam Search. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Vancouver, Canada; Association for Computational Linguistics: Stroudsburg, PA, 2017; pp 1535–1546, DOI: 10.18653/v1/P17-1141.
[39] Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A. N.; Kaiser, L.; Polosukhin, I. Attention Is All You Need. In Advances in Neural Information Processing Systems 30; Guyon, I., von Luxburg, U., Bengio, S., Wallach, H., Fergus, R., Vishwanathan, S., Garnett, R., Eds.; Curran Associates, Inc., 2017.
[40] Bengio, S.; Vinyals, O.; Jaitly, N.; Shazeer, N. Scheduled Sampling for Sequence Prediction with Recurrent Neural Networks. In Advances in Neural Information Processing Systems 28; Cortes, C., Lawrence, N., Lee, D., Sugiyama, M., Garnett, R., Eds.; Curran Associates, Inc., 2015.
[41] van den Oord, A.; Li, Y.; Vinyals, O. Representation Learning with Contrastive Predictive Coding. arXiv 2018, DOI: 10.48550/arXiv.1807.03748.
[42] Kuhl, C.; Tautenhahn, R.; Böttcher, C.; Larson, T. R.; Neumann, S. CAMERA: An Integrated Strategy for Compound Spectra Extraction and Annotation of Liquid Chromatography/Mass Spectrometry Data Sets. Anal. Chem. 2012, 84, 283–289, DOI: 10.1021/ac202450g.
[43] Xu, Y.-F.; Lu, W.; Rabinowitz, J. D. Avoiding Misannotation of In-Source Fragmentation Products as Cellular Metabolites in Liquid Chromatography–Mass Spectrometry-Based Metabolomics. Anal. Chem. 2015, 87, 2273–2281, DOI: 10.1021/ac504118y.
[44] Critical Assessment of Small Molecule Identification (CASMI) 2022. http://www.casmi-contest.org/2022/index.shtml, Accessed 2026-10-29.
[45] Schymanski, E. L. et al. Critical Assessment of Small Molecule Identification 2016: automated methods. J. Cheminf. 2017, 9, 22, DOI: 10.1186/s13321-017-0207-1.
[46] NIST23: Updates to the NIST Tandem and Electron Ionization Spectral Libraries. NIST Mass Spectrometry Data Center, National Institute of Standards and Technology: Gaithersburg, MD, 2023; https://www.nist.gov/programs-projects/nist23-updates-nist-tandem-and-electron-ionization-spectral-libraries, Accessed 2026-10-29.
[47] Kingma, D. P.; Ba, J. Adam: A Method for Stochastic Optimization. 3rd International Conference on Learning Representations (ICLR). San Diego, CA, 2015; DOI: 10.48550/arXiv.1412.6980.
[48] McNemar, Q. Note on the Sampling Error of the Difference Between Correlated Proportions or Percentages. Psychometrika 1947, 12, 153–157, DOI: 10.1007/BF02295996.
[49] Wilson, E. B. Probable Inference, the Law of Succession, and Statistical Inference. J. Am. Stat. Assoc. 1927, 22, 209–212, DOI: 10.1080/01621459.1927.10502953.
Appendix
This appendix supports the main article. It explains the notation and the terms used there, proves the two propositions in full, follows the feasibility automaton through a worked example, and describes the enumeration, the model, its training, the data sets and the baseline configurations in more detail than the main text allows. It then reports the results behind the main text in full, including accuracy and recall for every method on subsets of the data, an analysis of the remaining errors and of how the precursor is recorded, the cost of truncating the candidate list, the computational benchmarks, and three representative test spectra.
Unless stated otherwise, all results are on the NPLIB1 test split. Of its 2,205 spectra, 2,194 are evaluated for every method, so every comparison between methods is paired. The eleven spectra left out are of two kinds. Five have annotated formulas that contain silicon or boron, outside the ten elements FACET decodes: three spectra of C₁₆H₁₅F₂N₃Si and one each of C₂₈H₂₃BCl₂F₄N₂O₄ and C₁₉H₂₅BN₄O₄. The other six have peak lists that the spectrum preprocessing could not convert into encoder input.
A Notation and Terminology
Table A.1 collects the symbols of the main text. The paragraphs after it explain the terms from mass spectrometry and from machine learning that the article relies on, for readers who are more familiar with one field than with the other.
Table A.1: Symbols used in the main text.
| Symbol | Meaning |
|---|---|
| tandem mass spectrum: precursor and fragment peaks with and intensity , | |
| adduct, from the set of allowed adducts, and the mass shift it introduces | |
| ordered element set, carbon first and hydrogen last | |
| monoisotopic mass, valence and maximum count of element | |
| molecular formula as a vector of element counts; the correct formula | |
| neutral monoisotopic mass of | |
| neutral target mass, mass tolerance in Da, mass accuracy in ppm | |
| rdbe() | ring-and-double-bond equivalent of |
| feasible set: formulas in the mass window with rdbe and | |
| automaton state after counts: step, accumulated mass, accumulated $\sum_{j | |
| largest mass that elements can still add, | |
| spectrum encoder, its per-peak embeddings and its pooled embedding | |
| score of a candidate formula, and the learned embedding of its counts | |
| mass error of a candidate in ppm | |
| posterior of the adduct head, and decoder log-likelihood of a formula | |
| adduct-plausibility prior, for the two water-loss adducts and 0 otherwise | |
| fused score used when the adduct is unknown, and its weights |
Precursor ion and tandem mass spectrum. In tandem mass spectrometry (MS/MS) an ion of the intact molecule, the precursor, is selected by its mass-to-charge ratio () and fragmented, and the spectrum records the and the intensity of the fragment ions. MS1 denotes the spectrum of the intact ions before fragmentation, which carries the isotope pattern. The spectra used in this work contain MS/MS peaks only.
Adduct. The precursor is not the neutral molecule itself but an ion formed from it. It can be the protonated molecule, , or the molecule with an attached sodium, ammonium or potassium ion, , or . The protonated molecule can also lose one or two water molecules in the ion source, giving or . A permanently charged cation is recorded as . The adduct fixes the mass difference between the neutral molecule and the precursor.
Mass accuracy and mass window. Instruments measure with a relative error of a few parts per million (ppm). A tolerance of ppm on a neutral mass is a window of Da around it, and formulas whose monoisotopic mass falls in this window cannot be told apart by the precursor mass alone. The monoisotopic mass is the mass computed with the most abundant isotope of each element: C, H, N, O, P, S, Cl, F, Br and I.
Ring-and-double-bond equivalent and Senior's conditions. The RDBE is the number of rings plus double bonds that a formula implies. For a formula it equals , with phosphorus counted like nitrogen and halogens like hydrogen. Senior's theorem gives conditions under which atoms of given valences can form a connected molecular graph. The connectivity condition, that the valence sum is at least twice the number of atoms minus two, is equivalent to rdbe , as the main text shows. The parity condition, that the valence sum of an even-electron molecule is even, is not imposed by FACET, for the reason the main text gives.
Near-isobaric formulas. Formulas whose masses differ by less than the mass window, typically through an exchange of atoms of almost equal total mass. Exchanging N for changes the mass by 12.6 mDa, and exchanging for by only 0.49 mDa.
Recall, top- accuracy and conditional top-1 accuracy. Candidate-generation recall is the fraction of spectra whose correct formula is among the candidates a method generates. Top- accuracy is the fraction whose correct formula is among its highest-ranked candidates. Conditional top-1 accuracy is the top-1 accuracy over the spectra whose correct formula is among the candidates, so it measures ranking alone.
Encoder and Transformer. An encoder is a neural network that maps an input, here a spectrum, to vectors that summarize it, called embeddings. A Transformer is a network that processes a set or a sequence of tokens, here the peaks of a spectrum, by letting every token attend to every other one.
Autoregressive decoding, teacher forcing and scheduled sampling. An autoregressive decoder predicts a sequence one element at a time, each prediction conditioned on the previous ones. In FACET the sequence is the element counts of a formula. During training, teacher forcing gives the decoder the true previous counts, and scheduled sampling sometimes gives it its own earlier predictions instead, so that it also learns to continue from its own mistakes.
Beam search. A search that keeps only the most probable partial sequences at every step. It is fast but can lose the correct sequence, which exhaustive enumeration cannot.
Contrastive ranking loss and hard negatives. A ranking loss raises the score of the correct candidate relative to those of incorrect candidates, the negatives. Hard negatives are incorrect candidates that are difficult to distinguish from the correct one, and in FACET they are near-isobaric formulas from the spectrum's own feasible set.
McNemar's test and Wilson interval. McNemar's test compares two methods evaluated on the same items by using only the items on which exactly one of them is correct. The Wilson score interval is a confidence interval for a proportion that stays accurate close to 0 and 1.
B Proofs of Propositions 1 and 2
We write out the automaton's tests in full. For a step , the automaton admits the count at the state if and only if
\begin{align*}(i)&c\leq n_{k},\qquad(ii)M_{k}+c\nu_{k}\leq m_{a}^{*}+\varepsilon_{a},\qquad(iii)(m_{a}^{*}-\varepsilon_{a})-(M_{k}+c\nu_{k})\leq R_{k+1},\ $ iv)&V_{k}+c(v_{k}-2)+U_{k+1}\geq-2,\quad where U_{k+1}=\sum_{j>k}n_{j}\max(v_{j}-2,0).\end{align*}Tests (ii) and (iii) are the mass conditions of the main text, and test (iv) is the conservative connectivity test: is the largest increase of that the remaining elements could still contribute. At the last step, hydrogen, the automaton sets and accepts the formula if and only if , and . Throughout we use that is equivalent to , which follows directly from the definition of the RDBE.
Lemma B.1 (The hydrogen closure is unique). If , at most one integer satisfies , and if one does, it equals round .
Proof. Two integers that both satisfied the bound would give masses at least apart inside a window of width , which is impossible. If satisfies the bound, then , so is the nearest integer to .
The premise holds by a wide margin. With Da, the lemma needs Da, whereas the largest window in this work, at 30 ppm and the heaviest test precursor of 992.5, is 29.8 mDa. The implementation also keeps every window at least 2 mDa wide, a floor that binds only for targets below 67 Da and leaves the premise intact.
Lemma B.2 (The mass tests are necessary). Let and . At the state reached along the prefix of , the count passes tests (i) to (iii).
Proof. Test (i) holds because . All counts and masses are non-negative, so , which is test (ii). Moreover , and since , test (iii) follows.
Lemma B.3 (The connectivity test is necessary). Let and . At the state reached along the prefix of , the count passes test (iv).
Proof. Because , . The terms up to sum to , and the remaining terms satisfy . Hence .
Proposition 1 (Validity by construction). Every complete formula accepted by the automaton lies in .
Proof. A formula is complete only after the hydrogen step. Its counts are non-negative by construction, for by test (i), and by the closure. The closure also requires and , that is, . Every condition of the definition of therefore holds.
Proposition 2 (Recall guarantee). Enum . Consequently is a candidate whenever , and candidate-generation recall equals .
Proof. Proposition 1 gives . For the converse, let . By Lemmas B.2 and B.3, the count is admitted at every step of the depth-first search along the prefix of , so the search reaches the state formed by . There , so Lemma B.1 shows that the closure chooses exactly , and it accepts because and . Hence . The statement about recall follows because the candidate set is on the exhaustive route.
The Round-Robin computation. FACET computes with the Round-Robin decomposition rather than with the depth-first search of Algorithm 1. The decomposition visits every vector of non-negative counts within the bounds whose integer-scaled mass lies in an interval that brackets the window, widened by the largest possible rounding error, and it uses an extended residue table over hydrogen to skip prefixes that cannot be completed. It then keeps exactly the vectors whose exact mass lies in the window and whose RDBE is non-negative, so it returns the same set, and Propositions 1 and 2 hold for it unchanged. The automaton's tests are used for the decoder's masks and for constrained beam search.
A direct check on NPLIB1. We checked the completeness half of Proposition 2 directly on all NPLIB1 spectra: for each of the 10,539 spectra whose correct formula lies in , the automaton admits the correct count at every step of its prefix, as Lemmas B.2 and B.3 require.
C A Worked Example of the Feasibility Automaton
Figure 1 of the main text follows one precursor through FACET. Here we trace the automaton through the same example with the numbers the implementation produces. The precursor has 335.2222 and is observed as with a 30 ppm tolerance, so the neutral target mass is Da and the window extends mDa around it. Table C.1 follows the automaton along the path of .
Carbon comes first and may take any count from 0 to 27: 28 carbon atoms alone would weigh 336 Da and overshoot the window, whereas for any smaller count the elements that follow could still add enough mass to reach the window, which is all that the mass test checks. Once 20 carbon atoms are chosen, nitrogen may take 0 to 6 atoms, and with no nitrogen, oxygen may take 0 to 5. After 20 carbon and 4 oxygen atoms, 30.25 Da remain below the upper end of the window. Phosphorus, at 30.974 Da, and the heavier sulfur, chlorine, bromine and iodine no longer fit, while one fluorine atom, at 18.998 Da, still does. Hydrogen comes last and closes the mass
Table C.1: The feasibility automaton along the path of C₂₀H₃₀O₄ for a precursor at m/z 335.2222, [M+H]⁺, 30 ppm. “Mass before” is the mass of the counts already chosen, and “room” the mass that remains below the upper end of the window.
| Element | Mass before (Da) | Room (Da) | Admissible counts | Count taken |
|---|---|---|---|---|
| C | 0.000 | 334.225 | 0–27 | 20 |
| N | 240.000 | 94.225 | 0–6 | 0 |
| O | 240.000 | 94.225 | 0–5 | 4 |
| P | 303.980 | 30.245 | 0 | 0 |
| S | 303.980 | 30.245 | 0 | 0 |
| Cl | 303.980 | 30.245 | 0 | 0 |
| F | 303.980 | 30.245 | 0–1 | 0 |
| Br | 303.980 | 30.245 | 0 | 0 |
| I | 303.980 | 30.245 | 0 | 0 |
| H | 303.980 | 30.245 | 30 | 30 |
with 30 atoms. The exhaustive search over every admissible path returns 145 formulas, all inside the window. C₂₀H₃₀O₄ lies −0.51 mDa from the target and C₂₁H₂₆N₄ +0.82 mDa, so the two are 1.34 mDa apart and only the spectrum can order them.
The same precursor gives different feasible sets under other adducts. Under [M–H₂O+H]⁺ there are 215 formulas, among them C₂₀H₃₂O₅ at −0.51 mDa: this is the in-source water-loss reading of the very same ion, with exactly the mass error of C₂₀H₃₀O₄ under [M+H]⁺, and it is the reading that the prior demotes. Under [M+Na]⁺ there are 51 formulas, among them C₁₉H₂₈N₄ at −1.58 mDa. When the adduct is unknown, FACET enumerates the feasible set under every allowed adduct in this way and ranks all the resulting (adduct, formula) pairs together.
D Enumeration, Decoding Routes and the Enumeration Budget
Enumeration. FACET’s enumerator implements the Round-Robin decomposition. Masses are scaled to integers by a factor of 100,000, an extended residue table is built over hydrogen, the lightest element, and the search scans the integer masses that bracket the mass window, widened by the largest possible rounding error. Every solution is then checked against the exact masses and the RDBE condition, and the element bounds are enforced inside the recursion. The search is compiled to machine code and can run in parallel, with the integer masses of the window divided among threads. This is what lets FACET’s enumerator use additional cores, as Appendix K shows.
Decoding routes. For every spectrum, and for every adduct when the adduct is unknown, FACET first counts the feasible set with an early exit at a budget of formulas, and with a cap of visited nodes. If the set fits the budget, it is enumerated exhaustively and scored in full. Otherwise FACET falls back to constrained beam search of width 64, driven by the decoder under the automaton mask. If a route returns no candidate, FACET widens the beam to 256, then relaxes the mass tolerance to 50 ppm and enumerates again, and only if that also fails does it return no answer for that adduct. FACET never returns a formula that violates the constraints, whatever the route, and it returns its 10 highest-ranked formulas. Table D.1 shows how often each route is taken and the recall achieved on it.
With the adduct known, no spectrum needs the relaxed tolerance, and 99.6% of the spectra take
Table D.1: Share of test spectra decoded by each route and candidate-generation recall within the route (). A dash marks a route that was never taken.
| Route | Adduct known | Adduct unknown | ||
|---|---|---|---|---|
| Share (%) | Recall | Share (%) | Recall | |
| exhaustive enumeration | 99.59 | 0.984 | 98.36 | 0.997 |
| enumeration, relaxed tolerance | 0.00 | — | 0.91 | 1.000 |
| constrained beam search | 0.41 | 0.444 | 0.73 | 0.625 |
the exhaustive route, on which Proposition 2 applies. The remaining 9 spectra all have precursors above 888, and beam search recovers the correct formula for 4 of them. With the adduct unknown, a spectrum is assigned to the beam route if any of its adducts needed beam search, and to the relaxed route if any needed the relaxed tolerance, so the shares are not directly comparable with those for the known adduct.
Feasible-set sizes. Table D.2 summarizes the sizes of the feasible sets enumerated with the adduct known, which Figure 2 of the main text plots. The median grows by a factor of 3.6 for every 100Da of precursor mass, and 72% of the enumerated sets hold more than 256 formulas.
Table D.2: Sizes of the feasible sets enumerated with the adduct known, by precursor .
| Precursor | Spectra | Median | 90th percentile | Largest | Above 256 (%) |
|---|---|---|---|---|---|
| < 200 | 141 | 22 | 77 | 226 | 0 |
| 200–400 | 1,072 | 364 | 1,642 | 10,513 | 58 |
| 400–600 | 719 | 2,288 | 9,600 | 87,397 | 97 |
| 600–800 | 198 | 24,870 | 163,076 | 1,042,603 | 100 |
| > 800 | 55 | 362,367 | 1,552,008 | 1,997,469 | 100 |
The enumeration budget. The enumeration budget, not the scorer, decides how many spectra the recall guarantee covers. With the same trained model, a budget of formulas sends more heavy spectra to beam search and gives a recall of 0.969 and a top-1 accuracy of 0.853, whereas the budget of used throughout gives 0.982 and 0.859.
E Model Architecture and Training
Architecture. Table E.1 lists the modules of FACET and their parameter counts, read from the trained checkpoint. The encoder is DreaMS, pretrained by self-supervision and fine-tuned here. It reads the 60 most intense peaks of a spectrum together with the precursor, and the output at the precursor token serves as the pooled embedding . The decoder is a Transformer decoder with 4 layers, a model width of 512, 8 attention heads, a feed-forward width of 2048 and a dropout rate of 0.2. Its input at step is the sum of an embedding of the step, an embedding of the count chosen at step , and a projection of embeddings of the adduct and the instrument type. It attends causally to the previous steps and, through cross-attention, to the per-peak embeddings . A linear layer shared by all steps maps the decoder output to logits over the possible counts, and the automaton mask restricts them to the admissible ones. The scoring head maps the count vector, scaled by 1/10, through a linear layer to a 64-dimensional embedding , concatenates it with , the scaled mass error and the scaled RDBE, and applies a three-layer perceptron with GELU activations and 256 hidden units. The auxiliary head regresses the total number of atoms, the monoisotopic mass and the H/C ratio from , and the adduct head predicts the adduct from .
Table E.1: Modules of FACET and their parameter counts.
| Module | Role | Parameters (M) |
|---|---|---|
| DreaMS encoder | spectrum embeddings , ; once per spectrum | 96.080 |
| Autoregressive decoder | beam-search fallback, log-likelihood | 16.955 |
| Scoring head | score of every candidate | 0.215 |
| Auxiliary head | atom count, mass and H/C regression | 0.132 |
| Adduct head | adduct posterior | 0.133 |
| Total | 113.5 |
The encoder has about 447 times as many parameters as the scoring head, which is the only module whose cost grows with the number of candidates.
Element space. FACET decodes ten elements in the order and with the maximum counts C 74, N 15, O 33, P 6, S 9, Cl 7, F 21, Br 4, I 6, H 128. The maxima were set from the training data with headroom, and Appendix F compares them with the largest counts observed in NPLIB1. Silicon, boron and selenium are not decoded.
Training. Table E.2 lists the training settings of the known-adduct model. The mass tolerance during training and inference is the instrument tolerance raised to a floor of 30 ppm, which is 30 ppm for every spectrum, apart from the relaxed route of Appendix D, because no instrument tolerance in the data set exceeds 15 ppm.
Table E.2: Training settings of the known-adduct model.
| Setting | Value |
|---|---|
| Optimizer | Adam, learning rate , weight decay |
| Encoder learning rate | the decoder learning rate |
| Batch size; epochs | 16 spectra; at most 60, early stopping after 12 epochs without improvement |
| Loss weights | , , |
| Label smoothing | 0.05 on the decoder cross-entropy, 0.05 on the ranking loss |
| Automaton mask | soft for 2 epochs, annealed to hard over the next 2 |
| Scheduled sampling | from epoch 4, probability ramped up to 0.25 |
| Negatives per spectrum | 64 per training step, from a pool of 96 |
| Checkpoint selection | top-1 accuracy over enumerated validation feasible sets |
Hard negatives. For each training and validation spectrum, FACET enumerates the feasible set under the true adduct and keeps a pool of 96 negatives: the 48 formulas closest in mass to the correct formula and 48 sampled at random from the rest. The pool is restricted to formulas with at most five sulfur, three phosphorus and one atom of each halogen, because unrestricted near-isobaric enumerations are dominated by halogen-rich formulas that make the contrast too easy. Pools exist for 8,058 of the 8,504 training and validation spectra. The others have feasible sets too large to enumerate within the budget used for building the pools. The restriction applies only to the training negatives: the candidate sets ranked at inference are never restricted.
The adduct-unknown fusion. The temperature of the adduct posterior and the weights , and of the fused score are chosen by a grid search that maximizes top-1 accuracy on the validation split. For the model trained on NPLIB1 the search selects a temperature of , , and , which give a validation top-1 accuracy of 0.783. For the model trained on NIST 23 and NPLIB1 the selected values are 0.75, 0.5, 0.1 and 1, with a validation top-1 accuracy of 0.813. Under each adduct, the fused score is evaluated for the 80 formulas that the scoring head ranks highest, and recall is counted over the full union of the feasible sets.
Hardware. Each model is trained and evaluated on a single NVIDIA L40S GPU with 8 CPU cores and 50 GB of memory.
F Data Sets
NPLIB1. NPLIB1 holds 10,709 positive-mode MS/MS spectra of 8,553 distinct structures and 5,433 distinct formulas. Tables F.1 and F.2 give the adducts and the instrument types in each part of the standard split. The split partitions formulas: the training, validation and test parts contain 3,912, 434 and 1,087 distinct formulas, and the test part shares none of them with the others, so every test formula is new to the model.
Table F.1: Adducts in the NPLIB1 split.
| Adduct | Training | Validation | Test | Total |
|---|---|---|---|---|
| 5,785 | 588 | 1,657 | 8,030 | |
| 741 | 69 | 188 | 998 | |
| 507 | 61 | 150 | 718 | |
| 497 | 43 | 167 | 707 | |
| 142 | 12 | 35 | 189 | |
| 41 | 1 | 5 | 47 | |
| 14 | 3 | 3 | 20 | |
| All | 7,727 | 777 | 2,205 | 10,709 |
Table F.3 shows how often each element occurs and the largest count observed, next to the maximum count FACET admits. Every NPLIB1 formula within the element space fits the bounds. Carbon reaches 66 atoms, below its bound of 74, and hydrogen 112, below its bound of 128.
CASMI 2022. The positive-mode set has 304 spectra, all acquired on Orbitrap instruments, with the adducts 177, 67, 60. We evaluate 295 of them for every method. The other 9, with correct formulas , , , , , , , , have precursors of 1,081 and above, beyond the input range of the spectrum encoder, which accepts precursors up to 1,000.
Table F.2: Instrument types in the NPLIB1 split, as annotated in the data set.
| Instrument | Training | Validation | Test | Total |
|---|---|---|---|---|
| Bruker Q-ToF | 2,478 | 264 | 716 | 3,458 |
| Q-ToF, other | 1,598 | 136 | 410 | 2,144 |
| Orbitrap | 1,021 | 102 | 338 | 1,461 |
| ion trap | 61 | 9 | 21 | 91 |
| FT-ICR | 1 | 0 | 0 | 1 |
| not annotated | 2,568 | 266 | 720 | 3,554 |
Table F.3: Elements in the NPLIB1 formulas: share of formulas that contain the element, largest count observed, and the maximum count FACET admits.
| Element | Share of formulas (%) | Largest count | FACET bound |
|---|---|---|---|
| N | 51.9 | 11 | 15 |
| O | 96.0 | 27 | 33 |
| P | 3.0 | 3 | 6 |
| S | 9.0 | 6 | 9 |
| Cl | 6.6 | 4 | 7 |
| F | 3.2 | 17 | 21 |
| Br | 0.5 | 2 | 4 |
| I | 0.3 | 4 | 6 |
NIST 23. The additional training data are 70,022 Orbitrap spectra of 16,476 distinct structures from the NIST 23 tandem library, with the adducts 45,006, 11,987, 9,354, 1,976, 1,402, 297. None of them carries a formula of the NPLIB1 test split, which is held out unchanged, so the in-domain comparison of models trained with NIST 23 remains a comparison on unseen formulas.
G Baseline Configurations
SIRIUS. SIRIUS 6.5.4 is run through its command-line interface, with -ppm-max=10, -c=50 to keep 50 candidates per spectrum, and a timeout of 600s per compound. With the adduct known, the considered adducts are pinned to the annotated one, and with the adduct unknown they are the seven adducts of the data set. All other settings are the shipped defaults. Under these defaults, candidates come from a bottom-up search at every precursor mass, which is not restricted by the element alphabet, and from a de novo decomposition below 400. The decomposition always considers C, H, N, O and P, adds sulfur as a fallback when no isotope pattern is available, and considers S, Br, Cl, B, Se, Fe, Zn and Mg only when an isotope pattern indicates them, which cannot happen for these MS1-free spectra. SIRIUS's de novo decomposition admits an RDBE of -0.5, one half below FACET's bound. When the adduct is unknown and several adducts tie on the same fragmentation tree, SIRIUS lists first, as the main text describes.
BUDDY. BUDDY is run through msbuddy 0.3.14 with the model the package ships, a tolerance of 10 ppm for both the precursor and the fragments, and halogens enabled. Each spectrum's peak list is reduced to its 256 most intense peaks. With the adduct known, every spectrum is submitted with its annotated adduct. With the adduct unknown, it is submitted once under each of the data set's adducts, and the candidates from all adducts are ranked together by their scores. msbuddy retrieves candidates by mass from a bundled database of formulas of known compounds, adds the formulas it assembles from those that explain the fragments and neutral losses, and keeps at most 350 of them for each adduct it is run under.
MIST-CF. MIST-CF runs its published pipeline with a model trained on the NPLIB1 training split. SIRIUS decomposes the precursor within 10 ppm, under the annotated adduct when it is known and under all seven adducts when it is not, with the common element limits of at most five sulfur, three phosphorus and one atom of each of fluorine, chlorine, bromine and iodine. A learned filter that reads only the formula keeps 256 candidates, subformulas are assigned to the 100 most intense fragment peaks of each candidate, and the MIST-CF model scores the candidates. MIST-CF reads the precursor of its published benchmark, the theoretical of the annotated ion with simulated noise.
FIDDLE. FIDDLE is retrained on the NPLIB1 training split with its own preprocessing, which keeps 7,662 of the 7,727 training spectra: its adduct scheme has no place for the 55 and spectra, and its encoder rejects 10 more. NPLIB1 does not record collision energy, so 35 eV is supplied for every spectrum. FIDDLE's released code trains its spectrum network but not its rescoring model, so FIDDLE runs as the network's prediction followed by its formula refinement, with the rescoring model replaced by a constant score that keeps the refinement order, which is the order of mass error.
H Accuracy and Recall in Detail
Table H.1 extends Table 2 of the main text to top-10 accuracy. Table H.2 gives FACET's accuracy and recall by precursor mass in both adduct settings. Table H.3 breaks the top-1 accuracy down by adduct type, instrument type and composition for every method, and its last two columns give FACET's paired top-1 margin over MIST-CF and the exact McNemar -value.
Table H.1: Top- accuracy and candidate-generation recall on the NPLIB1 test split ().
| Adduct | Method | Top-1 | Top-2 | Top-3 | Top-5 | Top-10 | Recall |
|---|---|---|---|---|---|---|---|
| known | SIRIUS | 0.599 | 0.721 | 0.780 | 0.833 | 0.873 | 0.912 |
| FIDDLE | 0.641 | 0.667 | 0.675 | 0.678 | 0.678 | 0.678 | |
| BUDDY | 0.736 | 0.767 | 0.776 | 0.783 | 0.788 | 0.789 | |
| MIST-CF | 0.766 | 0.847 | 0.879 | 0.907 | 0.932 | 0.959 | |
| FACET | 0.859 | 0.896 | 0.914 | 0.931 | 0.946 | 0.982 | |
| unknown | SIRIUS | 0.448 | 0.540 | 0.574 | 0.655 | 0.750 | 0.905 |
| BUDDY | 0.299 | 0.524 | 0.677 | 0.726 | 0.765 | 0.789 | |
| MIST-CF | 0.660 | 0.779 | 0.838 | 0.887 | 0.927 | 0.951 | |
| FACET | 0.729 | 0.867 | 0.893 | 0.912 | 0.936 | 0.994 |
Recall shows FACET's advantage where candidate generation matters most. For the 221 spectra with a halogenated formula, FACET's recall is 1.000 and that of MIST-CF 0.606. For the 87 spectra whose formula has two or more atoms of one halogen, which MIST-CF's decomposer excludes, the two recalls are 1.000 and 0.000.
Table H.2: FACET's top- accuracy and recall by precursor , in both adduct settings.
| Precursor | Adduct known | Adduct unknown | |||||||
|---|---|---|---|---|---|---|---|---|---|
| Top-1 | Top-3 | Top-10 | Recall | Top-1 | Top-3 | Top-10 | Recall | ||
| < 300 | 536 | 0.924 | 0.961 | 0.987 | 0.996 | 0.841 | 0.951 | 0.983 | 0.996 |
| 300–600 | 1,396 | 0.860 | 0.919 | 0.954 | 0.991 | 0.704 | 0.898 | 0.942 | 0.998 |
| 600–800 | 198 | 0.768 | 0.854 | 0.864 | 0.909 | 0.687 | 0.798 | 0.864 | 0.995 |
| > 800 | 64 | 0.562 | 0.609 | 0.688 | 0.891 | 0.469 | 0.594 | 0.641 | 0.891 |
Table H.3: Top-1 accuracy on subsets of the NPLIB1 test split, adduct known, with FACET's paired margin over MIST-CF and the McNemar -value.
| Subset | SIRIUS | FIDDLE | BUDDY | MIST-CF | FACET | |||
|---|---|---|---|---|---|---|---|---|
| all spectra | 2,194 | 0.599 | 0.641 | 0.736 | 0.766 | 0.859 | +0.093 | |
| 1,650 | 0.630 | 0.614 | 0.702 | 0.751 | 0.833 | +0.082 | ||
| 185 | 0.427 | 0.670 | 0.751 | 0.768 | 0.897 | +0.130 | ||
| 150 | 0.393 | 0.873 | 0.847 | 0.833 | 0.973 | +0.140 | ||
| 167 | 0.695 | 0.760 | 0.940 | 0.892 | 0.958 | +0.066 | 0.003 | |
| 35 | 0.571 | 0.314 | 0.914 | 0.657 | 0.943 | +0.286 | 0.002 | |
| Bruker Q-ToF | 714 | 0.633 | 0.856 | 0.838 | 0.882 | 0.966 | +0.084 | |
| Q-ToF, other | 407 | 0.553 | 0.528 | 0.828 | 0.715 | 0.853 | +0.138 | |
| Orbitrap | 334 | 0.656 | 0.464 | 0.623 | 0.683 | 0.805 | +0.123 | |
| not annotated | 718 | 0.564 | 0.572 | 0.630 | 0.719 | 0.781 | +0.063 | |
| containing sulfur | 250 | 0.500 | 0.004 | 0.652 | 0.416 | 0.704 | +0.288 |
I The Errors That Remain
Per-element count error. Table I.1 reports, for each element, the mean signed and mean absolute difference between the counts of the top-1 and the correct formula. A systematic bias would show as a large signed error. The largest is that of hydrogen, which is decoded last and closes the mass, so every exchange that involves hydrogen, such as the most frequent one, C₃N for O₃H₂, shows in its count.
Near-isobaric exchanges. A top-1 error is mass-indistinguishable when the predicted and the correct formula both lie inside one mass window, so that mass could not have separated them. With the adduct known, FACET ranks 310 of the 2,194 spectra wrongly, and 276 of these errors, or 89%, are mass-indistinguishable. With the adduct unknown, 61% of its 594 errors assign the wrong adduct, and 34% are near-isobaric confusions under the correct adduct. Table I.2 lists the element-count differences behind the mass-indistinguishable errors. They are rarely the textbook single exchanges: the most frequent are compound exchanges with mass gaps of a few millidaltons or less, well inside the 30 ppm window.
Validity and adduct accuracy. Validity asks whether a returned formula lies in the feasible set of the adduct the model used, which the automaton guarantees: FACET's validity rate is 1.000 in both adduct settings. Adduct accuracy is a different quantity. With the adduct unknown, FACET's adduct accuracy is 0.835, and checking the top-1 formula against the annotated adduct instead of the inferred one would measure this adduct accuracy, not validity.
Table I.1: Mean signed and mean absolute error in the atom counts of the top-1 formula, per element ().
| Element | Adduct known | Adduct unknown | ||
|---|---|---|---|---|
| Signed | Absolute | Signed | Absolute | |
| C | +0.022 | 0.351 | -0.094 | 0.373 |
| N | -0.007 | 0.227 | -0.037 | 0.217 |
| O | +0.057 | 0.282 | +0.086 | 0.414 |
| P | -0.015 | 0.021 | -0.015 | 0.021 |
| S | -0.013 | 0.057 | +0.000 | 0.065 |
| Cl | +0.018 | 0.061 | +0.005 | 0.055 |
| F | +0.008 | 0.072 | +0.020 | 0.089 |
| Br | -0.001 | 0.004 | +0.001 | 0.007 |
| I | -0.006 | 0.008 | -0.005 | 0.008 |
| H | -0.147 | 0.408 | -0.293 | 0.717 |
Table I.2: The most frequent element-count differences between the top-1 and the correct formula among the mass-indistinguishable errors. “Gap” is the mass difference of the exchange.
| Setting | Exchange (top-1 ↔ correct) | Gap (mDa) | Count | Share of errors (%) |
|---|---|---|---|---|
| adduct known | 2.68 | 28 | 10.1 | |
| adduct known | 1.34 | 26 | 9.4 | |
| adduct known | 1.34 | 13 | 4.7 | |
| adduct known | 1.54 | 12 | 4.3 | |
| adduct known | 0.49 | 11 | 4.0 | |
| adduct known | 1.14 | 9 | 3.3 | |
| adduct unknown | 2.68 | 21 | 10.3 | |
| adduct unknown | 1.34 | 16 | 7.9 | |
| adduct unknown | 0.49 | 14 | 6.9 | |
| adduct unknown | 1.34 | 10 | 4.9 | |
| adduct unknown | 5.18 | 8 | 3.9 | |
| adduct unknown | 1.54 | 8 | 3.9 |
J Precursor Provenance
NPLIB1 records the precursor of 1,410 evaluated test spectra as the theoretical of the annotated ion and of 750 as a measured value, which lies within 30 ppm of the theoretical one. For 34 spectra the recorded precursor lies more than 30 ppm from the annotated formula and adduct. FACET and FIDDLE read the measured value where one is recorded, SIRIUS and BUDDY read the parent mass of the spectrum file, and MIST-CF reads the precursor of its published benchmark, the theoretical with simulated noise. On the measured-precursor spectra, the value FACET reads lies a median of 0.9 ppm from the theoretical , and the value MIST-CF reads lies 1.5 ppm from it.
The provenance matters for ranking. Ranking each enumerated feasible set by mass error alone puts the correct formula first for 1,397 of the 1,403 theoretical-precursor spectra whose correct formula is enumerated, but for only 127 of the 748 measured-precursor spectra, so the measured-precursor spectra are where ranking quality is tested on equal terms. On them FACET leads MIST-CF in top-1 accuracy by 0.048 with the adduct known and by 0.035 with it unknown, with McNemar p-values of 0.0055 and 0.062. Table J.1 gives accuracy and recall for every method by precursor type.
Table J.1: Top-1 accuracy and candidate-generation recall by how the precursor is recorded.
| Adduct | Method | Theoretical | Measured | Inconsistent | |||
|---|---|---|---|---|---|---|---|
| Top-1 | Recall | Top-1 | Recall | Top-1 | Recall | ||
| known | SIRIUS | 0.635 | 0.931 | 0.556 | 0.913 | 0.029 | 0.088 |
| FIDDLE | 0.716 | 0.723 | 0.529 | 0.623 | 0.000 | 0.000 | |
| BUDDY | 0.841 | 0.879 | 0.569 | 0.651 | 0.059 | 0.059 | |
| MIST-CF | 0.793 | 0.966 | 0.723 | 0.947 | 0.618 | 0.912 | |
| FACET | 0.926 | 0.996 | 0.771 | 1.000 | 0.000 | 0.000 | |
| unknown | SIRIUS | 0.428 | 0.923 | 0.503 | 0.909 | 0.029 | 0.088 |
| BUDDY | 0.375 | 0.879 | 0.168 | 0.651 | 0.029 | 0.059 | |
| MIST-CF | 0.638 | 0.960 | 0.711 | 0.943 | 0.500 | 0.765 | |
| FACET | 0.738 | 0.996 | 0.745 | 1.000 | 0.000 | 0.794 | |
Of the 34 spectra with an inconsistent precursor, 29 are permanently charged cations, 26 of them phospholipids, which are annotated as although their precursor is the mass of the cation. The other 5 lie 99 to 10,071 ppm from every allowed adduct. MIST-CF recovers most of them because its benchmark derives the precursor from the annotation. With the adduct unknown, FACET also enumerates under and places 27 of the 34 correct formulas among its candidates.
K Truncation, Decomposition Cost and Latency
The cost of truncation. Two-stage pipelines shorten the candidate list before their expensive scorer runs. To measure what this costs independently of any particular filter, we rank each enumerated feasible set by mass error alone and ask how often the correct formula survives a cut to the formulas closest in mass. Figure K.1 and Table K.1 give the answer for the 2,151 test spectra whose correct formula is enumerated, and separately for the 748 with a measured precursor. A cut to 256 candidates loses 4.6% of the correct formulas, and 13.1% of those with a measured precursor. Scoring the full feasible set, as FACET does, keeps all of them.
Table K.1: Share of enumerated correct formulas kept by a mass-error pre-filter of size .
| All spectra | Measured precursor | |
|---|---|---|
| 1 | 0.709 | 0.170 |
| 64 | 0.881 | 0.659 |
| 128 | 0.923 | 0.778 |
| 256 | 0.954 | 0.869 |
| 512 | 0.974 | 0.925 |
| 1,024 | 0.984 | 0.953 |
| full set | 1.000 | 1.000 |

Figure K.1: Share of enumerated correct formulas kept by a cut to the feasible formulas closest in mass, for all test spectra and for those with a measured precursor.
Decomposition benchmark. Table 4 of the main text compares the decomposers of FACET and SIRIUS 6.5.4 on 120 neutral target masses from the test split, with a 30 ppm window and the same element bounds for both, namely C 0–74, N 0–15, O 0–33, P 0–6, S 0–9, Cl 0–7, F 0–21, Br 0–4, I 0–6, H 0–128. Both ran on one otherwise idle compute node. FACET on one thread returned 8,174,842 formulas in 51.3 s of wall-clock time and 51.1 s of CPU time, or 159,863 formulas per CPU second. With sixteen threads it took 15.8 s and 68.0 s of CPU time, used 4.3 cores on average and produced 120,160 formulas per CPU second. SIRIUS, given sixteen cores in one batch call, returned 9,060,070 formulas in 47.7 s and 72.7 s of CPU time. It used 1.5 cores on average and produced 124,574 formulas per CPU second. On the 10 heaviest masses alone, its wall-clock time did not respond to its core allocation, taking 40.3 s on 3, 40.9 s on 8 and 40.0 s on 16 cores. Across 4 repetitions of the benchmark, FACET's single-thread wall-clock time ranged over 50.4–51.3 s, that of SIRIUS over 47.0–48.7 s, and SIRIUS's throughput over 113,000–125,000 formulas per CPU second. SIRIUS returns 11% more formulas for the same window, mostly because its RDBE filter admits −0.5, and in part because one of the masses exceeds FACET's enumeration budget, so that FACET returns its formulas only up to the budget. In the decoding pipeline such a mass is routed to beam search instead.
Latency. Decoding latency was measured per spectrum on 2,176 test spectra, all of them decoded exhaustively. The encoder pass takes a median of 4.6 ms, independent of the number of candidates. Spectra with at most 256 candidates take a median of 7.9 ms in total. Beyond that size, the binned median latency grows in proportion to . Spectra with about candidates take a median of 3.4 s, and the largest feasible set of the split, 2.0 million formulas, takes 17.6 s.
L Representative Spectra
Table L.1 shows three test spectra, each chosen by a fixed rule to illustrate one aspect of FACET. Case (a) has a correct formula with two or more atoms of one halogen, which MIST-CF's decomposer cannot produce and FACET ranks first. Case (b) has a measured precursor and a correct formula that is not among the 256 feasible formulas closest in mass, yet is ranked first by FACET. Case (c) has a measured precursor and a runner-up, a near-isobar within 3 mDa of the correct formula, that lies closer to the precursor in mass, and FACET still ranks the correct formula first. Each rule picks the most pronounced instance in the test split: for (a) the largest feasible set, for (b) the worst mass-error rank of the correct formula among spectra with feasible sets of up to 400,000 formulas, and for (c) the largest mass-error advantage of the runner-up.
Table L.1: Three representative test spectra, adduct known. is the size of the feasible set and “Rank” the rank FACET gives the correct formula. FACET’s three highest-ranked formulas are given with their mass errors in ppm.
| Correct formula | Adduct | Rank | FACET top three | MIST-CF top-1 | |||
|---|---|---|---|---|---|---|---|
| (a) | 521.1490 | 12,625 | 1 | (0.4), (2.6), (0.1) | (correct formula absent) | ||
| (b) | 675.2810 | 15,587 | 1 | (5.2), (3.5), (0.1) | |||
| (c) | 267.1730 | 84 | 1 | (10.1), (0.0), (15.1) |
In case (a), mometasone furoate () carries two chlorine atoms. Its feasible set holds 12,625 formulas, and FACET ranks the correct formula first. MIST-CF’s decomposer admits at most one atom of each halogen, so the correct formula never enters its candidate list, and it returns instead.
In case (b), is recorded with a measured precursor 5.2 ppm from its theoretical . Its feasible set holds 15,587 formulas, and by mass error alone the correct formula ranks only 2,715th, so a pre-filter keeping the 256 formulas closest in mass would have discarded it. FACET scores the entire set and ranks it first.
In case (c), practolol () is recorded with a precursor 10.1 ppm from its theoretical , while the runner-up, , matches the precursor to within 0.003 ppm. The two differ by 2.68 mDa, an exchange of for . Mass error alone would rank the runner-up first, but the spectrum leads FACET to the correct formula.