Source-linked AI summary

Wavenumber-Aware Deep Learning for Robust Analysis of Raman Spectra

Jihwan Kim, Jaeseong Heo, Yujin Kim, Sang Bin Yoon, Chanjoong Kim, Kwang-Im Oh, Hyon Bin Na, Kyungwon Kwak, Myeongkee Park, Joonyoung F. Joung

arXiv:2610.30746v1cs.LGphysics.chem-phphysics.optics

TL;DR

Spectroscopy models commonly use fixed-grid intensity vectors, leaving physical coordinates implicit and tying inputs to particular sampling conditions. This paper represents Raman measurements with explicit wavenumbers and evaluates the approach across bacterial-classification architectures and acquisition variations. The representation improved robustness across those conditions, including partial observation and grids unseen during training.

  • Problem

    Fixed-grid intensity vectors encode physical coordinates implicitly, while spectra acquired under different conditions can vary in sampling positions, resolution, and spectral range.

    Source: §1 · pp. 2, 4
  • Method

    The approach supplies Raman intensity and physical wavenumber as separate inputs, using wavenumber-based positional encodings in Transformers.

    Source: §1 · p. 5, §3 · p. 20
  • Results

    Across CNN, ResNet, and Transformer models, wavenumber-aware inputs improved classification performance and remained robust to noise, reduced sampling density, partial observation, and unseen sampling grids.

    Source: §1 · p. 5, §3 · p. 20
  • Takeaways & Limitations

    Explicit physical coordinates are a supported alternative to coordinates implicitly defined by a discretized grid for Raman spectral analysis under varying measurement conditions.

    Source: §3 · p. 20

    The study does not establish zero-shot cross-instrument transfer; coordinates alone cannot capture residual differences in spectral response.

    Source: §2.6 · p. 19

Abstract

from arXiv · show

Machine-learning models for spectroscopy usually treat a spectrum as a fixed-grid intensity vector, leaving the physical coordinate implicit in the array index. Such models are tied to a single sampling grid, spectral range and resolution, which limits their use when measurement conditions change. Here we represent each spectral point as a pair of intensity and wavenumber and compute Transformer positional encodings from the wavenumber itself. On Raman spectra of three bacterial species and their synthetic mixtures, this representation remained robust to noise, sparser sampling and partial spectral coverage across convolutional, residual and Transformer networks. In controlled comparisons, wavenumber-based encoding outperformed index-based and learned encodings under partial observation and retained its performance on sampling grids never seen during training, where index-based encoding degraded. These findings were reproduced on a public 30-isolate bacterial benchmark. Explicit physical coordinates offer a simple route to robust spectral analysis under variable measurement conditions.

1 Introduction

Spectroscopy models commonly treat spectra as fixed-grid intensity vectors, leaving physical coordinates implicit and limiting their fit to changing acquisition conditions. The paper makes wavenumber explicit in Raman inputs and evaluates this representation for bacterial identification under variable measurements.

1 Introduction

  • Fixed-grid intensity vectors encode physical coordinates only through array indices, tying models to a particular grid, resolution, range, and complete, uniform sampling.When measurement conditions vary, spectra may instead require interpolation, padding, or separately trained models.Source: §1 · pp. 2, 4
  • Unlike sparse mass-spectral peak lists, Raman spectra are densely sampled continuous signals in which bands, shoulders, overlap, and even band-free regions are measured information.The introduction states that coordinate-based encoding of individual sampled points in these continuous spectra had not, to the authors’ knowledge, been examined.Source: §1 · pp. 3–4
  • Bacterial Raman identification is challenging because species share biochemical components and discriminative information is distributed across overlapping vibrational bands.The spectra may also vary in resolution, sampling density, spectral range, and signal quality.Source: §1 · p. 4
  • The proposed representation supplies intensity and wavenumber as separate inputs, and Transformer positional encodings use physical wavenumbers rather than sequence indices.This allows variable sampling density and partial spectral inputs without inference-time resampling to a common grid.Source: §1 · p. 5, Figure 1 · p. 5
  • Across acquisition conditions, wavenumber-aware inputs improved robustness in Raman classification, with comparisons on an in-house dataset and the public 30-isolate benchmark.The evaluation included spectral mixing, additive noise, reduced sampling density, partial observation, and sampling grids unseen during training.Source: §1 · p. 5

2 Results and discussion

The results examine wavenumber-aware spectral representations across architectures, augmentations, positional-encoding comparisons, and conditions beyond the training distribution. They distinguish the effects of spectral coverage and sampling on bacterial classification and frame coordinate-aware inputs as complementary to domain adaptation.

