Skip to content

← Back to Work

Reproducing published ECG foundation models before evaluating a new one

One optimizer setting in our evaluation code read a published model too low, by more than the gap between two published models

November 2026 · 9 min

ECGfoundation modelsevaluation

Abstract

Background. ECG foundation models are neural networks trained on millions of ECGs without diagnoses, then adapted to detect diagnoses from a smaller labelled set. A group that builds its own model compares it with published ones by running those models through its own evaluation code. Any error in that code changes the scores of every model it reports, the published ones included.

Methods. We built a foundation model of our own, trained on up to 410,000 ECGs from 13 public datasets. Before scoring it, we ran two published models, ECG-CPC and ECGFounder, through the same evaluation code on PTB-XL, a German dataset of 21,799 ECGs labelled by cardiologists with 71 diagnostic statements, and compared their scores with the scores their authors published. We also checked whether the ECGs held out for testing had been used to train our model.

Results. One optimizer setting in the classifier trained on top of ECG-CPC lowered its score from 0.899 to 0.833 (macro AUROC over the 71 statements). With that setting corrected, ECG-CPC matched its published scores within 0.006 in all three ways it was evaluated. ECGFounder reached 0.904 at best against 0.931 published, a gap we have not explained. Our model's training set contained 5,151 of the 5,208 test ECGs of three Chinese datasets.

Conclusions. One setting in the evaluation code moved a published model by 0.066, more than twice the 0.027 that separates ECG-CPC from ECGFounder in published results, enough to reorder models. Before a new ECG model is compared with published ones, the evaluation code should reproduce those models' published scores, and the test ECGs should be checked against the training set. Our own model was not compared with the published ones; only the evaluation was checked.

1. Introduction

An ECG foundation model is a neural network trained once on a large archive of ECGs, most of them without diagnoses, so that it learns a general representation of the signal; the part of the network that produces this representation is called the encoder. The encoder is then adapted to a diagnostic task with a smaller labelled set, in one of three ways: a linear probe, in which the encoder is frozen and a single linear layer is trained on its output; an attention probe, in which the encoder is frozen and a small attention layer learns which parts of the tracing to weight; and fine-tuning, in which the whole network is retrained on the labelled set. A recent benchmark scored eight published ECG foundation models in these ways on common tasks [1].

Two of these models span the range of design. ECG-CPC, introduced with the benchmark, is a small network of 3.8 million parameters trained on 10.7 million ECG samples by contrastive predictive coding, in which the network learns to tell the true continuation of a tracing from segments of other tracings, without any diagnosis [1]. ECGFounder has 33.8 million parameters and was trained to predict 150 diagnostic labels on more than ten million ECGs from the Harvard-Emory ECG Database [1, 2].

A group that builds its own model reports its scores beside those of published models, and the published models are scored again in the group's own code. If that code contains an error, it can lower every score, and lower some more than others, without any sign in the results. The only check is to reproduce, in the same code, the scores the authors of a published model reported. We measured whether our evaluation code reproduced the published scores of ECG-CPC and ECGFounder before our own model was scored, and whether our model's training set contained ECGs held out for testing.

2. Methods

2.1 Our model

The aim was a foundation model trained on a database of public ECGs that we assembled, to replace ECGFounder in our own studies if it scored better. It follows the design of ECG-CPC, built on structured state-space layers (S4), a type of network made for long signals, with 3.2 million parameters reading 2.5-second windows sampled at 240 Hz. It was trained by contrastive predictive coding on up to 410,000 ECGs from 13 public datasets. Into the same code we loaded the weights the authors of ECG-CPC published, and ECGFounder's published weights into its own architecture.

2.2 Data and score

PTB-XL (version 1.0.3) holds 21,799 ten-second, 12-lead ECGs from 18,869 patients of the Physikalisch-Technische Bundesanstalt in Berlin, each annotated by cardiologists with any of 71 statements: diagnoses, rhythms and descriptions of the waveform. Patients are split into ten folds as the publisher recommends; folds 1 to 8 trained the classifier, fold 9 chose when to stop training, and fold 10 was the test set. For each statement, the AUROC is the probability that an ECG carrying the statement scores higher than one that does not (0.5 is chance, 1 is perfect); the score reported is the mean over the 71 statements, the macro AUROC, with a 95% confidence interval from resampling patients. A model was taken to reproduce when its score fell within 0.01 of the published one.

2.3 What we varied

