Manuscript Offprint

arXiv:2611.08993

When2What: A Timing-Conditioned Framework for Long-Horizon Forecasting of Continuous Cardiovascular Waveforms

Chaoqi Zhang, Shujie Yan, Zhao Zhang, Yanhua Sun, Yu Wang, Li Li, Lingzhong Meng, Xiaoyi Chen, Haixu Tang

Abstract

Long-horizon forecasting of quasi-periodic cardiovascular waveforms, such as the electrocardiogram (ECG), arterial blood pressure (ABP), and photoplethysmogram (PPG), requires predicting both when future cardiac events will occur (beat timing) and what the local structural pattern looks like around each event (beat morphology). However, standard sequence forecasters trained with pointwise mean squared error (MSE) average across uncertain future heartbeat phases, flattening sharp R peaks and pulse upstrokes into featureless baselines. Our analysis of intraoperative ECG reveals a clear temporal asymmetry: beat-time predictability from history decays within seconds due to stochastic heart-rate variability, whereas local beat morphology aligned at true beat times remains stable over several minutes. Guided by this insight, we introduce When2What, a timing-conditioned framework comprising three stages: Predict, Commit, and Generate. Given a 120-s history, When2What predicts a dense 60-s timing map, selects and sharpens discrete beat events into unit-height Gaussian impulses, and conditions a neural waveform generator on both these committed events and the observed history. Across intraoperative ECG, When2What substantially outperforms existing time-series and physiological forecasters, achieving a near-term waveform event skill of 0.644 and reproducing 95.62% of its predicted heartbeats in the generated waveform where direct long-horizon forecasters collapse into flat baselines. Furthermore, When2What transfers zero-shot to external hospital and atrial fibrillation cohorts, extends effectively to ABP and PPG pulse waveforms, and is supported by ablations and synthetic analyses that establish explicit timing conditioning as an effective paradigm for quasi-periodic long-horizon waveform forecasting.

Keywords: Time series forecasting, Physiological signals, Electrocardiogram, Event timing, Conditional generation, Photoplethysmography, Arterial blood pressure

1. Introduction

Continuous cardiovascular waveforms, including the electrocardiogram (ECG), arterial blood pressure (ABP), and photoplethysmogram (PPG), are representative quasi-periodic, event-driven time series that are fundamental to physiological pattern analysis and critical care monitoring [1, 2]. While predictive monitoring often compresses these signals into a single risk score for adverse events such as hypotension [3, 4], full-waveform forecasting aims

*ORCID: Chaoqi Zhang 0000-0001-5113-7160; Shujie Yan 0000-0002-6211-3145; Zhao Zhang 0000-0001-6314-1116; Yanhua Sun 0009-0006-6086-6684; Yu Wang 0000-0003-0361-1563; Li Li 0009-0001-0301-7575; Lingzhong Meng 0000-0002-5168-5084; Xiaoyi Chen 0000-0002-6224-791X; Haixu Tang 0000-0001-8963-8155.

∗^{*}Corresponding author: Xiaoyi Chen. E-mail: chxiaoyi@iu.edu. Additional contact emails: cz42@iu.edu (Chaoqi Zhang); hatang@iu.edu (Haixu Tang).

1^{1}Home institution during the visiting appointment: Department of Cardiopulmonary Bypass, Fuwai Hospital, National Centre for Cardiovascular Diseases, Chinese Academy of Medical Sciences & Peking Union Medical College, National Clinical Research Centre for Cardiovascular Diseases, Beijing, China.

2^{2}Home institution during the visiting appointment: Department of Anesthesiology, Tianjin Chest Hospital, Tianjin University, Tianjin, China.

3^{3}Home institution during the visiting appointment: Department of Anesthesiology, Nanjing Drum Tower Hospital, Affiliated Hospital of Medical School, Nanjing University, Nanjing, Jiangsu, China.

4^{4}Present address: Department of Anesthesiology and Pain Medicine, University of California Davis School of Medicine, Sacramento, California, USA.

5^{5}Present address: Microsoft, Seattle, WA, USA.

to predict the continuous future evolution of the physiological signal itself. Because cardiovascular signals are driven by recurring heartbeats, a meaningful forecast must capture two complementary properties of each cardiac cycle: beat timing, which marks when individual events occur (ventricular R peaks in ECG or maximal-upslope pulse anchors in ABP and PPG), and beat morphology, which describes the local waveform shape surrounding each event. Preserving the structural integrity of a forecast therefore requires more than matching average signal levels; the predicted waveform must produce identifiable beats at the right times with realistic shapes.