2.1 Realistic spectral variability and data augmentation

  • The measured three-species dataset includes shifted and missing spectral windows and varying, nonlinear sampling intervals, so no single index-to-wavenumber mapping applies across spectra.The explicit coordinate representation accommodates this structure directly, whereas fixed-grid intensity vectors require interpolation onto a common grid.Source: §2.1 · p. 6
  • Training augmentation applied noise, windowing, and downsampling across classes, while synthetic mixtures combined measured spectra with random mixing ratios and treated contributions below 10% as absent.Randomly positioned windows removed the association between native coverage and species; the combined perturbation severity was sampled randomly and its joint distribution was not compiled.Source: §2.1 · pp. 6–8

2.2 Evaluation across neural network architectures

  • CNN, ResNet, and Transformer models used the same wavenumber-aware input and multi-label objective, enabling comparison of the representation across distinct architecture families.The input pairs normalized intensity with physical wavenumber; padding shorter spectra preserved their original coordinates.Source: §2.2 · pp. 8–9

2.3 Robustness under realistic spectral degradation

  • With 512 cm−1 windows, Macro F1 stayed about 87–91% in the fingerprint region and 79–83% in the high-wavenumber region, but narrow windows centered on the intense C–H band performed poorly.For 128 cm−1 windows centered at 2900–3030 cm−1, Macro F1 was about 47–52%; it recovered to about 76–80% when the window extended below 2850 cm−1, consistent with discriminative information depending on vibrational features rather than raw intensity.Source: §2.3 · pp. 11–12
  • Partial observation reduced F1micro by about 6–8 percentage points, while added downsampling changed Transformer F1micro only from 87.65% to 86.25%, making spectral coverage more limiting than resolution.Noise reduced F1micro by less than one percentage point across architectures, and downsampling retained F1micro above 91%.Source: §2.3 · pp. 10–12

2.4 Comparison with standard positional encodings

  • Under Noise+Slice, wavenumber encoding reached 87.65% F1micro versus 81.69% for index encoding in-house, and 73.91% Top-1 versus 42.82% on the public benchmark.On unperturbed spectra, the encodings were nearly equivalent in-house (93.78% versus 93.37%) and on the benchmark (95.90% versus 93.96% Top-1); windowing resets sequence indices, but physical coordinates retain absolute spectral location.Source: Table 2 · p. 13, §2.4 · pp. 13–14
  • Only the combination of wavenumber information and augmentation achieved high robustness: under Noise+Slice, it reached 87.65% F1micro versus 77.72% for augmentation with intensity-only input.Without augmentation, adding wavenumber raised unperturbed F1micro from 84.75% to 95.71% but yielded 61.70% under Noise+Slice versus 62.14% for intensity-only input; coordinates and augmentation are complementary.Source: §2.4 · pp. 14–15, Table 3 · p. 15

2.5 Generalization beyond the training distribution

  • At test-only window lengths, all architectures retained F1micro above 86% with at least 512 points, falling to 72.0–77.2% at 256 points and 62.1–69.2% at 128 points.Training used windows of 512–2048 points; the shorter test windows further show that narrow coverage can omit chemically informative bands.Source: Figure 5 · p. 16, §2.5 · p. 16
  • At downsampling factor 8, the Transformer achieved 90.99% F1micro, versus 80.09% for CNN and 75.17% for ResNet.The Transformer remained above 90% at factors 6 and 8; its coordinate-aware attention is not tied to a fixed number of neighboring points, unlike convolution kernels.Source: §2.5 · pp. 16–17
  • At σ = 0.20, the Transformer reached 68.60% F1micro, compared with 49.49% for CNN and 53.08% for ResNet.At σ = 0.15, it retained 74.20%, versus 54.13% and 56.18%; self-attention can combine evidence across the spectrum when noise distorts local band shapes.Source: §2.5 · p. 17
  • On unseen in-house grids, wavenumber encoding retained 92.4–93.7% F1micro versus as low as 72.5% for index encoding.The continuous sinusoidal map gives nearby wavenumbers similar embeddings; the residual decrease on coarser grids parallels downsampling, while index encoding fell below a constant baseline on finer grids.Source: §2.5 · pp. 17–18, Table 4 · p. 18
  • On benchmark 1 cm−1 grids, wavenumber encoding retained 51.89% F1micro under Noise+Slice versus index encoding’s 13.24%, and 73.22% versus 7.51% unperturbed.On the 2 and 4 cm−1 grids, wavenumber encoding retained 78.97% and 73.06%, compared with 80.08% on the native grid; index encoding fell to 23.35% and 24.86%.Source: §2.5 · p. 18, Table 4 · p. 18
  • Spectral coverage is a hard limit because no architecture can recover chemically informative bands missing from a narrow window, whereas sparse sampling proved less restrictive.The degradation tests exceeded training augmentation ranges, and the resampled-grid tests used coordinates absent during training, supporting generalization beyond those augmentation distributions.Source: §2.5 · pp. 18–19

