TL;DR
When2What is a novel framework for long-horizon forecasting of cardiovascular waveforms (like ECG and blood pressure) that solves the "flatline" problem of standard deep learning models. By decoupling the prediction of when a heartbeat occurs from what its shape looks like, the model preserves sharp, clinically essential features even when exact timing is uncertain.
What Problem Does This Paper Address?
Forecasting cardiovascular signals—such as the electrocardiogram (ECG), arterial blood pressure (ABP), or photoplethysmogram (PPG)—over long horizons (e.g., 60 seconds) is notoriously difficult. These signals are "quasi-periodic," meaning they repeat but with slight, stochastic variations in heart rate.
Standard time-series models (like Transformers or LSTMs) are typically trained to minimize Mean Squared Error (MSE). When faced with uncertainty about exactly when a future heartbeat will occur, an MSE-optimized model does the mathematically "safe" thing: it outputs the average of all possible future paths. Because these paths contain heartbeats that are slightly shifted in time, averaging them results in a featureless, flat baseline. For a clinician, this is useless; the sharp R-peaks and pulse upstrokes that indicate heart health are completely erased.
Methods
The authors introduce a three-stage "Predict, Commit, and Generate" pipeline called When2What:
- Predict (P): A shared Mamba-Attention backbone processes 120 seconds of history to estimate a dense "timing map"—a probability distribution of where future beats are likely to occur.
- Commit (C): This is the "bottleneck" stage. Instead of passing a blurry probability map to the next step, the model selects discrete beat events (local maxima) and sharpens them into unit-height Gaussian impulses. This forces the model to "commit" to a specific heart rate schedule.
- Generate (G): A neural waveform generator takes these committed timing "anchors" and the historical signal to synthesize a continuous 60-second forecast.
To ensure the generator learns to produce sharp shapes rather than averages, it is trained using teacher forcing, where it receives ground-truth timing during training but must rely on predicted timing during inference.
Datasets
The study primarily utilizes VitalDB, a large-scale dataset of intraoperative physiological recordings (ECG, ABP, and PPG). To test the model's robustness, the authors evaluated it on several external datasets:
- MOVER: Intraoperative ECG from a different medical center.
- SHDB-AF: Ambulatory Holter ECG recordings from patients with atrial fibrillation.
- NSRDB & LTAFDB: Used for analyzing beat-time predictability across different physiological states.
Key Insights and Ideas
- Temporal Asymmetry: The authors discovered a fundamental "asymmetry" in cardiovascular signals. While our ability to predict exactly when a beat will happen (timing) decays within seconds due to heart rate variability, the shape of the beat (morphology) remains remarkably stable for several minutes.
- The MSE Trap: The paper highlights that for quasi-periodic signals, low MSE is a misleading metric. Preserving sharp, realistic heartbeats actually increases MSE if the timing is off by even a few milliseconds. This establishes a mathematical trade-off between "pointwise accuracy" and "structural integrity."
- Decoupling is Key: By separating "When" from "What," the model can use the stable historical morphology to fill in the gaps once a timing schedule is decided, preventing the collapse into flat lines seen in "Direct" regression models.
Key Results
- Superior Beat Preservation: On 60-second ECG forecasts, When2What achieved a near-term waveform event skill of 0.644, whereas standard models like Informer or PatchTST collapsed into flat baselines (negative skill).
- High Fidelity: The model reproduced 95.62% of its predicted heartbeats in the final generated waveform, compared to only ~72% for a multi-task model that didn't use explicit timing conditioning.
- Zero-Shot Generalization: The framework transferred effectively to external hospital cohorts and different signal types (ABP and PPG) without retraining, proving that the "Predict-Commit-Generate" paradigm is robust across physiological domains.
Limitations and Future Work
The current version of When2What is deterministic—it commits to a single "best guess" beat schedule. However, because heart rate is inherently stochastic, there are many plausible futures. The authors suggest that a promising next step is integrating this framework with probabilistic generative models (like Diffusion or VAEs) to sample multiple potential heartbeat schedules and provide clinicians with calibrated uncertainty intervals. Additionally, while the model handles single channels well, extending it to multi-modal forecasting (e.g., predicting ECG and ABP simultaneously) remains an open challenge.
Summary updated