The ability to accurately perform counterfactual inference on time series is crucial for decision-making in fields like finance, healthcare, and marketing, as it allows us to understand the impact of events or treatments on outcomes over time. In this paper, we introduce a new counterfactual inference approach tailored to time series data impacted by market events, which is motivated by an industrial application. Utilizing the abduction-action-prediction procedure and the Structural Causal Model framework, we first adapt methods based on variational autoencoders and adversarial autoencoders, both previously used in counterfactual literature although not in time series settings. Then, we present the Conditional Entropy-Penalized Autoencoder (CEPAE), a novel autoencoder-based approach for counterfactual inference, which employs an entropy penalization loss over the latent space to encourage disentangled data representations. We validate our approach both theoretically and experimentally on synthetic, semi-synthetic, and real-world datasets, showing that CEPAE generally outperforms the other approaches in the evaluated metrics.
Figures & tables
Figure 1: Example of a time series counterfactual (cf) estimation comparison for our synthetic dataset among a baseline LSTM-based forecast model and CEPAE. The vertical line separates pre-event from post-event observations, counterfactual estimations and ground truth.
Figure 2: Problem setting’s computational graphs. Solid arrows denote direct influences on Y ; dotted double arrow reflects the abduction link. The confounded panel adds H→E .
Figure 3: Scheme of encoder-decoder based methods for counterfactual inference, both in training and counterfactual inference phase.
Model
Regularizer on Z
Practical implications
CVAE
KL divergence with fixed prior p(z)
Stable training with standard VAE machinery, but often poor reconstruction and insufficient disentanglement between Z and C , which can hurt counterfactual accuracy.
CAAE
Adversarial training on Z using an event discriminator.
Encourages disentanglement between Z and C and has good reconstruction, but inherits the instability and tuning difficulties of adversarial training.
CEPAE
Entropy penalty S(Z) .
Simple objective (no discriminator); encourages disentanglement between Z and C and has good reconstruction, having a stable training.
Table 1: Summary of the three encoder–decoder models used for counterfactual estimation. Here C denotes the conditioners (e.g., (h,e) ).
Synthetic
Conf. synth.
Semi-synth.
Real world
Metric
Method
0
1
0
1
0
1
0
1
Ground-truth metrics (synthetic and semi-synthetic only)
cf MAE ↓
LSTM
.199±.005
.198±.005
.199±.003
.201±.004
.101±.004
.080±.002
–
–
AB-LSTM
.201±.006
.197±.005
.202±.009
.202±.011
.103±.003
.083±.003
–
–
CVAE
.144±.021
.137±.014
.145±.007
.187±.017
.105±.005
.083±.004
–
–
CAAE
.087±.012
.083±.011
–
–
.065±.004
.061±.003
–
–
Table 2: Combined results across datasets for ef=0 and ef=1 (10 seeds). We evaluate both intervention directions: setting 0 where ef=0 and ecf=1 , and setting 1 where ef=1 and ecf=0 . Top block: ground-truth metrics (cf MAE/cf MBE; only available on synthetic and semi-synthetic datasets). Middle: Added Variations (Total/Altered Steps). Bottom: axiomatic metrics (Reconstruction, Reversibility, Effectiveness). “–” indicates not applicable (no counterfactual ground truth) or not reported due to unstable training.
Figure 4: Synthetic Control and Causal Impact comparison.
Appendix figures & tables8 assets
Supplementary material from the paper’s appendix.
Appendix
σ
MAE
0.0
0.004 0.002
0.1
0.045 0.002
0.3
0.077 0.001
1.0
0.114 0.002
1.5
0.128 0.002
Appendix
Table 3: MAE of the synthetic-control baseline for different noise standard deviations σ .
Figure 5: Convergence of CEPAE with a fixed EP weight of 0.09 on the unconfounded semi-synthetic dataset. We plot counterfactual MAE versus training epoch. The model converges slowly but reaches a stable low-error region around epoch 100.
Figure 6: Convergence of CEPAE with a linear schedule for the EP weight on the unconfounded semi-synthetic dataset. The EP weight increases linearly from 0 to 0.09 during the initial epochs. Counterfactual MAE decreases more rapidly than in the fixed-weight case and stabilizes around epoch 50.
Figure 7: Convergence of CAAE with a linear schedule for the adversarial weight on the unconfounded semi-synthetic dataset. The adversarial weight increases from 0 to 8.9 during training. After an initial drop in counterfactual MAE around epoch 50, the loss slowly increases again, illustrating the instability inherited from adversarial training.
Figure 8: Example of a failure mode for CAAE under a linear adversarial-weight schedule. At some point during training, the counterfactual MAE suddenly increases and remains high for the rest of the epochs, showing a typical instance of adversarial instability.
Figure 9: Convergence of CAAE with a fixed adversarial weight of 8.9 on the unconfounded semi-synthetic dataset. Without a schedule, the model fails to reach low-error regions and counterfactual MAE remains high throughout training.
Metric
Latent dimensionality Dz
6
7
8
9
10
11
12
MAE
0.062±0.004
0.058±0.003
0.056±0.004
0.051±0.003
0.049±0.004
0.055±0.004
0.051±0.004
MBE
−0.008±0.002
0.002±0.003
0.002±0.004
0.006±0.004
0.010±0.003
0.006±0.002
−0.003±0.002
Appendix
Table 4: Sensitivity of CEPAE to the latent dimensionality Dz on the unconfounded semi-synthetic dataset. We report counterfactual MAE and MBE (mean ± one standard deviation across seeds). The EP weight is fixed to 0.09 .
Metric
EP weight λEP
0.05
0.07
0.09
0.11
0.13
0.15
MAE
0.055±0.004
0.051±0.003
0.056±0.004
0.056±0.003
0.060±0.004
0.075±0.004
MBE
0.011±0.004
0.004±0.003
0.003±0.004
0.004±0.004
0.003±0.002
0.003±0.002
Appendix
Table 5: Sensitivity of CEPAE to the EP weight λEP on the unconfounded semi-synthetic dataset. We report counterfactual MAE and MBE (mean ± one standard deviation across seeds). The latent dimensionality is fixed to Dz=8 .
Causal counterfactual generation creates plausible alternative outcomes under interventions while preserving the relevant causal structure of a scenario.
Counterfactual estimation over time is important in various applications, such as personalized medicine. However, time-dependent confounding bias in observational data still poses a significant challenge in achieving accurate and efficient estimation. We introduce causal autoencoding and treatment conditioning (CAETC), a novel method for this problem. Built on adversarial representation learning, our method leverages an autoencoding architecture to learn a partially invertible and treatment-invariant representation, where the outcome prediction task is cast as applying a treatment-specific conditioning on the representation. Our design is independent of the underlying sequence model and can be applied to existing architectures such as long short-term memories (LSTMs) or temporal convolution networks (TCNs). We conduct extensive experiments on synthetic, semi-synthetic, and real-world data to demonstrate that CAETC yields significant improvement in counterfactual estimation over existing methods.
Nghia D. Nguyen, Pablo Robles-Granda, Lav R. Varshney
Siebel School of Computing and Data Science, University of Illinois Urbana-Champaign · VinUni-Illinois Smart Health Center, VinUniversity · AI Innovation Institute, Stony Brook University +1
Deep learning has enabled significant advances in time-series causal inference, yet progress remains constrained by the lack of realistic benchmarks with observable counterfactual outcomes. Existing datasets either rely on real-world observations without ground-truth counterfactuals or on simplified simulations that fail to capture complex causal dynamics. To address this gap, we develop a large-scale benchmark for counterfactual prediction in epidemic time series under dynamic interventions. Unlike existing benchmarks, it supports static and time-varying treatments, as well as both single-policy and multi-policy intervention settings, enabling evaluation of causal inference methods across a broad range of causal inference scenarios. Leveraging a calibrated agent-based model grounded in real-world demographic, mobility, epidemiological, and policy data, we generate realistic counterfactual trajectories across more than 150 U.S. counties. Using this benchmark, we evaluate widely used and state-of-the-art causal inference methods, revealing substantial performance differences and highlighting the challenges of realistic time-series causal reasoning.
Wenhao Mu, Facundo Yan, Anik Mumssen +2
University of Michigan · Computer Science and Engineering · Ann Arbor, Michigan, USA +1
Decision-making with deep learning-based time series forecasting requires not only accurate predictions but also actionable insights. However, current architectures do not inherently provide such information. Specifically, guidance is needed on how current conditions must be modified to shift from a predicted outcome to a desired future scenario. Counterfactual explanations provide a natural framework for this task, as they represent minimal input changes that alter the model's prediction, indicating when and how intervention is required. Existing approaches rely on instance-wise optimization, leading to inconsistency across instances, high computational costs, and limited applicability in real-time settings. To address these limitations, we reformulate counterfactual generation for time series forecasting as the problem of learning a globally consistent intervention strategy, allowing counterfactuals to be generated through a single shared function. We propose Counterfactual Time Series Explanations (ConTex), a model-agnostic, decomposed architecture comprising a temporal context encoder and a conditional encoder, followed by two heads that capture interventions in terms of temporal relevance and modification strength. This structure overcomes the instability and inconsistency of instance-based approaches by producing targeted, interpretable interventions across time and feature dimensions in a single forward pass, making it suitable for real-time applications. Across multiple forecasting architectures and benchmark datasets, ConTex achieves state-of-the-art validity while generating sparse counterfactuals that minimize the number of necessary interventions. Additionally, our approach reduces computational cost by at least 12-36x compared to instance-wise generation and supports real-time inference at approximately 0.007 seconds.
Jan Voets, Hasan Tercan, Tobias Meisen +1
Institute for Technologies and Management of Digital Transformation University of Wuppertal