- The paper introduces MS-DGFormer, a transformer-based model using SVD-denoised dictionaries to extract robust features from noisy, single-shot aerosol spectra, achieving 0.983 accuracy and 0.982 F1-score.
- The methodology leverages a dual-encoder transformer with convolutional patch embeddings and dedicated sub-dictionary processing to selectively extract class-specific peaks.
- The approach enhances real-time pathogen detection in portable MALDI-MS by reducing preprocessing requirements and computational load, paving the way for scalable field-deployable systems.
Background and Motivation
Environmental pathogen surveillance via Matrix Assisted Laser Desorption/Ionization Mass Spectrometry (MALDI-MS) offers a compelling path to public health protection, providing high-resolution identification of biomolecular signatures in aerosols. While MALDI-MS is standard in clinical laboratories, its deployment in dynamic field scenarios is constrained by requirements for laborious sample prep and the necessity for multi-shot spectral averaging. This renders portable aerosol MALDI-MS attractive for real-time scanning—yet such devices yield single-shot, noisy spectra, often from complex analyte mixtures, challenging traditional analysis workflows.
Figure 1: Single-batch aerosol spectra illustrate the mixture problem in environmental monitoring; averaging muddies class-specific features, demanding single-shot identification.
This research introduces the Mass Spectral Dictionary-Guided Transformer (MS-DGFormer), addressing the computational bottleneck for portable, field-deployable mass spectrometric pathogen detection, providing accurate multi-label classification from raw single-shot spectra with minimal preprocessing.
Technical Innovations
Single-Shot Analysis and Dictionary Construction
The core technical hurdle is extracting biological marker patterns from spectra comprising predominantly background noise and particulate matter. MS-DGFormer addresses this by constructing sub-dictionaries for each class using training spectra, then denoising using Singular Value Decomposition (SVD). Each sub-dictionary undergoes low-rank approximation, filtering dominant structural components and eliminating superfluous noise—facilitating robust feature extraction from raw incoming spectra.
Figure 2: SVD decomposes Bacillus globigii spectra, highlighting signal subspace with rapid decay beyond the first two singular values; rank-2 approximation yields noise-suppressed spectral representation.
MS-DGFormer employs a hybrid dual-encoder transformer architecture. Raw spectra are decomposed into overlapping patches using one-dimensional convolutions, mapped to high-dimensional latent space and augmented with positional information derived from zm​ values, reflecting mass-to-charge ratio progression. Dictionary spectra are embedded analogously, but processed separately to avoid mutual feature contamination.
Figure 3: Convolutional patch embeddings transform the 1D spectrum into an overlapping, position-encoded token sequence, facilitating local peak discrimination.
Figure 4: MS-DGFormer architecture contains (A) input and (B) dictionary embedding modules, (C) specialized selection attention mechanism, and (D) final peak prediction layer.
Dictionary encoder blocks process each sub-dictionary independently, aggregating contextual representations into a single learnable sequence per class. Selection cross-attention mechanisms allow the input encoder output to selectively extract relevant features from these aggregated dictionary sequences.
Figure 5: Sub-dictionary processing pipeline, with convolutional embedding and slice-wise attention aggregating class-specific latent vectors.
Figure 6: Multi-head cross-attention integrates input encodings (top) and sub-dictionary features (bottom), empowering class-discriminative peak selection.
Empirical Evaluation
Feature Visualization and Alignment
Attention map analysis reveals that class-specific peak locations dominate the output of learnable dictionary sequences, affirming the informational efficacy of dictionary-based priors.
Figure 7: Dictionary attention maps—peaks receive strongest scores, confirming efficient class-feature extraction.
Further, positional embeddings are demonstrated to align tightly with the underlying zm​ structure, preserving the physical relationships necessary for mass spectral interpretation.
Figure 8: Visualization of raw and embedded positional tokens per patch; model preserves and extends the overlapping structure in high-dimensional latent space.
Selection attention maps show class discrimination: input spectra matching a dictionary class induce focused, high-magnitude attention, while background (dust) spectra result in dispersed, low-magnitude attention—reducing misclassification risk.
Figure 9: Selection attention maps maximizing score for input-class matches (top/middle); noise input (Arizona Road Dust) produces diffuse attention.
MS-DGFormer outperforms RNN, LSTM, biLSTM, and ablated transformer baselines across all macro and micro classification metrics. Notably, the model achieves 0.983 accuracy and 0.982 F1-score macro average—quantitatively superior despite a reduced parameter footprint relative to most competitors. MS-DGFormer maintains high class-resolved F1-scores, crucially minimizing false positives in negative classes (e.g., dust).
Computational Efficiency
Inference optimization is achieved by precomputing dictionary representations; the efficient variant MS-DGFormer-E reduces parameter burden by nearly 50% during deployment (from 8.36M to 4.39M), nearly doubling throughput and matching top baseline inference times—without loss of predictive power. Addition of new classes only linearly increases stored sequence count without impacting main model latency, supporting scalable deployment.
Implications and Future Directions
The proposed MS-DGFormer architecture substantiates the feasibility of autonomous, real-time aerosol pathogen detection with minimal sample prep and no spectral averaging. Its capacity for robust multi-label discrimination—even in the noisy, mixed-threshold context of environmental sampling—positions it as an enabling technology for bio-surveillance in public spaces and critical infrastructure.
Practically, the system could be integrated into networked sensor arrays for continuous monitoring, rapid threat response, and epidemiological data collection. Theoretically, the use of dictionary-guided transformers and SVD-denoised side information provides a template for similar approaches in other spectrum-based analyses—potentially extending to chemical sensing, remote environmental monitoring, and even proteomics.
Scaling to broader analyte classes will require expanded training sets and careful calibration of dictionary construction; future work may augment the SVD process with supervised or unsupervised dictionary learning algorithms for richer subspace modeling.
Conclusion
MS-DGFormer demonstrates quantitatively robust, computationally efficient classification of minimally preprocessed, single-shot aerosol MALDI-MS spectra. The integration of low-rank dictionary priors and transformer-based sequence modeling addresses critical requirements for portable, field-deployable pathogen detection, presenting practical advances for public health surveillance and methodological contributions to mass spectrometric computational analysis.
(2511.17446)