REAL

Health Former: Dual-Level Time-Aware Transformers for Irregular Electronic Health Record Events

Kőrösi-Szabó, Péter and Kovács, Gábor and Forrai, Botond and Laki, Judit and Kováts, Tamás and Szócska, Miklós and Csiszárik, Adrián (2026) Health Former: Dual-Level Time-Aware Transformers for Irregular Electronic Health Record Events. COMPUTER METHODS AND PROGRAMS IN BIOMEDICINE. ISSN 0169-2607 (In Press)

[img]
Preview
Text
2026.03.25.26349262.full.pdf - Draft Version
Available under License Creative Commons Attribution.

Download (4MB) | Preview

Abstract

Longitudinal electronic health records (EHRs) form irregular event sequences that mix multiple clinical coding systems and care settings. Learning transferable patient representations requires modeling both within-encounter code composition and long-range temporal dependencies. We aim to develop a pretraining framework that preserves event structure and explicitly uses elapsed time, while remaining straightforward to fine-tune for new supervised endpoints without task-specific feature engineering. We propose HealthFormer, a dual-level Transformer for event-centric EHR modeling. An Intra-Event Encoder aggregates heterogeneous domain tokens within each typed clinical event into an event embedding via code-specific embedding modules and attention pooling. Event embeddings are combined with a Date Encoder and a continuous-time attention bias based on attention with linear biases (ALiBI) inside an Inter-Event Encoder. We pretrain on Hungarian national administrative health records from a large-scale nationwide longitudinal cohort (spanning millions of individuals over a decade) using multi-task self-supervision with (i) per-domain masked token prediction (masked language modeling, MLM), (ii) event-type prediction under full-event masking (Event-level MLM), (iii) next-event type prediction, and (iv) time-to-next-event (Δt) regression. Pretraining induces hierarchy-consistent organization in learned diagnosis (ICD-10) embedding geometry conducive to analysis and interpretation. On incident cancer prediction, end-to-end fine-tuning achieves test AUCs of 0.81/0.75/0.73 for colorectal cancer (CRC) and 0.94/0.87/0.84 for prostate cancer across 30/60/90-day horizons on balanced cohorts, outperforming logistic-regression baselines, including time-decayed bag-ofcodes. HealthFormer provides an event-centric, time-aware representation that transfers via standard fine-tuning without endpoint-specific designs. Using ICD-10 diagnoses and ATC codes can facilitate adoption beyond Hungary. Learned diagnosis embeddings align with the hierarchy, enabling clinical inspection. Broader benchmarking across endpoints remains needed.

Item Type: Article
Uncontrolled Keywords: electronic health records; self-supervised pretraining; hierarchical Transformer; timeaware attention; representation learning
Subjects: Q Science / természettudomány > QA Mathematics / matematika > QA75 Electronic computers. Computer science / számítástechnika, számítógéptudomány
R Medicine / orvostudomány > R1 Medicine (General) / orvostudomány általában
SWORD Depositor: MTMT SWORD
Depositing User: MTMT SWORD
Date Deposited: 29 Sep 2026 13:49
Last Modified: 29 Sep 2026 14:26
URI: https://real.mtak.hu/id/eprint/247897

Actions (login required)

View Item View Item