Source-linked AI summary
Transferable Mass Spectrum Prediction via Reference-Guided Test-time Specialization
Yunhua Zhong, Runting Li, Yifan Li, Pan Liu, Zhiwen Yang, Zikun Wang, Yixuan Tang, Jun Xia
TL;DR
Pretrained MS/MS predictors face chemical and acquisition shifts, while measured target spectra may be unavailable for adaptation. SPARC specializes a pretrained predictor using retrieved reference spectra and reliability-aware consistency; it improves spectral prediction across benchmark transfer settings and application libraries.
Problem
Pretrained predictors depend on training chemistry and acquisition distributions, limiting confidence that broad training coverage will yield accurate predictions for a particular study domain.
Source: §1 · p. 1Method
SPARC retrieves chemically related labeled spectra to adapt fragment intensities within the pretrained fragmentation space, weighting teacher consistency by support reconstruction errors.
Source: §1 · p. 2, §7 · p. 10Results
Across benchmark transfer settings, SPARC improves spectral similarity; on MSG→MSG-MNa, EntSim rises from 0.180 to 0.274 and CosSim from 0.280 to 0.370 versus the pretrained MSG checkpoint.
Source: §5.2 · p. 7, §7 · p. 10Takeaways & Limitations
Reference-guided specialization can extend pretrained predictors to specific chemical and acquisition domains, with online continuation providing further gains.
Source: §7 · p. 10SPARC cannot recover diagnostic fragments omitted by its frozen pretrained fragment generator and is limited to reweighting candidate fragments.
Source: §6 · p. 9
Abstract
from arXiv · showhide
Tandem mass spectrum prediction supports compound identification across metabolomics, natural-product discovery, and environmental analysis. However, pretrained predictors often degrade under shifts in chemical space and acquisition conditions, while retraining domain-specific models from scratch is costly. We introduce SPARC, a retrieval-guided test-time specialization framework that adapts a pretrained predictor using a spectral reference library without accessing test-query spectra. For each target query, SPARC retrieves chemically related reference spectra to recalibrate fragment intensities within the learned fragmentation space. During Transfer, SPARC combines reference-guided spectral adaptation with reliability-aware consistency, using reconstruction behavior on retrieved spectra to selectively preserve trustworthy predictions during continual specialization. Across MassSpecGym, NPLIB1 and application-specific GNPS libraries, SPARC improves spectral prediction under multiple transfer settings. These results establish retrieval-guided test-time specialization as a practical strategy for extending pretrained MS/MS predictors to specific chemical and acquisition domains, with continual test-time training providing further refinement during deployment.
1 INTRODUCTION
Pretrained MS/MS predictors can lose accuracy when target chemistry and acquisition conditions differ from training, and measured target spectra may be unavailable. SPARC uses related reference spectra to specialize predictions while constraining adaptation, improving results across benchmark transfers and application libraries.
1 INTRODUCTION
- Chemical and acquisition shifts can undermine prediction because deployment domains emphasize different molecules, adducts, instruments, ionization modes, and collision energies than broad training collections.Adduct-dependent fragmentation and missing paired spectra can create coverage and chemical-composition gaps.Source: §1 · p. 1
- Reference spectra provide an external signal that entropy-based adaptation lacks: entropy does not indicate whether predicted peaks occur at the correct locations.Target structures identify the queried chemical region but do not specify how predictions should change.Source: §1 · p. 2
- SPARC retrieves chemically related labeled spectra to supervise target-specific adaptation and uses support reconstruction errors to weight teacher–student consistency.An EMA teacher, stochastic restoration, and rollback constrain continual updates.Source: §1 · p. 2
- Across MassSpecGym, NPLIB1, and five application-specific GNPS collections, SPARC improves benchmark transfer, entropy similarity, and peak-level precision and F1-score.Peak-level gains occur within the preserved candidate space.Source: §1 · p. 2
2 RELATED WORK
Prior work spans spectrum interpretation and prediction, test-time adaptation, and the growth of heterogeneous spectral libraries and curated benchmarks. SPARC builds on these areas by targeting specialization to application-specific chemical and acquisition domains.
2 RELATED WORK
- Molecule-to-spectrum methods range from direct spectrum regression to graph-based fragmentation and structured probabilistic models, alongside spectrum-interpretation systems such as SIRIUS.Examples include NEIMS, 3DMolMS, GrAFF-MS, Iceberg, FIORA, MassFormer, and FraGNNet.Source: §2 · p. 3
- Test-time training includes entropy minimization, teacher averaging, and molecular-structure self-supervision, with prior applications in peptide-spectrum prediction and spectrum-guided molecule generation.Examples include TENT, CoTTA, and TAIP.Source: §2 · p. 3
- Public spectral repositories offer broad but heterogeneous coverage, while curated benchmarks and application-specific collections represent distinct compounds, adducts, ionization modes, and scientific settings.The paper curates five application-grounded GNPS target domains.Source: §2 · p. 3
3 METHOD
SPARC specializes a pretrained MS/MS predictor from labeled reference spectra without using measured test-query spectra for adaptation. It preserves the source fragmentation space while updating intensities through condition-aware retrieval, support supervision, reliability-weighted consistency, and drift controls.
3 METHOD
- SPARC predicts non-negative intensities over fixed m/z-resolution bins from a molecule and its acquisition metadata, and adapts a pretrained model without using measured test-query spectra in the objective.Deployment may use target validation labels for update acceptance and checkpoint selection, or an entropy guard when validation labels are unavailable.Source: §3 · p. 3
3.1 FRAGMENT-SPACE PRESERVING ADAPTATION
- SPARC freezes Iceberg’s fragment generator and adapts only its intensity model, reallocating intensity among candidate fragments in the existing fragmentation space.The generator supplies a fixed fragmentation prior; adaptation emphasizes characteristic fragments and suppresses less relevant candidates.Source: §3.1 · pp. 3–4
3.2 CONDITION-AWARE CHEMICAL RETRIEVAL
- For each query, SPARC ranks adduct-compatible references by chemical similarity, prioritizes instrument matches, and uses similarity-weighted support reconstruction to anchor adaptation in measured spectra.It falls back to global retrieval only when the adduct-compatible pool is empty; collision energy and precursor m/z are not hard filters.Source: §3.2 · p. 4
3.3 SUPPORT-CALIBRATED TEACHER CONSISTENCY
- Support reconstruction errors set bin-wise teacher-consistency weights, weakening constraints where the teacher reconstructs retrieved spectra poorly.Support errors are averaged uniformly over the retrieved set, while retrieval-similarity weights modulate supervised reconstruction; these weights are not calibrated probabilities of query-fragment correctness.Source: §3.3 · pp. 4–5
3.4 CONTINUAL UPDATES AND DRIFT CONTROL
- Continual updates carry accepted student and teacher states across queries, using stochastic restoration and rollback to constrain drift.With validation spectra, rollback checks post-update CosSim against a fraction of its pre-update value; without them, an entropy guard rejects updates that abruptly broaden predicted intensity distributions.Source: §3.4 · p. 5
4 EXPERIMENTS
SPARC is evaluated on adduct-focused and cross-library transfers using MassSpecGym, NPLIB1, and five application-specific GNPS libraries. The experiments define spectral-fidelity and peak-quality metrics, adaptation protocols, and predictor and adaptation baselines.
Datasets and benchmarks
- Evaluation covers MSG-to-MSG-MNa adduct specialization, MSG-to-NPLIB1 transfer, and five GNPS collections spanning forensic toxicology, lipid and acyl-amide chemistry, bile-acid conjugates, and approved pharmaceuticals.For GNPS, MSG training spectra serve as reference support and target spectra are reserved for evaluation; support molecules sharing test or validation Murcko scaffolds are excluded before retrieval.Source: §4 · p. 6
Evaluation
- Benchmark comparisons use cosine similarity, Jensen–Shannon entropy similarity, and mean squared error, with peak-presence and ion-current quality assessed by precision, recall, and F1 after exact-bin matching.Scoring retains the 100 highest-intensity predicted bins; entropy is an auxiliary diagnostic, and coverage is reported in Supplementary.Source: §4 · p. 6
Implementation details and baselines
- SPARC retrieves 64 support spectra per query, optimizes with Adam at a 1 × 10−4 learning rate, and uses the student model for prediction.Molecular representations concatenate 2,048 radius-2 Morgan fingerprint bits and 3,072 hashed atom-pair bits; the support-loss coefficient is λsup = 1.Source: §4 · p. 6
- Predictor baselines are NEIMS, GrAFF-MS, FIORA, and pretrained Iceberg, while source-free adaptation baselines are TENT and CoTTA applied to Iceberg.Architectural details are reported in Supplementary.Source: §4 · p. 6
Adaptation protocols
- MSG and NPLIB1 protocols use labeled target-training spectra for support, while GNPS uses MSG-training spectra as references; measured test-query spectra are excluded from adaptation and checkpoint decisions.SPARC(val) uses target-validation spectra for rollback and checkpoint selection before evaluation without test-time updates; SPARC–TTT continues adapting on test-query structures and acquisition metadata with entropy-based rollback.Source: §4 · p. 6
5 RESULTS
SPARC improves transfer and within-domain prediction, while peak-level analyses show more accurate intensity allocation and application-library gains. Results also show locally clustered prediction accuracy and identify similarity-based support retrieval as the most influential tested component.
5.1 PREDICTION HETEROGENEITY AND SPECTRAL DOMAIN SHIFTS
- Prediction accuracy varies locally in both molecule and spectral spaces, with high- and low-accuracy regions within every split.Only 19.0% of molecules with M+H spectra also have M+Na spectra; matched molecules often share no peaks or few neutral losses.Source: §5.1 · pp. 6–7, Figure 2 · p. 7
5.2 SPARC SPECIALIZES ACROSS AND WITHIN DOMAINS
- MSG→MSG-MNa EntSim/CosSim rose from 0.180/0.280 to 0.274/0.370; MSG→NPLIB1 rose from 0.470/0.517 to 0.559/0.630 after specialization.Validation-guided specialization provided the main gain in both transfer settings.Source: Table 1 · p. 7, §5.2 · p. 7
- SPARC improved EntSim and CosSim within MSG M+H from 0.462/0.529 to 0.505/0.547 and within NPLIB1 from 0.521/0.586 to 0.565/0.628.The gains occurred even when the backbone was trained on the target domain.Source: Table 2 · p. 8, §5.2 · p. 8
5.3 SPARC IMPROVES SPECTRAL PURITY BY SUPPRESSING SPURIOUS PEAKS
- At full recoverable coverage, SPARC has higher purity than Iceberg, with less unsupported predicted intensity for comparable experimental signal recovery.The comparison adds peaks in descending predicted-intensity order across 25%, 50%, 75%, and 100% recoverable coverage levels.Source: §5.3 · p. 8
- SPARC and SPARC–TTT improve intensity-weighted precision and F1, while ranking metrics indicate better prioritization of supported peaks and relative-intensity ordering.The peak-quality evaluation retains the 100 highest-intensity predicted bins and removes peaks below 1% of the predicted base-peak intensity.Source: Table 3 · p. 8, §5.3 · p. 8
5.4 SPARC TRANSFERS TO APPLICATION-SPECIFIC TARGET DOMAINS
- SPARC achieves the best EntSim on every application library and the best scores across all three reported metrics on GNPS-A/B and SC-FDA.The five target libraries were evaluated using MSG-training spectra as references, with measured target-library spectra reserved for evaluation.Source: Table 4 · p. 9, §5.4 · p. 9
5.5 COMPONENT ABLATION
- Removing similarity-based support retrieval causes the largest CosSim decrease among tested ablations, while removing stochastic restoration has the smallest effect.All tested ablations reduce CosSim relative to the full method.Source: Table 5 · p. 9, §5.5 · p. 9
6 LIMITATIONS
SPARC is constrained by the pretrained predictor’s candidate-fragment space and by assumptions about support-spectrum transferability. Continual specialization also depends on target-stream order, and entropy-based rollback does not ensure correct peak locations.
6 LIMITATIONS
- Freezing the fragment generator confines SPARC to reweighting candidate fragments, so omitted diagnostic fragments cannot be recovered.Expanding the candidate space without destabilizing online adaptation is a direction for domains with unseen fragmentation pathways.Source: §6 · pp. 9–10
- Poor support coverage or fingerprint-caused mismatch can bias both the supervised update and the support-derived reliability estimate.The method assumes chemically similar, acquisition-compatible support spectra provide transferable supervision.Source: §6 · p. 10
- Continual updates depend on target-stream order, while entropy-based rollback limits abrupt drift without guaranteeing correct peak locations.The authors suggest query-specific uncertainty estimates and order-robust safeguards more directly aligned with spectral fidelity.Source: §6 · p. 10
7 CONCLUSION
SPARC specializes pretrained MS/MS predictors by adapting fragment intensities from chemically related reference spectra while preserving the fragmentation space. Benchmark and application-library results support reference-guided specialization when compatible labeled references are available.
7 CONCLUSION
- SPARC adapts fragment intensities using chemically related reference spectra, with support reconstruction errors weighting teacher consistency.It preserves the pretrained predictor’s fragmentation space.Source: §7 · p. 10
- Validation-assisted specialization improves benchmark spectral similarity, with further gains from online continuation.Without validation specialization, entropy-guarded adaptation using MSG references improves EntSim across all GNPS application libraries.Source: §7 · p. 10
- Peak-level analyses associate the gains with higher spectral purity and intensity redistribution within the existing candidate space.The authors conclude that reference-guided specialization extends pretrained predictors when compatible labeled reference spectra are available.Source: §7 · p. 10