The electrocardiogram (ECG) records cardiac electrical activity across multiple leads and is used for detecting cardiac abnormalities. Recent ECG-language models enable large language models (LLMs) to interpret cardiac signals and answer clinically relevant questions. However, existing ECG-language models typically encode the ECG independently of the clinical question, forcing the ECG representation to retain broad and potentially irrelevant signal information. Moreover, these models often aggregate information across leads which can obscure lead-specific details needed for a particular question. To tackle these limitations, we introduce LEAP-LLM, an ECG-LLM architecture for Lead-aware ECG Alignment with Prompt conditioning. LEAP-LLM uses the clinical question to guide ECG feature extraction while preserving explicit lead and temporal structure. Task-trained instruction representations distill information from the question and guide two complementary branches. The Lead branch captures question-relevant temporal patterns within each ECG lead, while the Temporal branch summarizes relevant information across leads at each temporal position. Together, they provide the LLM with compact, question-relevant ECG information while preserving lead and temporal structure. LEAP-LLM reduces modality-token count by 89.0% and prefill FLOPs by 7.2x on average relative to other ECG-LLMs baselines. Across four ECG benchmarks, LEAP-LLM achieves better performance, including a 3.4-percentage-point improvement in G12EC over the strongest prior ECG-specific method. We further show that the model adaptively emphasizes the clinically relevant anatomical lead groups for different cardiac abnormalities, with lead importance patterns consistent with established diagnostic knowledge, providing interpretable evidence that the predictions are supported by clinically meaningful ECG structure.
Figures & tables
Figure 1: Electrode placement for 12-lead ECG acquisition. Ten electrodes generate the 12 ECG leads.
Figure 2: Overview of LEAP-LLM . (a) A multi-lead ECG and clinical query are encoded separately. Task-trained instruction tokens condition a dual-axis alignment module to produce compact structured tokens for the LLM. (b) The ECG is represented as lead-specific temporal tokens augmented with structural embeddings. Question-derived instruction tokens guide two complementary cross-attention branches: the Lead Branch , which summarizes temporal evidence within each lead, and the Temporal Branch , which summarizes cross-lead evidence at each temporal location. The resulting tokens are concatenated and projected into the LLM embedding space.
Model
PTB-XL
CODE-15%
G12EC
CSN
F1 ↑
AUC ↑
HL ↓
F1 ↑
AUC ↑
HL ↓
Acc. ↑
Acc. ↑
Random
33.2
50.3
50.1
15.0
48.8
32.1
12.1
11.6
General-purpose MLLMs
InternVL2-8B
14.3
50.6
27.8
16.1
55.8
17.7
37.5
47.7
Qwen2-VL-7B
22.4
51.3
30.8
24.8
60.7
20.5
32.9
25.5
Qwen2.5-VL-7B Instruct
16.8
51.5
27.6
26.2
57.9
19.5
13.8
12.2
Table 1: ECG-Bench abnormality detection results. Best results are shown in bold , and second-best results are underlined .
Method
LLM Backbone
ECG Tokens
Prefill FLOPs (T)
Prefill Latency (ms)
TTFT (ms)
HeartLLM
LLaMA-3.2-3B
313
2.74 †
108.0
138.0
GEM
Vicuna-7B
676
10.73
65.8
90.7
PULSE
Vicuna-7B
2,879
43.66
242.7
270.9
ECG-R1
Qwen3-8B
862
13.52
145.9
149.1
LEAP-LLM
Vicuna-7B
111
3.13
33.1
43.6
Table 2: Inference efficiency comparison with ECG-LLM baselines.
Variant
S
Q
P
CSN Acc ↑
G12 Acc ↑
(a)
78.2
71.2
(b)
✓
82.3 (+4.1)
74.2 (+3.0)
(c)
✓
✓
85.4 (+3.1)
78.0 (+3.8)
(d) LEAP-LLM
✓
✓
✓
90.6 (+5.2)
85.16 (+7.16)
Table 3: Contribution of lead-time structure (S), question conditioning (Q), and positional embeddings (P). Accuracy (%) and gains over the preceding row are reported.
Dataset
Metric
Lead Only
Temporal Only
Full
PTB-XL
F1
51.68
42.43
76.20
CODE-15
F1
65.08
77.59
87.20
CSN
Acc.
74.30
82.25
90.60
G12EC
Acc.
56.01
64.52
85.16
Table 4: Architectural ablation of LEAP-LLM LlaVA across ECG-Bench datasets.
Figure 3: LEAP-LLM attention patterns in myocardial infarction groups. Inferior MI shows higher attention in inferior leads, while anterior MI shows higher attention in anterior leads. Attention peaks near clinically relevant QRS and ST-segment regions.
Figure 4: Reduction in the likelihood of the correct answer for different patients after replacing lead-specific tokens with their dataset-mean representations.
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
Class
AUROC ↑
Normal ECG
0.989
First-degree AV block
0.983
RBBB
0.988
LBBB
0.992
Sinus bradycardia
0.995
Sinus tachycardia
0.998
Appendix
Table 5: Frozen-encoder linear-probe AUROC on the sampled CODE-15% cohort of 840 test examinations.
Setting
Stage 0
Stage I
Stage II
Encoder Pretraining
Alignment
Fine-tuning
ECG encoder
Trainable
Frozen
Frozen
ECG-LLM interface
–
Trainable
Trainable
Language model
–
Frozen
Trainable
Training objective
Masked reconstruction
Answer generation
Answer generation
Optimizer
AdamW
AdamW
AdamW
Appendix
Table 6: Optimization settings for ECG encoder pretraining and the two ECG-language training stages.
Dataset
Class
LEAP-LLM LlaVA
GEM
PULSE
PTB-XL
NORM
0.8914
0.8199
0.7614
MI
0.9290
0.8313
0.6415
STTC
0.9377
0.8735
0.8404
CD
0.8657
0.8095
0.7955
HYP
0.8515
0.7701
0.7677
Macro
0.8951
0.8208
0.7613
Appendix
Table 7: Per-class linear probing ROC-AUC on PTB-XL and CODE-15%. The best result for each class is shown in bold.
PTB-XL
CODE-15%
Model
F1 ↑
AUROC ↑
HL ↓
F1 ↑
AUROC ↑
HL ↓
ITFormer-3B
12.3
50.0
28.1
26.5
61.7
21.5
OpenTSLM-3B
21.6
50.9
30.7
14.5
52.9
16.3
LEAP-LLM -3B
71.2
80.4
12.7
83.5
88.7
5.8
Appendix
Table 8: Comparison with ITFormer and OpenTSLM at the 3B scale. All metrics are reported as percentages. HL denotes Hamming loss.
Method
Non-LLM
Modality
Prefill
Prefill
Decode
Total
Prefill
TTFT
E2E
Peak VRAM
Params (M)
Tokens
Tokens
FLOPs (T)
FLOPs (T)
FLOPs (T)
(ms)
(ms)
(ms)
(MB)
HeartLLM †
0.03 †
313
457
2.74 †
1.75 †
4.49 †
108.0
138.0
21,896
2,468
GEM
411
676
802
10.73
3.51
14.23
65.8
90.7
8,678
14,787
PULSE
324
2,879
3,005
43.66
3.80
47.46
242.7
270.9
8,972
16,993
ECG-R1
682
862
936
13.52
4.04
17.56
145.9
149.1
14,200
17,389
LEAP-LLM
235
111
239
3.13
3.43
6.56
33.1
43.6
8,344
13,585
Appendix
Table 9: Detailed inference-cost comparison. All latency measurements use batch size 1 on an NVIDIA A100-SXM4-40GB. FLOPs correspond to LLM computation; end-to-end measurements generate exactly 256 tokens.
Figure 5: Inference cost for multiple questions per ECG. Cumulative prefill FLOPs (left) and latency (right) as the number of questions per recording increases.
Group
ECGs
Normal
925
Abnormal, without MI
644
Inferior MI
224
Anterior MI
160
Lateral MI
23
Multiple-territory MI
106
Appendix
Table 10: PTB-XL cohort used for the question-swap analysis.
Question About
Inferior leads
Anterior leads
Inferior MI
79.8
7.7
Anterior MI
9.1
78.4
Appendix
Table 11: Attention share (%) assigned to each lead group when the queried MI territory changes while the ECG is held fixed.
Figure 6: Question-dependent lead attention for PTB-XL recording 6925. Changing the queried MI territory shifts attention toward the corresponding lead group while the ECG remains unchanged.
Tokens replaced
Inferior MI
Anterior MI
All leads
73.5% [71.3, 75.5]
80.7% [78.3, 82.7]
Inferior leads
50.5% [46.1, 54.4]
5.5% [1.6, 9.4]
Anterior leads
6.8% [3.2, 11.0]
55.0% [49.9, 59.5]
Random three leads
17.2% [13.6, 20.8]
17.6% [11.8, 23.4]
Random 12 temporal tokens
−0.2 % [ −0.5 , 0.1]
−0.2 % [ −0.6 , 0.1]
Appendix
Table 12: Full lead-token intervention results. Values report the reduction in gold-answer likelihood, D=1−R , with 95% bootstrap confidence intervals. Higher values indicate greater dependence on the replaced representations. Bold values denote the anatomically matched territory-specific interventions.