2.6 Relation to architecture-level and domain-adaptation approaches

  • Wavenumber-aware tokens complement RamanFormer[22] and fragment-fusion Transformer[23], while explicit coordinates could address grid heterogeneity before domain adaptation.These methods target different tasks, precluding direct numerical comparison. Zhang et al. reported 20.8% accuracy under direct cross-instrument transfer without adaptation[27]; coordinates alone do not enable zero-shot transfer, and the approach assumes a calibrated wavenumber axis.Source: §2.6 · p. 19

3 Conclusion

The study introduces a Raman representation that supplies intensity and wavenumber as separate inputs, then evaluates it across architectures and variable acquisition conditions. It reports robust performance under spectral degradation and on an independent bacterial benchmark.

3 Conclusion

  • The representation supplies spectral intensity and physical wavenumber as separate input channels, preserving their relationship across varying sampling densities, ranges, and measurement conditions.Fixed-grid representations encode coordinates implicitly through index positions, which is sufficient only while the sampling grid remains fixed.Source: §3 · p. 20
  • Across CNN, ResNet, and Transformer models, the representation improved performance under spectral degradation and matched Ho et al.'s published CNN baseline while improving partial-observation robustness.The independent benchmark was tenfold larger than the study's benchmark.Source: §3 · p. 20
  • Physical-coordinate inputs may extend to wavelength, frequency, chemical shift, or mass-to-charge measurements, but those extensions remain unvalidated.The authors identify coordinate-based spectral peaks in mass spectrometry as a related development.Source: §3 · p. 20
  • The authors anticipate benefits for Raman sensing under varying acquisition protocols, sparse sampling, or incomplete spectral observations.Source: §3 · p. 20

4 Methods

The methods build a bacterial Raman dataset and synthetic mixtures, then test multi-label models across acquisition perturbations, positional-encoding baselines, and a public benchmark. Models include convolutional and Transformer architectures, with inputs retained on native wavenumber grids.

4.1 Bacterial sample preparation and Raman measurements; 4.2 Dataset construction and data splitting

  • Spectra from three bacterial species were acquired and split into training, validation, and test sets, with mixtures and augmentations generated separately within each split.The dataset comprised 7,500 spectra; species-specific acquisition configurations included different spectral windows and nonuniform wavenumber mappings.Source: §4.2 · p. 21, §4.1 · p. 21

4.3 Synthetic mixture generation and spectral perturbation

  • Synthetic one-to-three-species mixtures used normalized spectra and mixing coefficients, with common grids formed from the coarsest measured coordinates in each overlap.A species was labeled present when its mixing coefficient exceeded 0.1; individual spectra entered models on native coordinates without model-input resampling.Source: §4.3 · p. 22
  • Evaluation covered noise, contiguous spectral slicing, downsampling, and their combination, using 10,000 test mixtures per scenario.Training varied noise, window length, and downsampling stride; evaluation used a 512-point window and strides of 2–4.Source: §4.3 · pp. 22–23

4.4 Machine learning model architectures; ResNet.

  • CNN and ResNet models process intensity–wavenumber inputs with convolutional feature extraction, while the ResNet adds skip connections and deeper hierarchical features.The CNN provides a local-feature baseline; the ResNet retains convolutional inductive bias while increasing representational capacity.Source: §4.4 · p. 23, ResNet · p. 23

Transformer.

  • The Transformer encodes each spectral point using its physical wavenumber and uses self-attention to model global interactions across spectral regions.A classification token aggregates the sequence-level representation for multi-label prediction.Source: Transformer · p. 24

4.5 Model training and evaluation

  • Models predict three bacterial labels using binary cross-entropy, sigmoid probabilities, and a 0.5 presence threshold; evaluation reports Exact Match and micro-averaged F1.AdamW and a cosine learning-rate schedule were used, with early stopping selected by validation loss.Source: §4.5 · p. 24

4.6 Positional-encoding baselines and resampled-grid evaluation

  • Positional-encoding variants differ only in whether they use physical wavenumber, sequence index, learned position embeddings, or no positional information; trained models were also tested on resampled grids.The resampled-grid evaluation applied the same trained models directly to uniform grids without retraining.Source: §4.6 · p. 25

