Separating Chemistry from Instrument in MALDI-TOF Resistance Prediction

Hospitals already identify bacteria in minutes with MALDI-TOF mass spectrometry. The technique fires a laser at a smear of cultured cells and measures the masses of the proteins that fly off. Machine learning on these spectra can also predict antibiotic resistance a day or more before the standard growth-based test finishes. These models fail in exactly the cases that matter most. Resistance to reserve antibiotics is rare, and a model trained at one hospital degrades at another hospital or in a later year. Our hypothesis is that much of this cross-site failure, especially for rare resistant classes, comes from differences between instruments that the model mistakes for biology. We further propose that isotope physics gives a principled way to separate the two.

The idea is simple. Every protein peak in a spectrum is the sum of two things. The first is the protein's natural isotopic spread, the cluster of masses that arises because some carbon, nitrogen, oxygen and sulfur atoms are heavier isotopes. That spread is fixed by chemistry and can be computed from mass alone. The second is the blur added by a particular instrument on a particular day. Because the isotopic part is known, the instrument part can be estimated from real spectra at each site. That estimate lets us generate realistic copies of scarce resistant isolates "as if measured on another machine." It also gives a classifier features that do not depend on which machine took the spectrum. The proposal tests whether this physically grounded nuisance model beats generic augmentation and reweighting for rare-resistance prediction under site and time shift.

Core Claim

A forward model of each peak, written as the computed isotopic envelope convolved with a site-specific instrument kernel and mass-calibration offset, should help in two ways. Fitted per site, it should improve detection of rare resistant phenotypes in external hospitals and in later years beyond what class reweighting, SMOTE, or generic random augmentation achieve. The model is used for two purposes. One is augmentation: re-rendering minority spectra under other sites' fitted instrument parameters. The other is representation: replacing binned intensities with fitted peak mass, area, and excess width beyond the isotopic expectation. The isotope term is the critical ingredient. It is the known "end-member" that makes the instrument blur identifiable. Without it, peak width cannot be split into chemistry and machine.

The claim requires correcting a premise in the obvious version of this idea. It is tempting to say that the 3 Da binning in Direct Antimicrobial Resistance Prediction from clinical MALDI-TOF mass spectra using Machine Learning "destroys isotopic envelopes" and that a model should simply learn those envelopes. That paper bins clinical spectra from 2,000 to 20,000 Da and classifies them with logistic regression, LightGBM and MLPs. Clinical linear-mode MALDI-TOF does not resolve individual isotope peaks at these masses, because neighbouring isotopes are about 1 Da apart and instrument blur is wider than that. A model trained to read resolved envelopes therefore has nothing to read. What does survive is the unresolved envelope's contribution to peak shape and centroid.

That contribution is not negligible. The isotopic spread can be estimated by counting atoms: carbon dominates, and the number of heavy carbons in a protein of roughly 440 carbons at 10 kDa has a standard deviation near $\sqrt{440 \times 0.011} \approx 2$ Da. So the isotopic part is a few daltons wide, comparable to instrument blur at the low-mass end. That is enough to anchor a deconvolution, and it is the version of "isotopic fingerprinting" this proposal uses.

Relation to Prior Work

Three papers motivate the gap. Weis et al. released DRIAMS: over 300,000 spectra with more than 750,000 resistance labels from four Swiss sites. They reported AUPRC alongside AUROC because reserve-drug resistance is rare. They also documented degradation on external sites and later years. We adopt their tasks and splits, and we target their documented failure. Pre-trained Maldi Transformers improve MALDI-TOF MS-based prediction treats spectra as sets of picked peaks. It pretrains a Transformer by asking it to spot peaks swapped in from other spectra, and it reports 84% accuracy on the 1,088-species LM-UGent benchmark. It still depends on heuristic peak picking, and it relies on an extra adaptation step for rare taxa. Our fitted peak parameters could feed such a model. The contrast is that we model the instrument explicitly rather than hoping pretraining absorbs it. Investigating Time Series Classification Techniques for Rapid Pathogen Identification with Single-Cell MALDI-TOF Mass Spectrum Data showed that treating the raw profile as a sequence beats bag-of-peaks features on single cells, using balanced laboratory isolates. That supports working on raw profiles rather than peak lists. Its single-cell data is not a benchmark we can use, so single-cell work is a later target, not part of this study.

Two papers supply the method. Machine-learning-enhanced time-of-flight mass spectrometry analysis trains LightGBM on synthetic spectra generated from natural isotopic abundances and identifies ions in alloy spectra without human labels. That establishes that isotope-grounded simulation can substitute for labeled data. Its work was on resolved inorganic spectra, whereas ours is unresolved protein peaks and clinical labels. TimeFRAME is a Bayesian isotope mixing model for trace gases. It found that uncertainty in the known source end-members dominated error, more than adding isotopic dimensions did. We take the lesson that the model should pin one component tightly, here the computed envelope, and infer only the uncertain one, the instrument kernel.

Two lines constrain the design. Imbalance work in the file warns that naive minority oversampling leads to memorisation, and Generative Invertible Networks generates rare "virtual patients" in CT along physically meaningful latent axes. Our augmentation follows the second philosophy: it moves only along axes we can physically name, namely calibration, resolution and intensity response. The copper-isotope prostate study, Copper Isotope Fractionation and Copper-to-Zinc Ratios as Diagnostic Markers of Prostate Malignancy, shows that true isotope-ratio biomarkers carry diagnostic signal (p = 0.00047). However, its offline instrument and its 122-person cohort with 21 controls rule it out as a testbed for rapid, imbalance-aware learning. We cite it as motivation, not as data.

Research Program

We would build a per-peak forward model and fit it to raw profile spectra from DRIAMS. Raw profiles, not the binned release, are required. Whether raw profiles are available for every site is the first feasibility check.

