UniECG: Understanding and Generating ECG in One Unified Model

Jiarui Jin, Haoyu Wang, Xiang Lan, Jun Li, Gaofeng Cheng, Hongyan Li, Shenda HongarXiv 2025 · DOI

Introduction

Electrocardiograms (ECGs) are the cornerstone of cardiac disease diagnosis. However, existing artificial intelligence models in this domain are often fragmented, acting as "specialists" that either perform classification (interpretation) or synthesis (generation). General-purpose models like GPT-4 frequently struggle with the fine-grained temporal features of heart signals, leading to medical hallucinations. UniECG addresses these limitations by introducing the first unified multimodal large language model (MLLM) capable of both interpreting ECG data and generating high-fidelity signals from text.

Methodology: A Decoupled Two-Stage Training Strategy

UniECG utilizes a two-stage training pipeline designed to decouple the tasks of understanding and generation, preventing the "catastrophic forgetting" often associated with multi-task learning in LLMs.

The UniECG training and inference pipeline, illustrating the two-stage learning process and autonomous response selection.

Stage I: Learning to Understand (ECG-to-Text)

The model employs modality-specific encoders for both ECG images and raw signals to extract high-level features. These features are mapped into the input space of a Large Language Model (LLM), which is then fine-tuned to provide "grounded" interpretations. Rather than simple classification, the model explains its reasoning by identifying specific physiological markers, such as irregular R-R intervals.

Stage II: Learning to Generate (Text-to-ECG)

To enable generative capabilities, special [ECG] tokens are added to the LLM's vocabulary. A Transformer-based mapper aligns the LLM's hidden states with the latent space of DiffuSETS, a pre-trained diffusion model for ECG synthesis. During inference, the model autonomously determines whether to provide a textual diagnosis or trigger the signal generator based on the user's prompt.

Datasets

The model was trained and evaluated using two key datasets:

  • MIMIC-IV-ECG: A large-scale collection of over 800,000 multi-lead ECG recordings.
  • ECG-Grounding: A specialized dataset of 30,000 instruction-response pairs featuring heartbeat-level features (e.g., QRS complex, PR intervals), essential for training evidence-based reasoning.

Results and Discussion

UniECG demonstrates a significant advancement in unified ECG modeling, particularly in its ability to provide grounded clinical evidence.

Quantitative comparison of UniECG against baseline models PULSE and GEM across various understanding metrics.

Superior Understanding and Grounding

As shown in the performance metrics, UniECG significantly outperforms previous multimodal models like PULSE. In the ECG Feature Grounding task, UniECG achieved a score of 69.44, nearly 30 points higher than PULSE’s 41.63. This indicates a superior ability to link textual descriptions to specific signal features.

High-Fidelity Signal Generation

Unlike models that generate static images, UniECG produces raw numerical signal data. Qualitative assessments show it can successfully synthesize complex waveforms, such as Atrial Fibrillation, adhering to clinical standards like absent P-waves and irregular rhythms. The model can also condition these generations on specific patient attributes like age, sex, and heart rate.

The Trade-off of Unified Modeling

While UniECG represents a breakthrough in unification, the authors observed a "knowledge forgetting" phenomenon. The addition of generative capabilities in Stage II led to a slight performance dip in understanding tasks compared to GEM, a model dedicated solely to interpretation.

Conclusion and Future Work

UniECG provides a robust framework for evidence-based AI in cardiology, bridging the gap between signal interpretation and data synthesis. Future research will focus on mitigating the performance trade-offs between understanding and generation, expanding the model's multi-turn dialogue capabilities, and exploring its utility in real-time clinical decision support systems.

Summary updated

BibTeX
@misc{jin2025uniecg,
  author = {Jiarui Jin and Haoyu Wang and Xiang Lan and Jun Li and Gaofeng Cheng and Hongyan Li and Shenda Hong},
  title = {{UniECG: Understanding and Generating ECG in One Unified Model}},
  year = {2025},
  eprint = {2509.18588},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.18588},
}
Figure