4.7 External benchmark experiments on the Ho et al. dataset; Data availability.; Code availability.

Supplementary Information

The supplementary methods describe three architectures that receive two-channel Raman inputs and account for missing spectral regions. They specify CNN, ResNet, and Transformer structures and how each aggregates spectral features for classification.

Section S1: Model architectures and hyperparameter optimization

1.1 CNN

  • The CNN uses four convolutional blocks with increasing channel widths, then fraction-weighted global average pooling and a two-layer classification MLP.The weighting excludes padded positions from pooled features.Source: §1.1 · p. 31

1.2 ResNet

  • The ResNet uses a convolutional stem and four residual stages, with global average pooling that excludes padded positions before classification.Its final configuration uses two residual blocks per stage and a base channel dimension of 64.Source: §1.2 · p. 31

1.3 Transformer

  • The Transformer projects intensities into an embedding, adds sinusoidal encodings from physical Raman shifts, and uses a [CLS] token to form the spectrum representation.A key-padding mask excludes padded positions from attention.Source: §1.3 · p. 31

1.4 Hyperparameter optimization

Hyperparameters were selected separately for each model using validation loss, following a search in which configurations were trained for 100 epochs.

1.4 Hyperparameter optimization

  • Each model's hyperparameters were optimized independently on the validation set, and the final configuration was chosen by lowest validation loss.Source: §1.4 · p. 31
  • Search configurations were trained for 100 epochs, and Supplementary Table 1 summarizes model-specific search ranges and selected values.The supplied passage identifies the table contents but does not state its individual values.Source: §1.4 · p. 32

1.5 Training details

The supplementary analyses show that the full wavenumber-aware, augmented configuration is robust across degradation conditions, while errors under combined degradation remain concentrated among compositionally related mixtures.

1.5 Training details

  • Training used AdamW, newly generated synthetic mixtures each epoch, and early stopping on validation loss, with all reported results obtained from one run using seed 42.Training ran for at most 300 epochs; the validation set contained 750 fixed synthetic mixtures.Source: §1.5 · p. 33

Section S2: Prediction behavior under spectral degradation

  • Under combined degradation, single-species samples remained relatively well classified, while errors increased mainly among multi-species mixtures.Single-species correct classification rates were 83.8% for L. innocua, 91.9% for E. coli, and 83.8% for B. atrophaeus; mixture rates fell from 61–77% to 38–51%.Source: Section S2: Prediction behavior under… · p. 34

Section S3: Ablation study

  • Across CNN, ResNet, and Transformer models, combining wavenumber information with augmentation consistently produced the highest robustness under degradation.Augmentation alone improved CNN and ResNet F1 scores under Noise+Slice+Downsample from 48.65% to 83.78% and from 47.70% to 82.99%, respectively; adding wavenumber information further improved both.Source: Section S3: Ablation study · p. 35
  • The Transformer’s intensity-only unperturbed F1 score was 84.75%, compared with 95.71% when wavenumber coordinates were included.Without augmentation, the wavenumber channel’s benefit largely disappeared under partial observation, consistent with the complementary role of augmentation.Source: Section S3: Ablation study · p. 35
  • The full I + ω+aug. configuration achieved the Transformer’s strongest F1 scores across all five test conditions.Scores were 93.78%, 92.98%, 87.65%, 91.31%, and 86.25% under Unperturbed, Noise, Noise+Slice, Noise+Downsample, and Noise+Slice+Downsample conditions, respectively.Source: Section S3: Ablation study · p. 35

Section S4: Additional positional-encoding results

The section adds positional-encoding comparisons and resampled-grid evaluations; its reported comparison finds sinusoidal wavenumber encoding stronger than the evaluated MLP coordinate embeddings.

Section S4: Additional positional-encoding results

  • The section reports Exact Match counterparts to the main-text positional-encoding comparison and evaluates MLP coordinate embeddings.The MLP variants encode either physical wavenumber or sequence index.Source: Section S4: Additional… · p. 37
  • Both MLP(ω) and MLP(index) underperformed sinusoidal wavenumber encoding across all evaluated scenarios.The index-based MLP variant also degraded under partial observation, consistent with sinusoidal index encoding.Source: Section S4: Additional… · p. 37
  • Resampled-grid evaluations include uniform spacings of 1, 2, and 4 cm−1 alongside the native measurement grid.The complete resampled-grid results cover all five evaluation scenarios.Source: Section S4: Additional… · pp. 37–38

Section S5: External benchmark: additional results and protocol comparison