For an observed profile $s(m)$ near a peak of average mass $M$, the model is

$$s(m) \approx A \cdot \big(E_M * K_{\phi}\big)(m - \delta_{\phi}(M)) + b(m),$$

The terms are as follows. $A$ is peak area. $E_M$ is the isotopic envelope computed for an average-composition protein of mass $M$. $K_{\phi}$ is an instrument blur kernel whose width grows with mass. $\delta_{\phi}(M)$ is a smooth calibration offset. $b$ is local baseline. $\phi$ collects instrument parameters shared across all spectra from one site and month. We fit $\phi$ hierarchically, borrowing strength across thousands of spectra per site-month as TimeFRAME does across time. The output is a distribution of instrument states for each site and period.

These fits then serve two uses. For augmentation, a minority-class spectrum is deconvolved with its own $\phi$ and re-rendered under a $\phi'$ sampled from another site or period. Biological content (peak masses, areas, relative intensities) is kept while the machine signature changes. For representation, each peak is summarised by calibrated mass, area, and residual width beyond what $E_M * K_\phi$ predicts. The same classifiers then run on these features.

We would also analyse which fitted instrument parameters best predict site identity. This tests how much of the "site effect" these parameters capture.

Baselines

The naive reference is a classifier that outputs the training prevalence. Its AUPRC equals the positive rate, which is below 5–10% for reserve drugs according to Weis et al. Any method must clear it by a wide margin on exactly those drugs.

The strongest established method for this question is the Weis et al. pipeline: binned spectra with LightGBM and MLP. It is the strongest competitor because it was built and tuned on DRIAMS for these exact resistance tasks. Its reported results are AUROC 0.80 for oxacillin resistance in S. aureus, 0.74 for ceftriaxone in E. coli, and 0.74 for ceftriaxone in K. pneumoniae. We will retrain it ourselves on identical splits, so that in-site, external-site and temporal numbers are directly comparable to ours.

The Maldi Transformer is the strongest representation-learning competitor. Lacuna has no reported AMR number for it beyond the claim of "state-of-the-art or competitive" performance, so we will fine-tune the released pretrained model ourselves on the same splits. Every method, including ours, receives the same hyperparameter search budget and compute. Every method is also offered class-weighted loss with a decision threshold tuned on source-site validation data only.

Two further reference points complete the comparison. One is SMOTE on binned spectra. The other is generic augmentation: random mass shifts, Gaussian peak broadening and intensity scaling, with magnitudes matched to the spread of our fitted parameters.

The key ablation keeps the entire pipeline but drops the isotope term $E_M$, letting a free Gaussian absorb all width. This model can still fit peaks, but it cannot tell chemistry from blur. If it matches the full model, the isotopic ingredient is not doing the work.

Beating the baselines means two things on external-site and temporal splits. First, a gain in AUPRC for rare-resistance tasks that is outside paired bootstrap intervals. Second, higher sensitivity at a fixed 90% specificity. In-site performance should hold steady.

Why not just…?

Why not just reweight the loss or use SMOTE? These change how much the model cares about rare positives. They do not tell it which spectral differences are the machine's. The imbalance literature in the file reports that oversampling leads to memorisation of few positives. In a cross-site setting, a memorised positive includes its site's calibration signature. Both methods are run as baselines on identical splits. If they close the external-site gap, our hypothesis about instrument confounding is wrong.

Why not just use generic random augmentation? This is the most serious threat. Random shifts and blurs might cover real site differences well enough. Our answer is empirical. The matched-magnitude generic augmentation and the no-isotope ablation isolate whether fitted, physically separated instrument parameters add anything. If generic augmentation ties, we will report that the isotope model is unnecessary and that the result reduces to "augment calibration and resolution."

Why not just fine-tune a pretrained Maldi Transformer, or retrain at each site? Pretraining helps, but De Waele et al. note that model capacity is limited by public data, and they needed an extra adaptation step for rare taxa. Retraining at each site requires labeled resistant isolates at the new site, which are exactly what is scarce. We test the Transformer on its own and with our augmentation, since the two are complementary rather than exclusive. Per-site retraining is reported as an upper bound under a small target-label budget.

Why not just use targeted molecular tests such as RPA-CRISPR? Assays like the RPA-CRISPR/Cas12a Toxoplasma assay are fast and sensitive, but they detect predefined sequences. Clinical resistance spans many mechanisms across hundreds of species. MALDI-TOF is already run on every isolate at no extra cost, which is why improving its reliability is worth doing. The two approaches answer different clinical questions.

Proposed Experiments

The main experiment trains on DRIAMS-A and tests on DRIAMS-B, -C and -D. A temporal split trains on 2016–2017 and tests on 2018. Tasks are the three Weis et al. drug–species pairs plus the reserve-drug tasks with the lowest positive rates. Metrics are AUPRC, AUROC, and sensitivity at 90% specificity, with paired bootstrap intervals.

An imbalance stress test subsamples training positives to 1%, 2% and 5% prevalence. It measures whether the advantage over baselines grows as positives become scarcer, which is the predicted signature if augmentation substitutes for missing site diversity among positives.

A secondary experiment applies the same augmentation to the rarest species in LM-UGent. There, the Maldi Transformer's 84% overall accuracy is the reference, and we report accuracy on species with three or fewer strains.

Three decisive checks follow. First, fitted instrument parameters alone should classify site of origin well above chance, while spectra re-rendered to another site's parameters should be misattributed to that site. If not, the model is not capturing site effects. Second, the full model must beat the no-isotope ablation on external AUPRC. Third, the improvement must concentrate on external and temporal splits rather than in-site. Failure on any one of these falsifies the core claim regardless of headline numbers.