NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Exploiting a Mixture-of-Layers in an Electrocardiography Foundation Model

Phu X. Nguyen, Huy Phan, Hieu Pham, Christos Chatzichristos, Bert Vandenberk, Maarten De VosarXiv 2025 · DOI

Abstract

Standard practices in Transformer-based foundation models prioritize the output of the final layer for downstream clinical tasks. However, in electrocardiography (ECG) analysis, generative pretraining tasks like masked signal reconstruction can cause final layers to over-specialize in raw signal details, potentially degrading high-level semantic representations. We introduce ECG-Soup, a framework utilizing a "Mixture-of-Layers" (PMA) gating network to dynamically aggregate features across the entire model depth. Our results demonstrate that middle layers often contain superior diagnostic information compared to the final layer. ECG-Soup achieves state-of-the-art results on the PTB-XL dataset (macro AUC > 94%) and secured 1st place in the 2025 PhysioNet Challenge.

Introduction

The adoption of Transformer architectures for ECG analysis has largely followed the conventions of Natural Language Processing, where the final hidden state is treated as the definitive representation. This paper identifies a "representation gap" in ECG foundation models pretrained via generative tasks. While the objective of reconstructing masked signal patches (Spatio-Temporal Masked Modeling, or STMEM) is effective for learning local features, the final layers often become preoccupied with minimizing Mean Squared Error (MSE) for reconstruction. This focus can lead to a decorrelation of patches that is detrimental to global clinical diagnosis. We propose that a synergy of all layers, rather than just the last, is required for robust heart health assessment.

Methods

The backbone of our approach is a 1-dimensional Vision Transformer (ViT1d). To harness the information distributed across the network, we developed three cross-layer aggregation schemes:

  1. Post-pretraining Pooling-based Aggregation (PPA): A static average of all encoder layers.
  2. Post-pretraining Mixture-of-layers Aggregation (PMA): A dynamic approach using a small gating network to assign "soft weights" to each layer based on the input sample. This allows the model to prioritize layers with the most relevant diagnostic features for a specific case.
  3. In-pretraining Pooling-based Aggregation (IPASTMEM): Integrating pooling during the pretraining phase to improve gradient flow.
The ECG-Soup architecture featuring the Mixture-of-Layers gating network and weighted sum aggregation.

Results

Our analysis of the PTB-XL dataset reveals a characteristic "hump" in performance when evaluating layers individually. Diagnostic accuracy, measured by macro AUC, peaks in the middle layers and declines as the model approaches the final reconstruction-focused layers. This confirms that the most useful semantic features for classification are often found before the final layer.

Layer-wise macro AUC on the PTB-XL dataset, illustrating the performance peak in middle layers.

Key results include:

  • State-of-the-Art Accuracy: The PMA method achieved a macro AUC exceeding 94% across 71 ECG conditions.
  • Superior Generalization: In Out-of-Distribution (OOD) settings, the multi-layer approach significantly outperformed standard "last-layer" baselines.
  • Competition Success: The pretrained backbone ranked 1st out of 111 teams in the 2025 George B. Moody PhysioNet Challenge, proving its efficacy in real-world clinical environments.

Discussion and Conclusion

The success of ECG-Soup challenges the "last-layer" paradigm in medical signal processing. By mathematically and empirically showing that generative objectives can lead to the "un-learning" of semantic relationships in deep layers, we provide a strong rationale for multi-layer aggregation. Future work will explore multimodal integration, combining ECG signals with clinical text reports to enable zero-shot recognition of rare cardiac conditions through physiological descriptions.

Summary updated

BibTeX
@misc{nguyen2025exploiting,
  author = {Phu X. Nguyen and Huy Phan and Hieu Pham and Christos Chatzichristos and Bert Vandenberk and Maarten De Vos},
  title = {{Exploiting a Mixture-of-Layers in an Electrocardiography Foundation Model}},
  year = {2025},
  eprint = {2509.00102},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.00102},
}
Figure