The benchmark section supplements external validation with architecture comparisons for single spectra and synthetic mixtures, using distinct classification formulations for those tasks.

Section S5: External benchmark: additional results and protocol comparison

  • Single benchmark spectra were treated as 30-class classifiers and evaluated by Top-1 accuracy, while synthetic mixtures used the main text’s multi-label formulation.Each benchmark spectrum belongs to exactly one of 30 isolates.Source: Section S5: External benchmark:… · p. 39
  • The single-spectrum benchmark comparison reports 30-class Top-1 and empiric-treatment 8-group accuracy for CNN, ResNet, and Transformer models.The models use the I + ω+aug. configuration.Source: Section S5: External benchmark:… · p. 39
  • The synthetic-mixture benchmark comparison covers mixtures of up to three isolates and reports Exact Match and F1micro for CNN, ResNet, and Transformer models.The compared models use the I + ω+aug. configuration.Source: Section S5: External benchmark:… · p. 39

5.1 Comparison with the published evaluation protocol

The protocol comparison separates an in-domain split of the 1-s reference data from the published 2-s fine-tuning evaluation, with the wavenumber-aware Transformer reaching comparable performance under the latter protocol.

5.1 Comparison with the published evaluation protocol

  • 95.90% Top-1 and 99.59% group accuracy were achieved on a random stratified split of the 1-s reference set.This is the in-domain evaluation setting.Source: §5.1 · p. 39
  • 83.00% Top-1 and 96.47% group accuracy were achieved when replicating the published evaluation protocol.The reported values were comparable to Ho et al.’s 82.2±0.3% and 97.0±0.3%.Source: §5.1 · p. 39
  • The published protocol fine-tunes on the distributed 2-s set, whereas the reference training data were acquired at 1-s exposure.Fine-tuning used up to 30 epochs, a learning rate of 10−5, batch size 32, and validation-loss early stopping with patience 5.Source: §5.1 · p. 39

5.2 Exposure-shift analysis

On the distributed 2-s exposure test set, fine-tuning reached 83.00% 30-class Top-1 accuracy, while zero-shot transfer from 1-s spectra reached 41.60% with wavenumber input and 41.97% with augmentation.

5.2 Exposure-shift analysis

  • The exposure shift from 1 s to 2 s produced systematically less noisy test spectra, opposite to the additional-noise direction used in training augmentation.The exposure time was increased to compensate for documented degradation of optical-system efficiency.Source: §5.2 · pp. 39–40
  • 83.00% 30-class Top-1 and 96.47% group accuracy after fine-tuning, versus the fine-tuned CNN’s 82.2±0.3% and 97.0±0.3%, respectively.The comparison is on the distributed test set acquired at 2-s exposure.Source: §5.2 · p. 40
  • 41.60% zero-shot Top-1 accuracy with wavenumber input rose to 41.97% with augmentation; intensity-only configurations scored 8.90% and 10.00%.The wavenumber-plus-augmentation model reached 62.80% at the treatment-group level without fine-tuning.Source: §5.2 · p. 40

5.3 Input-representation ablation and class-wise predictions

The benchmark section reports a Transformer input-representation ablation and class-wise predictions, with errors concentrated among closely related isolates.

5.3 Input-representation ablation and class-wise predictions

  • The input-representation ablation covers single-spectrum 30-class Top-1 and synthetic-mixture Exact Match accuracy, including configurations trained without augmentation.Augmented configurations are also reported in the main-text Table 2.Source: §5.3 · pp. 40–41
  • The table labels idxPE as index-based sinusoidal positional encoding and lrnPE as learned positional embeddings.Source: §5.3 · p. 41
  • The row-normalized 30-isolate confusion matrix marks empiric-treatment groupings in red, and misclassifications cluster within closely related isolates.The error pattern mirrors the structure reported by Ho et al.Source: §5.3 · pp. 40, 42

5.4 Resampled-grid evaluation on the benchmark

The benchmark evaluation resampled synthetic mixtures onto multiple grids without retraining, while the dataset-composition section reports aggregate train, validation, and test counts.

5.4 Resampled-grid evaluation on the benchmark

  • Synthetic mixtures were evaluated without retraining on 1, 1.5, 2, and 4 cm−1 grids, against the native grid of about 1.41 cm−1.The 1 cm−1 resampling yields about 1,410 points, exceeding the fixed 1,024-point input length.Source: §5.4 · p. 43
  • Spectra exceeding the 1,024-point input length were truncated at the high-wavenumber end.Source: §5.4 · p. 43

Section S6: Dataset composition

Loading 2610.30746v1…