BioFormer: Rethinking Cross-Subject Generalization via Spectral Structural Alignment in Biomedical Time-Series

Guikang Du, Haoran Li, Xinyu Liu, Zhibo Zhang, Xiaoli Gong, Jin Zhang

Abstract / TL;DR In medical AI, models trained on one patient's physiological signals—such as electroencephalograms (EEG) or electrocardiograms (ECG)—often struggle to generalize to new patients. This "cross-subject generalization" hurdle arises because every human body presents a unique biological environment. BioFormer introduces a novel Transformer-based architecture that explicitly models and mitigates this variability through the lens of "spectral drift." By aligning frequency-domain structures, BioFormer achieves a remarkable 6% absolute F1-score improvement over state-of-the-art baselines across multiple biomedical datasets.

The Challenge of Cross-Subject Generalization

Biomedical time-series (BTS) data is notoriously subject-dependent. While the underlying biological patterns of a specific heart condition or neurological state might be consistent, the raw waveforms often look drastically different across individuals. Factors like electrode placement, skin impedance, and unique anatomical traits introduce significant noise.

Historically, machine learning approaches have attempted to bypass these differences using adversarial learning—forcing the model to "forget" the subject's identity—or by relying on massive, data-hungry models. However, these methods treat subject variability as a black-box nuisance rather than an explicit feature to be managed.

A New Perspective: Spectral Drift

The authors of BioFormer propose a paradigm shift: treating subject differences as "tuning" discrepancies within specific frequency bands, a phenomenon they term spectral drift.

Even when two subjects share the same medical diagnosis, their signals often exhibit different strengths (magnitude) or timing offsets (phase) within specific frequency components. While time-domain waveforms vary wildly, the "global spectral envelope"—the general shape of the frequency distribution—remains remarkably consistent for a given medical condition. The variability is primarily just drift within those bands.

The BioFormer Architecture

To tackle spectral drift, BioFormer introduces two core innovations wrapped within a Pyramid Convolutional Embedding (PCE) backbone, which processes signals at multiple resolutions to capture both rapid spikes and long-term rhythms.

  1. Frequency-Band Alignment Module (FBAM): Instead of processing signals exclusively in the time domain, FBAM converts features into the frequency domain using a Fast Fourier Transform (FFT). It divides the spectrum into distinct bands and employs a cross-attention mechanism with learnable "band tokens." This calculates precisely how much to scale the amplitude and rotate the phase of each band. By "re-tuning" the signal to a consistent global structure, FBAM makes the underlying medical pattern much clearer to the model.
  2. Sample Conditional Layer Normalization (SCLN): Standard normalization techniques often wash out critical individual differences or rely too heavily on knowing the subject's identity. SCLN adaptively calibrates feature statistics based on the intrinsic properties of the individual sample itself. Using a stop-gradient mechanism, it ensures the model learns stable, cross-subject representations without memorizing subject IDs.

Key Findings and Performance

The researchers evaluated BioFormer on six diverse biomedical benchmarks, encompassing both EEG (APAVA, ADFTD, BCI-2a, BCI-2b) and ECG (PTB, PTB-XL) datasets. These included both subject-level and sample-level labeling, providing a rigorous test of the model's flexibility.

  • State-of-the-Art Dominance: BioFormer achieved the #1 rank across all six datasets, outperforming 12 baselines, including specialized medical Transformers (Medformer) and shape-based models (SoftShape).
  • Significant Accuracy Gains: On the APAVA (Alzheimer's) and ADFTD (Dementia) datasets, BioFormer improved the F1-score by roughly 6% absolute over the next best model.
  • The Importance of Phase: Ablation studies revealed that for rhythmic signals like ECGs, aligning the phase was more critical than magnitude. This aligns with physiological intuition, as timing offsets between subjects are a major source of noise in heartbeats.
  • Subject-Blind Latent Space: t-SNE visualizations confirmed that BioFormer’s latent space clusters samples by medical label rather than subject identity, proving the model successfully isolates the disease signature from individual quirks.

Limitations and Future Directions

While highly effective, BioFormer's approach is optimized for data with a stable oscillatory structure, such as the rhythmic beating of a heart or the alpha/beta waves of a brain.

The authors note that its benefits might be diminished in "event-driven" data, where critical information lies in sparse, non-periodic transients (e.g., a random muscle twitch or a one-off artifact) rather than sustained rhythms. Additionally, the current model relies on pre-defined frequency bands. Future iterations could explore "soft" or learnable band boundaries that adapt dynamically to different types of physiological signals.

By treating the human body's signals as a structured composition that requires careful alignment, BioFormer offers a highly interpretable, efficient, and promising path toward medical AI that works reliably for every patient.

Summary updated

BibTeX
@inproceedings{du2026bioformer,
  author = {Guikang Du and Haoran Li and Xinyu Liu and Zhibo Zhang and Xiaoli Gong and Jin Zhang},
  title = {{BioFormer: Rethinking Cross-Subject Generalization via Spectral Structural Alignment in Biomedical Time-Series}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=6I7yMzQBts},
}
Figure