
Transferable Mass Spectrum Prediction via Reference-Guided Test-time Specialization
This arXiv preprint introduces SPARC, a retrieval-guided test-time specialization framework that adapts a pretrained mass spectrum predictor to new chemical/acquisition domains using a reference spectral library, without needing labeled test-query spectra. It retrieves chemically related reference spectra to recalibrate fragment intensities and combines this with a reliability-aware consistency mechanism that uses reconstruction behavior to decide which predictions to trust during continual specialization. The method is evaluated across MassSpecGym, NPLIB1, and application-specific GNPS libraries, showing gains under domain-shift transfer settings — offering a general pattern (retrieval-guided, label-free test-time adaptation) that could extend beyond mass spectrometry.
What it claims
SPARC (Spectral Prediction via Adaptation with Retrieval-calibrated Consistency) specializes a pretrained MS/MS predictor at inference time. It changes only the intensity head and supervises it with measured spectra of chemically similar reference molecules. The fragment candidate set is never altered, so adaptation can only re-weight peaks the base model already proposes. The authors report gains on two benchmark transfers (MassSpecGym → its M+Na subset, MassSpecGym → NPLIB1) and higher entropy similarity on all five curated GNPS application libraries. The fetched text cuts off before the results tables, so no figures are available here.
How it works
- Backbone: Iceberg. The autoregressive fragment generator (Iceberg-Generate) is frozen and acts as a fixed fragmentation prior. Only the intensity scorer θ (Iceberg-Score) is trained.
- Retrieval, acquisition first:
- References are filtered to the query's adduct.
- Within that pool, references matching the query's instrument rank first.
- Each group is sorted by cosine similarity on an ℓ2-normalized concatenation of 2,048-bit radius-2 Morgan and 3,072-bit hashed AtomPair fingerprints.
- The top K = 64 are kept.
- Global retrieval is used only if no reference shares the adduct.
- Collision energy and precursor m/z are model inputs, not retrieval filters.
- Support loss: a softmax-weighted (τ = 0.1) MSE between the student's predictions on the retrieved molecules and their measured spectra.
- Teacher consistency:
- An EMA teacher (α = 0.99) is evaluated on the support set to get a per-m/z-bin error.
- That error becomes a weight c = exp(−γ·error), with γ = 10.
- The student is pulled toward the teacher on the query mainly in bins the teacher reconstructs well.
- The authors say these weights are a regularizer, not calibrated correctness probabilities.
- Objective: consistency loss plus support loss (λ_sup = 1), optimized with Adam at lr 1e-4.
- Continual state: student and teacher persist across queries. After each step, every student parameter is reset to its source value with probability ρ = 0.02 (CoTTA-style stochastic restoration).
- Rollback: each trial update is snapshotted and accepted or rejected depending on the deployment setting:
flowchart TD
Q[Target query] --> R[Adduct/instrument-filtered retrieval, K=64]
R --> S[Support reconstruction loss]
R --> E[Teacher error per bin]
E --> C[Weighted teacher consistency]
S --> U[Trial update of intensity head]
C --> U
U --> V{Target validation labels?}
V -- yes --> A[Accept if val CosSim ≥ η × before]
V -- no --> B[Reject if teacher entropy rises > δ]
A --> N[Carry state to next query]
B --> NWith labels, the update is accepted if post-update validation CosSim stays at least η times the pre-update value; η is not given in the fetched text. Without labels, it is rejected if the normalized spectral entropy of the teacher's query prediction rises by more than δ = 0.1.
Evidence
Settings:
- MSG → MSG-MNa is subset specialization: the source checkpoint already saw M+Na data.
- MSG → NPLIB1 is cross-library transfer.
- The five GNPS targets are Drugs of Abuse, 3-Hydroxy Acyl Amides, ECG Acyl Amides C4–C24, Alkylamines–Bile Acids, and SelleckChem FDA.
- For the GNPS targets, the MSG training split is the reference library.
- Support molecules sharing a Murcko scaffold with any validation or test molecule are removed before retrieval.
Metrics:
- CosSim, entropy similarity and MSE, computed on the top 100 predicted bins.
- Peak-level precision, recall and F1 with exact-bin matching.
- The authors report precision and F1 gains at peak and intensity level.
No numbers survive in the fetched text.
How to use it
To deploy this you need:
- an Iceberg checkpoint;
- a labeled reference library with adduct and instrument metadata;
- per-query gradient steps at inference.
No code, repository or licence is mentioned in the fetched text.
Limits
- Peaks only, no new fragments: adaptation cannot add fragments the frozen generator misses. Recall gains are therefore bounded by the base model's candidate set.
- Iceberg only: the method is tied to Iceberg's split between fragment generation and intensity scoring, and only that backbone is tested.
- Label-free guard is weak: the entropy check is described as a "lightweight stability criterion." It rejects broadening of the predicted distribution, not wrong peak locations.
- Order dependence: continual state means results can depend on query order. The text does not say whether this was tested.
- Partial coverage: comparisons use only queries where all methods succeeded, and coverage is reported only in the supplementary material.
- Easy benchmark setting: MSG → MSG-MNa is not a true out-of-distribution shift.
- Not in the fetched text: inference cost, results and ablations.
Organisations named here
- GNPS
- MassSpecGym
- NPLIB1
Techniques named here
- SPARC
Related in research



