WorksComputer Science
Physics-Aware Self-Supervised Pretraining on Multi-Domain Raman Spectra
Abstract
Raman spectroscopy generates large volumes of unlabeled data that are difficult to exploit with conventional supervised learning. This work introduces a multi-domain self-supervised learning framework based on a masked autoencoder (MAE) for learning transferable Raman spectral representations from heterogeneous biological, chemical, forensic, and materials datasets. The proposed pretraining strategy incorporates physics-aware objectives by combining masked intensity reconstruction with a sparse Voigt-profile decoder that models spectral peak structure through differentiable peak centers, widths, and amplitudes. A denoising objective is further included to improve robustness to spectral corruption. The learned encoder is evaluated on substance classification, component identification, concentration estimation, and spectral denoising under linear probing, attention-based probing, end-to-end fine-tuning, and training from scratch. Experimental results show that self-supervised pretraining is most beneficial for challenging tasks with limited labeled data. Attention-based probing also reveals substantially more useful information in the frozen representation than linear probing, indicating that conventional linear evaluation may underestimate representation quality. In addition, the benefits of pretraining become more pronounced with increasing encoder capacity. Overall, the proposed framework demonstrates that physics-aware, multi-domain self-supervised pretraining can improve label efficiency, robustness, and transferability across diverse Raman spectroscopy tasks.
Introduction
Raman spectroscopy provides label-free, non-destructive molecular fingerprints and is used routinely in chemistry, biology, materials science, and forensics. Acquiring spectra has become cheap, as portable spectrometers, surface-enhanced Raman scattering (SERS) substrates, and hyperspectral imaging produce large volumes of measurements, and a single imaging study of breast cancer cells yielded more than 1.5 million spectra [11]. Labeling them has not become cheaper. Assigning a spectrum to a bacterial species, a tissue type, a mineral, or a set of mixture components requires reference measurements or expert analysis, so labeled datasets remain small; the forensic GBL concentration dataset used in this study, for example, contains about 1,500 spectra. Most measured Raman spectra therefore carry no labels, and supervised models, which learn only from the labeled part of one dataset for one task, leave them unused.
Self-supervised learning (SSL) offers a way to use these spectra. A model is first pretrained on unlabeled data through a pretext task and then adapted to downstream tasks with few labels. Masked modeling, in which the model reconstructs hidden parts of its input, has become a widely used pretext task for language [4] and images [9], and has been extended to one-dimensional physiological and time-series signals [22, 36]. For Raman spectroscopy, SSL is at an early stage. SMAE [25] pretrains a masked autoencoder with per-pixel reconstruction on a single bacterial dataset and evaluates it on that same dataset, and contrastive methods have likewise targeted bacterial classification [34]. DSCF [32] pretrains on more than a million simulated and experimental spectra across UV, IR, and Raman modalities, showing that large-scale spectral pretraining is feasible. How such pretraining is best designed for Raman spectra, and what it provides downstream, has not yet been studied in depth.
Two properties of Raman data suggest ways to go beyond this. First, Raman datasets from different domains share the physics that produces their peaks while differing in how the measurement distorts them, since each setup shifts and broadens peaks, rescales intensities, and adds its own baseline and noise. Pretraining on a single dataset ties the encoder to one instrument, one sample type, and one downstream task, whereas pooling unlabeled spectra across domains exposes it to many distortions of the same underlying physics, which may help it learn features that are less tied to any one setup. Second, Raman bands have a recognizable shape. Experimentally observed bands are often neither purely Gaussian nor purely Lorentzian but contain contributions from both, and the Voigt profile, their convolution, is commonly used to model them [13, 23, 28]. Its center is associated with a vibrational mode, its width with factors such as local environment and instrumental broadening, and its amplitude with concentration. Per-pixel reconstruction, borrowed from images, makes no use of this structure. A pretext task that asks the encoder to describe masked peak regions with a few Voigt profiles can therefore complement it with a peak-level view of the spectrum. Such a description is a parametric approximation, and a single fitted profile may stand in for several overlapping vibrational modes, an asymmetric band, or hot-band and intermolecular contributions, so we use it as a training signal rather than as a claim about the underlying components [16, 23].
What pretraining provides downstream also remains to be characterized. Raman analysis is not only classification, as practitioners ask which substance a sample is, whether a given component is present in a mixture, how much of it there is, and what the clean signal looks like beneath the noise. Whether a single encoder serves all of these, whether its frozen features suffice or must be adapted, and when it improves on training the same architecture from scratch are empirical matters, and they determine whether pretraining is worth its cost in practice.
We present a multi-domain masked autoencoder (MAE) for Raman spectra that addresses the first two points by design and studies the third through systematic evaluation. A single one-dimensional Vision Transformer encoder is pretrained without labels on ten datasets spanning biological tissue, cells and bacteria, minerals, and chemical and forensic mixtures, several hundred thousand spectra in total. A shared normalization of intensities and wavenumber axes puts these datasets on a common footing, and augmentations simulate further setup-specific distortions such as calibration shift and stretch, intensity scaling, and detector noise. The pretext task combines three objectives. Per-pixel reconstruction recovers the masked intensities. Sparse Voigt reconstruction has a decoder describe each masked peak region with a small set of Voigt profiles, predicting their centers, widths, and amplitudes differentially under a sparsity penalty on the number of active profiles. Denoising trains the encoder to recover clean spectra from inputs corrupted by Poisson shot noise and additive Gaussian noise.
We then evaluate the pretrained encoder with the protocols standard in the SSL literature [3, 9] on four downstream tasks, substance classification, component identification, concentration estimation, and spectral denoising, across twelve dataset–task pairs and three encoder scales. Linear probing and attention probing measure what the frozen representation already contains; end-to-end fine-tuning measures its value as an initialization; and training the identical architecture from random initialization isolates the contribution of pretraining. Because the downstream datasets contribute unlabeled training spectra to the pretraining corpus, this setting measures the reuse of one encoder across datasets and tasks; transfer to acquisition domains unseen during pretraining is left to future work.
We make three observations. First, pretraining helps as an initialization where labeled data are scarce relative to the difficulty of the task. With the base encoder, fine-tuning roughly doubles the macro-F1 of training from scratch on 30-class bacterial identification from low signal-to-noise spectra (0.65 vs. 0.33), a gain that holds at all three scales, and it also improves forensic GBL concentration estimation (0.84 vs. 0.74) and R6G detection in beverages (1.00 vs. 0.96). Where the downstream training set is large or the task is close to saturation, as for the 192-class mineral subset, liver tissue, sugar mixtures, and denoising, training from scratch catches up and pretraining is neutral or slightly worse. Second, as reported for MAE on natural images [9], linear probing underestimates what the pretrained encoder contains. With the base encoder, a linear head on the frozen features trails fine-tuning on nine of the eleven prediction tasks, and attention pooling over the frozen token embeddings improves on linear probing on ten of them. Third, the value of pretraining grows with encoder scale (Appendix § 10). From the smallest to the largest encoder, linear-probe F1 rises by 0.11 to 0.57 on seven of the eleven prediction tasks, and the margin of fine-tuning over training from scratch widens by 0.05 to 0.22 F1 on five of them, because fine-tuned encoders benefit more from added capacity than encoders trained from scratch, which degrade in four of these five cases. The margin widens most on the 1,332-class mineral subset, where pretraining turns a deficit with the smallest encoder into a lead with the largest, which also surpasses the published baseline (F1 0.88, vs. 0.85 for Sang et al. [26]).
This article makes the following main contributions.
A multi-domain MAE framework that pretrains a single Raman spectral encoder, without labels, on ten heterogeneous datasets spanning biological, chemical, forensic, and materials domains, providing a common initialization for downstream analysis.
A physics-aware pretext task that combines masked intensity reconstruction, sparse Voigt-profile reconstruction, and denoising, coupling dense signal reconstruction with an explicit, physically parameterized model of peak structure.
A systematic evaluation of the pretrained encoder, following standard SSL protocols, on twelve dataset–task pairs covering substance classification, component identification, concentration estimation, and spectral denoising at three encoder scales, which characterizes when self-supervised pretraining improves on training from scratch and when it does not.
The source code is available at https://github.com/chdavalas/multidomain-raman-ssl.
Related Work
Self-supervised learning (SSL) has emerged as an effective strategy for learning transferable representations from large quantities of unlabeled data. The masked autoencoder paradigm was originally popularized by BERT [4] for natural language processing, where randomly masked tokens are reconstructed from surrounding context. This concept was later extended to computer vision by He et al. [9], who introduced Masked Autoencoders (MAE) based on Vision Transformers (ViTs). By reconstructing heavily masked image patches, MAEs learn representations that capture global semantic structure rather than local texture statistics. Subsequent work has demonstrated that masked prediction objectives generalize effectively to one-dimensional scientific signals, including electroencephalography (EEG) [2, 35], electrocardiography (ECG) [22], and general time-series data [36]. Within Raman spectroscopy, Ren et al. [25] recently proposed a masked autoencoder trained on bacterial spectra using a standard per-pixel reconstruction objective, demonstrating competitive downstream classification performance under limited supervision. More broadly, foundation models for spectral data have begun to emerge beyond Raman-specific settings: Xue et al. [32] propose a deep spectral component filtering objective as a foundation model for metabolic profiling, and Yang et al. [33] introduce SpectrumWorld, a general-purpose pretraining framework spanning multiple spectroscopic modalities. Neither of these approaches, nor Ren et al. [25], incorporates a physically motivated decomposition of the reconstruction target. Our work extends this line of research by introducing multi-domain pretraining, physics-aware reconstruction through Voigt profile decomposition, and a comprehensive multi-task evaluation framework. Alternative SSL paradigms based on contrastive learning have also been explored [3, 8, 34]; however, such approaches rely heavily on carefully designed augmentations and the construction of meaningful positive and negative pairs. Reconstruction-based objectives are generally more straightforward to apply across heterogeneous spectroscopic datasets and naturally preserve spectral structure.
Deep learning has become increasingly prevalent in Raman spectroscopy, particularly for classification and identification tasks. Convolutional neural networks have been successfully applied to bacterial identification [10], cancer detection [12], pharmaceutical quality control, and materials characterization [26]. More recently, transformer-based architectures have been adopted for Raman mixture quantification [17] and, in combination with convolutional feature extractors, for qualitative spectral analysis [31]. To address challenges arising from limited labeled data and instrument-specific variability, transfer learning and domain adaptation strategies have been investigated, often leveraging pretrained one-dimensional neural networks as initialization [14]. The availability of large-scale synthetic datasets has further expanded opportunities for representation learning. For example, Liang et al. [21] introduced a dataset containing more than 220,000 density functional theory (DFT)-computed Raman and infrared spectra derived from ChEMBL molecules, providing a complementary source of training data beyond experimentally acquired measurements. In the self-supervised setting, Yao et al. [34] proposed a dual-perspective contrastive framework with self-calibration mechanisms for bacterial Raman classification under semi-supervised conditions, highlighting the growing interest in SSL approaches for spectroscopic analysis.
A parallel line of research focuses on incorporating physical knowledge into machine learning models. Physics-informed neural networks (PINNs) integrate governing physical principles as constraints during optimization, improving generalization and reducing dependence on large labeled datasets [24]. Within spectroscopy, Vemuri et al. [30] embedded the Kramers–Kronig relations as differentiable constraints to recover Raman spectra from coherent anti-Stokes Raman scattering (CARS) measurements, demonstrating that physically motivated inductive biases can facilitate zero-shot transfer from synthetic to experimental data. In a related direction, Georgiev et al. [7] used physics-constrained autoencoders to perform hyperspectral unmixing of Raman spectra, encoding chemical mixture priors directly into the network architecture; unlike our approach, this physical constraint is imposed at the level of a supervised downstream task rather than a pretraining objective. Another longstanding challenge in spectroscopy is the decomposition of spectra into physically meaningful peak profiles. Voigt and pseudo-Voigt profiles are widely used to fit Raman bands, typically by nonlinear least-squares optimization [13, 23, 28], although symmetric profiles can be unreliable for asymmetric or overlapping bands [16]. Deep learning has also been explored to accelerate peak fitting in other spectroscopies, for example in two-dimensional NMR [20]. However, existing methods typically treat peak fitting as a standalone downstream task. To the best of our knowledge, incorporating sparse Voigt decomposition directly into a self-supervised reconstruction objective has not previously been investigated.
The evaluation of pretrained representations has become increasingly standardized within the SSL literature. Linear probing and end-to-end fine-tuning are widely used to assess the quality and transferability of learned representations [3, 9]. Linear probing evaluates the discriminative power of frozen features, whereas fine-tuning measures the extent to which pretrained representations can be adapted to a downstream task. Comparisons against models trained from random initialization provide a direct measure of the sample-efficiency gains attributable to pretraining, particularly under limited-label settings.
Standardized benchmarking of machine learning methods for Raman spectroscopy has itself only recently begun. Two concurrent efforts have taken initial steps toward unified evaluation protocols, albeit at more limited scale: Sineesh and Kamsali [27] compare five Raman-specific deep learning classifiers across three open-source datasets, and Lange et al. [19] benchmark eleven tabular and deep learning models, including TabPFN, on a single bioprocess-monitoring regression dataset. Koddenbrock et al. [15] substantially extend both efforts and introduced RamanBench, a large-scale, living benchmark unifying 74 public Raman datasets (163 prediction targets, 325,668 spectra) spanning material science, biotechnology, medical, and chemical/industrial domains, and evaluating 28 model families — from classical chemometrics (PLS, SVM) and gradient-boosted trees to Raman-specific deep architectures, time-series classifiers (ROCKET, Arsenal), and Tabular Foundation Models (TabPFN, TabICL, MITRA) — under a standardized protocol with Elo-rating, normalized-score, and improvability metrics. Their central findings are that Tabular Foundation Models and time-series classifiers consistently outperform Raman-specific architectures and gradient-boosting baselines, that Partial Least Squares remains a surprisingly durable long-standing baseline, and that no single model family generalizes across all datasets. Notably, RamanBench evaluates every model as a supervised learner trained from scratch on each individual prediction target; it does not consider self-supervised pretraining, cross-domain representation transfer, or physics-aware reconstruction objectives. Our work is complementary to this effort: rather than proposing a new supervised architecture to compete on RamanBench’s leaderboard, we ask whether a single encoder, pretrained once via physics-aware masked reconstruction across heterogeneous unlabeled Raman corpora, can transfer across exactly this kind of multi-domain, multi-task diversity — potentially narrowing the generalization gap that RamanBench identifies.
Datasets
We assemble a multi-domain pretraining corpus from the following experimental Raman datasets, spanning diverse biological, chemical, forensic, and materials domains. For a compact overview of the corpus, including split sizes and spectral characteristics, see Table 1.
Table 1: Multi-domain pretraining corpus. Domain, whether windowed sampling is applied, resulting train/validation/test spectrum counts, and spectral range and resolution () for each dataset; paired rows show the effect of windowed sampling on split size and resolution. All spectra are used unlabeled during pretraining.
| Dataset | Windowed Sampling | Domain | # Spectra (Train/Val/Test) | Range () | Resolution () |
| Adenine mixtures | × | Biological | 2107/234/1175 | 400–1999 | 3 |
| ✓ | 6321/702/3525 | 6 | |||
| Bacteria | × | Biological | 48000/12000/3000 | 381–1792 | ≈ 1.4 |
| ✓ | 192000/24000/24000 | ≈ 2.8 | |||
| Liver Cancer | × | Biological | 4000/1000/1000 | 500–2000 | ≈ 1.68 |
| ✓ | 16000/4000/4000 | ≈ 3.36 | |||
| RRUFF-S 1&2 | × | Minerals | 9570/139/4161 | 30–1599 | 1 |
| ✓ | 57422/832/24966 | 2 | |||
| R6G | × | Component identification | 56084/7010/7010 | 531–1821 | ≈ 1.08 |
| Raman sugars | × | Component identification | 6272/784/784 | 142–3684 | ≈ 1.77 |
| GBL | × | Concentration estimation | 1207/150/150 | 513–1636 | ≈ 1.08 |
| DeepRaman | × | Component identification | 3510/390/36 | 50–3200 | 2 |
| Hyperspectral | × | Reconstruction | 141330/17666/17666 | 498–1799 | ≈ 2.6 |
| MDA-Spectral | × | Denoising | 159618/15961/12694 | 498–1799 | ≈ 2.6 |
| Total | 639764/71495/94831 |
Table 1. Multi-domain pretraining corpus. Domain, whether windowed sampling is applied, resulting train/validation/test spectrum counts, and spectral range and resolution () for each dataset; paired rows show the effect of windowed sampling on split size and resolution. All spectra are used unlabeled during pretraining.
Adenine mixtures. The adenine dataset [6] consists of Raman spectra acquired from pure adenine samples at multiple concentration levels and under varying acquisition conditions. This dataset comprises the results of the first interlaboratory study (ILS) focused on the quantitative application of surface-enhanced Raman scattering (SERS). It was generated within the framework of Working Group 1 (WG1) of the EU COST Action BM1401 (Raman4Clinics) and involves contributions from 15 independent laboratories and 44 researchers. The dataset was designed to systematically evaluate the reproducibility and trueness of SERS-based quantitative measurements across different experimental conditions. Specifically, the dataset includes measurements obtained using diverse SERS methodologies, reflecting variations in instrumentation, substrates, analytes, and analytical matrices. This diversity enables a comprehensive assessment of method performance and interlaboratory variability. In addition, the dataset supports comparative analysis between different quantitative SERS approaches, highlighting factors that influence accuracy and robustness. Overall, this dataset serves as a benchmark resource for the validation and standardization of SERS protocols. By providing a community-driven reference for evaluating analytical performance, it contributes to improving the reliability and broader acceptance of SERS in regulated and application-oriented environments. The dataset was converted into a binary classification task by thresholding the concentration values to distinguish samples below and above a defined cutoff.
Bacteria. The bacterial dataset Ho et al. [10], Ren et al. [25] consists of Raman spectra acquired from 30 clinically relevant pathogenic bacterial isolates, with each species exhibiting distinct yet partially overlapping biochemical signatures associated with proteins, lipids, nucleic acids, and other cellular constituents. Originally introduced by Ho et al. [10], the dataset was developed to evaluate rapid pathogen identification using Raman spectroscopy combined with deep learning approaches. Spectra were collected under low signal-to-noise conditions, reflecting realistic experimental variability and enabling the assessment of robust representation learning methods for microbial classification. Due to substantial intra-class variability, biological heterogeneity, and fluorescence interference, the dataset provides a challenging benchmark for evaluating the robustness and generalization ability of machine learning models for Raman-based bacterial identification.
Liver Cancer. This dataset [12] comprises Raman spectroscopic measurements of human hepatic tissue samples, developed to support pathological diagnosis of liver carcinoma. It includes spectral data acquired from both carcinoma tissues and adjacent non-tumorous tissues, enabling comparative analysis for accurate tissue classification. The dataset is generated using a label-free, non-destructive Raman spectroscopy workflow and is designed for both in vitro and intraoperative diagnostic applications. It incorporates high-resolution spectral and imaging data, including two-dimensional (2D) and three-dimensional (3D) Raman maps of unprocessed tissue sections at submicrometric resolution. These data capture detailed molecular composition, facilitating the identification of tumor boundaries and structural heterogeneity. In addition to binary classification (tumor vs. non-tumor), the dataset contains annotations supporting advanced pathological characterization, such as cancer subtype, differentiation grade, and tumor stage. Although the data readily available focus more on binary classification between Cancerous and Paracancerous tissues (Binary classification). Validation is further supported through complementary metabolomics data, enhancing the reliability of biochemical interpretations. Overall, this dataset provides a comprehensive resource for the development and evaluation of machine learning and deep learning models aimed at rapid, real-time liver cancer diagnosis, including potential deployment in intraoperative settings using portable Raman systems.
RRUFF Subset (RRUFF-S) This subset of mineral data, from the work of [26], is derived from the RRUFF [18] Raman spectral database and consists of a large collection of mineral Raman spectra curated for multi-class classification tasks. It includes spectral measurements from a wide variety of mineral samples, encompassing hundreds to potentially thousands of distinct classes with varying sample sizes per class.
To support comprehensive evaluation, the dataset is organized into two sub-datasets, each designed to assess classification performance under different conditions. These sub-datasets enable analysis of model robustness across scenarios involving large class diversity and imbalanced class distributions, without the application of data augmentation techniques. The dataset captures detailed molecular information inherent to mineral compositions, making it suitable for benchmarking both traditional machine learning approaches (e.g., support vector machines and k-nearest neighbors) and deep learning architectures. In particular, it is well-suited for evaluating one-dimensional convolutional neural networks (1D CNNs) for spectral classification tasks. Overall, this dataset provides a challenging and scalable benchmark for high-dimensional, multi-class Raman spectral classification, supporting the development and validation of advanced deep learning models capable of handling large-scale and imbalanced datasets with high accuracy. In the paper, the dataset has been evaluated in two different parts one with 192 classes and the second part which has an larger number of classes 1332 and is a more demanding set in terms of substance classification.
R6G (Rhodamine 6G). R6G is a highly fluorescent dye commonly employed as a tracer and laser dye. The R6G dataset, acquired through measurements conducted at the National Centre for Scientific Research “Demokritos,” is used for the component identification task, where the objective is to determine the presence or absence of a target substance. It comprises positive mixtures, in which R6G was present in solvents such as water, Coca-Cola, and whiskey; negative mixtures obtained from beverages including beer, rum, Fanta, red and white wine, and vodka; and reference spectra of pure R6G measured on different substrates.
Raman sugars. This dataset by [1], comprises a comprehensive collection of Raman spectra acquired from controlled mixtures of aqueous sugar solutions, and is intended as a benchmark resource for the development and evaluation of spectral analysis methodologies. The dataset includes measurements from 245 unique mixtures composed of four sugars—sucrose, fructose, maltose, and glucose—combined with water in a full factorial design, enabling systematic variation in concentration profiles. Two complementary sub-datasets are provided, which correspond to identical sample compositions measured under different acquisition conditions. Specifically, these datasets differ in integration time (5 s and 0.5 s, respectively), resulting in distinct signal-to-noise ratio (SNR) characteristics. Each mixture is measured multiple times to capture experimental variability, yielding 1,960 spectra in the high-SNR dataset and 7,840 spectra in the low-SNR dataset. The inclusion of repeated measurements, structured into acquisition rounds and repetitions, allows for the assessment of temporal effects and measurement consistency. Overall, this dataset provides a high-quality, well-annotated, and experimentally rigorous benchmark for quantitative Raman spectroscopy, supporting tasks such as concentration estimation, noise robustness analysis, and the development of advanced machine learning and deep learning models for spectral interpretation.
GBL (Gamma-Butyrolactone). GBL is a forensically relevant solvent and controlled-substance precursor whose quantification in seized samples represents a practical analytical challenge. The GBL dataset, acquired through measurements conducted at the National Centre for Scientific Research “Demokritos,” is used for the concentration estimation task, formulated as a multi-class classification problem over discrete concentration bins rather than as continuous regression. It comprises Raman spectroscopic measurements of samples containing varying concentrations of gamma-butyrolactone (GBL), an industrial solvent that is rapidly converted into gamma-hydroxybutyrate (GHB) following ingestion. The dataset was designed to support classification and detection across concentration levels relevant to analytical and forensic applications. Specifically, it includes four discrete GBL concentrations: 0 mg/mL, 0.1 mg/mL, 1 mg/mL, and 10 mg/mL. Overall, the dataset enables the development and validation of spectral analysis methods for both binary presence-or-absence detection and multi-class concentration classification, particularly under conditions of low analyte concentration and uneven class distribution.
Hyperspectral dataset. The Hyperspectral dataset [11] consists of high-resolution, spatially resolved hyperspectral Raman images acquired from in vitro MDA-MB-231 human breast cancer cells. Each sample provides a complete spatial-spectral data cube that captures the complex molecular signatures of intricate cellular structures, such as the nucleus and lipid droplets, offering a highly detailed and uncorrupted representation of the biological samples. This dataset comprises a large-scale collection of hyperspectral Raman imaging data designed to support the development of deep-learning methods for accelerated molecular imaging. It contains over 1.5 million Raman spectra, corresponding to approximately 400 hours of experimental acquisition, and represents one of the most extensive datasets for high-throughput Raman spectroscopy applications.
MDA-Spectral dataset. The MDA-Spectral dataset is also included in the Hyperspectral dataset [11] and comprises spectra acquired from in vitro MDA-MB-231 human breast cancer cells. The dataset consists of paired short-acquisition, low signal-to-noise ratio (SNR) spectra and corresponding long-acquisition, high SNR target spectra. This dataset is used for the spectral denoising task, aiming to digitally recover clean molecular signatures from highly noisy inputs without sacrificing chemical information. The dataset is structured to enable multiple computational tasks, including spectral denoising, image reconstruction, and spatial super-resolution of hyperspectral Raman images. It captures molecular signatures with varying signal-to-noise ratios, enabling the training and evaluation of models aimed at improving spectral quality and imaging efficiency. In particular, it supports the recovery of clean Raman signals from noisy measurements and the enhancement of spatial resolution by factors of 2–4× while preserving biologically relevant molecular information.
DeepRaman dataset. Originally curated for training the DeepRaman component identification model [5], this composite dataset relies on distinct subsets for its original training and evaluation phases. The foundational training corpus comprises a comprehensive collection of standardized Raman spectra, aggregating broad multi-wavelength measurements (1064 nm, 785 nm, 532 nm, and 488 nm) from the extensive S.T. Japan database, alongside a targeted subset of pure pharmaceutical compounds acquired via a B&W Tek i-Raman-785S spectrometer. As detailed in the original study, this training data was expanded through a synthetic augmentation strategy to generate positive and negative spectral pairs by combining pure component spectra with simulated complex mixtures. To increase spectral diversity, these simulated mixtures were generated using randomized concentration ratios and subjected to stochastic peak shifting, noise injection, and intensity scaling, followed by a final maximum-value normalization. Conversely, for testing, the original study utilized two experimental sets: a multi-component dataset comprising of 105 physical mixtures of up to 13 common solvents, and a liquid and powder dataset consisting of 6 experimental mixture samples. In our current study, we maintain this functional separation: the extensive augmented training corpus is utilized exclusively for the pretraining of the MAE, while the experimental multi-component and liquid and powder datasets are reserved for evaluating the downstream component identification task.
Methodology
This section describes the pipeline used to pretrain and instantiate our Raman spectra foundation model. Our pretraining framework follows the masked autoencoder (MAE) paradigm, in which a fraction of the input spectrum is masked, a Transformer encoder processes the visible tokens, and a decoder reconstructs the masked regions. We depart from standard MAE in three ways, namely (1) a physics-aware Voigt reconstruction head that produces interpretable peak decompositions, (2) an auxiliary denoising objective, and (3) a multi-objective loss combining these components. The encoder is a Vision Transformer (ViT) adapted to one-dimensional spectral inputs and processes only the visible tokens during masked reconstruction; a decoder then reconstructs the masked regions. Figure 1 provides an overview of the full architecture. Three model scales are evaluated — MAE-S, MAE-B, and MAE-L — with corresponding encoder and decoder depths summarized in Table 2. Positional information is incorporated through either trainable embeddings, fixed sinusoidal embeddings, or physically-informed Fourier embeddings derived from the Raman wavenumber axis. During pretraining no [CLS] token is used, whereas for downstream tasks a [CLS] token is prepended and its final embedding is used as the spectrum representation.

