MACHINE LEARNING · ECG SIMILARITY · TEAM RESEARCH

Can a heartbeat tell us who you are?

ECG patient matching across clinical and wearable devices

Can two electrocardiograms belong to the same unseen patient, even when taken at different times or with different devices? Our team investigated that question through contrastive learning, CNN/GRU representations and rigorous matching experiments.

2026 Wake Forest ECG-AI Build-a-Thon · Aiden Kranz · Keith Rawls · Ming Chen · Joshua Ekoja

INPUTLead I ECGUp to 10 sec · 250 Hz
REPRESENTATION128 dimensionsECG identity embedding
FINAL SYSTEMK2 · 4 encoders3 CNNs + 1 Raw GRU
EVALUATIONUnseen patientsPatient-disjoint testing
01 — THE CHALLENGE

Which two ECGs belong to the same person?

ECG waveforms are affected by more than identity. A different patient's ECG may look familiar, while the same person's ECG may change across recordings.

THINK LIKE A MATCHING MODEL

Three traces. Two belong together.

SYNTHETIC ILLUSTRATION
01Artificial ECG-like waveform 01
02Artificial ECG-like waveform 02
03Artificial ECG-like waveform 03

Computer-generated traces, not patient data.

Reveal the intended answer ↓
02 and 03 are the same person. Their beat shape changed between recordings, while 01 is a look-alike from someone else. These hard positives are what make the task difficult: the model has to recognize a person even after the waveform changes.
02 — OUR METHOD

Learn a representation, not a fixed patient ID.

Our task was similarity scoring, not medical diagnosis. We used patient-level contrastive learning to teach models to rank same-person pairs above different-person pairs.

STEP 01≈

Preprocess

Prepare a standardized Lead I signal: clip length, missing-value handling, 250 Hz sampling, 0.5–40 Hz bandpass and normalization.

STEP 02[128]

Encode

Process ECG A and ECG B through the same encoder weights to produce normalized 128-dimensional representations.

STEP 03cos θ

Score

Compute cosine similarity for the two embeddings. Higher scores should correspond to more likely same-patient matches.

THE FINAL SUBMITTED SYSTEM · K2

Three CNNs and one Raw GRU

The final system did not stack a CNN and GRU into a single network. Four independently trained encoders each evaluated the same pair; their four cosine scores were averaged with equal weights.

Different model families can contribute complementary errors and representations, which motivated the score-level ensemble.

Technical deep dive: what one CNN member does

One K2 CNN member starts with a 1D convolutional stem, then passes through residual convolution stages (32 → 64 → 128 → 256 channels). Attention pooling summarizes the time dimension; a projection head creates a unit-length 128-dimensional embedding. The Raw GRU member instead reads short waveform patches as a sequence before attention pooling.

03 — THE KEY DISCOVERY

Same patient.
Different heartbeat.

Some of the hardest clinical-to-clinical examples were not simply cases separated by many months. They were pairs where the waveform morphology had changed significantly.

THE FAILURE MODE

Patient identity must survive variation

Heart rate, rhythm, physiological state, electrode placement and recording conditions may influence the trace. We investigated cases where a later recording from the same individual looked less similar than a different person's recording.

“The signal can change even when the patient does not.”

Observed in development data; we did not establish the physiological causes.

MORPHOLOGY AS A DIAGNOSTIC LENS

Different shapes, different difficulty

We grouped clinical positive pairs by heartbeat-shape change to investigate where errors concentrated. The most-changed group was consistently harder than more stable pairs.

Large changeHarder matching
ModerateMixed difficulty
Stable shapeGenerally easier

Illustrative ordering, not plotted values.

04 — THE RESEARCH JOURNEY

We changed the training evidence, not only the architecture.

We went beyond swapping in another network: we changed how many recordings each patient contributed, added time-stretch augmentation, and combined models that made different mistakes.

LONGITUDINAL TRAINING

More recordings per patient

The later CNN training recipe sampled up to four clinical ECG recordings from a patient rather than relying on only two, selecting a same-person pair each epoch. This exposed the model to more within-person variation.

Up to 4 recordingsPatient-level pairs
AUGMENTATION & ENSEMBLING

Variation and complementary models

The training recipe also used ±20% time-stretch augmentation. Separately trained CNN members were averaged, then complemented by a Raw GRU in K2. More recordings and time stretch were changed together; their effects cannot be isolated from that particular comparison.

±20% stretch3 CNN + 1 GRU
Why there is no leaderboard of every experiment

Earlier experiments used different patients, pair lists and evaluation protocols, so their AUROCs are not comparable with each other. Putting them on one chart would imply a fair comparison that did not exist. This page reports only the official competition scores.

05 — EVALUATION & RESULTS

What happens on unseen patients?

The organizers scored two settings on their own test data: matching clinical ECGs to each other, and matching clinical ECGs to Apple Watch recordings.

Keith Rawls, an event presenter, Aiden Kranz and Ming Chen holding third-place certificates at the 2026 ECG-AI Build-a-Thon
Third-place award · Oct 15, 2026From left: Keith Rawls, event presenter, Aiden Kranz, Ming Chen
OFFICIAL COMPETITION RESULTS

Third place

2026 Wake Forest ECG-AI Build-a-Thon

0.960Clinical ↔ Clinical AUROCMatching two clinical ECGs from the same unseen patient
0.930Clinical ↔ Apple Watch AUROCMatching a clinical ECG to the same patient's watch recording

Scored by the organizers on their own test data; the two settings are reported separately.

WHY THE EVALUATION DESIGN MATTERED

No patient crossed between splits

Every split was patient-disjoint, so a model could not score well by memorizing individuals.

  1. 1 · TrainLearn from training patients only
  2. 2 · SelectCompare candidates on 3,000 held-out development patients
  3. 3 · FreezeLock K2, then test once on 5,000 unseen patients (clinical pairs)
  4. 4 · Final eventOrganizers score clinical and Apple Watch matching
POST-COMPETITION REFLECTION

Our clinical validation was stronger than our wearable validation.

Our one-time sealed test covered clinical pairs only. We checked Apple Watch performance on development patients but never ran an equally independent wearable holdout, so the official 0.930 was our first truly independent measure of cross-device performance. Next time, cross-device validation gets its own frozen test before submission.

06 — MY ROLE & TEAM

What I contributed to the research.

01

Model experimentation: developed and evaluated beat-level CNN representations and ran CNN vs. RNN design comparisons.

02

Controlled evaluation: supported patient-disjoint benchmarks, comparable cohorts and cross-team model selection.

03

Failure analysis: traced the hardest same-patient matches to changes in waveform shape over time.

04

Final validation: helped coordinate the independent clinical-only holdout used to confirm K2 before submission.

07 — THE NEXT RESEARCH QUESTION

Research does not end at the leaderboard.

The important next step is independent cross-device validation and better robustness to longitudinal ECG morphology change, not simply adding more model complexity.

RESEARCH MATERIALS

Full technical report

The full record includes more experiments, ablations and model analysis than this page shows. Happy to walk through what can be shared.

Contact me about the research →

About these materials

A collaborative team project. Scores shown are the official competition results. ECG traces on this page are synthetic; no patient recordings, model weights or raw data are published.