Demographic-Aware Self-Supervised Anomaly Detection Pretraining for Equitable Rare Cardiac Diagnosis

Chaoqin Huang, Zi Zeng, Aofan Jiang, Yuchen Xu, Qing Cao, Kang Chen, Chenfei Chi, Yanfeng Wang, Ya ZhangarXiv 2026

TL;DR

This paper introduces a two-stage self-supervised AI framework for electrocardiogram (ECG) analysis that tackles the dual challenges of diagnosing rare cardiac conditions and eliminating demographic biases. By pretraining a model to reconstruct masked ECG signals and predict patient attributes simultaneously, the framework learns robust, equitable representations that reduce the performance gap between common and rare cardiac anomalies by 73%.

What Problem Does This Paper Address?

In clinical settings, common cardiac conditions like atrial fibrillation dominate datasets, while life-threatening rare anomalies (e.g., high-degree atrioventricular blocks or sinus pause) reside in the long tail of the data distribution. Standard deep learning models optimized for aggregate performance frequently miss these rare conditions, leading to delayed interventions.

Furthermore, AI models often exhibit diagnostic disparities across different demographic groups, particularly across age and sex, because physiological baselines naturally shift (e.g., variations in QRS and QT intervals). If an AI model doesn't explicitly account for these variations, it risks amplifying existing health inequities. Finally, most existing deep learning models act as "black boxes," failing to provide precise spatial localization of anomalies on the ECG trace, which limits their trustworthiness among clinicians.

Methods

The authors propose a two-stage diagnostic framework centered on fairness-aware representation learning:

  1. Stage 1: Self-Supervised Anomaly Detection Pretraining Without using any diagnostic labels, the model learns the baseline of "normal" cardiac physiology through three tasks:

  2. Multi-Scale Cross-Restoration: The model randomly masks segments of the ECG at both a global level (10-second rhythm) and a local level (individual heartbeat) and learns to reconstruct them. This mimics how cardiologists evaluate both overall rhythm and granular beat morphology.

  3. Trend-Assisted Restoration: An auxiliary module extracts and reconstructs the underlying temporal trend of the signal to capture macro-level variations.
  4. Attribute Prediction Module (APM): The model is forced to predict patient-specific attributes (age, sex, heart rate, PR interval) from the unmasked features. This guides the latent space to become demographically aware and invariant to biases.
  5. Stage 2: Fine-Tuning and Localization The pretrained network is fine-tuned for multi-label classification using an Asymmetric Loss function, which dynamically down-weights easy negative samples to force the model to focus on hard-to-classify rare conditions. By comparing the reconstructed signal against the original input during inference, the model also generates pixel-level anomaly score maps to pinpoint exactly where the abnormality occurs.
The proposed two-stage ECG diagnosis framework.

Datasets

The framework was trained and evaluated across multiple diverse cohorts:

  • ECG-LT (Internal Dataset): A massive, newly introduced benchmark containing 1,089,367 clinical ECG records spanning 116 cardiac anomaly types. Crucially, it includes 43 rare conditions (fewer than 400 occurrences) that are completely absent from public datasets.
  • PTB-XL (External Validation): A widely used public dataset containing 21,837 clinical ECGs to test cross-site generalizability.
  • Renji Dataset (External Validation): A curated clinical cohort of 1,385 ECGs from Shanghai Renji Hospital specifically focusing on rare, atypical cases.
  • Ruijin Hospital Cohort: 238 ECG recordings used for a simulated real-world emergency department validation study.

Key Insights and Ideas

  • Anomaly Detection as a Foundation for Long-Tail Learning: Instead of forcing a classifier to learn rare conditions from only a handful of examples, pretraining the model to deeply understand "normal" physiology allows it to easily flag rare anomalies as subtle deviations from the norm.
  • Demographic Invariance via Attribute Prediction: By explicitly multi-tasking the network to predict age and sex during the self-supervised phase, the model learns to decouple normal demographic-driven signal variations from actual pathological anomalies.
  • Hierarchical Feature Fusion: Combining global context with local heartbeat details prevents the model from missing localized issues (like a single missed beat) or macro-level issues (like a slow drifting arrhythmia).

Key Results

  • High Accuracy on Rare Conditions: The model achieved an AUROC of 94.7%, a sensitivity of 92.2%, and a specificity of 92.5% for rare anomalies on the ECG-LT dataset, outperforming state-of-the-art methods by 8.9% in AUROC.
  • Bridging the Equity Gap: The performance gap between common and rare conditions was slashed by 73% (reducing the AUROC gap to just 2.2%), while maintaining stable accuracy across sex and age groups.
  • Clinical Utility and Speedup: In a simulated emergency department trial, cardiologists aided by the AI improved their diagnostic accuracy from 77.3% to 84.0% and reduced their average ECG interpretation time by 32.5%.
  • Precise Localization: The model achieved a 76.5% AUROC in localizing anomalies, aligning closely with expert cardiologist annotations.
Visualization of anomaly localization compared against ground truth.

Limitations and Future Work

While the model demonstrated excellent fairness across the vast majority of patient demographics, the authors noted a slight drop-off in performance at the absolute extremes of age—specifically in pediatric patients under 10 years old and geriatric patients over 90 years old. This is likely due to the highly unique physiological baselines of these age groups and their relative underrepresentation even within a million-sample dataset. The authors point to targeted calibration strategies for these age extremes as a vital direction for future work.

Summary updated

BibTeX
@misc{huang2026demographic,
  author = {Chaoqin Huang and Zi Zeng and Aofan Jiang and Yuchen Xu and Qing Cao and Kang Chen and Chenfei Chi and Yanfeng Wang and Ya Zhang},
  title = {{Demographic-Aware Self-Supervised Anomaly Detection Pretraining for Equitable Rare Cardiac Diagnosis}},
  year = {2026},
  eprint = {2603.19695},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.19695},
}
Figure