Figure 1. Pretraining architecture. The input spectrum is tokenized into patches and partially masked; a Transformer encoder processes the visible tokens and a decoder reconstructs the masked regions through three heads (per-pixel reconstruction, sparse Voigt-profile reconstruction, and denoising).
| Model size | embedding size | encoder depth | decoder depth | mlp size | # heads | head size |
| MAE-S (Small) | 64 | 4 | 2 | 256 | 4 | 64 |
| MAE-B (Base) | 128 | 4 | 2 | 512 | 4 | 128 |
| MAE-L (Large) | 256 | 6 | 2 | 1024 | 4 | 256 |
Table 2. Model-scale configurations. Encoder/decoder dimensions for the three evaluated model sizes (MAE-S, MAE-B, MAE-L): embedding size, encoder and decoder depth, MLP hidden size, and attention head count and size.
We first describe the preprocessing pipeline shared by all datasets (§ 4.1), then the masking strategy used during pretraining (§ 4.2), and finally the multi-objective reconstruction and denoising losses that define our pretraining objective (§ 4.3).
Preprocessing
Prior to tokenization and model input, all Raman spectra undergo a standardized preprocessing pipeline. Let denote the raw intensity spectrum of a given sample, together with its associated wavenumber axis; when explicit wavenumber values are not available, they are reconstructed from the Raman shift information reported in the original data source. Both the wavenumber axis and the intensity values are normalized via global min-max scaling computed over the entire dataset corpus, mapping values to . This ensures comparability across datasets acquired under different experimental conditions and mitigates the influence of outliers and numerical artifacts; datasets already provided within a fixed numerical range are left unchanged.
Tokenization. Following normalization, spectra are converted into patch-level representations using a sliding-window procedure parameterized by a window size , stride , and dilation factor , the latter controlling the effective sampling resolution within each window. By default spans the entire spectrum, yielding a single global token. Window extraction is implemented using strided views to avoid unnecessary memory copies, after which the windows are materialized as a contiguous tensor for subsequent embedding and Transformer processing.
Data augmentation. To improve robustness and reduce sensitivity to acquisition-specific artifacts, several spectral augmentations are applied independently during self-supervised pretraining. Spectral shift augmentation introduces a discrete random displacement of the spectral axis by an integer offset using circular rolling, simulating small calibration misalignments between measurements. Intensity scaling multiplies the entire spectrum by a random factor , reflecting variations in laser power, detector sensitivity, and sample concentration. Additive Gaussian noise,
with proportional to the spectrum’s standard deviation, models measurement noise and sensor uncertainty. Finally, peak shift and stretch augmentation applies a continuous deformation of the spectral axis using a random shift and a stretch factor , followed by linear interpolation, simulating non-uniform calibration drift and small physical variations in peak positions commonly encountered in Raman spectroscopy.
Masking Strategies
Given an input spectrum divided into patches, we mask a fraction of the sequence during pretraining. The number of masked patches is , and the masked and visible patch sets are denoted by and , respectively. We consider four masking strategies.
Random contiguous masking. A contiguous block of patches is removed at a random position. The starting index is sampled as , so that . Because the block is contiguous, the model must infer the missing structure from broader context rather than interpolate from adjacent patches.
Peak-centered masking. The dominant peak is located at , and the mask is a window around it, with . If the window extends beyond the spectral boundaries, it is shifted to remain within . This forces the model to reconstruct the most informative region of the spectrum.
Voigt peak masking. This strategy uses the same peak-centered indices, but the masked region is assigned to the physics-aware Voigt reconstruction objective rather than to per-pixel reconstruction alone.
Front masking. The final contiguous region of the spectrum is removed, so that and . The model must then reconstruct the missing region using only the preceding visible context.
Reconstruction and Denoising Objectives
Per-pixel reconstruction. The first reconstruction branch is a per-pixel decoder that predicts the original spectral values for all patches. The reconstruction loss over masked patches is
where denotes the masked patch indices and is the decoder output for patch .
Physics-aware Voigt reconstruction. To incorporate physically meaningful peak representations, a second reconstruction branch predicts sparse Voigt-profile decompositions. A Voigt profile is defined as the convolution of Lorentzian and Gaussian functions, a more detailed description of the loss functions is included in Appendix A.
The Voigt head predicts up to candidate profiles for each masked patch. Each profile is parameterized by and a soft presence score . The reconstructed spectrum is formed as a weighted sum of candidate profiles, while positivity and physical validity are enforced through softplus and sigmoid parameterizations. The corresponding reconstruction objective combines peak-weighted reconstruction, global reconstruction, and sparsity regularization.
Denoising objective. In addition to masked reconstruction, we introduce a denoising pretext task. A corrupted spectrum is generated using Poisson shot noise and additive Gaussian noise. Unlike the masking objectives, the encoder processes the complete unmasked sequence. A dedicated two-layer MLP predicts the clean spectrum, and the loss is
where denotes the encoder-decoder network.
Overall pretraining objective. The overall pretraining objective jointly optimizes the reconstruction and denoising tasks:
where , , and are non-negative hyperparameters. Setting recovers a standard pixel-MAE, whereas setting yields a purely physics-aware model.
Experiments
This section describes how we assess the quality and downstream utility of the representations learned during pretraining. We first define the four downstream tasks used to probe the pretrained encoder, spanning the primary analytical objectives of Raman spectroscopy (§ 5.1). We then describe four complementary evaluation protocols that adapt the frozen or pretrained encoder to each task, probing different aspects of the learned representations from frozen-feature quality to full fine-tuning (§ 5.2). § 6 reports the resulting performance across all task/protocol combinations.
Downstream Tasks
We evaluate the learned representations on four downstream tasks that collectively capture the primary analytical objectives of Raman spectroscopy, including classification, component identification, concentration estimation, and signal reconstruction.
The first task is substance classification, where the objective is to assign a Raman spectrum to one of a predefined set of classes. This task is implemented using a ViT1D encoder followed by a classification head. Depending on the dataset, the problem may be formulated as either binary classification, where the model distinguishes between two classes, or multi-class classification, where the model predicts the correct label among molecular species, bacterial strains, or chemical categories. This setup follows established Raman spectroscopy benchmarks, including bacterial identification datasets in which each spectrum is directly associated with a known class [10].
The second task is component identification. Given a query spectrum and a reference spectrum corresponding to a candidate component, the model must determine whether the reference component is present in the query. Rather than predicting a class label from a single spectrum, this task is formulated as a similarity-learning problem. We employ a pseudo-Siamese architecture in which the query and reference spectra are processed by separate encoder branches and projected into a shared embedding space. Training is performed using positive and negative spectrum pairs, encouraging samples containing the same component to produce similar embeddings while separating representations associated with different components. This formulation supports both binary component detection and multi-component identification by comparing a query spectrum against a library of reference spectra. Similar reference-based matching strategies have previously been explored for Raman spectral analysis [5].
The third task is concentration estimation. Given a spectrum from a sample of known composition but unknown concentration, the model predicts the concentration level as one of discrete classes. This formulation reflects practical analytical settings in which concentrations are assigned to calibrated ranges (e.g., trace, low, medium, and high) rather than estimated as continuous values. Such scenarios arise in applications including forensic quantification of GBL and quantitative SERS analysis using R6G. Concentration bins are defined separately for each dataset according to the physical concentration ranges available during data collection. Performance is evaluated using classification accuracy and macro-averaged F1 score.
The final task is spectral denoising, where the model reconstructs a clean Raman spectrum from a noisy observation. Unlike classification-based tasks, denoising directly evaluates the extent to which the learned representations capture underlying spectral structure and peak morphology beyond class-discriminative information [11]. Denoising is evaluated in two settings: (i) fine-tuning, in which the pretrained encoder initializes a denoising network that is subsequently optimized on task-specific data, and (ii) training from scratch, in which the same denoising architecture is randomly initialized and trained on the same task-specific data. Performance is assessed using Mean Squared Error (MSE), Peak Signal-to-Noise Ratio (PSNR) and the Structural Similarity Index Measure (SSIM).
Table 3 summarizes the downstream task assigned to each dataset. For substance classification, the label count denotes the number of substance or sample classes, whereas for concentration estimation it denotes the number of discrete concentration levels. Component identification is formulated as a binary presence-or-absence decision for a specified target component in a mixture. Thus, the value of one reported for R6G and Raman Sugars denotes one target component, rather than one output class: each prediction distinguishes a negative sample from a sample containing R6G or the target sugar, respectively. Spectral denoising has no discrete label space, as the target is a high-SNR spectrum.
| Task | Dataset | # Labels |
| Classification | Adenine | 2 |
| Classification | Bacteria | 30 |
| Classification | Liver Cancer | 2 |
| Classification | RRUFF-S (1/2) | 192 |
| Classification | RRUFF-S (2/2) | 1332 |
| Component Identification | DeepRaman (Multi-Component) | 13 |
| Component Identification | DeepRaman (Liquid & Powder) | 6 |
| Component Identification | R6G | 1 |
| Component Identification | Raman Sugars | 1 |
| Concentration Estimation | GBL | 4 |
| Concentration Estimation | Raman Sugars | 5 |
| Spectral Denoising | MDA-Spectral | – |
Table 3. Dataset-to-task mapping. Downstream task assignment for each dataset, together with the number of labels(classes, number of components, or concentration levels) defining the corresponding label space.
Evaluation Protocols
We evaluate representation quality through four complementary protocols: linear probing, attention probing, fine-tuning, and training from scratch. Together, these protocols assess different aspects of the learned representations, including feature quality without task adaptation, the effect of pretraining on optimization efficiency, and the interpretability of internal model behavior. Figure 2 illustrates the evaluation pipeline.

