NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

DoFlow: Flow-based Generative Models for Interventional and Counterfactual Forecasting on Time Series

Dongze Wu, Feng Qiu, Yao Xie

Introduction

DoFlow is a novel generative framework designed to move beyond simple "next-step" predictions to answer complex "what-if" causal questions in time series. By combining Continuous Normalizing Flows (CNFs) with causal graphs, it provides a unified approach to perform observational forecasting, simulate interventions, and reconstruct counterfactual "could-have-beens" with theoretical guarantees.

The Challenge of "What-If" Forecasting

Standard time-series models, such as LSTMs or Transformers, excel at finding correlations: if they observe event $A$, they reliably predict event $B$. However, these models are purely observational. They struggle with two critical types of causal queries:

  1. Interventional: "How will the system change if I manually set the turbine speed to $X$ for the next hour?"
  2. Counterfactual: "We saw the patient's tumor grow under Treatment A; what would have happened if we had used Treatment B instead?"

Answering these questions requires understanding the underlying causal structure (which variables influence others) and isolating the specific "noise" or individual characteristics of a particular instance. Most existing models either ignore the causal graph entirely or lack the generative flexibility to handle continuous variables over time.

Methodology: The DoFlow Framework

The authors introduce DoFlow, a model built on three main pillars to enable robust causal reasoning:

  • Causal DAGs: The model assumes the variables in the system follow a Directed Acyclic Graph (DAG). Each node represents a variable, and directed edges represent causal influences over time.
  • Continuous Normalizing Flows (CNFs): For every node in the graph, DoFlow learns a CNF. A CNF is a generative model that uses a Neural ODE to transform a simple base distribution (like a Gaussian) into the complex distribution of the real data. Because these flows are mathematically invertible, they are perfect for "Abduction"—the process of isolating the hidden factors behind a specific observed event.
  • Time-Conditioned RNNs: To handle temporal dynamics, each node's flow is conditioned on a hidden state (via an LSTM or GRU) that summarizes its own history and the history of its causal parents.
Overview of the DoFlow architecture, illustrating the RNN state update, observational/interventional generation, and the three-step counterfactual process.

To generate a counterfactual, DoFlow executes a precise three-step process (illustrated in Panel C above):

  1. Abduction: Encode the observed "factual" data ($X^F$) into a latent noise space ($Z^F$) using the forward flow.
  2. Action: Change the intervention variable (e.g., alter the treatment dose), which updates the downstream hidden states to a counterfactual state ($\hat{H}^{CF}$).
  3. Prediction: Decode that exact same latent noise ($Z^F$) back into the data space under the new conditions to produce the counterfactual prediction ($\hat{X}^{CF}$).

Datasets and Experimental Results

The authors evaluated DoFlow on a mix of controlled synthetic environments and complex real-world data:

  • Synthetic DAGs: Four structures (Tree, Diamond, Fully Connected Layer, and Chain) were created with both simple additive noise and complex non-linear relationships. These provided the "ground truth" for counterfactuals, which is otherwise impossible to obtain in real-world scenarios.
  • Hydropower System: Real-world data from Argonne National Laboratory involving vibrations, currents, and power output. DoFlow was used to test interventional forecasting and anomaly detection during power outages.
  • Cancer Treatment: A benchmark dataset containing daily patient tumor volumes and treatment schedules (chemotherapy/radiotherapy).

Key Results: * Superior Accuracy: In synthetic tests, DoFlow consistently outperformed established models like the Temporal Fusion Transformer (TFT) and TiDE in terms of Root Mean Squared Error (RMSE) for both observational and interventional tasks. * Uniquely Counterfactual: DoFlow was the only model capable of producing consistent counterfactual trajectories, achieving very low error (0.11 to 0.41 RMSE) across various graph structures. * Real-World Impact: In the Hydropower case, DoFlow predicted system-wide "spikes" following a turbine failure more accurately than baselines, and its anomaly detection flagged outages up to 20 minutes before they occurred. In the Cancer Treatment dataset, it achieved a significant reduction in error for estimating treatment effects compared to specialized baselines like the Counterfactual Recurrent Network (CRN).

Key Insights and Theoretical Guarantees

  • Invertibility is the Secret Sauce: The exact invertibility of Normalizing Flows is what makes counterfactuals possible. By "undoing" the randomness to find the specific latent noise of a trajectory, the model can re-simulate that exact same trajectory under different choices.
  • Likelihood as an Anomaly Detector: Because DoFlow is a probabilistic model, it calculates the exact "log-density" (likelihood) of a future path. If a system starts behaving in a way that the model finds highly improbable, it serves as a principled early warning system for anomalies.
  • Theoretical Recovery: The authors provide a proof showing that under certain conditions (like monotonicity), DoFlow is guaranteed to recover the true counterfactual. This bridges the gap between deep learning heuristics and formal causal inference.

Limitations and Future Directions

The primary limitation of DoFlow is the "Known DAG" assumption. The framework requires the user to provide the causal graph upfront, whereas in many complex systems, the exact causal relationships are unknown. Furthermore, the authors assume causal sufficiency, meaning there are no hidden confounders influencing the system that aren't captured in the data.

For future work, the authors suggest coupling DoFlow with Causal Discovery algorithms to automatically learn the graph structure from data, as well as extending the model to handle hidden confounders.

Summary updated

BibTeX
@inproceedings{wu2026doflow,
  author = {Dongze Wu and Feng Qiu and Yao Xie},
  title = {{DoFlow: Flow-based Generative Models for Interventional and Counterfactual Forecasting on Time Series}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=4IPIhOgVqz},
}
Figure