A standard approach to waveform forecasting maps the observed history directly to future samples using general-purpose time-series models or ECG-specific networks trained with pointwise objectives such as mean squared error (MSE) [5, 6, 7]. However, existing ECG forecasters typically operate on short windows of one to a few seconds, and direct samplewise regression breaks down over longer multi-beat horizons (such as 10 to 60 s) when future beat timing is uncertain. The optimal point forecast is the conditional mean of plausible future trajectories [8], which means that when heartbeats shift slightly in time across these trajectories, averaging them together inevitably attenuates or broadens sharp waveform features such as the R peak and flattens the forecast waveform. To better preserve waveform structure, prior studies have modified the training objective. For example, FADE [9] weights different amplitude bands separately in its loss function. Other methods organize forecasts around recurring patterns or events: BeatLex [10] forecasts sequences of learned waveform patterns and concatenates them into a continuous signal, RDiffGAN-ECG [11] synthesizes ECG conditioned on supplied R-peak locations and diagnostic categories, and DiffECG [12] forecasts only a single next heartbeat from the preceding beat using segments aligned around annotated R peaks. Yet, forecasting an uninterrupted, unsegmented multi-beat recording poses a distinct challenge: future beat locations are neither supplied in advance nor pre-aligned, which requires a forecaster to estimate multiple future beat times from history and express those beats in a continuous output waveform.

Our analysis of intraoperative ECG motivates decoupling these two steps by revealing a marked temporal asymmetry between beat timing and beat morphology. When estimated from historical waveforms alone, beat-time forecast skill decays within a few seconds as beat-to-beat interval variations accumulate. By contrast, when future beats are aligned at their reference times, their local waveform shape remains highly consistent with a historical beat template over intervals of several minutes. This contrast between rapidly growing uncertainty in when future beats will occur, and multi-minute stability in what each beat looks like, motivates representing predicted event times explicitly while drawing on the observed history to construct the local waveform shape. Crucially, this raises the central question of our study: in long-horizon waveform forecasting, how should a model connect uncertain future beat timing (when) to continuous waveform generation (what) so that identifiable heartbeats are preserved in the output?

To answer this question, we introduce When2What, a timing-conditioned framework for long-horizon cardiovascular waveform forecasting. Given a 120-s waveform history at 500 Hz, When2What decomposes forecasting into three sequential stages: Predict (P), Commit (C), and Generate (G). First, the timing predictor P estimates a dense timing probability map over the 60-s forecast horizon. Because beat-time uncertainty causes raw timing predictions to broaden and decay in amplitude as lead time increases, feeding the raw map directly into a generator would still result in flattened waveforms. The commit step C overcomes this problem by selecting discrete beat events and re-encoding them into a sharpened timing map of unit-height Gaussian impulses. Finally, the waveform generator G conditions on both this sharpened timing map and the encoded history at coarse token and fine sample scales to synthesize a continuous 60-s waveform. We evaluate When2What against existing time-series and physiological forecasting baselines across multiple cohorts and pulse signals, and conduct systematic ablations against unconditioned regression variants (Direct and Direct-MT), unsharpened timing maps, and static historical beat templates.

Extensive experiments on intraoperative ECG, ABP, and PPG waveforms demonstrate the effectiveness of When2What. Across all evaluated settings, When2What consistently outperforms existing time-series and ECG forecasters, including Informer [13], PatchTST [5], DLinear [14], HTF [15], BeatLex [10], FADE [9], and the foundation model TimesFM [16], achieving a 0–10-s waveform event skill of 0.644 where direct long-horizon forecasters collapse into flat baselines. Our ablation study reveals why this improvement occurs: although a multi-task network with auxiliary timing supervision (Direct-MT) predicts future beat times accurately in its timing head, its unconditioned waveform generator reproduces only 72.04% of those correctly predicted beats in the output waveform, whereas When2What reproduces 95.62% and improves waveform event skill by +0.110. Moreover, our learned generator outperforms static historical beat templates across event accuracy, 60-s waveform MSE, and resilience to event-input perturbations, while controlled synthetic experiments confirm that preserving sharp heartbeats under timing uncertainty mathematically requires trading off pointwise squared error.

Our contributions are fourfold:

  • Timing and morphology characterization: We show that beat-time forecast accuracy from history decays within seconds in intraoperative ECG, whereas beat morphology aligned at reference times remains stable over several minutes, motivating the decoupling of beat-time estimation and waveform construction.
  • Timing-conditioned long-horizon waveform forecasting: We develop When2What, a predict, commit, and generate pipeline that sharpens predicted future beat locations into explicit conditioning inputs to synthesize 60-s, multi-beat continuous physiological waveforms without the peak flattening of direct regression.

  • Effectiveness and cross-signal generalization: We demonstrate that When2What outperforms existing time-series and ECG forecasters and generalizes zero-shot to external hospital and arrhythmia cohorts (MOVER and SHDB-AF) as well as ABP and PPG pulse waveforms.

  • Pipeline ablations and theoretical trade-off analysis: Through systematic ablations and controlled synthetic experiments, we show that both discrete event sharpening and learned dynamic waveform generation are essential, and establish why preserving sharp cardiac events under timing uncertainty inevitably increases pointwise MSE.

References (38)