Figure 2. Evaluation pipeline. The four protocols used to assess the pretrained encoder, namely linear probing and attention probing (frozen encoder with a linear or attention-pooling head, respectively), fine-tuning (end-to-end adaptation), and training from scratch (random initialization).
Linear probing is used to evaluate the quality of the learned representations when the encoder is frozen and only a linear classifier is trained on top of the [CLS] embedding using labeled data. This setting provides a strict measure of representation quality since no gradient updates are propagated into the encoder, and performance directly reflects the structure of the pretrained feature space.
Attention probing evaluates representation quality using a lightweight attention-pooling head trained on top of the frozen encoder’s token embeddings, in place of the fixed [CLS] embedding used for linear probing. The probe learns a set of attention weights over the token sequence to produce a pooled representation, which is then passed to a classifier. Because the encoder itself remains frozen, this setting isolates the benefit of adaptive, task-specific pooling over the pretrained token representations from the benefit of full parameter adaptation, providing an intermediate evaluation point between linear probing and full fine-tuning.
In addition to probing-based evaluations, we consider full fine-tuning of the pretrained encoder on labeled data. In this setting, the encoder is initialized from pretraining and trained end-to-end, measuring the benefit of pretraining as an initialization strategy. This typically provides an upper bound on downstream performance for a fixed amount of labeled data.
Finally, we include a training-from-scratch baseline in which an architecture identical to the pretrained model is trained solely on labeled data with random initialization. This baseline quantifies the contribution of pretraining by comparing against models trained without any self-supervised signal.
Results
Experimental setup. Training uses AdamW with a learning rate of , weight decay of , gradient clipping of 0.5, and a cosine learning-rate schedule. Models trained from scratch are optimized for 50 epochs, whereas linear probing, attention probing, and fine-tuning are performed for 10 epochs. Bacterial classification is an exception: all protocols use 30 epochs to match the training budget of the baseline and ensure a fair comparison. The default masking ratio is 0.25, sinusoidal positional encodings are used unless otherwise stated, and the Voigt decoder predicts up to candidate peaks. Spectra are normalized using min–max scaling, and dataset-specific sampling parameters are applied where appropriate. All experiments are repeated across three random seeds.
Table 4, Table 5, Table 6, and Table 7 summarises performance across all downstream tasks and evaluation protocols for MAE-B; results for MAE-S and MAE-L and the effect of encoder scale are reported in Appendix § 10. In Table 4, the results demonstrate that the effectiveness of transfer learning is highly dependent on the characteristics of the downstream dataset. For the Adenine dataset, which is essentially a binary classification task the benefit of fine-tuning is most prevalent. For the Bacteria dataset (30 classes), fine-tuning achieved a substantial improvement over both probing approaches and training from scratch, attaining an Accuracy score of approximately 66% compared to 39% for the randomly initialized model, note that the Bacteria dataset experiments have been conducted based on the held out dataset protocol as described in [10]. Since the transfer learning experiments and the baseline study were both trained for 30 epochs, this comparison suggests that the pretrained representation provides a meaningful advantage under equivalent optimization conditions. The progressive improvement from linear probing to attention probing and full fine-tuning further indicates that while useful task-relevant information is present within the pretrained encoder, additional adaptation of the learned features is required to maximize performance on this task.
| Dataset | Evaluation Protocols | Accuracy | AUC | AUPRC | F1-Score |
| Adenine | Linear Probe | 0.6287 ± 0.0073 | 0.6613 ± 0.0188 | 0.6632 ± 0.0191 | 0.6060 ± 0.0170 |
| Adenine | Attention Probe | 0.7413 ± 0.0044 | 0.8100 ± 0.0086 | 0.7988 ± 0.0068 | 0.7009 ± 0.0063 |
| Adenine | Fine Tune | 0.7787 ± 0.0017 | 0.8336 ± 0.0108 | 0.8238 ± 0.0067 | 0.7580 ± 0.0027 |
| Adenine | From Scratch | 0.7298 ± 0.0456 | 0.8170 ± 0.0425 | 0.8008 ± 0.0411 | 0.7351 ± 0.0453 |
| Bacteria | Linear Probe | 0.2639 ± 0.0265 | 0.8191 ± 0.0070 | 0.2537 ± 0.0170 | 0.2065 ± 0.0227 |
| Bacteria | Attention Probe | 0.4279 ± 0.0497 | 0.9193 ± 0.0109 | 0.4506 ± 0.0490 | 0.3987 ± 0.0548 |
| Bacteria | Fine Tune | 0.6611 ± 0.0133 | 0.9661 ± 0.0007 | 0.7061 ± 0.0083 | 0.6520 ± 0.0140 |
| Bacteria | From Scratch | 0.3938 ± 0.0379 | 0.9000 ± 0.0115 | 0.4117 ± 0.0333 | 0.3319 ± 0.0371 |
| Bacteria | All isolates baseline | 0.8220 ± 0.0030 | - | - | - |
| Liver Cancer | Linear Probe | 0.8873 ± 0.0057 | 0.9492 ± 0.0053 | 0.9446 ± 0.0070 | 0.8873 ± 0.0057 |
| Liver Cancer | Attention Probe | 0.9053 ± 0.0112 | 0.9652 ± 0.0003 | 0.9650 ± 0.0007 | 0.9053 ± 0.0113 |
| Liver Cancer | Fine Tune | 0.8843 ± 0.0462 | 0.9609 ± 0.0006 | 0.9602 ± 0.0018 | 0.8836 ± 0.0474 |
| Liver Cancer | From Scratch | 0.8950 ± 0.0231 | 0.9590 ± 0.0016 | 0.9582 ± 0.0014 | 0.8948 ± 0.0232 |
| Liver Cancer | Baseline | ≈ 0.9000 | - | - | - |
| RRUFF-S (1/2) | Linear Probe | 0.2558 ± 0.0132 | 0.9539 ± 0.0079 | 0.3903 ± 0.0484 | 0.1603 ± 0.0117 |
| RRUFF-S (1/2) | Attention Probe | 0.4363 ± 0.0394 | 0.9786 ± 0.0044 | 0.6189 ± 0.0308 | 0.3313 ± 0.0447 |
| RRUFF-S (1/2) | Fine Tune | 0.9519 ± 0.0046 | 0.9997 ± 0.0001 | 0.9864 ± 0.0018 | 0.9479 ± 0.0057 |
| RRUFF-S (1/2) | From Scratch | 0.9773 ± 0.0022 | 0.9979 ± 0.0035 | 0.9926 ± 0.0028 | 0.9766 ± 0.0021 |
| RRUFF-S (1/2) | Baseline | 0.9772 | 0.9979 | 0.9909 | 0.9763 |
| RRUFF-S (2/2) | Linear Probe | 0.2055 ± 0.0011 | 0.9371 ± 0.0033 | 0.2872 ± 0.0071 | 0.1052 ± 0.0016 |
| RRUFF-S (2/2) | Attention Probe | 0.3136 ± 0.0219 | 0.9574 ± 0.0054 | 0.4283 ± 0.0288 | 0.1996 ± 0.0164 |
| RRUFF-S (2/2) | Fine Tune | 0.8454 ± 0.0083 | 0.9942 ± 0.0016 | 0.9282 ± 0.0085 | 0.8219 ± 0.0085 |
| RRUFF-S (2/2) | From Scratch | 0.8439 ± 0.0166 | 0.6581 ± 0.0033 | 0.9235 ± 0.0137 | 0.8309 ± 0.0192 |
| RRUFF-S (2/2) | Baseline | 0.8791 | 0.9691 | 0.9073 | 0.8511 |
Table 4. Classification results (MAE-B). Accuracy, AUC, AUPRC, and F1-score (mean ± std over three seeds) on the Adenine, Bacteria, Liver Cancer, and RRUFF-S (192- and 1332-class) datasets, for linear probing, attention probing, fine-tuning, and training from scratch, alongside published baselines where available.
| Dataset | Evaluation Protocol | Accuracy | AUC | AUPRC | F1-Score |
| DeepRaman (Multi-component) | Linear Probe | ||||
| DeepRaman (Multi-component) | Attention Probe | ||||
| DeepRaman (Multi-component) | Fine Tune | ||||
| DeepRaman (Multi-component) | From Scratch | ||||
| DeepRaman (Liquid & Powder) | Linear Probe | ||||
| DeepRaman (Liquid & Powder) | Attention Probe | ||||
| DeepRaman (Liquid & Powder) | Fine Tune | ||||
| DeepRaman (Liquid & Powder) | From Scratch | ||||
| R6G | Linear Probe | ||||
| R6G | Attention Probe | ||||
| R6G | Fine Tune | ||||
| R6G | From Scratch | ||||
| Raman Sugars | Linear Probe | ||||
| Raman Sugars | Attention Probe | ||||
| Raman Sugars | Fine Tune | ||||
| Raman Sugars | From Scratch |
Table 5. Component identification results (MAE-B). Accuracy, AUC, AUPRC, and F1-score (mean std over three seeds) on the DeepRaman (multi-component), DeepRaman (Liquid & Powder), R6G, and Raman Sugars datasets, for linear probing, attention probing, fine-tuning, and training from scratch.
| Dataset | Evaluation Protocol | Accuracy | AUC | AUPRC | F1-Score |
| GBL | Linear Probe | ||||
| GBL | Attention Probe | ||||
| GBL | Fine Tune | ||||
| GBL | From Scratch | ||||
| Raman Sugars | Linear Probe | ||||
| Raman Sugars | Attention Probe | ||||
| Raman Sugars | Fine Tune | ||||
| Raman Sugars | From Scratch |
Table 6. Concentration estimation results (MAE-B). Accuracy, AUC, AUPRC, and F1-score (mean std over three seeds) on the GBL and Raman Sugars datasets, framed as discrete-bin classification, for linear probing, attention probing, fine-tuning, and training from scratch.
| Dataset | Evaluation Protocol | MSE | PSNR | SSIM |
| MDA-Spectral | Fine Tune | |||
| MDA-Spectral | From Scratch | |||
| MDA-Spectral | Baseline |
Table 7. Denoising results (MAE-B) on MDA-Spectral. MSE, PSNR, and SSIM (mean std over three seeds) for fine-tuning and training from scratch, compared against the published baseline.
In contrast, all approaches produced comparable results on the binary classification Liver Cancer dataset, with F1 scores ranging from 88% to 90% and closely matching the baseline reported in the github repository from [12]. The strong performance of the frozen encoder suggests that the pretrained representation already captures features relevant to the downstream classification task, while the limited gains from fine-tuning indicate that further parameter adaptation provides little additional benefit.
The RRUFF-S datasets exhibit a different behavior. For the 192-class subset, training from scratch achieved the highest performance and closely matched the reported baseline, while fine-tuning resulted in a small performance degradation. Similarly, for the 1332-class subset, fine-tuning and training from scratch produced nearly identical F1 scores, although both remained below the baseline. As the RRUFF-S experiments employed an approximately 69-70% train and exactly 30% train and test split respectively, consistent with the baseline study, these results suggest that the larger mineral spectroscopy datasets contain sufficient task-specific information to learn effective representations without relying heavily on pretraining. An interesting observation is the substantial difference in AUC between the fine-tuned and randomly initialized models on the 1332-class subset despite their comparable F1, precision, and accuracy scores. This behavior indicates that although both models achieve similar classification performance at the selected decision threshold, the fine-tuned model produces probability estimates with considerably better class separability across threshold values. Consequently, the pretrained representation appears to improve the ranking and calibration ibration characteristics of the classifier even when threshold-dependent performance metrics remain largely unchanged.
Overall, the findings indicate that transfer learning provides the greatest benefit in data-constrained settings, whereas its advantage diminishes as the size and diversity of the downstream dataset increase. Furthermore, the results suggest that the benefits of pretraining may extend beyond improvements in classification accuracy alone, contributing to enhanced probability discrimination and confidence estimation in complex multiclass settings.
Table 5 reports the results for the component identification task across four datasets of varying complexity. Overall, the results show that task difficulty is strongly influenced by the number of components present in each dataset, with performance generally improving as the number of components decreases.
The most challenging benchmark is the DeepRaman multi-component dataset, which contains 13 possible components. Across all evaluation protocols, the achieved performance remains relatively modest, with accuracies ranging from 0.5903 to 0.5975 and F1-scores ranging from 0.5660 to 0.5729. The similarity of the results obtained by linear probing, attention probing, fine-tuning, and training from scratch suggests that the complexity of the dataset limits the achievable performance regardless of the learning strategy. Fine-tuning achieves the highest F1-score of 0.5729, while attention probing achieves the highest accuracy of 0.5975. However, the differences between protocols remain small, indicating that the learned representations already capture most of the discriminative information available for this task.
For the Liquid & Powder dataset, which involves identification among six components, performance improves substantially. Linear probing, fine-tuning, and training from scratch all achieve the highest accuracy of 0.8333 and an F1-score of 0.8500. However, linear probing obtains the best AUC and AUPRC values, reaching 0.9200 and 0.8924, respectively. Fine-tuning also performs strongly, with an AUC of 0.8812 and an AUPRC of 0.8653, outperforming training from scratch on these metrics. The attention probe shows lower average performance, with an accuracy of 0.7222 and an F1-score of 0.7125, suggesting reduced stability on this relatively small dataset.
The binary R6G identification task achieves strong overall performance, although the results vary substantially across evaluation protocols. Linear probing reaches an accuracy of and an F1-score of , while maintaining high ranking performance, with an AUC of and an AUPRC of . Attention probing substantially improves classification performance, achieving an accuracy and F1-score of , together with an AUC and AUPRC of . Fine-tuning achieves perfect and fully consistent results across all metrics, with accuracy, AUC, AUPRC, and F1-score values of . Training from scratch also performs strongly, reaching an accuracy of and an F1-score of , with an AUC of and an AUPRC of . Overall, these findings indicate that the R6G spectral signatures are highly discriminative when the representation is adapted through attention probing or fine-tuning, whereas the lower linear-probing accuracy suggests that they are not perfectly separable using a simple linear classifier on fixed features.
The Raman Sugars dataset presents an intermediate level of difficulty in the component identification task. In this case, fine-tuning achieves the best overall performance, reaching an accuracy of 0.9523, an AUC of 0.9899, an AUPRC of 0.9855, and an F1-score of 0.9414. Training from scratch performs very similarly, with an accuracy of 0.9519, an AUC of 0.9873, an AUPRC of 0.9822, and an F1-score of 0.9398. Attention probing also performs strongly, substantially outperforming linear probing across all metrics, with an accuracy of 0.8555 compared to 0.7449 for linear probing, and an F1-score of 0.8171 compared to 0.5822. The significant improvement observed after fine-tuning suggests that task-specific adaptation is beneficial when subtle spectral differences exist between classes.
Across all datasets, a clear relationship emerges between the number of candidate components and classification performance. Datasets with fewer components generally yield higher accuracy, AUC, AUPRC, and F1-score values. Furthermore, pretrained approaches—particularly fine-tuning—generally match or exceed the performance of models trained from scratch, highlighting the effectiveness of transfer learning for Raman-based component identification. The largest benefits of fine-tuning are observed on datasets of intermediate difficulty, such as Raman Sugars, whereas for very simple tasks, such as R6G, or highly challenging tasks, such as DeepRaman multi-component identification, the differences between evaluation protocols become less pronounced.
Table 6 reports the results for the concentration estimation task across two Raman-based datasets with different numbers of target levels. The results show clear and consistent differences in the effectiveness of transfer learning depending on both dataset structure and supervision regime.
For the GBL dataset with four concentration levels, performance improves substantially as model capacity for adaptation increases. Linear probing achieves relatively weak performance, with an accuracy of 0.4689 and an F1-score of 0.2652, indicating limited separability under a frozen representation. Attention probing improves performance significantly, reaching an accuracy of 0.64 and an F1-score of 0.5331, suggesting that incorporating attention-based adaptation partially resolves representational limitations. Fine-tuning yields the best overall results, with an accuracy of 0.8733, AUC of 0.9814, and F1-score of 0.8351, demonstrating that full parameter adaptation is highly effective for this task. Training from scratch also performs strongly, achieving an F1-score of 0.7441 and an accuracy of 0.7297, although it remains consistently below the fine-tuned model. These results indicate that while pretraining provides a substantial advantage when fully leveraged through fine-tuning, learning from randomly initialized weights remains a competitive alternative for this dataset.
For the Raman Sugars dataset with five concentration levels, a different trend emerges. Linear probing again yields the lowest performance, with an accuracy of 0.3667 and an F1-score of 0.2201. Attention probing improves results but remains limited compared to full training strategies. Fine-tuning achieves strong performance with an accuracy of 0.8990 and an F1-score of 0.8883, while training from scratch further improves accuracy to 0.9460 and achieves the highest F1-score of 0.9461. Notably, despite fine-tuning achieving high AUPRC (0.9718), training from scratch surpasses it across most metrics, suggesting that task-specific optimization from random initialization is particularly effective for this dataset.
Overall, the results indicate that concentration estimation benefits significantly from deeper model adaptation, with fine-tuning consistently outperforming shallow probing approaches. However, unlike the GBL dataset where pretraining provides the best overall performance when fully utilized, the Raman Sugars dataset demonstrates that training from scratch can match or exceed fine-tuning performance. This suggests that the usefulness of pretraining is highly dependent on the underlying data distribution and that, in some cases, task-specific learning from random initialization may yield superior discriminative performance.
Table 7 summarizes denoising performance on the MDA-Spectral dataset. Fine-tuning achieves an MSE of and a PSNR of 47.45 dB, compared with and 47.29 dB for training from scratch. Conversely, training from scratch achieves a higher SSIM (0.9603 versus 0.9575). These results show similar denoising performance under the two initialization strategies, with fine-tuning yielding slightly better reconstruction error and training from scratch yielding slightly better structural similarity.
The published results of Horgan et al. [11] are included for reference. Their MSE measures spectral reconstruction error, whereas their PSNR and SSIM assess reconstructed peak-intensity images. Our PSNR and SSIM are evaluated directly on one-dimensional spectra.
The results indicate that pretraining does not provide the same level of advantage for the denoising task as observed for some of the classification datasets. Instead, both initialization strategies achieve comparable performance and significantly outperform the baseline method. This suggests that the MDA-Spectral denoising task may be sufficiently constrained for the network to learn robust reconstruction mappings directly from the available training data, while pretraining offers only modest improvements in reconstruction error and signal fidelity. Nevertheless, the lower MSE and higher PSNR obtained through fine-tuning indicate that pretraining can still provide a small but measurable benefit in optimizing reconstruction accuracy, even when overall denoising performance remains largely comparable between the two training strategies.
Conclusion
This article studied self-supervised pretraining for Raman spectroscopy. We pretrained a masked autoencoder on unlabeled spectra from ten biological, chemical, forensic, and materials datasets, using a pretext task that combines per-pixel reconstruction, sparse Voigt-profile reconstruction, and denoising. The Voigt decoder describes masked peak regions with a few profiles whose centers, widths, and amplitudes are interpretable as approximate peak parameters, while the per-pixel and denoising objectives preserve dense signal fidelity.
We then evaluated the encoder across tasks, protocols, and scales, and the outcome depends on the task. Fine-tuning the pretrained encoder improves on training the same architecture from scratch where labeled data are scarce relative to task difficulty, most clearly on 30-class bacterial identification, and brings little or no benefit where downstream datasets are large or tasks are near saturation. Frozen features are poorly served by a linear head but considerably better by attention pooling. The value of pretraining grows with encoder scale. Frozen features improve on most tasks, and on several the margin over training from scratch widens, because larger encoders trained from scratch gain less from added capacity and often degrade. For practitioners, this suggests starting from the pretrained encoder and fine-tuning it when labels are limited, rather than relying on a linear probe of frozen features.
Future work will follow the scaling trend observed here, pretraining larger encoders on larger and more diverse corpora, and will evaluate transfer to instruments and sample types held out from pretraining.
Acknowledgement
This work has received funding from the European Union’s Horizon Innovation Actions under Grant Agreement no.101168416 (ARMADILLO).
Voigt Profile Mathematics
A Voigt profile is the convolution of a Lorentzian and a Gaussian :
where is the peak center (wavenumber), and are the Lorentzian and Gaussian half-widths at half-maximum (HWHM), respectively. For computational efficiency we use the Thompson et al. pseudo-Voigt approximation [29], which expresses the profile as a linear combination of a Lorentzian and a Gaussian with a mixing parameter :
where is the amplitude, is the total HWHM, and is determined analytically from and . This approximation is differentiable with respect to all parameters , enabling end-to-end training. For each masked patch , the Voigt head predicts a set of at most candidate profiles. Each candidate is associated with parameters and a soft presence score produced by a sigmoid output. The reconstructed spectrum over the masked patch region is:
Physical constraints are enforced via parameter activations: and are passed through softplus to ensure positivity; is bounded to the patch wavenumber range by a sigmoid rescaling. The Voigt reconstruction loss combines spectral fidelity with a sparsity penalty on the number of active profiles:
where
The sparsity term implements an -type penalty on the presence scores, encouraging the model to explain each masked region with as few Voigt profiles as physically necessary. At inference time, profiles with (threshold ) are discarded, yielding an interpretable peak decomposition. Profiles with are discarded, yielding an interpretable decomposition of spectral peaks.
Model Size Ablation
The results reported in § 6 use the base model configuration, MAE-B (Table 2). To assess how representation quality scales with model capacity, we repeat the full evaluation protocol — linear probing, attention probing, fine-tuning, and training from scratch — using the smaller MAE-S and larger MAE-L configurations across all downstream tasks. Table 8, Table 9, Table 10, and Table 11 report the corresponding results for the classification, component identification, concentration estimation, and denoising tasks, respectively, and should be read alongside the MAE-B results in § 6 to assess the effect of encoder scale.
| Dataset | Evaluation Protocols | Accuracy | AUC | AUPRC | F1-Score |
| MAE-SMALL | |||||
| Adenine | Linear Probe | 0.5861 ± 0.0185 | 0.5953 ± 0.0304 | 0.5707 ± 0.0489 | 0.4734 ± 0.0662 |
| Adenine | Attention Probe | 0.6094 ± 0.0419 | 0.7313 ± 0.0172 | 0.7341 ± 0.0149 | 0.6078 ± 0.0396 |
| Adenine | Fine Tune | 0.7433 ± 0.0093 | 0.8294 ± 0.0106 | 0.8164 ± 0.0092 | 0.7260 ± 0.0187 |
| Adenine | From Scratch | 0.7291 ± 0.0059 | 0.8126 ± 0.0073 | 0.7924 ± 0.0089 | 0.7368 ± 0.0063 |
| Bacteria | Linear Probe | 0.2121 ± 0.0307 | 0.7816 ± 0.0255 | 0.2066 ± 0.0098 | 0.1623 ± 0.0213 |
| Bacteria | Attention Probe | 0.3233 ± 0.0081 | 0.8679 ± 0.0050 | 0.3329 ± 0.0198 | 0.2873 ± 0.0079 |
| Bacteria | Fine Tune | 0.6490 ± 0.0094 | 0.9709 ± 0.0022 | 0.6986 ± 0.0179 | 0.6404 ± 0.0099 |
| Bacteria | From Scratch | 0.3861 ± 0.0115 | 0.9116 ± 0.0078 | 0.4334 ± 0.0011 | 0.3246 ± 0.0111 |
| Bacteria | All isolates baseline | 0.8220 ± 0.0030 | - | - | - |
| Liver Cancer | Linear Probe | 0.8560 ± 0.0356 | 0.9528 ± 0.0017 | 0.9515 ± 0.0021 | 0.8550 ± 0.0370 |
| Liver Cancer | Attention Probe | 0.8370 ± 0.0035 | 0.9611 ± 0.0024 | 0.9606 ± 0.0022 | 0.8350 ± 0.0035 |
| Liver Cancer | Fine Tune | 0.9083 ± 0.0280 | 0.9625 ± 0.0018 | 0.9609 ± 0.0002 | 0.9082 ± 0.0282 |
| Liver Cancer | From Scratch | 0.8970 ± 0.0061 | 0.9637 ± 0.0041 | 0.9633 ± 0.0039 | 0.8969 ± 0.0061 |
| Liver Cancer | Baseline | ≈ 0.9000 | - | - | - |
| RRUFF-S (1/2) | Linear Probe | 0.1235 ± 0.0282 | 0.8797 ± 0.0061 | 0.1796 ± 0.0213 | 0.0509 ± 0.0108 |
| RRUFF-S (1/2) | Attention Probe | 0.1750 ± 0.0197 | 0.9219 ± 0.0137 | 0.2793 ± 0.0370 | 0.0768 ± 0.0101 |
| RRUFF-S (1/2) | Fine Tune | 0.8889 ± 0.0047 | 0.9988 ± 0.0005 | 0.9591 ± 0.0009 | 0.8723 ± 0.0029 |
| RRUFF-S (1/2) | From Scratch | 0.9793 ± 0.0032 | 0.9982 ± 0.0030 | 0.9928 ± 0.0025 | 0.9789 ± 0.0032 |
| RRUFF-S (1/2) | Baseline | 0.9772 | 0.9979 | 0.9909 | 0.9763 |
| RRUFF-S (2/2) | Linear Probe | 0.0841 ± 0.0089 | 0.8316 ± 0.0085 | 0.0856 ± 0.0017 | 0.0274 ± 0.0055 |
| RRUFF-S (2/2) | Attention Probe | 0.0990 ± 0.0117 | 0.8284 ± 0.0138 | 0.1107 ± 0.0112 | 0.0286 ± 0.0036 |
| RRUFF-S (2/2) | Fine Tune | 0.7428 ± 0.0014 | 0.9949 ± 0.0018 | 0.8913 ± 0.0045 | 0.6939 ± 0.0034 |
| RRUFF-S (2/2) | From Scratch | 0.8312 ± 0.0172 | 0.6576 ± 0.0030 | 0.9227 ± 0.0068 | 0.8163 ± 0.0180 |
| RRUFF-S (2/2) | Baseline | 0.8791 | 0.9691 | 0.9073 | 0.8511 |
| MAE-LARGE | |||||
| Adenine | Linear Probe | 0.6670 ± 0.0117 | 0.7249 ± 0.0195 | 0.7166 ± 0.0106 | 0.6449 ± 0.0134 |
| Adenine | Attention Probe | 0.7608 ± 0.0111 | 0.8031 ± 0.0214 | 0.7945 ± 0.0200 | 0.7332 ± 0.0214 |
| Adenine | Fine Tune | 0.7517 ± 0.0052 | 0.8150 ± 0.0068 | 0.8018 ± 0.0064 | 0.7176 ± 0.0066 |
| Adenine | From Scratch | 0.7278 ± 0.0066 | 0.8045 ± 0.0096 | 0.7965 ± 0.0102 | 0.7354 ± 0.0072 |
| Bacteria | Linear Probe | 0.4691 ± 0.0067 | 0.9165 ± 0.0009 | 0.4872 ± 0.0067 | 0.4485 ± 0.0071 |
| Bacteria | Attention Probe | 0.5694 ± 0.0280 | 0.9533 ± 0.0041 | 0.6129 ± 0.0226 | 0.5566 ± 0.0306 |
| Bacteria | Fine Tune | 0.6898 ± 0.0059 | 0.9644 ± 0.0033 | 0.7391 ± 0.0090 | 0.6797 ± 0.0056 |
| Bacteria | From Scratch | 0.4012 ± 0.0284 | 0.8701 ± 0.0202 | 0.4012 ± 0.0407 | 0.3467 ± 0.0335 |
| Bacteria | All isolates baseline | 0.8220 ± 0.0030 | - | - | - |
| Liver Cancer | Linear Probe | 0.8317 ± 0.0188 | 0.9615 ± 0.0030 | 0.9603 ± 0.0052 | 0.8291 ± 0.0203 |
| Liver Cancer | Attention Probe | 0.8587 ± 0.0601 | 0.9599 ± 0.0036 | 0.9592 ± 0.0039 | 0.8566 ± 0.0635 |
| Liver Cancer | Fine Tune | 0.8703 ± 0.0442 | 0.9526 ± 0.0122 | 0.9518 ± 0.0127 | 0.8697 ± 0.0448 |
| Liver Cancer | From Scratch | 0.8740 ± 0.0357 | 0.9569 ± 0.0088 | 0.9549 ± 0.0103 | 0.8735 ± 0.0363 |
| Liver Cancer | Baseline | ≈ 0.9000 | - | - | - |
| RRUFF-S (1/2) | Linear Probe | 0.6832 ± 0.0142 | 0.9955 ± 0.0010 | 0.8486 ± 0.0087 | 0.6223 ± 0.0182 |
| RRUFF-S (1/2) | Attention Probe | 0.8176 ± 0.0151 | 0.9965 ± 0.0009 | 0.9071 ± 0.0087 | 0.7938 ± 0.0174 |
| RRUFF-S (1/2) | Fine Tune | 0.9612 ± 0.0095 | 0.9999 ± 0.0000 | 0.9910 ± 0.0011 | 0.9594 ± 0.0109 |
| RRUFF-S (1/2) | From Scratch | 0.9690 ± 0.0053 | 0.9981 ± 0.0029 | 0.9892 ± 0.0016 | 0.9696 ± 0.0025 |
| RRUFF-S (1/2) | Baseline | 0.9772 | 0.9979 | 0.9909 | 0.9763 |
| RRUFF-S (2/2) | Linear Probe | 0.4751 ± 0.0020 | 0.9862 ± 0.0012 | 0.7295 ± 0.0047 | 0.3598 ± 0.0042 |
| RRUFF-S (2/2) | Attention Probe | 0.5721 ± 0.0316 | 0.9871 ± 0.0015 | 0.7606 ± 0.0248 | 0.4915 ± 0.0358 |
| RRUFF-S (2/2) | Fine Tune | 0.8939 ± 0.0074 | 0.9962 ± 0.0009 | 0.9507 ± 0.0063 | 0.8800 ± 0.0109 |
| RRUFF-S (2/2) | From Scratch | 0.8054 ± 0.0249 | 0.6555 ± 0.0047 | 0.9092 ± 0.0045 | 0.7872 ± 0.0275 |
| RRUFF-S (2/2) | Baseline | 0.8791 | 0.9691 | 0.9073 | 0.8511 |
Table 8. Classification results for MAE-S and MAE-L. Accuracy, AUC, AUPRC, and F1-score (mean ± std over three seeds) for all four evaluation protocols across model scales, complementing the MAE-B results in Table 4.
| Dataset | Evaluation Protocol | Accuracy | AUC | AUPRC | F1-Score |
| MAE-SMALL | |||||
| DeepRaman (Multi-component) | Linear Probe | 0.5945 ± 0.0014 | 0.6463 ± 0.0221 | 0.4886 ± 0.0387 | 0.5653 ± 0.0123 |
| DeepRaman (Multi-component) | Attention Probe | 0.5886 ± 0.0347 | 0.4763 ± 0.0176 | 0.4588 ± 0.1588 | 0.2518 ± 0.2885 |
| DeepRaman (Multi-component) | Fine Tune | 0.5914 ± 0.0068 | 0.6056 ± 0.0454 | 0.4246 ± 0.0459 | 0.5615 ± 0.0189 |
| DeepRaman (Multi-component) | From Scratch | 0.5953 ± 0.0000 | 0.5935 ± 0.0234 | 0.4004 ± 0.0193 | 0.5724 ± 0.0000 |
| DeepRaman (Liquid & Powder) | Linear Probe | 0.8333 ± 0.0000 | 0.8121 ± 0.0686 | 0.7472 ± 0.1428 | 0.8500 ± 0.0000 |
| DeepRaman (Liquid & Powder) | Attention Probe | 0.7314 ± 0.1764 | 0.6904 ± 0.1657 | 0.6207 ± 0.1348 | 0.7333 ± 0.2021 |
| DeepRaman (Liquid & Powder) | Fine Tune | 0.8333 ± 0.0000 | 0.8446 ± 0.0386 | 0.7949 ± 0.0549 | 0.8500 ± 0.0000 |
| DeepRaman (Liquid & Powder) | From Scratch | 0.8333 ± 0.0000 | 0.7956 ± 0.0697 | 0.6957 ± 0.1064 | 0.8500 ± 0.0000 |
| R6G | Linear Probe | 0, 7131 ± 0, 0175 | 0, 9768 ± 0, 0032 | 0, 9778 ± 0, 0031 | 0, 6756 ± 0, 0234 |
| R6G | Attention Probe | 0, 8885 ± 0, 0489 | 0, 9897 ± 0, 0087 | 0, 9899 ± 0, 0085 | 0, 8854 ± 0, 0518 |
| R6G | Fine Tune | 1, 0000 ± 0, 0000 | 1, 0000 ± 0, 0000 | 1, 0000 ± 0, 0000 | 1, 0000 ± 0, 0000 |
| R6G | From Scratch | 0, 9239 ± 0, 0489 | 0, 9758 ± 0, 0238 | 0, 9771 ± 0, 0224 | 0, 9238 ± 0, 0489 |
| Raman Sugars | Linear Probe | 0, 7463 ± 0, 0045 | 0, 6808 ± 0, 0123 | 0, 6460 ± 0, 0091 | 0, 5571 ± 0, 0363 |
| Raman Sugars | Attention Probe | 0, 7614 ± 0, 0205 | 0, 7430 ± 0, 0517 | 0, 7109 ± 0, 0488 | 0, 6280 ± 0, 0467 |
| Raman Sugars | Fine Tune | 0, 9391 ± 0, 0066 | 0, 9825 ± 0, 0024 | 0, 9742 ± 0, 0035 | 0, 9219 ± 0, 0078 |
| Raman Sugars | From Scratch | 0, 9195 ± 0, 0572 | 0, 9658 ± 0, 0336 | 0, 9546 ± 0, 0394 | 0, 8933 ± 0, 0785 |
| MAE-LARGE | |||||
| DeepRaman (Multi-component) | Linear Probe | 0.6059 ± 0.0128 | 0.6422 ± 0.0200 | 0.4644 ± 0.0545 | 0.5721 ± 0.0040 |
| DeepRaman (Multi-component) | Attention Probe | 0.5936 ± 0.0029 | 0.6041 ± 0.0267 | 0.4203 ± 0.0316 | 0.5557 ± 0.0289 |
| DeepRaman (Multi-component) | Fine Tune | 0.5958 ± 0.0009 | 0.6025 ± 0.0156 | 0.4099 ± 0.0244 | 0.5727 ± 0.0006 |
| DeepRaman (Multi-component) | From Scratch | 0.5953 ± 0.0000 | 0.6100 ± 0.0347 | 0.4342 ± 0.0425 | 0.5724 ± 0.0000 |
| DeepRaman (Liquid & Powder) | Linear Probe | 0.8333 ± 0.0000 | 0.8090 ± 0.0533 | 0.7349 ± 0.1103 | 0.8500 ± 0.0000 |
| DeepRaman (Liquid & Powder) | Attention Probe | 0.7777 ± 0.0962 | 0.7647 ± 0.0891 | 0.6886 ± 0.0424 | 0.7571 ± 0.1608 |
| DeepRaman (Liquid & Powder) | Fine Tune | 0.8333 ± 0.0000 | 0.8590 ± 0.0901 | 0.8049 ± 0.1396 | 0.8500 ± 0.0000 |
| DeepRaman (Liquid & Powder) | From Scratch | 0.8333 ± 0.0000 | 0.8937 ± 0.0143 | 0.8688 ± 0.0212 | 0.8500 ± 0.0000 |
| R6G | Linear Probe | 0, 8022 ± 0, 0262 | 0, 9578 ± 0, 0007 | 0, 9602 ± 0, 0005 | 0, 7887 ± 0, 0315 |
| R6G | Attention Probe | 1, 0000 ± 0, 0000 | 1, 0000 ± 0, 0000 | 1, 0000 ± 0, 0000 | 1, 0000 ± 0, 0000 |
| R6G | Fine Tune | 1, 0000 ± 0, 0000 | 1, 0000 ± 0, 0000 | 1, 0000 ± 0, 0000 | 1, 0000 ± 0, 0000 |
| R6G | From Scratch | 0, 9982 ± 0, 0016 | 0, 9998 ± 0, 0002 | 0, 9998 ± 0, 0002 | 0, 9982 ± 0, 0016 |
| Raman Sugars | Linear Probe | 0, 7419 ± 0, 0068 | 0, 6941 ± 0, 0063 | 0, 6475 ± 0, 0050 | 0, 5443 ± 0, 0436 |
| Raman Sugars | Attention Probe | 0, 9227 ± 0, 0178 | 0, 9739 ± 0, 0099 | 0, 9610 ± 0, 0131 | 0, 9011 ± 0, 0187 |
| Raman Sugars | Fine Tune | 0, 9557 ± 0, 0215 | 0, 9895 ± 0, 0076 | 0, 9842 ± 0, 0104 | 0, 9438 ± 0, 0275 |
| Raman Sugars | From Scratch | 0, 8964 ± 0, 0708 | 0, 9491 ± 0, 0434 | 0, 9343 ± 0, 0561 | 0, 8648 ± 0, 0930 |
Table 9. Component identification results for MAE-S and MAE-L. Accuracy, AUC, AUPRC, and F1-score (mean ± std over three seeds) for all four evaluation protocols across model scales, complementing the MAE-B results in Table 5.
| Dataset | Evaluation Protocol | Accuracy | AUC | AUPRC | F1-Score |
| MAE-SMALL | |||||
| GBL | Linear Probe | 0.4511 0.0252 | 0.6965 0.0019 | 0.3794 0.0269 | 0.1914 0.0344 |
| GBL | Attention Probe | 0.5311 0.0391 | 0.8084 0.0297 | 0.5194 0.0551 | 0.2998 0.0920 |
| GBL | Fine Tune | 0.8022 0.0308 | 0.9586 0.0102 | 0.8496 0.0436 | 0.7445 0.0649 |
| GBL | From Scratch | 0.8220 0.0404 | 0.9756 0.0040 | 0.9128 0.0046 | 0.8094 0.0393 |
| Raman Sugars | Linear Probe | 0.2838 0.0148 | 0.6897 0.0077 | 0.4074 0.0050 | 0.1198 0.0252 |
| Raman Sugars | Attention Probe | 0.4478 0.0188 | 0.6896 0.0134 | 0.4291 0.0233 | 0.3487 0.0258 |
| Raman Sugars | Fine Tune | 0.8744 0.0094 | 0.9264 0.0202 | 0.8483 0.0680 | 0.7629 0.0314 |
| Raman Sugars | From Scratch | 0.9558 0.0156 | 0.9614 0.0103 | 0.9861 0.0037 | 0.9527 0.0120 |
| MAE-LARGE | |||||
| GBL | Linear Probe | 0.5133 0.0437 | 0.7604 0.0359 | 0.5264 0.0886 | 0.372 0.0992 |
| GBL | Attention Probe | 0.6422 0.0543 | 0.87 0.0198 | 0.7179 0.0455 | 0.6113 0.0863 |
| GBL | Fine Tune | 0.7267 0.0416 | 0.9413 0.0034 | 0.8855 0.0109 | 0.7466 0.046 |
| GBL | From Scratch | 0.7166 0.0588 | 0.9052 0.0211 | 0.8032 0.0577 | 0.701 0.0739 |
| Raman Sugars | Linear Probe | 0.4880 0.0042 | 0.7579 0.0204 | 0.4931 0.0296 | 0.4138 0.0171 |
| Raman Sugars | Attention Probe | 0.7896 0.0189 | 0.8668 0.0363 | 0.7971 0.0547 | 0.7258 0.0696 |
| Raman Sugars | Fine Tune | 0.9162 0.0102 | 0.9178 0.0438 | 0.9789 0.0053 | 0.9260 0.0064 |
| Raman Sugars | From Scratch | 0.9835 0.0045 | 0.9559 0.0323 | 0.9966 0.0011 | 0.9821 0.0036 |
Table 10. Concentration estimation results for MAE-S and MAE-L. Accuracy, AUC, AUPRC, and F1-score (mean std over three seeds) for all four evaluation protocols across model scales, complementing the MAE-B results in Table 6.
| Dataset | Evaluation Protocol | MSE | PSNR | SSIM |
| MAE-SMALL | ||||
| MDA-Spectral | Fine Tune | 47.5364 0.1795 | 0.9597 0.0003 | |
| MDA-Spectral | From Scratch | 47.7670 0.2270 | 0.9608 0.0002 | |
| MDA-Spectral | Baseline | 46.21 | 0.9532 | |
| MAE-LARGE | ||||
| MDA-Spectral | Fine Tune | 47.6834 0.1317 | 0.9594 0.0019 | |
| MDA-Spectral | From Scratch | 46.9844 0.3076 | 0.9603 0.0003 | |
| MDA-Spectral | Baseline | 46.21 | 0.9532 |
Table 11. Denoising results on MDA-Spectral for MAE-S and MAE-L. MSE, PSNR, and SSIM (mean std over three seeds) for fine-tuning and training from scratch across model scales, compared against the published baseline and complementing the MAE-B results in Table 7.
Two trends emerge across scales. First, the frozen representation improves with encoder size. From MAE-S to MAE-L, linear-probe F1 rises by 0.11 to 0.57 on seven of the eleven prediction tasks (Adenine, Bacteria, both RRUFF-S subsets, R6G, GBL, and Raman Sugars concentration), with the largest gains on the 192-class RRUFF-S subset (0.05 to 0.62) and on Bacteria (0.16 to 0.45). On the remaining four tasks, the two DeepRaman datasets, Raman Sugars identification, and Liver Cancer, linear-probe F1 changes by at most 0.03. Second, the margin of fine-tuning over training from scratch widens with encoder size on five tasks, by 0.05 to 0.22 F1: both RRUFF-S subsets, Raman Sugars identification and concentration, and GBL. On four of these five, the model trained from scratch degrades from MAE-S to MAE-L, consistent with larger models overfitting the limited labeled data when trained without pretraining, whereas the fine-tuned model does not. The largest change occurs on the 1,332-class RRUFF-S subset, where fine-tuning trails training from scratch by 0.12 F1 with MAE-S but leads by 0.09 with MAE-L, and exceeds the published baseline on all four metrics. Denoising follows the same pattern: fine-tuning yields a higher MSE than training from scratch with MAE-S but a lower one with MAE-L. The margin narrows by more than 0.02 F1 only on R6G (by 0.07), where training from scratch itself approaches perfect performance with MAE-L.
Qualitative Analysis of Maximum Peak Reconstruction
The Voigt reconstruction head is designed to provide a compact representation of localized Raman peak structure. Rather than predicting every intensity value independently, the decoder represents a masked spectral region through a small set of parameterized Voigt profiles. Each profile is defined by its amplitude, center position, Gaussian width, Lorentzian width, and presence score. This parameterization allows the model to summarize the dominant morphology of a peak using substantially fewer quantities than direct per-pixel reconstruction.
The objective is not to assume that every Raman band follows an ideal Voigt line shape. Instead, the Voigt function is used as a general representation of peak-like spectral structure. Its parameters capture the principal properties of a localized band, including its position, intensity, and width, while the sparsity constraint encourages the reconstruction to rely on a limited number of active components.
Figure 3 presents a representative reconstruction produced by the Voigt branch. The predicted profile captures the position and overall width of the dominant Raman peak while producing a smooth approximation of the surrounding signal. In comparison with an unconstrained per-pixel decoder, the Voigt representation suppresses small point-wise fluctuations and emphasizes the broader morphology of the peak. This behavior is consistent with the role of the Voigt branch as a structured compression mechanism rather than as a direct replacement for dense spectral reconstruction.

