Aligning tokens with ECG shapes boosts heart signal model accuracy
On the role of the tokenizer in ECG transformer models
Machine LearningArtificial Intelligence
Summary
How an ECG (heart signal) is split into pieces for a computer model to understand it matters a lot. The authors show that breaking the ECG into chunks that match real heartbeats or important heart features helps models read and predict heart problems better. This way of splitting also makes the model much faster and uses less memory. They tested these ideas on several different model types and found consistent improvements.
What this means in practice
- •For medical device developers: Implement heart signal models that use physiologically aligned tokenization to improve diagnostic accuracy and reduce device memory needs.$Commercial implications: Enables more accurate and efficient ECG analysis features in commercial cardiac devices by optimizing input representation.
- •For software engineers building health apps: Design heart monitoring applications with better performance by applying morphology-aware tokenization to ECG data for improved prediction and efficiency.
Authors
Jiawei Li, Fabio Bonassi, Johan Sundström, Thomas B. Schön, Antônio H. Ribeiro
Abstract
Tokenization determines both the physiological content presented to an ECG Transformer and the sequence over which attention operates. We compare eight tokenization strategies across Transformer, Informer, Reformer, and FEDformer on the nine-label CPSC2018 classification task. The input projection and principal backbone capacity are controlled to isolate the effect of token construction. Median-beat and HeartLang tokenization achieve mean macro-AUCs of 0.893 and 0.889 across the four backbones, compared with 0.822 and 0.824 for point-wise and patch-wise tokenization. Pooling the two physiology-aware representations yields an 8.2% relative improvement in macro-AUC. They also reduce mean sequence length from 1,250 to 158 tokens and mean peak training memory from 5.21 to 0.27 GB. The results show that aligning tokens with ECG morphology can improve both predictive performance and memory efficiency without increasing backbone capacity. The source code is available on https://github.com/LeeJarvis996/ecg_tokenizer.