README.md
February 22, 2026 Β· View on GitHub
GEM: Empowering MLLM for Grounded ECG Understanding with Time Series and Images
If you find this project useful, please give us a starπ.
Xiang Lan1, Feng Wu1, Kai He1, Qinghao Zhao2, Shenda Hong3, Mengling Feng1
1National University of Singapore 2Peking University People's Hospital 3Peking University
Introduction
While recent multimodal large language models (MLLMs) have advanced automated ECG interpretation, they still face two key limitations: (1) insufficient multimodal synergy between ECG time series signals and ECG images, and (2) limited explainability in linking diagnoses to granular waveform evidence. We introduce GEM, the first MLLM unifying ECG time series, 12-lead ECG images and text for grounded and clinician-aligned ECG interpretation. GEM enables feature-grounded analysis, evidence-driven reasoning, and a clinician-like diagnostic process through three core innovations: a dual-encoder framework extracting complementary time series and image features, cross-modal alignment for effective multimodal understanding, and knowledge-guided instruction data generation for generating high-granularity grounding data (ECG-Grounding) linking diagnoses to measurable parameters (e.g., QRS/PR Intervals). Additionally, we propose the Grounded ECG Understanding task, a clinically motivated benchmark designed to comprehensively assess the MLLM's capability in grounded ECG understanding. Experimental results on both existing and our proposed benchmarks show GEM significantly improves predictive performance (CSN +7.4%β), explainability (+22.7%β), and grounding (+25.3%β), making it a promising approach for real-world clinical applications.
π₯Updates
- [Feb 2026] New RL-trained reasoning models are released! ECG-R1: Protocol-Guided and Modality-Agnostic MLLM for Reliable ECG Interpretation (Demo) (Code).
- [Sep 2025] GEM has been accepted to NeurIPS 2025! More updates coming soon.
- [Jul 2025] The full version of MIMIC-IV-ECG with beat-level features and GPT-4o interpretations has been released β check it out here!
- [Mar 2025] GEM-7B and ECG-Grounding-30k are now available.
We will continue to release more ECG-Grounding data and associated beat-level features progressively.
Stay tuned for updates!
Resource
Project Page: π Page
Paper: π Arxiv
Model: π€ GEM
Data: π€ ECG-Grounding
Setup
git clone https://github.com/lanxiang1017/GEM.git
bash GEM/setup.sh
Data Preparation
Please download required data:
ECG:
Images:
- ECG-Grounding-Images (mimic_gen)
- PTB-XL-Test-Images (ptb-xl-gen)
- ECG-Instruct
- ECG-Bench
After downloading all of them, organize the data as follows in ./data,
βββ ecg_timeseries
βββ champan-shaoxing
βββ code15
βββ cpsc2018
βββ ptbxl
βββ georgia
βββ mimic-iv
βββ ecg_images
βββ cod15_v4
βββ csn_aug_all_layout_papersize
βββ csn_ori_layout_papersize
βββ csn_part_noise_layout_papersize
βββ gen_images
βββ mimic_gen
βββ ptb-xl-gen
βββ mimic
βββ mimic_v4
βββ ptb-xl
βββ ecg_bench
βββ images
βββ ecg-grounding-test-mimiciv.json
βββ ecg-grounding-test-ptbxl.json
βββ ecg_jsons
βββ ECG_Grounding_30k.json
Pretrained Model Preparation
Pretrained ECG Encoder:
- ECG-CoCa : download
cpt_wfep_epoch_20.pt, place it inGEM/ecg_coca/open_clip/checkpoint
Pretrained MLLMs:
Train
For training from scratch:
- step 1. specify paths in
GEM/scripts/train_gem.sh - step 2. run
bash GEM/scripts/train_gem.sh
Evaluation
For ECG-Grounding:
- step 1. generate interpretations:
GEM/evaluation/gem_bench/bench_ecggrounding.sh - step 2. process interpretations:
GEM/gem_evaluation/process_gem_outputs.ipynb - step 3. generate GPT evaluation reports:
GEM/gem_evaluation/generate_gpt_eval.py - step 4. process evaluation reports and get scores:
GEM/gem_evaluation/process_grounding_scores.ipynb
For ECG-Bench:
- step 1. generate results:
GEM/evaluation/gem_bench/bench_ecgbench.sh - step 2. evaluate results:
GEM/evaluation/evaluate_ecgbench.py - step 3. evaluate reports:
GEM/evaluation/eval_report.py
Note
-
- You need to specify the result paths in all evaluation scripts (For ECG-Bench, you also need to specify the path to question files in evaluate_ecgbench.py).
-
- If you download our trained GEM-7B model from HuggingFace, you must set the path to ECG-CoCa in the config.json file (under "mm_ecg_tower") before using it.
-
- bench_ecggrounding.sh is designed to use multiple GPUs to generate interpretations simultaneously, reducing generation time. To use it, you must split the test file (ecg-grounding-test-mimiciv.json) into multiple chunks. If you prefer a simpler setup, you can use bench_ecgbench.sh instead. The core generation functions are the same. Example usage:
bash bench_ecgbench.sh -m PATH_TO_GEM -d ecg-grounding-test-mimiciv.
- bench_ecggrounding.sh is designed to use multiple GPUs to generate interpretations simultaneously, reducing generation time. To use it, you must split the test file (ecg-grounding-test-mimiciv.json) into multiple chunks. If you prefer a simpler setup, you can use bench_ecgbench.sh instead. The core generation functions are the same. Example usage:
Citation
If you find GEM helpful for your research and applications, please cite our paper:
@article{lan2025gem,
title={Gem: Empowering mllm for grounded ecg understanding with time series and images},
author={Lan, Xiang and Wu, Feng and He, Kai and Zhao, Qinghao and Hong, Shenda and Feng, Mengling},
journal={arXiv preprint arXiv:2503.06073},
year={2025}
}
Acknowledgement
We thank the authors of PULSE and ECG-Chat for their publicly released models, datasets, and training codes.