Figure 3. The input spectrum is shown together with the reconstruction produced by the sparse Voigt decoder. The reconstructed profile captures the location and overall morphology of the dominant peak using a compact parameterized representation.
The qualitative example illustrates that the decoder can approximate a localized Raman feature using a compact set of peak parameters. The resulting reconstruction is smoother than the original spectrum and does not reproduce every small fluctuation. This is expected, as the branch is intended to preserve the dominant peak structure rather than model all local noise and baseline variation. The per-pixel and Voigt branches therefore play complementary roles: the per-pixel branch preserves detailed signal intensity, whereas the Voigt branch encourages the encoder to retain a low-dimensional description of the underlying peak morphology.
The per-pixel reconstruction branch predicts the intensity values of the masked spectral region directly. Unlike the Voigt branch, it is not constrained to represent the signal using a particular peak family and can therefore model both localized peaks and broader spectral variation. This branch provides the standard masked-autoencoding objective and encourages the encoder to retain sufficient contextual information to recover the missing signal.
Figure 4 shows an example of a spectrum reconstructed by the per-pixel decoder. The prediction follows the overall signal shape and recovers the dominant peak locations, while smaller fluctuations and fine-scale intensity variations are reproduced less precisely. The reconstruction demonstrates that the encoder retains information about both the global spectral trend and the principal local structures required to estimate the missing region.

