Multivariate Time Series Causal Foundation Model with In-Context Learning

Mehmet Yigit Balik, Pekka Marttinen, Harri LähdesmäkiarXiv 2026

TL;DR

Imagine a doctor deciding on a patient's next dose of medication: they don't just care about whether the tumor shrinks—they need to know how the patient's blood counts, organ function, and other vitals will react over the coming weeks. MTS-CFM is a foundation model for causal time-series forecasting that predicts how every variable in a dynamic system—both the main outcome and all surrounding covariates—will evolve under a planned sequence of interventions. Trained entirely on synthetic data, it adapts to new patients and datasets in a single forward pass with zero fine-tuning.

Figure 1: Overview of MTS-CFM. (a) The model learns entirely from synthetic multivariate trajectories drawn from a temporal SCM prior. (b) Using an in-context set and query history, MTS-CFM instantly forecasts all variates of the system under a planned intervention in a single forward pass.

What Problem Does This Paper Address?

In fields like healthcare, economics, and engineering, decisions are rarely one-off. A clinician adjusts medication based on evolving vitals, which were themselves shaped by earlier treatments. This creates time-varying confounding: past treatments affect current covariates, which in turn influence both future treatments and future outcomes.

Classical causal inference methods handle this by training a specialized model from scratch for every new dataset—a slow, data-hungry process that usually predicts only a single scalar outcome. Meanwhile, recent Prior-data Fitted Networks (PFNs)—transformers pre-trained on synthetic data to perform Bayesian inference in-context—have made training-free forecasting possible. However, existing temporal PFNs either ignore interventions altogether, handle only static settings, or (like CausalLongPFN) predict just one target variable at a time, ignoring how the rest of the system responds.

Methods

MTS-CFM bridges this gap by framing causal forecasting as amortized interventional multi-step inference over the entire multivariate system. Given a query unit's observed history, static covariates, a context set of related trajectories, and a planned treatment sequence, it outputs the full multi-step forecast in one forward pass.

The authors structure each task as a 3D token grid indexed by (sample, time, variate). Each transformer layer applies three axis-wise attention blocks in sequence:

  1. Temporal attention (with rotary positional embeddings) along the time axis to learn each variable's dynamics.
  2. Variate attention across the treatment, covariates, and outcome at each time step to couple interventions into the system state.
  3. Context attention across the cohort, where the query reads from the in-context trajectories after absorbing its own history and treatment plan.
Three axis-wise attention operations in MTS-CFM

Careful masking ensures that future query states never leak backward into the history, and that planned treatments are read causally. A shared predictive head then maps each query horizon token to a univariate Gaussian mixture model, trained using negative log-likelihood regularized with a Huber loss (to keep point forecasts sharp) and a hinge penalty (to prevent mode collapse).

Crucially, MTS-CFM is trained exclusively on synthetic data—2.56 million unique episodes generated on the fly from a temporal Structural Causal Model (SCM) prior with explicit treatment-assignment mechanisms and time-varying confounding.

Datasets

  • Training: Synthetic trajectories sampled on the fly from a temporal SCM prior (up to 10 covariates, 1–2 lags, and five dynamic motifs like homeostatic reversion and saturating accumulation).
  • Evaluation: Four benchmarks (histories capped at 60 steps, 5-step forecast horizon):
  • Cancer tumor growth: Synthetic simulator with no time-varying covariates ($d_x = 0$).
  • HIV treatment dynamics: Synthetic simulator with 5 covariates ($d_x = 5$).
  • Warfarin PK/PD: Synthetic pharmacokinetic/pharmacodynamic simulator with 9 covariates ($d_x = 9$).
  • MIMIC-III: Real-world intensive care records with 9 covariates ($d_x = 9$), used to evaluate factual predictions under administered care.

Key Insights and Ideas

  • Shared representations beat single-target rollouts: Because MTS-CFM conditions every variable's prediction on a representation shared across all covariates and the treatment plan, it avoids the compounding errors of autoregressive rollouts (like G-Net) and the $d_x$-fold compute cost of querying single-target PFNs (like CausalLongPFN) separately for each covariate.
  • In-context causal inference scales to multivariate systems: A single pre-trained model can match or outperform specialized estimators retrained from scratch on each dataset, showing that a rich enough synthetic SCM prior transfers effectively to both complex simulators and real-world ICU data.

Key Results

  • Outcome prediction: Without any gradient updates, MTS-CFM is competitive with six domain-trained baselines (MSM, RMSN, G-Net, CRN, CT, GT) and CausalLongPFN. It achieves the best RMSE at both 1-step and 5-step horizons on HIV (cutting CausalLongPFN's 5-step RMSE by 33%) and MIMIC-III, and ranks second only to MSM on Warfarin.
  • Covariate prediction: MTS-CFM achieves the lowest covariate RMSE in 4 of 6 settings. Its advantage grows with the forecast horizon: at horizon 5, it reduces covariate RMSE relative to CausalLongPFN by 33% on HIV, 15% on Warfarin, and 2% on MIMIC-III, winning on 19 of 23 individual covariates.
  • Calibration: At horizon 5, MTS-CFM outperforms CausalLongPFN on every probabilistic metric (NLL, CRPS, PIT-ECE, and interval coverage), whereas CausalLongPFN's 80% prediction intervals cover only 18–48% of outcomes.

Limitations and Future Work

  • Prior mismatch: MTS-CFM is only as reliable as the match between its synthetic prior and the target data. Larger systems, continuous doses, and time-varying unobserved confounding fall outside the prior, and the model cannot flag out-of-prior queries.
  • Alignment and covariate-free settings: Trajectories must be aligned to a shared clock origin (e.g., admission), and the model offers no structural advantage on covariate-free systems like the Cancer benchmark.
  • Marginal predictions: Because the predictive head outputs per-variable, per-step marginals, it cannot sample coherent joint trajectories across time and variables—a natural direction for future work alongside broader priors.

Summary updated

BibTeX
@misc{balik2026multivariate,
  author = {Mehmet Yigit Balik and Pekka Marttinen and Harri Lähdesmäki},
  title = {{Multivariate Time Series Causal Foundation Model with In-Context Learning}},
  year = {2026},
  eprint = {2612.05159},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2612.05159},
}
Figure