TL;DR
ECG-Agent is the first LLM-based, tool-calling agent designed for multi-turn electrocardiogram (ECG) conversations on consumer devices. By offloading complex signal analysis to specialized external tools, compact models (<4B parameters) can run efficiently on-device while delivering more precise and medically accurate insights than much larger end-to-end multimodal models.
What Problem Does This Paper Address?
While Multimodal Large Language Models (MLLMs) have advanced rapidly, existing models for ECG interpretation suffer from three critical flaws that prevent real-world deployment on wearables and smartphones:
- Lack of Multi-Turn Conversational Ability: Most models are trained on isolated, single-turn QA pairs and fail to maintain context during a natural, ongoing dialogue with a patient.
- Resource Constraints: Current architectures typically couple a large LLM (>7B parameters) with an ECG encoder, making them too heavy for standard smartphone RAM (6–8GB), where a 4-bit quantized model needs to stay under 3B parameters to fit comfortably alongside the OS.
- Loss of Precision: End-to-end encoding often smooths out the fine-grained, quantitative details of an ECG signal, leading to inaccurate or hallucinated measurements for critical metrics like heart rate or PQRST intervals.
Methods
To solve these challenges, the authors shift the paradigm from end-to-end multimodal processing to a tool-calling agent framework. Instead of forcing the LLM to directly interpret raw ECG waveforms, a lightweight text-only LLM acts as a central coordinator that reasons, plans, and delegates tasks to three specialized external tools:
- Classification Tool: A self-supervised model trained with Random Lead Masking (RLM) to robustly classify arrhythmias across arbitrary lead configurations.
- Measurement Tool: Powered by the Neurokit2 Python package, this tool handles precise neurophysiological signal processing to extract exact quantitative intervals (e.g., heart rate, PR interval, QRS duration).
- Explanation Tool: Utilizes the SpectralX framework to provide time-frequency explanations for time-series classifiers.
The core LLM is instruction-tuned to generate a structured "thought" process, allowing it to dynamically decide whether to call a tool or respond directly to the user based on the conversational context.
Datasets
Because no multi-turn ECG dialogue dataset existed, the authors introduced the ECG-Multi-Turn-Dialogue (ECG-MTD) dataset.
To build it, they extracted representative topics from real online medical consultation datasets (HealthCareMagic-100k and icliniq-10k) and mapped out 20 realistic conversational action sequences. They then used Gemini-2.5-Flash to generate 21,837 multi-turn dialogues (averaging 7.68 turns per dialogue) based on ECG samples from the PTB-XL dataset. The dataset diversifies user language proficiency across three CEFR levels (Basic, Intermediate, Advanced) and covers three distinct hardware configurations: 12-lead (clinical standard), Lead I (wearables), and Lead II (patches).
Key Insights and Ideas
- Modular Intelligence over Brute-Force Scaling: The paper demonstrates that a 1B or 3B parameter model equipped with the right tools can easily outperform a 7B or even a proprietary closed-source model at domain-specific tasks. Offloading signal processing to deterministic code (like Neurokit2) eliminates the hallucination risks inherent to neural network-based measurements.
- Wearable-Ready Efficiency: By keeping the backbone model small, the framework proves that highly accurate, privacy-preserving medical AI can run entirely offline on consumer hardware.
- Contextual Routing: Instruction tuning successfully teaches small models to accurately predict the "Next Action" (when to measure, when to classify, and when to simply talk), bridging the gap between rigid programmatic tools and fluid human conversation.
Key Results
The authors evaluated ECG-Agent across multiple base model sizes (Llama 3.2 1B/3B, Llama 3.1 8B, and Qwen3 32B) against state-of-the-art baselines like PULSE and GEM.
- Superior Accuracy and Completeness: For queries requiring classification or measurement, all ECG-Agent variants significantly outperformed the baselines. For instance, on 12-lead configurations, the Llama 3.2 3B ECG-Agent achieved an accuracy score of 3.45 (on a 1-5 scale), compared to just 2.27 for PULSE and 2.48 for GEM.
- High Action Fidelity: The instruction-tuned agents achieved over 90% accuracy in Next Action Prediction (NAP), proving they can reliably navigate complex multi-turn dialogues without losing track of the user's intent.
- Minimal Performance Gap Across Sizes: Crucially, the compact, on-device capable models (1B and 3B) performed comparably to the much larger 8B and 32B models, validating the viability of small-footprint medical agents.
Limitations and Future Work
- Dimensionality Constraints on Explanations: The explanation tool (SpectralX) is inherently designed for univariate time-series. As a result, the authors had to exclude it from the clinical 12-lead setup, limiting the agent's ability to explain complex multi-lead interactions.
- Complexity-Driven Hallucinations: While faithfulness scores were high for single-lead setups, they dipped slightly in the 12-lead configuration. The authors note that larger, more complex diagnostic class sets increase the risk of the agent misinterpreting tool outputs.
- Synthetic Dialogue Bias: Although the underlying ECG data and conversational topics are real, the dialogues themselves were synthetically generated by an LLM, meaning future work will need to validate the agent against real-world patient-doctor interactions.
Summary updated