Figure 4. The decoder recovers the overall spectral shape and the dominant Raman features through direct prediction of the intensity values.
The per-pixel and Voigt reconstructions should not be expected to behave identically. The per-pixel decoder has greater flexibility and can approximate arbitrary signal shapes, while the Voigt decoder is restricted to a compact combination of smooth peak profiles. The two branches therefore provide different training signals. Dense reconstruction encourages local fidelity, whereas Voigt reconstruction encourages the representation of peak position, amplitude, and width through a lower-dimensional parameterization.
References
- [1]Alvaro-FG. Raman sugars: Dataset of raman spectra collected from a set of sugar mixtures. https://github.com/Alvaro-FG/Raman_Sugars, 2023.
- [2]Hubert Banville, Omar Chehab, Aapo Hyvärinen, Denis-Alexander Engelmann, and Alexandre Gramfort. Uncovering the structure of clinical eeg signals with self-supervised learning. Journal of Neural Engineering, 18(4):046020, 2021.DOI
- [3]Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In Proceedings of the International Conference on Machine Learning (ICML), pages 1597–1607, 2020.arxiv.org/abs/2002.05709
- [4]Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of NAACL-HLT, pages 4171–4186, 2019.arxiv.org/abs/1810.04805
- [5]Xiaojiong Fan, Yue Wang, Chuanxiu Yu, Yuanxia Lv, Hailiang Zhang, Qiong Yang, Ming Wen, Hongmei Lu, and Zhimin Zhang. A universal and accurate method for easily identifying components in raman spectroscopy based on deep learning. Analytical Chemistry, 95(11):4863–4870, 2023.DOI
- [6]Stefano Fornasaro, Fatima Alsamad, Monica Baia, Luis AE Batista de Carvalho, Claudia Beleites, Hugh J Byrne, Alessandro Chiadò, Mihaela Chis, Malama Chisanga, Amuthachelvi Daniel, et al. Surface enhanced raman spectroscopy for quantitative analysis: results of a large-scale european multi-instrument interlaboratory study. Analytical chemistry, 92(5):4053–4064, 2020.
- [7]Dimitar Georgiev, Álvaro Fernández-Galiana, Simon Vilms Pedersen, Georgios Papadopoulos, Ruoxiao Xie, Molly M Stevens, and Mauricio Barahona. Hyperspectral unmixing for Raman spectroscopy via physics-constrained autoencoders. Proceedings of the National Academy of Sciences, 121(45): e2407439121, 2024.DOI
- [8]Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre H. Richemond, Elena Buchatskaya, Carl Doersch, Bilal Azar, Bilal Piot, Koray Kavukcuoglu, Rémi Munos, and Michal Valko. Bootstrap your own latent: A new approach to self-supervised learning. In Advances in Neural Information Processing Systems (NeurIPS), volume 33, pages 21271–21284, 2020.arxiv.org/abs/2006.07733
- [9]Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollár, and Ross Girshick. Masked autoencoders are scalable vision learners. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 16000–16009, 2022.arxiv.org/abs/2111.06377
- [10]Chi-Sing Ho, Neal Jean, Catherine A Hogan, Lena Blackmon, Stefanie S Jeffrey, Mark Holodniy, Niaz Banaei, Amr AE Saleh, Stefano Ermon, and Jennifer Dionne. Rapid identification of pathogenic bacteria using raman spectroscopy and deep learning. Nature communications, 10(1):4927, 2019.DOI
- [11]Conor C Horgan, Magnus Jensen, Anika Nagelkerke, Jean-Philippe St-Pierre, Tom Vercauteren, Molly M Stevens, and Mads S Bergholt. High-throughput molecular imaging via deep-learning-enabled raman spectroscopy. Analytical chemistry, 93(48):15850–15860, 2021.DOI
- [12]Liping Huang, Hongwei Sun, Liangbin Sun, Keqing Shi, Yuzhe Chen, Xueqian Ren, Yuancai Ge, Danfeng Jiang, Xiaohu Liu, Wolfgang Knoll, et al. Rapid, label-free histopathological diagnosis of liver cancer based on raman spectroscopy and deep learning. Nature Communications, 14(1):48, 2023.
- [13]Takashi Ida, Masayuki Ando, and Hideo Toraya. Extended pseudo-voigt function for approximating the voigt profile. Journal of Applied Crystallography, 33(6):1311–1316, 2000.DOI
- [14]Jawad Kamran, Julian Hniopek, and Thomas Bocklitz. Transfer-learning deep raman models using semiempirical quantum chemistry. Journal of Chemical Information and Modeling, 65(13):6632–6643, 2025.DOI
- [15]Mario Koddenbrock, Christoph Lange, Robin Legner, Martin Jaeger, Martin Kögler, Mariano N Cruz Bournazou, Peter Neubauer, Felix Bieβmann, and Erik Rodner. RamanBench: A large-scale benchmark for machine learning on Raman spectroscopy. arXiv preprint arXiv:2605.02003, 2026.arxiv.org/abs/2605.02003
- [16]Vitaly I. Korepanov and Darya M. Sedlovets. An asymmetric fitting function for condensed-phase raman spectroscopy. Analyst, 143(12):2674–2679, 2018.DOI
- [17]Onur Can Koyun, Reyhan Kevser Keser, Safa Onur Sahin, Damla Bulut, Mustafa Yorulmaz, Veysel Yucesoy, and Behcet Ugur Toreyin. RamanFormer: A transformer-based quantification approach for Raman mixture components. ACS Omega, 9(22):23241–23251, 2024.DOI
- [18]Barbara Lafuente, Robert T Downs, Hexiong Yang, and Nate Stone. 1. the power of databases: The ruff project. In Highlights in mineralogical crystallography, pages 1–30. De Gruyter (O), 2015.DOI
- [19]Christoph Lange, Madeline Altmann, Daniel Stors, Simon Seidel, Kyle Moynahan, Linda Cai, Stefan Born, Peter Neubauer, and M Nicolas Cruz Bournazou. Deep learning for Raman spectroscopy: Benchmarking models for upstream bioprocess monitoring. Measurement, page 118884, 2025.
- [20]Da-Wei Li, Alexandar L Hansen, Chunhua Yuan, Lei Bruschweiler-Li, and Rafael Brüschweiler. Deep picker is a deep neural network for accurate deconvolution of complex two-dimensional mmr spectra. Nature communications, 12(1):5229, 2021.DOI
- [21]Jiechun Liang, Jack Ling, Limin Xu, and Xi Zhu. A dataset of Raman and infrared spectra as an extension to the ChEMBL. Scientific Data, 12(1):939, 2025.DOI
- [22]Temesgen Mehari and Nils Strodthoff. Self-supervised representation learning from 12-lead ecg data. Computers in biology and medicine, 2022.DOI
- [23]Robert J. Meier. On art and science in curve-fitting vibrational spectra. Vibrational Spectroscopy, 39 (2):266–269, 2005. doi: 10.1016/j.vibspec.2005.03.003.DOI
- [24]Maziar Raissi, Paris Perdikaris, and George E. Karniadakis. Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational Physics, 378:686–707, 2019.DOI
- [25]Pengju Ren, Ri-gui Zhou, and Yaochong Li. A self-supervised learning method for Raman spectroscopy based on masked autoencoders. arXiv preprint arXiv:2504.16130, 2025.arxiv.org/abs/2504.16130
- [26]Xiancheng Sang, Ri-gui Zhou, Yaochong Li, and Shengjun Xiong. One-dimensional deep convolutional neural network for mineral classification from raman spectroscopy. Neural Processing Letters, 54(1):677–690, 2022.
- [27]Adithya Sineesh and Akshita Kamsali. Benchmarking deep learning models for Raman spectroscopy across open-source datasets. arXiv preprint arXiv:2601.16107, 2026.
- [28]Tom Sundius. Computer fitting of voigt profiles to raman lines. Journal of Raman Spectroscopy, 1(5):471–488, 1973.DOI
- [29]Paul Thompson, D. E. Cox, and J. B. Hastings. Rietveld refinement of Debye-Scherrer synchrotron X-ray data from Al₂O₃. Journal of Applied Crystallography, 20(2):79–83, 1987.DOI
- [30]Sai Karthikeya Vemuri, Adithya Ashok Chalain Valapil, Tim Büchner, and Joachim Denzler. RamPINN: Recovering Raman spectra from coherent anti-Stokes spectra using embedded physics. arXiv preprint arXiv:2510.06020, 2025.arxiv.org/abs/2510.06020
- [31]Zilong Wang, Yunfeng Li, Jinglei Zhai, Siwei Yang, Biao Sun, and Pei Liang. Deep learning-based Raman spectroscopy qualitative analysis algorithm: A convolutional neural network and transformer approach. Talanta, 275:126138, 2024.DOI
- [32]Bingsen Xue, Xinyuan Bi, Zheyi Dong, Yunzhe Xu, Minghui Liang, Xin Fang, Yizhe Yuan, Ruoxi Wang, Shuyu Liu, Rushi Jiao, et al. Deep spectral component filtering as a foundation model for spectral analysis demonstrated in metabolic profiling. Nature Machine Intelligence, 7, 2025.DOI
- [33]Zhuo Yang, Jiaqing Xie, Shuaike Shen, Daolang Wang, Yeyun Chen, Ben Gao, Shuzhou Sun, Biqing Qi, Dongzhan Zhou, Lei Bai, et al. SpectrumWorld: Artificial intelligence foundation for spectroscopy. arXiv preprint arXiv:2508.01188, 2025.arxiv.org/abs/2508.01188
- [34]Haiming Yao, Wei Luo, Tao Zhou, Ang Gao, and Xue Wang. Self-calibrated dual contrasting for annotation-efficient bacteria Raman spectroscopy clustering and classification. arXiv preprint arXiv:2412.20060, 2024.arxiv.org/abs/2412.20060
- [35]Ye Yuan, Guangxu Xun, Qiuling Suo, Kebin Jia, and Aidong Zhang. Wave2vec: Deep representation learning for clinical temporal data. Neurocomputing, 324:31–42, 2019.DOI
- [36]Kexin Zhang, Qingsong Wen, Chaoli Zhang, Rongyao Cai, Ming Jin, Yong Liu, James Y Zhang, Yuxuan Liang, Guansong Pang, Dongjin Song, et al. Self-supervised learning for time series analysis: Taxonomy, progress, and prospects. IEEE transactions on pattern analysis and machine intelligence, 46(10):6775–6794, 2024.DOI
Machine contribution statement
No AI-use declaration is available for this version in Valency.
The available record does not establish whether AI systems or models contributed to this work.