The classifier on top of a frozen encoder was trained with the Adam optimizer and weight decay, a penalty that pulls weights toward zero to limit overfitting. Weight decay can be added to the gradient (coupled, as in PyTorch's Adam) or applied as a separate step (decoupled, as in AdamW [3]). The linear probe on ECG-CPC was trained three ways, at the same value of 1e-3: coupled, decoupled, and without decay. ECGFounder was given four inputs: one 10-second window or four 2.5-second windows, each in raw millivolts or rescaled with a global mean and standard deviation.

2.4 Test ECGs in the training set

The identifier of every test ECG was matched against the list of ECGs used to train our model, including copies of the same tracing published again under another identifier.

3. Results

3.1 One optimizer setting moved ECG-CPC by 0.066

The linear probe on ECG-CPC reached 0.833 with coupled weight decay, 0.899 with decoupled weight decay and 0.899 without decay. Keeping only statements with at least ten ECGs changed nothing (all 71 have ten), and averaging the classifier's probabilities over windows instead of its raw outputs added 0.001.

3.2 ECG-CPC reproduced in all three modes

ModeOur code [95% CI]Published [1]Difference
Linear probe0.899 [0.889–0.909]0.904−0.005
Attention probe0.925 [0.915–0.934]0.931−0.006
Fine-tuning0.945 [0.939–0.951]0.949−0.004

The attention probe reproduced only once the encoder's outputs were rescaled to mean 0 and standard deviation 1 on the training folds. On the unscaled outputs of our own model, whose standard deviations were at or below 0.22, it stopped improving at its first checkpoint and scored 0.702, against 0.816 for the linear probe.

3.3 ECGFounder did not reproduce

Input to ECGFounderMacro AUROC [95% CI]Difference from 0.931
10 s, raw mV0.888 [0.875–0.901]−0.043
4 × 2.5 s, raw mV0.861 [0.846–0.877]−0.070
10 s, rescaled0.878 [0.858–0.896]−0.053
4 × 2.5 s, rescaled0.904 [0.889–0.918]−0.027

ECG-CPC reproduced on the same split and labels, so the remaining gap lies in how ECGFounder's input is prepared or how its output is read. The input setting written in the benchmark's own evaluation script gave the lowest of the four scores.

3.4 Test ECGs in our training set

Our first training run excluded three datasets by name (PTB-XL, CODE-test and LUDB), while the test sets of three other datasets, Chapman-Shaoxing, Ningbo and CPSC 2018, were defined separately in the evaluation code. The two lists were never compared, and 5,151 of those 5,208 test ECGs entered training; scores on those three datasets would have measured memory of the tracings. The corrected rule holds out one fold of every dataset, the three datasets above in full, and any ECG that shares a patient or an identical signal with a held-out one: 86,154 ECGs held out and 368,468 left for training, with a test in the code that fails if the rule is removed.

4. Discussion

4.1 Principal findings

One setting in the classifier's optimizer moved a published model by 0.066 on PTB-XL. The error was found only because a published model was scored in our code before our own, and its scores could be compared with those its authors reported. The size of the error is more than twice the gap between ECG-CPC and ECGFounder in published results, so an error of this kind can reorder published models. ECGFounder remained 0.027 below its published score; a comparator scored too low makes a new model look better against it.

4.2 Comparison with prior work

Coupled and decoupled weight decay are known to behave differently under adaptive optimizers such as Adam [3]. The benchmark trains its classifiers with AdamW, at a learning rate and a weight decay of 1e-3 [1], which is why the decoupled setting reproduced its scores and the coupled one did not.

4.3 Strengths and limitations

Each score comes from one training run. The checks used PTB-XL only. Every score our code produced before the optimizer correction is biased low, by an amount that depends on the model, and none is reported. The ECGFounder gap is unexplained; three causes remain untested: random crops while the classifier trains, the rescaling of features inside our classifier, and per-lead rescaling on PTB-XL statistics. The project was paused after these checks, before our model was compared with the published ones, so nothing is claimed about it here.

4.4 Implications

An evaluation of a new ECG model should first reproduce a published model's scores in each mode it reports, then reproduce each model it compares against, and only then score the new model. ECGs held out for testing should be listed by record and by identical signal, with a test that fails when the list is removed.

References

  1. Al-Masud MA, Lopez Alcaraz JM, Strodthoff N. Benchmarking ECG FMs: a reality check across clinical tasks. arXiv:2509.25095, 2025.
  2. Li J, Aguirre A, Moura J, et al. An electrocardiogram foundation model built on over 10 million recordings with external evaluation across multiple domains. arXiv:2410.04133, 2024.
  3. Loshchilov I, Hutter F. Decoupled weight decay regularization. ICLR 2019. arXiv:1711.05101.