Skip to content

MedTimeQ: Query-guided fusion of time-series foundation models and LLMs for multi-lead ECG classification

Kiana Taktehrani, Maryam Hosseini, Arash Mohammadi

eess.SP

Abstract

Accurate classification of medical time series, such as electrocardiograms (ECGs), requires capturing waveform morphology, long-range temporal structure, inter-lead dependencies, and clinical semantics. Existing large language model (LLM)-based approaches often map signal patches directly into the language embedding space, potentially underusing pretrained time-series knowledge and transferring redundant or irrelevant information. We propose MedTimeQ, a parameter-efficient framework that integrates a lead-aware temporal foundation encoder with an LLM-reprogrammed ECG pathway through gated residual fusion. A Query Former uses learned diagnostic queries to select and compress fused representations into informative soft tokens for a frozen LLM. Semantic prototype learning further guides classification through multiple clinical descriptions per category, statistics-based prompt selection, and knowledge distillation. Both foundation backbones remain frozen, limiting training to lightweight interface and classification components. We evaluate MedTimeQ on PTB-XL, Chapman-Shaoxing, and MIT-BIH for recording-level diagnosis, rhythm classification, and heartbeat classification, respectively. MedTimeQ achieves the best performance in 11 of 12 dataset-metric comparisons, with consistent class-balanced gains across all three tasks. On PTB-XL, it achieves 76.93% accuracy and 58.14% macro-F1, exceeding MedTsLLM by 10.08 and 7.07 percentage points, respectively. These results demonstrate the benefits of selectively integrating pretrained temporal representations with clinical language semantics. Code: https://github.com/kkianamm/MedTimeQ

Create a lesson